Version Description
- Bugfix: Innocraft cloud URL *.matomo.cloud will work
- Option to configure filter_limit parameter (see expert settings)
- Replaced piwik.php proxy script by matomo.php proxy script
Download this release
Release Info
Developer | Braekling |
Plugin | WP-Matomo (WP-Piwik) |
Version | 1.0.22 |
Comparing to | |
See all releases |
Code changes from version 1.0.20 to 1.0.22
- .gitignore +0 -2
- LICENSE +0 -0
- README.md +0 -0
- bitcoin.png +0 -0
- classes/.htaccess +0 -0
- classes/WP_Piwik.php +1327 -1327
- classes/WP_Piwik/Admin.php +0 -0
- classes/WP_Piwik/Admin/Network.php +0 -0
- classes/WP_Piwik/Admin/Settings.php +720 -718
- classes/WP_Piwik/Admin/Sitebrowser.php +111 -111
- classes/WP_Piwik/Admin/Statistics.php +0 -0
- classes/WP_Piwik/Logger.php +0 -0
- classes/WP_Piwik/Logger/Dummy.php +0 -0
- classes/WP_Piwik/Logger/File.php +0 -0
- classes/WP_Piwik/Logger/Screen.php +0 -0
- classes/WP_Piwik/Request.php +0 -0
- classes/WP_Piwik/Request/Php.php +3 -1
- classes/WP_Piwik/Request/Rest.php +7 -5
- classes/WP_Piwik/Settings.php +408 -407
- classes/WP_Piwik/Shortcode.php +0 -0
- classes/WP_Piwik/Template.php +0 -0
- classes/WP_Piwik/Template/MetaBoxCustomVars.php +0 -0
- classes/WP_Piwik/TrackingCode.php +150 -150
- classes/WP_Piwik/Widget.php +375 -375
- classes/WP_Piwik/Widget/BrowserDetails.php +0 -0
- classes/WP_Piwik/Widget/Browsers.php +0 -0
- classes/WP_Piwik/Widget/Chart.php +0 -0
- classes/WP_Piwik/Widget/City.php +0 -0
- classes/WP_Piwik/Widget/Country.php +0 -0
- classes/WP_Piwik/Widget/Ecommerce.php +0 -0
- classes/WP_Piwik/Widget/Items.php +0 -0
- classes/WP_Piwik/Widget/ItemsCategory.php +0 -0
- classes/WP_Piwik/Widget/Keywords.php +0 -0
- classes/WP_Piwik/Widget/Models.php +0 -0
- classes/WP_Piwik/Widget/Noresult.php +0 -0
- classes/WP_Piwik/Widget/OptOut.php +0 -0
- classes/WP_Piwik/Widget/Overview.php +0 -0
- classes/WP_Piwik/Widget/Pages.php +0 -0
- classes/WP_Piwik/Widget/Plugins.php +0 -0
- classes/WP_Piwik/Widget/Post.php +0 -0
- classes/WP_Piwik/Widget/Referrers.php +0 -0
- classes/WP_Piwik/Widget/Screens.php +0 -0
- classes/WP_Piwik/Widget/Search.php +0 -0
- classes/WP_Piwik/Widget/Seo.php +0 -0
- classes/WP_Piwik/Widget/SystemDetails.php +0 -0
- classes/WP_Piwik/Widget/Systems.php +0 -0
- classes/WP_Piwik/Widget/Types.php +0 -0
- classes/WP_Piwik/Widget/Visitors.php +0 -0
- config.php +8 -8
- css/index.php +1 -1
- css/wp-piwik-spark.css +2 -2
- css/wp-piwik.css +0 -0
- gpl-3.0.html +0 -0
- index.php +1 -1
- js/index.php +1 -1
- js/jqplot/IMPORTANT_NOTICE.txt +0 -0
- js/jqplot/MIT-LICENSE.txt +0 -0
- js/jqplot/README.txt +0 -0
- js/jqplot/changes.txt +0 -0
- js/jqplot/copyright.txt +0 -0
- js/jqplot/excanvas.min.js +2 -2
- js/jqplot/gpl-2.0.txt +0 -0
- js/jqplot/index.php +1 -1
- js/jqplot/jquery.jqplot.min.css +0 -0
- js/jqplot/jquery.jqplot.min.js +2 -2
- js/jqplot/plugins/jqplot.pieRenderer.min.js +2 -2
- js/jqplot/plugins/jqplot.trendline.min.js +2 -2
- js/jqplot/usage.txt +0 -0
- js/jqplot/wp-piwik.jqplot.js +0 -0
- js/sparkline/index.php +1 -1
- js/sparkline/jquery.sparkline.js +0 -0
- js/sparkline/jquery.sparkline.min.js +0 -0
- js/wp-piwik.js +0 -0
- languages/.htaccess +0 -0
- languages/.tx/config +0 -0
- languages/update.sh +0 -0
- languages/wp-piwik-az_AZ.mo +0 -0
- languages/wp-piwik-az_AZ.po +0 -0
- languages/wp-piwik-be_BY.mo +0 -0
- languages/wp-piwik-be_BY.po +0 -0
- languages/wp-piwik-cs_CZ.mo +0 -0
- languages/wp-piwik-cs_CZ.po +0 -0
- languages/wp-piwik-de_CH.mo +0 -0
- languages/wp-piwik-de_CH.po +0 -0
- languages/wp-piwik-de_DE.mo +0 -0
- languages/wp-piwik-de_DE.po +0 -0
- languages/wp-piwik-el.mo +0 -0
- languages/wp-piwik-el.po +0 -0
- languages/wp-piwik-el_GR.mo +0 -0
- languages/wp-piwik-el_GR.po +0 -0
- languages/wp-piwik-es_ES.mo +0 -0
- languages/wp-piwik-es_ES.po +0 -0
- languages/wp-piwik-fa_IR.mo +0 -0
- languages/wp-piwik-fa_IR.po +0 -0
- languages/wp-piwik-fr_FR.mo +0 -0
- languages/wp-piwik-fr_FR.po +0 -0
- languages/wp-piwik-hi.mo +0 -0
- languages/wp-piwik-hi.po +0 -0
- languages/wp-piwik-hu_HU.mo +0 -0
- languages/wp-piwik-hu_HU.po +0 -0
- languages/wp-piwik-id.mo +0 -0
- languages/wp-piwik-id.po +0 -0
- languages/wp-piwik-it_IT.mo +0 -0
- languages/wp-piwik-it_IT.po +0 -0
- languages/wp-piwik-lb.mo +0 -0
- languages/wp-piwik-lb.po +0 -0
- languages/wp-piwik-lt_LT.mo +0 -0
- languages/wp-piwik-lt_LT.po +0 -0
- languages/wp-piwik-nb_NO.mo +0 -0
- languages/wp-piwik-nb_NO.po +0 -0
- languages/wp-piwik-nl_NL.mo +0 -0
- languages/wp-piwik-nl_NL.po +0 -0
- languages/wp-piwik-pl_PL.mo +0 -0
- languages/wp-piwik-pl_PL.po +0 -0
- languages/wp-piwik-pt_BR.mo +0 -0
- languages/wp-piwik-pt_BR.po +0 -0
- languages/wp-piwik-ro_RO.mo +0 -0
- languages/wp-piwik-ro_RO.po +0 -0
- languages/wp-piwik-ru_RU.mo +0 -0
- languages/wp-piwik-ru_RU.po +0 -0
- languages/wp-piwik-sl_SI.mo +0 -0
- languages/wp-piwik-sl_SI.po +0 -0
- languages/wp-piwik-sq.mo +0 -0
- languages/wp-piwik-sq.po +0 -0
- languages/wp-piwik-sv_SE.mo +0 -0
- languages/wp-piwik-sv_SE.po +0 -0
- languages/wp-piwik-tr_TR.mo +0 -0
- languages/wp-piwik-tr_TR.po +0 -0
- languages/wp-piwik-ua_UA.mo +0 -0
- languages/wp-piwik-ua_UA.po +0 -0
- languages/wp-piwik-uk_UA.mo +0 -0
- languages/wp-piwik-uk_UA.po +0 -0
- languages/wp-piwik-zh_CN.mo +0 -0
- languages/wp-piwik-zh_CN.po +0 -0
- languages/wp-piwik.pot +0 -0
- logs/.htaccess +0 -0
- proxy/config.php +38 -38
- proxy/index.php +1 -1
- proxy/matomo.php +137 -0
- proxy/piwik.php +1 -136
- readme.txt +11 -3
- screenshot-1.gif +0 -0
- screenshot-2.gif +0 -0
- screenshot-3.gif +0 -0
- screenshot-4.gif +0 -0
- screenshot-5.gif +0 -0
- uninstall.php +0 -0
- update/.htaccess +0 -0
- update/2015051101.php +40 -40
- update/2017080701.php +0 -0
- update/90001.php +8 -8
- update/90801.php +4 -4
- update/91006.php +9 -9
- wp-piwik.php +83 -83
- wpml-config.xml +0 -0
.gitignore
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
|
2 |
-
.idea/
|
|
|
|
LICENSE
CHANGED
File without changes
|
README.md
CHANGED
File without changes
|
bitcoin.png
CHANGED
File without changes
|
classes/.htaccess
CHANGED
File without changes
|
classes/WP_Piwik.php
CHANGED
@@ -1,1327 +1,1327 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* The main WP-Matomo class configures, registers and manages the plugin
|
5 |
-
*
|
6 |
-
* @author André Bräkling <webmaster@braekling.de>
|
7 |
-
* @package WP_Piwik
|
8 |
-
*/
|
9 |
-
class WP_Piwik {
|
10 |
-
|
11 |
-
/**
|
12 |
-
*
|
13 |
-
* @var Runtime environment variables
|
14 |
-
*/
|
15 |
-
private static $revisionId =
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Constructor class to configure and register all WP-Piwik components
|
19 |
-
*/
|
20 |
-
public function __construct() {
|
21 |
-
global $blog_id;
|
22 |
-
self::$blog_id = (isset ( $blog_id ) ? $blog_id : 'n/a');
|
23 |
-
$this->openLogger ();
|
24 |
-
$this->openSettings ();
|
25 |
-
$this->setup ();
|
26 |
-
$this->addFilters ();
|
27 |
-
$this->addActions ();
|
28 |
-
$this->addShortcodes ();
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Destructor class to finish logging
|
33 |
-
*/
|
34 |
-
public function __destruct() {
|
35 |
-
$this->closeLogger ();
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Setup class to prepare settings and check for installation and update
|
40 |
-
*/
|
41 |
-
private function setup() {
|
42 |
-
self::$pluginBasename = plugin_basename ( __FILE__ );
|
43 |
-
if (! $this->isInstalled ())
|
44 |
-
$this->installPlugin ();
|
45 |
-
elseif ($this->isUpdated ())
|
46 |
-
$this->updatePlugin ();
|
47 |
-
if ($this->isConfigSubmitted ())
|
48 |
-
$this->applySettings ();
|
49 |
-
self::$settings->save ();
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Register WordPress actions
|
54 |
-
*/
|
55 |
-
private function addActions() {
|
56 |
-
if ( is_admin () ) {
|
57 |
-
add_action ( 'admin_menu', array (
|
58 |
-
$this,
|
59 |
-
'buildAdminMenu'
|
60 |
-
) );
|
61 |
-
add_action ( 'admin_post_save_wp-piwik_stats', array (
|
62 |
-
$this,
|
63 |
-
'onStatsPageSaveChanges'
|
64 |
-
) );
|
65 |
-
add_action ( 'load-post.php', array (
|
66 |
-
$this,
|
67 |
-
'addPostMetaboxes'
|
68 |
-
) );
|
69 |
-
add_action ( 'load-post-new.php', array (
|
70 |
-
$this,
|
71 |
-
'addPostMetaboxes'
|
72 |
-
) );
|
73 |
-
if ($this->isNetworkMode ()) {
|
74 |
-
add_action ( 'network_admin_notices', array (
|
75 |
-
$this,
|
76 |
-
'showNotices'
|
77 |
-
) );
|
78 |
-
add_action ( 'network_admin_menu', array (
|
79 |
-
$this,
|
80 |
-
'buildNetworkAdminMenu'
|
81 |
-
) );
|
82 |
-
add_action ( 'update_site_option_blogname', array (
|
83 |
-
$this,
|
84 |
-
'onBlogNameChange'
|
85 |
-
) );
|
86 |
-
add_action ( 'update_site_option_siteurl', array (
|
87 |
-
$this,
|
88 |
-
'onSiteUrlChange'
|
89 |
-
) );
|
90 |
-
} else {
|
91 |
-
add_action ( 'admin_notices', array (
|
92 |
-
$this,
|
93 |
-
'showNotices'
|
94 |
-
) );
|
95 |
-
add_action ( 'update_option_blogname', array (
|
96 |
-
$this,
|
97 |
-
'onBlogNameChange'
|
98 |
-
) );
|
99 |
-
add_action ( 'update_option_siteurl', array (
|
100 |
-
$this,
|
101 |
-
'onSiteUrlChange'
|
102 |
-
) );
|
103 |
-
}
|
104 |
-
if ($this->isDashboardActive ())
|
105 |
-
add_action ( 'wp_dashboard_setup', array (
|
106 |
-
$this,
|
107 |
-
'extendWordPressDashboard'
|
108 |
-
) );
|
109 |
-
}
|
110 |
-
if ($this->isToolbarActive ()) {
|
111 |
-
add_action ( is_admin () ? 'admin_head' : 'wp_head', array (
|
112 |
-
$this,
|
113 |
-
'loadToolbarRequirements'
|
114 |
-
) );
|
115 |
-
add_action ( 'admin_bar_menu', array (
|
116 |
-
$this,
|
117 |
-
'extendWordPressToolbar'
|
118 |
-
), 1000 );
|
119 |
-
}
|
120 |
-
if ($this->isTrackingActive ()) {
|
121 |
-
if ( !is_admin () || $this->isAdminTrackingActive ()) {
|
122 |
-
$prefix = is_admin ()?'admin':'wp';
|
123 |
-
add_action ( self::$settings->getGlobalOption ( 'track_codeposition' ) == 'footer' ? $prefix.'_footer' : $prefix.'_head', array (
|
124 |
-
$this,
|
125 |
-
'addJavascriptCode'
|
126 |
-
) );
|
127 |
-
if (self::$settings->getGlobalOption ( 'dnsprefetch' ))
|
128 |
-
add_action ( $prefix.'_head', array (
|
129 |
-
$this,
|
130 |
-
'addDNSPrefetchTag'
|
131 |
-
) );
|
132 |
-
if ($this->isAddNoScriptCode ())
|
133 |
-
add_action ( $prefix.'_footer', array (
|
134 |
-
$this,
|
135 |
-
'addNoscriptCode'
|
136 |
-
) );
|
137 |
-
}
|
138 |
-
if (self::$settings->getGlobalOption ( 'add_post_annotations' ))
|
139 |
-
add_action ( 'transition_post_status', array (
|
140 |
-
$this,
|
141 |
-
'addPiwikAnnotation'
|
142 |
-
), 10, 3 );
|
143 |
-
}
|
144 |
-
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Register WordPress filters
|
149 |
-
*/
|
150 |
-
private function addFilters() {
|
151 |
-
if (is_admin()) {
|
152 |
-
add_filter ( 'plugin_row_meta', array (
|
153 |
-
$this,
|
154 |
-
'setPluginMeta'
|
155 |
-
), 10, 2 );
|
156 |
-
add_filter ( 'screen_layout_columns', array (
|
157 |
-
$this,
|
158 |
-
'onScreenLayoutColumns'
|
159 |
-
), 10, 2 );
|
160 |
-
} elseif ($this->isTrackingActive ()) {
|
161 |
-
if ($this->isTrackFeed ()) {
|
162 |
-
add_filter ( 'the_excerpt_rss', array (
|
163 |
-
$this,
|
164 |
-
'addFeedTracking'
|
165 |
-
) );
|
166 |
-
add_filter ( 'the_content', array (
|
167 |
-
$this,
|
168 |
-
'addFeedTracking'
|
169 |
-
) );
|
170 |
-
}
|
171 |
-
if ($this->isAddFeedCampaign ()) {
|
172 |
-
add_filter ( 'post_link', array (
|
173 |
-
$this,
|
174 |
-
'addFeedCampaign'
|
175 |
-
) );
|
176 |
-
}
|
177 |
-
if ($this->isCrossDomainLinkingEnabled ()) {
|
178 |
-
add_filter ( 'wp_redirect', array (
|
179 |
-
$this,
|
180 |
-
'forwardCrossDomainVisitorId'
|
181 |
-
) );
|
182 |
-
}
|
183 |
-
}
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Register WordPress shortcodes
|
188 |
-
*/
|
189 |
-
private function addShortcodes() {
|
190 |
-
if ($this->isAddShortcode ())
|
191 |
-
add_shortcode ( 'wp-piwik', array (
|
192 |
-
$this,
|
193 |
-
'shortcode'
|
194 |
-
) );
|
195 |
-
}
|
196 |
-
|
197 |
-
/**
|
198 |
-
* Install WP-Piwik for the first time
|
199 |
-
*/
|
200 |
-
private function installPlugin($isUpdate = false) {
|
201 |
-
self::$logger->log ( 'Running WP-Piwik installation' );
|
202 |
-
if (! $isUpdate)
|
203 |
-
$this->addNotice ( 'install', sprintf ( __ ( '%s %s installed.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$version ), __ ( 'Next you should connect to Piwik', 'wp-piwik' ) );
|
204 |
-
self::$settings->setGlobalOption ( 'revision', self::$revisionId );
|
205 |
-
self::$settings->setGlobalOption ( 'last_settings_update', time () );
|
206 |
-
}
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Uninstall WP-Piwik
|
210 |
-
*/
|
211 |
-
public function uninstallPlugin() {
|
212 |
-
self::$logger->log ( 'Running WP-Piwik uninstallation' );
|
213 |
-
if (! defined ( 'WP_UNINSTALL_PLUGIN' ))
|
214 |
-
exit ();
|
215 |
-
self::deleteWordPressOption ( 'wp-piwik-notices' );
|
216 |
-
self::$settings->resetSettings ( true );
|
217 |
-
}
|
218 |
-
|
219 |
-
/**
|
220 |
-
* Update WP-Piwik
|
221 |
-
*/
|
222 |
-
private function updatePlugin() {
|
223 |
-
self::$logger->log ( 'Upgrade WP-Piwik to ' . self::$version );
|
224 |
-
$patches = glob ( dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'update' . DIRECTORY_SEPARATOR . '*.php' );
|
225 |
-
$isPatched = false;
|
226 |
-
if (is_array ( $patches )) {
|
227 |
-
sort ( $patches );
|
228 |
-
foreach ( $patches as $patch ) {
|
229 |
-
$patchVersion = ( int ) pathinfo ( $patch, PATHINFO_FILENAME );
|
230 |
-
if ($patchVersion && self::$settings->getGlobalOption ( 'revision' ) < $patchVersion) {
|
231 |
-
self::includeFile ( 'update' . DIRECTORY_SEPARATOR . $patchVersion );
|
232 |
-
$isPatched = true;
|
233 |
-
}
|
234 |
-
}
|
235 |
-
}
|
236 |
-
if ((self::$settings->getGlobalOption('update_notice') == 'enabled') || ((self::$settings->getGlobalOption('update_notice') == 'script') && $isPatched))
|
237 |
-
$this->addNotice ( 'update', sprintf ( __ ( '%s updated to %s.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$version ), __ ( 'Please validate your configuration', 'wp-piwik' ) );
|
238 |
-
$this->installPlugin ( true );
|
239 |
-
}
|
240 |
-
|
241 |
-
/**
|
242 |
-
* Define a notice
|
243 |
-
*
|
244 |
-
* @param string $type
|
245 |
-
* identifier
|
246 |
-
* @param string $subject
|
247 |
-
* notice headline
|
248 |
-
* @param string $text
|
249 |
-
* notice content
|
250 |
-
* @param boolean $stay
|
251 |
-
* set to true if the message should persist (default: false)
|
252 |
-
*/
|
253 |
-
private function addNotice($type, $subject, $text, $stay = false) {
|
254 |
-
$notices = $this->getWordPressOption ( 'wp-piwik-notices', array () );
|
255 |
-
$notices [$type] = array (
|
256 |
-
'subject' => $subject,
|
257 |
-
'text' => $text,
|
258 |
-
'stay' => $stay
|
259 |
-
);
|
260 |
-
$this->updateWordPressOption ( 'wp-piwik-notices', $notices );
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Show all notices defined previously
|
265 |
-
*
|
266 |
-
* @see addNotice()
|
267 |
-
*/
|
268 |
-
public function showNotices() {
|
269 |
-
$link = sprintf ( '<a href="' . $this->getSettingsURL () . '">%s</a>', __ ( 'Settings', 'wp-piwik' ) );
|
270 |
-
if ($notices = $this->getWordPressOption ( 'wp-piwik-notices' )) {
|
271 |
-
foreach ( $notices as $type => $notice ) {
|
272 |
-
printf ( '<div class="updated fade"><p>%s <strong>%s:</strong> %s: %s</p></div>', $notice ['subject'], __ ( 'Important', 'wp-piwik' ), $notice ['text'], $link );
|
273 |
-
if (! $notice ['stay'])
|
274 |
-
unset ( $notices [$type] );
|
275 |
-
}
|
276 |
-
}
|
277 |
-
$this->updateWordPressOption ( 'wp-piwik-notices', $notices );
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Get the settings page URL
|
282 |
-
*
|
283 |
-
* @return string settings page URL
|
284 |
-
*/
|
285 |
-
private function getSettingsURL() {
|
286 |
-
return (self::$settings->checkNetworkActivation () ? 'settings' : 'options-general') . '.php?page=' . self::$pluginBasename;
|
287 |
-
}
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Echo javascript tracking code
|
291 |
-
*/
|
292 |
-
public function addJavascriptCode() {
|
293 |
-
if ($this->isHiddenUser ()) {
|
294 |
-
self::$logger->log ( 'Do not add tracking code to site (user should not be tracked) Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
|
295 |
-
return;
|
296 |
-
}
|
297 |
-
$trackingCode = new WP_Piwik\TrackingCode ( $this );
|
298 |
-
$trackingCode->is404 = (is_404 () && self::$settings->getGlobalOption ( 'track_404' ));
|
299 |
-
$trackingCode->isUsertracking = self::$settings->getGlobalOption ( 'track_user_id' ) != 'disabled';
|
300 |
-
$trackingCode->isSearch = (is_search () && self::$settings->getGlobalOption ( 'track_search' ));
|
301 |
-
self::$logger->log ( 'Add tracking code. Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
|
302 |
-
if ($this->isNetworkMode () && self::$settings->getGlobalOption ( 'track_mode' ) == 'manually') {
|
303 |
-
$siteId = $this->getPiwikSiteId ();
|
304 |
-
if ($siteId != 'n/a')
|
305 |
-
echo str_replace ( '{ID}', $siteId, $trackingCode->getTrackingCode () );
|
306 |
-
else
|
307 |
-
echo '<!-- Site will be created and tracking code added on next request -->';
|
308 |
-
} else
|
309 |
-
echo $trackingCode->getTrackingCode ();
|
310 |
-
}
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Echo DNS prefetch tag
|
314 |
-
*/
|
315 |
-
public function addDNSPrefetchTag() {
|
316 |
-
echo '<link rel="dns-prefetch" href="'.$this->getPiwikDomain().'" />';
|
317 |
-
}
|
318 |
-
|
319 |
-
/**
|
320 |
-
* Get Piwik Domain
|
321 |
-
*/
|
322 |
-
public function getPiwikDomain() {
|
323 |
-
switch (self::$settings->getGlobalOption ( 'piwik_mode' )) {
|
324 |
-
case 'php' :
|
325 |
-
return '//' . parse_url(self::$settings->getGlobalOption ( 'proxy_url' ), PHP_URL_HOST);
|
326 |
-
case 'cloud' :
|
327 |
-
return '//' . self::$settings->getGlobalOption ( 'piwik_user' ) . '.innocraft.cloud';
|
328 |
-
case 'cloud-matomo' :
|
329 |
-
return '//' . self::$settings->getGlobalOption ( 'matomo_user' ) . '.matomo.cloud';
|
330 |
-
default :
|
331 |
-
return '//' . parse_url(self::$settings->getGlobalOption ( 'piwik_url' ), PHP_URL_HOST);
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Echo noscript tracking code
|
337 |
-
*/
|
338 |
-
public function addNoscriptCode() {
|
339 |
-
if (self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy')
|
340 |
-
return;
|
341 |
-
if ($this->isHiddenUser ()) {
|
342 |
-
self::$logger->log ( 'Do not add noscript code to site (user should not be tracked) Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
|
343 |
-
return;
|
344 |
-
}
|
345 |
-
self::$logger->log ( 'Add noscript code. Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
|
346 |
-
echo self::$settings->getOption ( 'noscript_code' ) . "\n";
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Register post view meta boxes
|
351 |
-
*/
|
352 |
-
public function addPostMetaboxes() {
|
353 |
-
if (self::$settings->getGlobalOption ( 'add_customvars_box' )) {
|
354 |
-
add_action ( 'add_meta_boxes', array (
|
355 |
-
new WP_Piwik\Template\MetaBoxCustomVars ( $this, self::$settings ),
|
356 |
-
'addMetabox'
|
357 |
-
) );
|
358 |
-
add_action ( 'save_post', array (
|
359 |
-
new WP_Piwik\Template\MetaBoxCustomVars ( $this, self::$settings ),
|
360 |
-
'saveCustomVars'
|
361 |
-
), 10, 2 );
|
362 |
-
}
|
363 |
-
if (self::$settings->getGlobalOption ( 'perpost_stats' )) {
|
364 |
-
add_action ( 'add_meta_boxes', array (
|
365 |
-
$this,
|
366 |
-
'onloadPostPage'
|
367 |
-
) );
|
368 |
-
}
|
369 |
-
}
|
370 |
-
|
371 |
-
/**
|
372 |
-
* Register admin menu components
|
373 |
-
*/
|
374 |
-
public function buildAdminMenu() {
|
375 |
-
if (self::isConfigured ()) {
|
376 |
-
$cap = 'wp-piwik_read_stats';
|
377 |
-
if (self::$settings->checkNetworkActivation ()) {
|
378 |
-
global $current_user;
|
379 |
-
$userRoles = $current_user->roles;
|
380 |
-
$allowed = self::$settings->getGlobalOption ( 'capability_read_stats' );
|
381 |
-
if (is_array($userRoles) && is_array($allowed))
|
382 |
-
foreach ($userRoles as $userRole)
|
383 |
-
if (isset( $allowed[$userRole] ) && $allowed[$userRole]) {
|
384 |
-
$cap = 'read';
|
385 |
-
break;
|
386 |
-
}
|
387 |
-
}
|
388 |
-
$statsPage = new WP_Piwik\Admin\Statistics ( $this, self::$settings );
|
389 |
-
$this->statsPageId = add_dashboard_page ( __ ( 'Piwik Statistics', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), $cap, 'wp-piwik_stats', array (
|
390 |
-
$statsPage,
|
391 |
-
'show'
|
392 |
-
) );
|
393 |
-
$this->loadAdminStatsHeader ( $this->statsPageId, $statsPage );
|
394 |
-
}
|
395 |
-
if (! self::$settings->checkNetworkActivation ()) {
|
396 |
-
$optionsPage = new WP_Piwik\Admin\Settings ( $this, self::$settings );
|
397 |
-
self::$optionsPageId = add_options_page ( self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'activate_plugins', __FILE__, array (
|
398 |
-
$optionsPage,
|
399 |
-
'show'
|
400 |
-
) );
|
401 |
-
$this->loadAdminSettingsHeader ( self::$optionsPageId, $optionsPage );
|
402 |
-
}
|
403 |
-
}
|
404 |
-
|
405 |
-
/**
|
406 |
-
* Register network admin menu components
|
407 |
-
*/
|
408 |
-
public function buildNetworkAdminMenu() {
|
409 |
-
if (self::isConfigured ()) {
|
410 |
-
$statsPage = new WP_Piwik\Admin\Network ( $this, self::$settings );
|
411 |
-
$this->statsPageId = add_dashboard_page ( __ ( 'Piwik Statistics', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'manage_sites', 'wp-piwik_stats', array (
|
412 |
-
$statsPage,
|
413 |
-
'show'
|
414 |
-
) );
|
415 |
-
$this->loadAdminStatsHeader ( $this->statsPageId, $statsPage );
|
416 |
-
}
|
417 |
-
$optionsPage = new WP_Piwik\Admin\Settings ( $this, self::$settings );
|
418 |
-
self::$optionsPageId = add_submenu_page ( 'settings.php', self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'manage_sites', __FILE__, array (
|
419 |
-
$optionsPage,
|
420 |
-
'show'
|
421 |
-
) );
|
422 |
-
$this->loadAdminSettingsHeader ( self::$optionsPageId, $optionsPage );
|
423 |
-
}
|
424 |
-
|
425 |
-
/**
|
426 |
-
* Register admin header extensions for stats page
|
427 |
-
*
|
428 |
-
* @param $optionsPageId options
|
429 |
-
* page id
|
430 |
-
* @param $optionsPage options
|
431 |
-
* page object
|
432 |
-
*/
|
433 |
-
public function loadAdminStatsHeader($statsPageId, $statsPage) {
|
434 |
-
add_action ( 'admin_print_scripts-' . $statsPageId, array (
|
435 |
-
$statsPage,
|
436 |
-
'printAdminScripts'
|
437 |
-
) );
|
438 |
-
add_action ( 'admin_print_styles-' . $statsPageId, array (
|
439 |
-
$statsPage,
|
440 |
-
'printAdminStyles'
|
441 |
-
) );
|
442 |
-
add_action ( 'admin_head-' . $statsPageId, array (
|
443 |
-
$statsPage,
|
444 |
-
'extendAdminHeader'
|
445 |
-
) );
|
446 |
-
add_action ( 'load-' . $statsPageId, array (
|
447 |
-
$this,
|
448 |
-
'onloadStatsPage'
|
449 |
-
) );
|
450 |
-
}
|
451 |
-
|
452 |
-
/**
|
453 |
-
* Register admin header extensions for settings page
|
454 |
-
*
|
455 |
-
* @param $optionsPageId options
|
456 |
-
* page id
|
457 |
-
* @param $optionsPage options
|
458 |
-
* page object
|
459 |
-
*/
|
460 |
-
public function loadAdminSettingsHeader($optionsPageId, $optionsPage) {
|
461 |
-
add_action ( 'admin_head-' . $optionsPageId, array (
|
462 |
-
$optionsPage,
|
463 |
-
'extendAdminHeader'
|
464 |
-
) );
|
465 |
-
add_action ( 'admin_print_styles-' . $optionsPageId, array (
|
466 |
-
$optionsPage,
|
467 |
-
'printAdminStyles'
|
468 |
-
) );
|
469 |
-
}
|
470 |
-
|
471 |
-
/**
|
472 |
-
* Register WordPress dashboard widgets
|
473 |
-
*/
|
474 |
-
public function extendWordPressDashboard() {
|
475 |
-
if (current_user_can ( 'wp-piwik_read_stats' )) {
|
476 |
-
if (self::$settings->getGlobalOption ( 'dashboard_widget' ) != 'disabled')
|
477 |
-
new WP_Piwik\Widget\Overview ( $this, self::$settings, 'dashboard', 'side', 'default', array (
|
478 |
-
'date' => self::$settings->getGlobalOption ( 'dashboard_widget' ),
|
479 |
-
'period' => 'day'
|
480 |
-
) );
|
481 |
-
if (self::$settings->getGlobalOption ( 'dashboard_chart' ))
|
482 |
-
new WP_Piwik\Widget\Chart ( $this, self::$settings );
|
483 |
-
if (self::$settings->getGlobalOption ( 'dashboard_ecommerce' ))
|
484 |
-
new WP_Piwik\Widget\Ecommerce ( $this, self::$settings );
|
485 |
-
if (self::$settings->getGlobalOption ( 'dashboard_seo' ))
|
486 |
-
new WP_Piwik\Widget\Seo ( $this, self::$settings );
|
487 |
-
}
|
488 |
-
}
|
489 |
-
|
490 |
-
/**
|
491 |
-
* Register WordPress toolbar components
|
492 |
-
*/
|
493 |
-
public function extendWordPressToolbar($toolbar) {
|
494 |
-
if (current_user_can ( 'wp-piwik_read_stats' ) && is_admin_bar_showing ()) {
|
495 |
-
$id = WP_Piwik\Request::register ( 'VisitsSummary.getUniqueVisitors', array (
|
496 |
-
'period' => 'day',
|
497 |
-
'date' => 'last30'
|
498 |
-
) );
|
499 |
-
$unique = $this->request ( $id );
|
500 |
-
$url = is_network_admin () ? $this->getSettingsURL () : false;
|
501 |
-
$content = is_network_admin () ? __('Configure WP-Piwik', 'wp-piwik') : '';
|
502 |
-
// Leave if result array does contain a message instead of valid data
|
503 |
-
if (isset($unique['result']))
|
504 |
-
$content .= '<!-- '.$unique['result'].': '.($unique['message']?$unique['message']:'...').' -->';
|
505 |
-
elseif (is_array ( $unique ) ) {
|
506 |
-
$content = "<script type='text/javascript'>var \$jSpark = jQuery.noConflict();\$jSpark(function() {var piwikSparkVals=[" . implode ( ',', $unique ) . "];\$jSpark('.wp-piwik_dynbar').sparkline(piwikSparkVals, {type: 'bar', barColor: '#ccc', barWidth:2});});</script><span class='wp-piwik_dynbar'>Loading...</span>";
|
507 |
-
$url = $this->getStatsURL ();
|
508 |
-
}
|
509 |
-
$toolbar->add_menu ( array (
|
510 |
-
'id' => 'wp-piwik_stats',
|
511 |
-
'title' => $content,
|
512 |
-
'href' => $url
|
513 |
-
) );
|
514 |
-
}
|
515 |
-
}
|
516 |
-
|
517 |
-
/**
|
518 |
-
* Add plugin meta data
|
519 |
-
*
|
520 |
-
* @param array $links
|
521 |
-
* list of already defined plugin meta data
|
522 |
-
* @param string $file
|
523 |
-
* handled file
|
524 |
-
* @return array complete list of plugin meta data
|
525 |
-
*/
|
526 |
-
public function setPluginMeta($links, $file) {
|
527 |
-
if ($file == 'wp-piwik/wp-piwik.php' && (!$this->isNetworkMode () || is_network_admin()) )
|
528 |
-
return array_merge ( $links, array (
|
529 |
-
sprintf ( '<a href="%s">%s</a>', self::getSettingsURL (), __ ( 'Settings', 'wp-piwik' ) )
|
530 |
-
) );
|
531 |
-
return $links;
|
532 |
-
}
|
533 |
-
|
534 |
-
/**
|
535 |
-
* Prepare toolbar widget requirements
|
536 |
-
*/
|
537 |
-
public function loadToolbarRequirements() {
|
538 |
-
if (is_admin_bar_showing ()) {
|
539 |
-
wp_enqueue_script ( 'wp-piwik-sparkline', $this->getPluginURL () . 'js/sparkline/jquery.sparkline.min.js', array (
|
540 |
-
'jquery'
|
541 |
-
), self::$version );
|
542 |
-
wp_enqueue_style ( 'wp-piwik', $this->getPluginURL () . 'css/wp-piwik-spark.css', array (), $this->getPluginVersion () );
|
543 |
-
}
|
544 |
-
}
|
545 |
-
|
546 |
-
/**
|
547 |
-
* Add tracking pixels to feed content
|
548 |
-
*
|
549 |
-
* @param string $content
|
550 |
-
* post content
|
551 |
-
* @return string post content extended by tracking pixel
|
552 |
-
*/
|
553 |
-
public function addFeedTracking($content) {
|
554 |
-
global $post;
|
555 |
-
if (is_feed ()) {
|
556 |
-
self::$logger->log ( 'Add tracking image to feed entry.' );
|
557 |
-
if (! self::$settings->getOption ( 'site_id' )) {
|
558 |
-
$siteId = $this->requestPiwikSiteId ();
|
559 |
-
if ($siteId != 'n/a')
|
560 |
-
self::$settings->setOption ( 'site_id', $siteId );
|
561 |
-
else
|
562 |
-
return false;
|
563 |
-
}
|
564 |
-
$title = the_title ( null, null, false );
|
565 |
-
$posturl = get_permalink ( $post->ID );
|
566 |
-
$urlref = get_bloginfo ( 'rss2_url' );
|
567 |
-
if (self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy')
|
568 |
-
$url = plugins_url ( 'wp-piwik' ) . '/proxy/piwik.php';
|
569 |
-
else {
|
570 |
-
$url = self::$settings->getGlobalOption ( 'piwik_url' );
|
571 |
-
if (substr($url, -10, 10) == '/index.php')
|
572 |
-
$url = str_replace('/index.php', '/piwik.php', $url);
|
573 |
-
else
|
574 |
-
$url .= 'piwik.php';
|
575 |
-
}
|
576 |
-
$trackingImage = $url . '?idsite=' . self::$settings->getOption ( 'site_id' ) . '&rec=1&url=' . urlencode ( $posturl ) . '&action_name=' . urlencode ( $title ) . '&urlref=' . urlencode ( $urlref );
|
577 |
-
$content .= '<img src="' . $trackingImage . '" style="border:0;width:0;height:0" width="0" height="0" alt="" />';
|
578 |
-
}
|
579 |
-
return $content;
|
580 |
-
}
|
581 |
-
|
582 |
-
/**
|
583 |
-
* Add a campaign parameter to feed permalink
|
584 |
-
*
|
585 |
-
* @param string $permalink
|
586 |
-
* permalink
|
587 |
-
* @return string permalink extended by campaign parameter
|
588 |
-
*/
|
589 |
-
public function addFeedCampaign($permalink) {
|
590 |
-
global $post;
|
591 |
-
if (is_feed ()) {
|
592 |
-
self::$logger->log ( 'Add campaign to feed permalink.' );
|
593 |
-
$sep = (strpos ( $permalink, '?' ) === false ? '?' : '&');
|
594 |
-
$permalink .= $sep . 'pk_campaign=' . urlencode ( self::$settings->getGlobalOption ( 'track_feed_campaign' ) ) . '&pk_kwd=' . urlencode ( $post->post_name );
|
595 |
-
}
|
596 |
-
return $permalink;
|
597 |
-
}
|
598 |
-
|
599 |
-
/**
|
600 |
-
* Forwards the cross domain parameter pk_vid if the URL parameter is set and a user is about to be redirected.
|
601 |
-
* When another website links to WooCommerce with a pk_vid parameter, and WooCommerce redirects the user to another
|
602 |
-
* URL, the pk_vid parameter would get lost and the visitorId would later not be applied by the tracking code
|
603 |
-
* due to the lost pk_vid URL parameter. If the URL parameter is set, we make sure to forward this parameter.
|
604 |
-
*
|
605 |
-
* @param string $location
|
606 |
-
*
|
607 |
-
* @return string location extended by pk_vid URL parameter if the URL parameter is set
|
608 |
-
*/
|
609 |
-
public function forwardCrossDomainVisitorId($location) {
|
610 |
-
|
611 |
-
if (!empty($_GET['pk_vid'])
|
612 |
-
&& preg_match('/^[a-zA-Z0-9]{24,48}$/', $_GET['pk_vid'])) {
|
613 |
-
// currently, the pk_vid parameter is 32 characters long, but it may vary over time.
|
614 |
-
$location = add_query_arg( 'pk_vid', $_GET['pk_vid'], $location );
|
615 |
-
}
|
616 |
-
|
617 |
-
return $location;
|
618 |
-
}
|
619 |
-
|
620 |
-
/**
|
621 |
-
* Apply settings update
|
622 |
-
*
|
623 |
-
* @return boolean settings update applied
|
624 |
-
*/
|
625 |
-
private function applySettings() {
|
626 |
-
self::$settings->applyChanges ( $_POST ['wp-piwik'] );
|
627 |
-
if (self::$settings->getGlobalOption ( 'auto_site_config' ) && self::isConfigured ()) {
|
628 |
-
if ($this->isPHPMode () && ! defined ( 'PIWIK_INCLUDE_PATH' ))
|
629 |
-
self::definePiwikConstants ();
|
630 |
-
$siteId = $this->getPiwikSiteId ();
|
631 |
-
$trackingCode = $this->updateTrackingCode ( $siteId );
|
632 |
-
self::$settings->setOption ( 'site_id', $siteId );
|
633 |
-
}
|
634 |
-
self::$settings->setGlobalOption ( 'revision', self::$revisionId );
|
635 |
-
self::$settings->setGlobalOption ( 'last_settings_update', time () );
|
636 |
-
return true;
|
637 |
-
}
|
638 |
-
|
639 |
-
/**
|
640 |
-
* Check if WP-Piwik is configured
|
641 |
-
*
|
642 |
-
* @return boolean Is WP-Piwik configured?
|
643 |
-
*/
|
644 |
-
public static function isConfigured() {
|
645 |
-
return (self::$settings->getGlobalOption ( 'piwik_token' ) && (self::$settings->getGlobalOption ( 'piwik_mode' ) != 'disabled') && (((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'http') && (self::$settings->getGlobalOption ( 'piwik_url' ))) || ((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'php') && (self::$settings->getGlobalOption ( 'piwik_path' ))) || ((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'cloud') && (self::$settings->getGlobalOption ( 'piwik_user' ))) || ((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'cloud-matomo') && (self::$settings->getGlobalOption ( 'matomo_user' )))));
|
646 |
-
}
|
647 |
-
|
648 |
-
/**
|
649 |
-
* Check if WP-Piwik was updated
|
650 |
-
*
|
651 |
-
* @return boolean Was WP-Piwik updated?
|
652 |
-
*/
|
653 |
-
private function isUpdated() {
|
654 |
-
return self::$settings->getGlobalOption ( 'revision' ) && self::$settings->getGlobalOption ( 'revision' ) < self::$revisionId;
|
655 |
-
}
|
656 |
-
|
657 |
-
/**
|
658 |
-
* Check if WP-Piwik is already installed
|
659 |
-
*
|
660 |
-
* @return boolean Is WP-Piwik installed?
|
661 |
-
*/
|
662 |
-
private function isInstalled() {
|
663 |
-
$oldSettings = $this->getWordPressOption ( 'wp-piwik_global-settings', false );
|
664 |
-
if ($oldSettings && isset( $oldSettings['revision'] )) {
|
665 |
-
self::log('Save old settings');
|
666 |
-
self::$settings->setGlobalOption ( 'revision', $oldSettings['revision'] );
|
667 |
-
} else self::log( 'Current revision '.self::$settings->getGlobalOption ( 'revision' ) );
|
668 |
-
return self::$settings->getGlobalOption ( 'revision' ) > 0;
|
669 |
-
}
|
670 |
-
|
671 |
-
/**
|
672 |
-
* Check if new settings were submitted
|
673 |
-
*
|
674 |
-
* @return boolean Are new settings submitted?
|
675 |
-
*/
|
676 |
-
public static function isConfigSubmitted() {
|
677 |
-
return isset ( $_POST ) && isset ( $_POST ['wp-piwik'] ) && self::isValidOptionsPost();
|
678 |
-
}
|
679 |
-
|
680 |
-
/**
|
681 |
-
* Check if PHP mode is chosen
|
682 |
-
*
|
683 |
-
* @return Is PHP mode chosen?
|
684 |
-
*/
|
685 |
-
public function isPHPMode() {
|
686 |
-
return self::$settings->getGlobalOption ( 'piwik_mode' ) && self::$settings->getGlobalOption ( 'piwik_mode' ) == 'php';
|
687 |
-
}
|
688 |
-
|
689 |
-
/**
|
690 |
-
* Check if WordPress is running in network mode
|
691 |
-
*
|
692 |
-
* @return boolean Is WordPress running in network mode?
|
693 |
-
*/
|
694 |
-
public function isNetworkMode() {
|
695 |
-
return self::$settings->checkNetworkActivation ();
|
696 |
-
}
|
697 |
-
|
698 |
-
/**
|
699 |
-
* Check if a WP-Piwik dashboard widget is enabled
|
700 |
-
*
|
701 |
-
* @return boolean Is a dashboard widget enabled?
|
702 |
-
*/
|
703 |
-
private function isDashboardActive() {
|
704 |
-
return self::$settings->getGlobalOption ( 'dashboard_widget' ) || self::$settings->getGlobalOption ( 'dashboard_chart' ) || self::$settings->getGlobalOption ( 'dashboard_seo' );
|
705 |
-
}
|
706 |
-
|
707 |
-
/**
|
708 |
-
* Check if a WP-Piwik toolbar widget is enabled
|
709 |
-
*
|
710 |
-
* @return boolean Is a toolbar widget enabled?
|
711 |
-
*/
|
712 |
-
private function isToolbarActive() {
|
713 |
-
return self::$settings->getGlobalOption ( 'toolbar' );
|
714 |
-
}
|
715 |
-
|
716 |
-
/**
|
717 |
-
* Check if WP-Piwik tracking code insertion is enabled
|
718 |
-
*
|
719 |
-
* @return boolean Insert tracking code?
|
720 |
-
*/
|
721 |
-
private function isTrackingActive() {
|
722 |
-
return self::$settings->getGlobalOption ( 'track_mode' ) != 'disabled';
|
723 |
-
}
|
724 |
-
|
725 |
-
/**
|
726 |
-
* Check if admin tracking is enabled
|
727 |
-
*
|
728 |
-
* @return boolean Is admin tracking enabled?
|
729 |
-
*/
|
730 |
-
private function isAdminTrackingActive() {
|
731 |
-
return self::$settings->getGlobalOption ( 'track_admin' ) && is_admin ();
|
732 |
-
}
|
733 |
-
|
734 |
-
/**
|
735 |
-
* Check if WP-Piwik noscript code insertion is enabled
|
736 |
-
*
|
737 |
-
* @return boolean Insert noscript code?
|
738 |
-
*/
|
739 |
-
private function isAddNoScriptCode() {
|
740 |
-
return self::$settings->getGlobalOption ( 'track_noscript' );
|
741 |
-
}
|
742 |
-
|
743 |
-
/**
|
744 |
-
* Check if feed tracking is enabled
|
745 |
-
*
|
746 |
-
* @return boolean Is feed tracking enabled?
|
747 |
-
*/
|
748 |
-
private function isTrackFeed() {
|
749 |
-
return self::$settings->getGlobalOption ( 'track_feed' );
|
750 |
-
}
|
751 |
-
|
752 |
-
/**
|
753 |
-
* Check if feed permalinks get a campaign parameter
|
754 |
-
*
|
755 |
-
* @return boolean Add campaign parameter to feed permalinks?
|
756 |
-
*/
|
757 |
-
private function isAddFeedCampaign() {
|
758 |
-
return self::$settings->getGlobalOption ( 'track_feed_addcampaign' );
|
759 |
-
}
|
760 |
-
|
761 |
-
/**
|
762 |
-
* Check if feed permalinks get a campaign parameter
|
763 |
-
*
|
764 |
-
* @return boolean Add campaign parameter to feed permalinks?
|
765 |
-
*/
|
766 |
-
private function isCrossDomainLinkingEnabled() {
|
767 |
-
return self::$settings->getGlobalOption ( 'track_crossdomain_linking' );
|
768 |
-
}
|
769 |
-
|
770 |
-
/**
|
771 |
-
* Check if WP-Piwik shortcodes are enabled
|
772 |
-
*
|
773 |
-
* @return boolean Are shortcodes enabled?
|
774 |
-
*/
|
775 |
-
private function isAddShortcode() {
|
776 |
-
return self::$settings->getGlobalOption ( 'shortcodes' );
|
777 |
-
}
|
778 |
-
|
779 |
-
/**
|
780 |
-
* Define Piwik constants for PHP reporting API
|
781 |
-
*/
|
782 |
-
public static function definePiwikConstants() {
|
783 |
-
if (! defined ( 'PIWIK_INCLUDE_PATH' )) {
|
784 |
-
//@header('Content-type: text/html');
|
785 |
-
define ( 'PIWIK_INCLUDE_PATH', self::$settings->getGlobalOption ( 'piwik_path' ) );
|
786 |
-
define ( 'PIWIK_USER_PATH', self::$settings->getGlobalOption ( 'piwik_path' ) );
|
787 |
-
define ( 'PIWIK_ENABLE_DISPATCH', false );
|
788 |
-
define ( 'PIWIK_ENABLE_ERROR_HANDLER', false );
|
789 |
-
define ( 'PIWIK_ENABLE_SESSION_START', false );
|
790 |
-
}
|
791 |
-
}
|
792 |
-
|
793 |
-
/**
|
794 |
-
* Start chosen logging method
|
795 |
-
*/
|
796 |
-
private function openLogger() {
|
797 |
-
switch (WP_PIWIK_ACTIVATE_LOGGER) {
|
798 |
-
case 1 :
|
799 |
-
self::$logger = new WP_Piwik\Logger\Screen ( __CLASS__ );
|
800 |
-
break;
|
801 |
-
case 2 :
|
802 |
-
self::$logger = new WP_Piwik\Logger\File ( __CLASS__ );
|
803 |
-
break;
|
804 |
-
default :
|
805 |
-
self::$logger = new WP_Piwik\Logger\Dummy ( __CLASS__ );
|
806 |
-
}
|
807 |
-
}
|
808 |
-
|
809 |
-
/**
|
810 |
-
* Log a message
|
811 |
-
*
|
812 |
-
* @param string $message
|
813 |
-
* logger message
|
814 |
-
*/
|
815 |
-
public static function log($message) {
|
816 |
-
self::$logger->log ( $message );
|
817 |
-
}
|
818 |
-
|
819 |
-
/**
|
820 |
-
* End logging
|
821 |
-
*/
|
822 |
-
private function closeLogger() {
|
823 |
-
self::$logger = null;
|
824 |
-
}
|
825 |
-
|
826 |
-
/**
|
827 |
-
* Load WP-Piwik settings
|
828 |
-
*/
|
829 |
-
private function openSettings() {
|
830 |
-
self::$settings = new WP_Piwik\Settings ( $this, self::$logger );
|
831 |
-
if (! $this->isConfigSubmitted () && $this->isPHPMode () && ! defined ( 'PIWIK_INCLUDE_PATH' ))
|
832 |
-
self::definePiwikConstants ();
|
833 |
-
}
|
834 |
-
|
835 |
-
/**
|
836 |
-
* Include a WP-Piwik file
|
837 |
-
*/
|
838 |
-
private function includeFile($strFile) {
|
839 |
-
self::$logger->log ( 'Include ' . $strFile . '.php' );
|
840 |
-
if (WP_PIWIK_PATH . $strFile . '.php')
|
841 |
-
include (WP_PIWIK_PATH . $strFile . '.php');
|
842 |
-
}
|
843 |
-
|
844 |
-
/**
|
845 |
-
* Check if user should not be tracked
|
846 |
-
*
|
847 |
-
* @return boolean Do not track user?
|
848 |
-
*/
|
849 |
-
private function isHiddenUser() {
|
850 |
-
if (is_multisite ())
|
851 |
-
foreach ( self::$settings->getGlobalOption ( 'capability_stealth' ) as $key => $val )
|
852 |
-
if ($val && current_user_can ( $key ))
|
853 |
-
return true;
|
854 |
-
return current_user_can ( 'wp-piwik_stealth' );
|
855 |
-
}
|
856 |
-
|
857 |
-
/**
|
858 |
-
* Check if tracking code is up to date
|
859 |
-
*
|
860 |
-
* @return boolean Is tracking code up to date?
|
861 |
-
*/
|
862 |
-
public function isCurrentTrackingCode() {
|
863 |
-
return (self::$settings->getOption ( 'last_tracking_code_update' ) && self::$settings->getOption ( 'last_tracking_code_update' ) > self::$settings->getGlobalOption ( 'last_settings_update' ));
|
864 |
-
}
|
865 |
-
|
866 |
-
/**
|
867 |
-
* DEPRECTAED Add javascript code to site header
|
868 |
-
*
|
869 |
-
* @deprecated
|
870 |
-
*
|
871 |
-
*/
|
872 |
-
public function site_header() {
|
873 |
-
self::$logger->log ( 'Using deprecated function site_header' );
|
874 |
-
$this->addJavascriptCode ();
|
875 |
-
}
|
876 |
-
|
877 |
-
/**
|
878 |
-
* DEPRECTAED Add javascript code to site footer
|
879 |
-
*
|
880 |
-
* @deprecated
|
881 |
-
*
|
882 |
-
*/
|
883 |
-
public function site_footer() {
|
884 |
-
self::$logger->log ( 'Using deprecated function site_footer' );
|
885 |
-
$this->addNoscriptCode ();
|
886 |
-
}
|
887 |
-
|
888 |
-
/**
|
889 |
-
* Identify new posts if an annotation is required
|
890 |
-
* and create Piwik annotation
|
891 |
-
*
|
892 |
-
* @param string $newStatus
|
893 |
-
* new post status
|
894 |
-
* @param strint $oldStatus
|
895 |
-
* new post status
|
896 |
-
* @param object $post
|
897 |
-
* current post object
|
898 |
-
*/
|
899 |
-
public function addPiwikAnnotation($newStatus, $oldStatus, $post) {
|
900 |
-
$enabledPostTypes = self::$settings->getGlobalOption ( 'add_post_annotations' );
|
901 |
-
if (isset($enabledPostTypes[$post->post_type]) && $enabledPostTypes[$post->post_type] && $newStatus == 'publish' && $oldStatus != 'publish') {
|
902 |
-
$note = 'Published: ' . $post->post_title . ' - URL: ' . get_permalink ( $post->ID );
|
903 |
-
$id = WP_Piwik\Request::register ( 'Annotations.add', array (
|
904 |
-
'idSite' => $this->getPiwikSiteId (),
|
905 |
-
'date' => date ( 'Y-m-d' ),
|
906 |
-
'note' => $note
|
907 |
-
) );
|
908 |
-
$result = $this->request ( $id );
|
909 |
-
self::$logger->log ( 'Add post annotation. ' . $note . ' - ' . serialize ( $result ) );
|
910 |
-
}
|
911 |
-
}
|
912 |
-
|
913 |
-
/**
|
914 |
-
* Get WP-Piwik's URL
|
915 |
-
*/
|
916 |
-
public function getPluginURL() {
|
917 |
-
return trailingslashit ( plugins_url () . '/wp-piwik/' );
|
918 |
-
}
|
919 |
-
|
920 |
-
/**
|
921 |
-
* Get WP-Piwik's version
|
922 |
-
*/
|
923 |
-
public function getPluginVersion() {
|
924 |
-
return self::$version;
|
925 |
-
}
|
926 |
-
|
927 |
-
/**
|
928 |
-
* Enable three columns for WP-Piwik stats screen
|
929 |
-
*
|
930 |
-
* @param
|
931 |
-
* array full list of column settings
|
932 |
-
* @param
|
933 |
-
* mixed current screen id
|
934 |
-
* @return array updated list of column settings
|
935 |
-
*/
|
936 |
-
public function onScreenLayoutColumns($columns, $screen) {
|
937 |
-
if (isset( $this->statsPageId ) && $screen == $this->statsPageId)
|
938 |
-
$columns [$this->statsPageId] = 3;
|
939 |
-
return $columns;
|
940 |
-
}
|
941 |
-
|
942 |
-
/**
|
943 |
-
* Add tracking code to admin header
|
944 |
-
*/
|
945 |
-
function addAdminHeaderTracking() {
|
946 |
-
$this->addJavascriptCode ();
|
947 |
-
}
|
948 |
-
|
949 |
-
/**
|
950 |
-
* Get option value
|
951 |
-
*
|
952 |
-
* @param string $key
|
953 |
-
* option key
|
954 |
-
* @return mixed option value
|
955 |
-
*/
|
956 |
-
public function getOption($key) {
|
957 |
-
return self::$settings->getOption ( $key );
|
958 |
-
}
|
959 |
-
|
960 |
-
/**
|
961 |
-
* Get global option value
|
962 |
-
*
|
963 |
-
* @param string $key
|
964 |
-
* global option key
|
965 |
-
* @return mixed global option value
|
966 |
-
*/
|
967 |
-
public function getGlobalOption($key) {
|
968 |
-
return self::$settings->getGlobalOption ( $key );
|
969 |
-
}
|
970 |
-
|
971 |
-
/**
|
972 |
-
* Get stats page URL
|
973 |
-
*
|
974 |
-
* @return string stats page URL
|
975 |
-
*/
|
976 |
-
public function getStatsURL() {
|
977 |
-
return admin_url () . '?page=wp-piwik_stats';
|
978 |
-
}
|
979 |
-
|
980 |
-
/**
|
981 |
-
* Execute WP-Piwik test script
|
982 |
-
*/
|
983 |
-
private function loadTestscript() {
|
984 |
-
$this->includeFile ( 'debug' . DIRECTORY_SEPARATOR . 'testscript' );
|
985 |
-
}
|
986 |
-
|
987 |
-
/**
|
988 |
-
* Echo an error message
|
989 |
-
*
|
990 |
-
* @param string $message
|
991 |
-
* message content
|
992 |
-
*/
|
993 |
-
private static function showErrorMessage($message) {
|
994 |
-
echo '<strong class="wp-piwik-error">' . __ ( 'An error occured', 'wp-piwik' ) . ':</strong> ' . $message . ' [<a href="' . (self::$settings->checkNetworkActivation () ? 'network/settings' : 'options-general') . '.php?page=wp-piwik/classes/WP_Piwik.php&tab=support">' . __ ( 'Support', 'wp-piwik' ) . '</a>]';
|
995 |
-
}
|
996 |
-
|
997 |
-
/**
|
998 |
-
* Perform a Piwik request
|
999 |
-
*
|
1000 |
-
* @param string $id
|
1001 |
-
* request ID
|
1002 |
-
* @return mixed request result
|
1003 |
-
*/
|
1004 |
-
public function request($id, $debug = false) {
|
1005 |
-
if ( self::$settings->getGlobalOption ( 'piwik_mode' ) == 'disabled' )
|
1006 |
-
return 'n/a';
|
1007 |
-
if (! isset ( self::$request ) || empty ( self::$request ))
|
1008 |
-
self::$request = (self::$settings->getGlobalOption ( 'piwik_mode' ) == 'http' || self::$settings->getGlobalOption ( 'piwik_mode' ) == 'cloud' ? new WP_Piwik\Request\Rest ( $this, self::$settings ) : new WP_Piwik\Request\Php ( $this, self::$settings ));
|
1009 |
-
if ($debug)
|
1010 |
-
return self::$request->getDebug ( $id );
|
1011 |
-
return self::$request->perform ( $id );
|
1012 |
-
}
|
1013 |
-
|
1014 |
-
/**
|
1015 |
-
* Reset request object
|
1016 |
-
*/
|
1017 |
-
public function resetRequest() {
|
1018 |
-
if (is_object(self::$request))
|
1019 |
-
self::$request->reset();
|
1020 |
-
self::$request = NULL;
|
1021 |
-
}
|
1022 |
-
|
1023 |
-
/**
|
1024 |
-
* Execute WP-Piwik shortcode
|
1025 |
-
*
|
1026 |
-
* @param array $attributes
|
1027 |
-
* attribute list
|
1028 |
-
*/
|
1029 |
-
public function shortcode($attributes) {
|
1030 |
-
shortcode_atts ( array (
|
1031 |
-
'title' => '',
|
1032 |
-
'module' => 'overview',
|
1033 |
-
'period' => 'day',
|
1034 |
-
'date' => 'yesterday',
|
1035 |
-
'limit' => 10,
|
1036 |
-
'width' => '100%',
|
1037 |
-
'height' => '200px',
|
1038 |
-
'idsite' => '',
|
1039 |
-
'language' => 'en',
|
1040 |
-
'range' => false,
|
1041 |
-
'key' => 'sum_daily_nb_uniq_visitors'
|
1042 |
-
), $attributes );
|
1043 |
-
$shortcodeObject = new \WP_Piwik\Shortcode ( $attributes, $this, self::$settings );
|
1044 |
-
return $shortcodeObject->get();
|
1045 |
-
}
|
1046 |
-
|
1047 |
-
/**
|
1048 |
-
* Get Piwik site ID by blog ID
|
1049 |
-
*
|
1050 |
-
* @param int $blogId
|
1051 |
-
* which blog's Piwik site ID to get, default is the current blog
|
1052 |
-
* @return mixed Piwik site ID or n/a
|
1053 |
-
*/
|
1054 |
-
public function getPiwikSiteId($blogId = null) {
|
1055 |
-
if (! $blogId && $this->isNetworkMode ())
|
1056 |
-
$blogId = get_current_blog_id ();
|
1057 |
-
$result = self::$settings->getOption ( 'site_id', $blogId );
|
1058 |
-
self::$logger->log ( 'Database result: ' . $result );
|
1059 |
-
return (! empty ( $result ) ? $result : $this->requestPiwikSiteId ( $blogId ));
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
/**
|
1063 |
-
* Get a detailed list of all Piwik sites
|
1064 |
-
*
|
1065 |
-
* @return array Piwik sites
|
1066 |
-
*/
|
1067 |
-
public function getPiwikSiteDetails() {
|
1068 |
-
$id = WP_Piwik\Request::register ( 'SitesManager.getSitesWithAtLeastViewAccess', array () );
|
1069 |
-
$piwikSiteDetails = $this->request ( $id );
|
1070 |
-
return $piwikSiteDetails;
|
1071 |
-
}
|
1072 |
-
|
1073 |
-
/**
|
1074 |
-
* Estimate a Piwik site ID by blog ID
|
1075 |
-
*
|
1076 |
-
* @param int $blogId
|
1077 |
-
* which blog's Piwik site ID to estimate, default is the current blog
|
1078 |
-
* @return mixed Piwik site ID or n/a
|
1079 |
-
*/
|
1080 |
-
private function requestPiwikSiteId($blogId = null) {
|
1081 |
-
$isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
|
1082 |
-
if (self::$settings->getGlobalOption ( 'auto_site_config' )) {
|
1083 |
-
$id = WP_Piwik\Request::register ( 'SitesManager.getSitesIdFromSiteUrl', array (
|
1084 |
-
'url' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl
|
1085 |
-
) );
|
1086 |
-
$result = $this->request ( $id );
|
1087 |
-
$this->log ( 'Tried to identify current site, result: ' . serialize ( $result ) );
|
1088 |
-
if (is_array( $result ) && empty( $result ))
|
1089 |
-
$result = $this->addPiwikSite ( $blogId );
|
1090 |
-
elseif ( $result != 'n/a' && isset($result [0]) )
|
1091 |
-
$result = $result [0] ['idsite'];
|
1092 |
-
else $result = null;
|
1093 |
-
} else $result = null;
|
1094 |
-
self::$logger->log ( 'Get Piwik ID: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl) . ' = Piwik ID ' . $result );
|
1095 |
-
if ($result !== null) {
|
1096 |
-
self::$settings->setOption ( 'site_id', $result, $blogId );
|
1097 |
-
if (self::$settings->getGlobalOption ( 'track_mode' ) != 'disabled' && self::$settings->getGlobalOption ( 'track_mode' ) != 'manually') {
|
1098 |
-
$code = $this->updateTrackingCode ( $result, $blogId );
|
1099 |
-
}
|
1100 |
-
$this::$settings->save ();
|
1101 |
-
return $result;
|
1102 |
-
}
|
1103 |
-
return 'n/a';
|
1104 |
-
}
|
1105 |
-
|
1106 |
-
/**
|
1107 |
-
* Add a new Piwik
|
1108 |
-
*
|
1109 |
-
* @param int $blogId
|
1110 |
-
* which blog's Piwik site to create, default is the current blog
|
1111 |
-
* @return int Piwik site ID
|
1112 |
-
*/
|
1113 |
-
public function addPiwikSite($blogId = null) {
|
1114 |
-
$isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
|
1115 |
-
// Do not add site if Piwik connection is unreliable
|
1116 |
-
if (! $this->request ( 'global.getPiwikVersion' ))
|
1117 |
-
return null;
|
1118 |
-
$id = WP_Piwik\Request::register ( 'SitesManager.addSite', array (
|
1119 |
-
'urls' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl,
|
1120 |
-
'siteName' => urlencode( $isCurrent ? get_bloginfo ( 'name' ) : get_blog_details ( $blogId )->blogname )
|
1121 |
-
) );
|
1122 |
-
$result = (int) $this->request ( $id );
|
1123 |
-
self::$logger->log ( 'Create Piwik ID: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl) . ' = Piwik ID ' . $result );
|
1124 |
-
if (empty ( $result ))
|
1125 |
-
return null;
|
1126 |
-
else {
|
1127 |
-
do_action('wp-piwik_site_created', $result);
|
1128 |
-
return $result;
|
1129 |
-
}
|
1130 |
-
}
|
1131 |
-
|
1132 |
-
/**
|
1133 |
-
* Update a Piwik site's detail information
|
1134 |
-
*
|
1135 |
-
* @param int $siteId
|
1136 |
-
* which Piwik site to updated
|
1137 |
-
* @param int $blogId
|
1138 |
-
* which blog's Piwik site ID to get, default is the current blog
|
1139 |
-
*/
|
1140 |
-
private function updatePiwikSite($siteId, $blogId = null) {
|
1141 |
-
$isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
|
1142 |
-
$id = WP_Piwik\Request::register ( 'SitesManager.updateSite', array (
|
1143 |
-
'idSite' => $siteId,
|
1144 |
-
'urls' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl,
|
1145 |
-
'siteName' => $isCurrent ? get_bloginfo ( 'name' ) : get_blog_details ( $blogId )->blogname
|
1146 |
-
) );
|
1147 |
-
$this->request ( $id );
|
1148 |
-
self::$logger->log ( 'Update Piwik site: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )
|
1149 |
-
}
|
1150 |
-
|
1151 |
-
/**
|
1152 |
-
* Update a site's tracking code
|
1153 |
-
*
|
1154 |
-
* @param int $siteId
|
1155 |
-
* which Piwik site to updated
|
1156 |
-
* @param int $blogId
|
1157 |
-
* which blog's Piwik site ID to get, default is the current blog
|
1158 |
-
* @return string tracking code
|
1159 |
-
*/
|
1160 |
-
public function updateTrackingCode($siteId = false, $blogId = null) {
|
1161 |
-
if (!$siteId)
|
1162 |
-
$siteId = $this->getPiwikSiteId ();
|
1163 |
-
if (self::$settings->getGlobalOption ( 'track_mode' ) == 'disabled' || self::$settings->getGlobalOption ( 'track_mode' ) == 'manually')
|
1164 |
-
return false;
|
1165 |
-
$id = WP_Piwik\Request::register ( 'SitesManager.getJavascriptTag', array (
|
1166 |
-
'idSite' => $siteId,
|
1167 |
-
'mergeSubdomains' => self::$settings->getGlobalOption ( 'track_across' ) ? 1 : 0,
|
1168 |
-
'mergeAliasUrls' => self::$settings->getGlobalOption ( 'track_across_alias' ) ? 1 : 0,
|
1169 |
-
'disableCookies' => self::$settings->getGlobalOption ( 'disable_cookies' ) ? 1 : 0,
|
1170 |
-
'crossDomain' => self::$settings->getGlobalOption ( 'track_crossdomain_linking' ) ? 1 : 0,
|
1171 |
-
'trackNoScript' => 1
|
1172 |
-
) );
|
1173 |
-
$code = $this->request ( $id );
|
1174 |
-
if (is_array($code) && isset($code['value']))
|
1175 |
-
$code = $code['value'];
|
1176 |
-
$result = !is_array ( $code ) ? html_entity_decode ( $code ) : '<!-- '.json_encode($code).' -->';
|
1177 |
-
self::$logger->log ( 'Delivered tracking code: ' . $result );
|
1178 |
-
$result = WP_Piwik\TrackingCode::prepareTrackingCode ( $result, self::$settings, self::$logger, true );
|
1179 |
-
if (isset ( $result ['script'] ) && ! empty ( $result ['script'] )) {
|
1180 |
-
self::$settings->setOption ( 'tracking_code', $result ['script'], $blogId );
|
1181 |
-
self::$settings->setOption ( 'noscript_code', $result ['noscript'], $blogId );
|
1182 |
-
self::$settings->setGlobalOption ( 'proxy_url', $result ['proxy'], $blogId );
|
1183 |
-
}
|
1184 |
-
return $result;
|
1185 |
-
}
|
1186 |
-
|
1187 |
-
/**
|
1188 |
-
* Update Piwik site if blog name changes
|
1189 |
-
*
|
1190 |
-
* @param string $oldValue
|
1191 |
-
* old blog name
|
1192 |
-
* @param string $newValue
|
1193 |
-
* new blog name
|
1194 |
-
*/
|
1195 |
-
public function onBlogNameChange($oldValue, $newValue = null) {
|
1196 |
-
$this->updatePiwikSite ( self::$settings->getOption ( 'site_id' ) );
|
1197 |
-
}
|
1198 |
-
|
1199 |
-
/**
|
1200 |
-
* Update Piwik site if blog URL changes
|
1201 |
-
*
|
1202 |
-
* @param string $oldValue
|
1203 |
-
* old blog URL
|
1204 |
-
* @param string $newValue
|
1205 |
-
* new blog URL
|
1206 |
-
*/
|
1207 |
-
public function onSiteUrlChange($oldValue, $newValue = null) {
|
1208 |
-
$this->updatePiwikSite ( self::$settings->getOption ( 'site_id' ) );
|
1209 |
-
}
|
1210 |
-
|
1211 |
-
/**
|
1212 |
-
* Register stats page meta boxes
|
1213 |
-
*
|
1214 |
-
* @param mixed $statsPageId
|
1215 |
-
* WordPress stats page ID
|
1216 |
-
*/
|
1217 |
-
public function onloadStatsPage($statsPageId) {
|
1218 |
-
if (self::$settings->getGlobalOption ( 'disable_timelimit' ))
|
1219 |
-
set_time_limit ( 0 );
|
1220 |
-
wp_enqueue_script ( 'common' );
|
1221 |
-
wp_enqueue_script ( 'wp-lists' );
|
1222 |
-
wp_enqueue_script ( 'postbox' );
|
1223 |
-
wp_enqueue_script ( 'wp-piwik', $this->getPluginURL () . 'js/wp-piwik.js', array (), self::$version, true );
|
1224 |
-
wp_enqueue_script ( 'wp-piwik-jqplot', $this->getPluginURL () . 'js/jqplot/wp-piwik.jqplot.js', array (
|
1225 |
-
'jquery'
|
1226 |
-
), self::$version );
|
1227 |
-
new \WP_Piwik\Widget\Chart ( $this, self::$settings, $this->statsPageId );
|
1228 |
-
new \WP_Piwik\Widget\Visitors ( $this, self::$settings, $this->statsPageId );
|
1229 |
-
new \WP_Piwik\Widget\Overview ( $this, self::$settings, $this->statsPageId );
|
1230 |
-
if (self::$settings->getGlobalOption ( 'stats_ecommerce' )) {
|
1231 |
-
new \WP_Piwik\Widget\Ecommerce ($this, self::$settings, $this->statsPageId);
|
1232 |
-
new \WP_Piwik\Widget\Items ($this, self::$settings, $this->statsPageId);
|
1233 |
-
new \WP_Piwik\Widget\ItemsCategory ($this, self::$settings, $this->statsPageId);
|
1234 |
-
}
|
1235 |
-
if (self::$settings->getGlobalOption ( 'stats_seo' ))
|
1236 |
-
new \WP_Piwik\Widget\Seo ( $this, self::$settings, $this->statsPageId );
|
1237 |
-
new \WP_Piwik\Widget\Pages ( $this, self::$settings, $this->statsPageId );
|
1238 |
-
new \WP_Piwik\Widget\Keywords ( $this, self::$settings, $this->statsPageId );
|
1239 |
-
new \WP_Piwik\Widget\Referrers ( $this, self::$settings, $this->statsPageId );
|
1240 |
-
new \WP_Piwik\Widget\Plugins ( $this, self::$settings, $this->statsPageId );
|
1241 |
-
new \WP_Piwik\Widget\Search ( $this, self::$settings, $this->statsPageId );
|
1242 |
-
new \WP_Piwik\Widget\Noresult ( $this, self::$settings, $this->statsPageId );
|
1243 |
-
new \WP_Piwik\Widget\Browsers ( $this, self::$settings, $this->statsPageId );
|
1244 |
-
new \WP_Piwik\Widget\BrowserDetails ( $this, self::$settings, $this->statsPageId );
|
1245 |
-
new \WP_Piwik\Widget\Screens ( $this, self::$settings, $this->statsPageId );
|
1246 |
-
new \WP_Piwik\Widget\Types ( $this, self::$settings, $this->statsPageId );
|
1247 |
-
new \WP_Piwik\Widget\Models ( $this, self::$settings, $this->statsPageId );
|
1248 |
-
new \WP_Piwik\Widget\Systems ( $this, self::$settings, $this->statsPageId );
|
1249 |
-
new \WP_Piwik\Widget\SystemDetails ( $this, self::$settings, $this->statsPageId );
|
1250 |
-
new \WP_Piwik\Widget\City ( $this, self::$settings, $this->statsPageId );
|
1251 |
-
new \WP_Piwik\Widget\Country ( $this, self::$settings, $this->statsPageId );
|
1252 |
-
}
|
1253 |
-
|
1254 |
-
/**
|
1255 |
-
* Add per post statistics to a post's page
|
1256 |
-
*
|
1257 |
-
* @param mixed $postPageId
|
1258 |
-
* WordPress post page ID
|
1259 |
-
*/
|
1260 |
-
public function onloadPostPage($postPageId) {
|
1261 |
-
global $post;
|
1262 |
-
$postUrl = get_permalink ( $post->ID );
|
1263 |
-
$this->log ( 'Load per post statistics: ' . $postUrl );
|
1264 |
-
array (
|
1265 |
-
new \WP_Piwik\Widget\Post ( $this, self::$settings, array('post', 'page', 'custom_post_type'), 'side', 'default', array (
|
1266 |
-
'url' => $postUrl
|
1267 |
-
) ),
|
1268 |
-
'show'
|
1269 |
-
);
|
1270 |
-
}
|
1271 |
-
|
1272 |
-
/**
|
1273 |
-
* Stats page changes by POST submit
|
1274 |
-
*
|
1275 |
-
* @see http://tinyurl.com/5r5vnzs
|
1276 |
-
*/
|
1277 |
-
function onStatsPageSaveChanges() {
|
1278 |
-
if (! current_user_can ( 'manage_options' ))
|
1279 |
-
wp_die ( __ ( 'Cheatin’ uh?' ) );
|
1280 |
-
check_admin_referer ( 'wp-piwik_stats' );
|
1281 |
-
wp_redirect ( $_POST ['_wp_http_referer'] );
|
1282 |
-
}
|
1283 |
-
|
1284 |
-
/**
|
1285 |
-
* Get option value, choose method depending on network mode
|
1286 |
-
*
|
1287 |
-
* @param string $option option key
|
1288 |
-
* @return string option value
|
1289 |
-
*/
|
1290 |
-
private function getWordPressOption($option, $default = null) {
|
1291 |
-
return ($this->isNetworkMode () ? get_site_option ( $option, $default ) : get_option ( $option, $default ));
|
1292 |
-
}
|
1293 |
-
|
1294 |
-
/**
|
1295 |
-
* Delete option, choose method depending on network mode
|
1296 |
-
*
|
1297 |
-
* @param string $option option key
|
1298 |
-
*/
|
1299 |
-
private function deleteWordPressOption($option) {
|
1300 |
-
if ( $this->isNetworkMode () )
|
1301 |
-
delete_site_option ( $option );
|
1302 |
-
else
|
1303 |
-
delete_option ( $option );
|
1304 |
-
}
|
1305 |
-
|
1306 |
-
/**
|
1307 |
-
* Set option value, choose method depending on network mode
|
1308 |
-
*
|
1309 |
-
* @param string $option option key
|
1310 |
-
* @param mixed $value option value
|
1311 |
-
*/
|
1312 |
-
private function updateWordPressOption($option, $value) {
|
1313 |
-
if ( $this->isNetworkMode () )
|
1314 |
-
update_site_option ( $option, $value );
|
1315 |
-
else
|
1316 |
-
update_option ( $option, $value );
|
1317 |
-
}
|
1318 |
-
|
1319 |
-
/**
|
1320 |
-
* Check if WP-Piwik options page
|
1321 |
-
*
|
1322 |
-
* @return boolean True if current page is WP-Piwik's option page
|
1323 |
-
*/
|
1324 |
-
public static function isValidOptionsPost() {
|
1325 |
-
return is_admin() && check_admin_referer( 'wp-piwik_settings' ) && current_user_can( 'manage_options' ) ;
|
1326 |
-
}
|
1327 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The main WP-Matomo class configures, registers and manages the plugin
|
5 |
+
*
|
6 |
+
* @author André Bräkling <webmaster@braekling.de>
|
7 |
+
* @package WP_Piwik
|
8 |
+
*/
|
9 |
+
class WP_Piwik {
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* @var Runtime environment variables
|
14 |
+
*/
|
15 |
+
private static $revisionId = 2019072901, $version = '1.0.22', $blog_id, $pluginBasename = NULL, $logger, $settings, $request, $optionsPageId;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Constructor class to configure and register all WP-Piwik components
|
19 |
+
*/
|
20 |
+
public function __construct() {
|
21 |
+
global $blog_id;
|
22 |
+
self::$blog_id = (isset ( $blog_id ) ? $blog_id : 'n/a');
|
23 |
+
$this->openLogger ();
|
24 |
+
$this->openSettings ();
|
25 |
+
$this->setup ();
|
26 |
+
$this->addFilters ();
|
27 |
+
$this->addActions ();
|
28 |
+
$this->addShortcodes ();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Destructor class to finish logging
|
33 |
+
*/
|
34 |
+
public function __destruct() {
|
35 |
+
$this->closeLogger ();
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Setup class to prepare settings and check for installation and update
|
40 |
+
*/
|
41 |
+
private function setup() {
|
42 |
+
self::$pluginBasename = plugin_basename ( __FILE__ );
|
43 |
+
if (! $this->isInstalled ())
|
44 |
+
$this->installPlugin ();
|
45 |
+
elseif ($this->isUpdated ())
|
46 |
+
$this->updatePlugin ();
|
47 |
+
if ($this->isConfigSubmitted ())
|
48 |
+
$this->applySettings ();
|
49 |
+
self::$settings->save ();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Register WordPress actions
|
54 |
+
*/
|
55 |
+
private function addActions() {
|
56 |
+
if ( is_admin () ) {
|
57 |
+
add_action ( 'admin_menu', array (
|
58 |
+
$this,
|
59 |
+
'buildAdminMenu'
|
60 |
+
) );
|
61 |
+
add_action ( 'admin_post_save_wp-piwik_stats', array (
|
62 |
+
$this,
|
63 |
+
'onStatsPageSaveChanges'
|
64 |
+
) );
|
65 |
+
add_action ( 'load-post.php', array (
|
66 |
+
$this,
|
67 |
+
'addPostMetaboxes'
|
68 |
+
) );
|
69 |
+
add_action ( 'load-post-new.php', array (
|
70 |
+
$this,
|
71 |
+
'addPostMetaboxes'
|
72 |
+
) );
|
73 |
+
if ($this->isNetworkMode ()) {
|
74 |
+
add_action ( 'network_admin_notices', array (
|
75 |
+
$this,
|
76 |
+
'showNotices'
|
77 |
+
) );
|
78 |
+
add_action ( 'network_admin_menu', array (
|
79 |
+
$this,
|
80 |
+
'buildNetworkAdminMenu'
|
81 |
+
) );
|
82 |
+
add_action ( 'update_site_option_blogname', array (
|
83 |
+
$this,
|
84 |
+
'onBlogNameChange'
|
85 |
+
) );
|
86 |
+
add_action ( 'update_site_option_siteurl', array (
|
87 |
+
$this,
|
88 |
+
'onSiteUrlChange'
|
89 |
+
) );
|
90 |
+
} else {
|
91 |
+
add_action ( 'admin_notices', array (
|
92 |
+
$this,
|
93 |
+
'showNotices'
|
94 |
+
) );
|
95 |
+
add_action ( 'update_option_blogname', array (
|
96 |
+
$this,
|
97 |
+
'onBlogNameChange'
|
98 |
+
) );
|
99 |
+
add_action ( 'update_option_siteurl', array (
|
100 |
+
$this,
|
101 |
+
'onSiteUrlChange'
|
102 |
+
) );
|
103 |
+
}
|
104 |
+
if ($this->isDashboardActive ())
|
105 |
+
add_action ( 'wp_dashboard_setup', array (
|
106 |
+
$this,
|
107 |
+
'extendWordPressDashboard'
|
108 |
+
) );
|
109 |
+
}
|
110 |
+
if ($this->isToolbarActive ()) {
|
111 |
+
add_action ( is_admin () ? 'admin_head' : 'wp_head', array (
|
112 |
+
$this,
|
113 |
+
'loadToolbarRequirements'
|
114 |
+
) );
|
115 |
+
add_action ( 'admin_bar_menu', array (
|
116 |
+
$this,
|
117 |
+
'extendWordPressToolbar'
|
118 |
+
), 1000 );
|
119 |
+
}
|
120 |
+
if ($this->isTrackingActive ()) {
|
121 |
+
if ( !is_admin () || $this->isAdminTrackingActive ()) {
|
122 |
+
$prefix = is_admin ()?'admin':'wp';
|
123 |
+
add_action ( self::$settings->getGlobalOption ( 'track_codeposition' ) == 'footer' ? $prefix.'_footer' : $prefix.'_head', array (
|
124 |
+
$this,
|
125 |
+
'addJavascriptCode'
|
126 |
+
) );
|
127 |
+
if (self::$settings->getGlobalOption ( 'dnsprefetch' ))
|
128 |
+
add_action ( $prefix.'_head', array (
|
129 |
+
$this,
|
130 |
+
'addDNSPrefetchTag'
|
131 |
+
) );
|
132 |
+
if ($this->isAddNoScriptCode ())
|
133 |
+
add_action ( $prefix.'_footer', array (
|
134 |
+
$this,
|
135 |
+
'addNoscriptCode'
|
136 |
+
) );
|
137 |
+
}
|
138 |
+
if (self::$settings->getGlobalOption ( 'add_post_annotations' ))
|
139 |
+
add_action ( 'transition_post_status', array (
|
140 |
+
$this,
|
141 |
+
'addPiwikAnnotation'
|
142 |
+
), 10, 3 );
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Register WordPress filters
|
149 |
+
*/
|
150 |
+
private function addFilters() {
|
151 |
+
if (is_admin()) {
|
152 |
+
add_filter ( 'plugin_row_meta', array (
|
153 |
+
$this,
|
154 |
+
'setPluginMeta'
|
155 |
+
), 10, 2 );
|
156 |
+
add_filter ( 'screen_layout_columns', array (
|
157 |
+
$this,
|
158 |
+
'onScreenLayoutColumns'
|
159 |
+
), 10, 2 );
|
160 |
+
} elseif ($this->isTrackingActive ()) {
|
161 |
+
if ($this->isTrackFeed ()) {
|
162 |
+
add_filter ( 'the_excerpt_rss', array (
|
163 |
+
$this,
|
164 |
+
'addFeedTracking'
|
165 |
+
) );
|
166 |
+
add_filter ( 'the_content', array (
|
167 |
+
$this,
|
168 |
+
'addFeedTracking'
|
169 |
+
) );
|
170 |
+
}
|
171 |
+
if ($this->isAddFeedCampaign ()) {
|
172 |
+
add_filter ( 'post_link', array (
|
173 |
+
$this,
|
174 |
+
'addFeedCampaign'
|
175 |
+
) );
|
176 |
+
}
|
177 |
+
if ($this->isCrossDomainLinkingEnabled ()) {
|
178 |
+
add_filter ( 'wp_redirect', array (
|
179 |
+
$this,
|
180 |
+
'forwardCrossDomainVisitorId'
|
181 |
+
) );
|
182 |
+
}
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Register WordPress shortcodes
|
188 |
+
*/
|
189 |
+
private function addShortcodes() {
|
190 |
+
if ($this->isAddShortcode ())
|
191 |
+
add_shortcode ( 'wp-piwik', array (
|
192 |
+
$this,
|
193 |
+
'shortcode'
|
194 |
+
) );
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Install WP-Piwik for the first time
|
199 |
+
*/
|
200 |
+
private function installPlugin($isUpdate = false) {
|
201 |
+
self::$logger->log ( 'Running WP-Piwik installation' );
|
202 |
+
if (! $isUpdate)
|
203 |
+
$this->addNotice ( 'install', sprintf ( __ ( '%s %s installed.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$version ), __ ( 'Next you should connect to Piwik', 'wp-piwik' ) );
|
204 |
+
self::$settings->setGlobalOption ( 'revision', self::$revisionId );
|
205 |
+
self::$settings->setGlobalOption ( 'last_settings_update', time () );
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Uninstall WP-Piwik
|
210 |
+
*/
|
211 |
+
public function uninstallPlugin() {
|
212 |
+
self::$logger->log ( 'Running WP-Piwik uninstallation' );
|
213 |
+
if (! defined ( 'WP_UNINSTALL_PLUGIN' ))
|
214 |
+
exit ();
|
215 |
+
self::deleteWordPressOption ( 'wp-piwik-notices' );
|
216 |
+
self::$settings->resetSettings ( true );
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Update WP-Piwik
|
221 |
+
*/
|
222 |
+
private function updatePlugin() {
|
223 |
+
self::$logger->log ( 'Upgrade WP-Piwik to ' . self::$version );
|
224 |
+
$patches = glob ( dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'update' . DIRECTORY_SEPARATOR . '*.php' );
|
225 |
+
$isPatched = false;
|
226 |
+
if (is_array ( $patches )) {
|
227 |
+
sort ( $patches );
|
228 |
+
foreach ( $patches as $patch ) {
|
229 |
+
$patchVersion = ( int ) pathinfo ( $patch, PATHINFO_FILENAME );
|
230 |
+
if ($patchVersion && self::$settings->getGlobalOption ( 'revision' ) < $patchVersion) {
|
231 |
+
self::includeFile ( 'update' . DIRECTORY_SEPARATOR . $patchVersion );
|
232 |
+
$isPatched = true;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
}
|
236 |
+
if ((self::$settings->getGlobalOption('update_notice') == 'enabled') || ((self::$settings->getGlobalOption('update_notice') == 'script') && $isPatched))
|
237 |
+
$this->addNotice ( 'update', sprintf ( __ ( '%s updated to %s.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$version ), __ ( 'Please validate your configuration', 'wp-piwik' ) );
|
238 |
+
$this->installPlugin ( true );
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Define a notice
|
243 |
+
*
|
244 |
+
* @param string $type
|
245 |
+
* identifier
|
246 |
+
* @param string $subject
|
247 |
+
* notice headline
|
248 |
+
* @param string $text
|
249 |
+
* notice content
|
250 |
+
* @param boolean $stay
|
251 |
+
* set to true if the message should persist (default: false)
|
252 |
+
*/
|
253 |
+
private function addNotice($type, $subject, $text, $stay = false) {
|
254 |
+
$notices = $this->getWordPressOption ( 'wp-piwik-notices', array () );
|
255 |
+
$notices [$type] = array (
|
256 |
+
'subject' => $subject,
|
257 |
+
'text' => $text,
|
258 |
+
'stay' => $stay
|
259 |
+
);
|
260 |
+
$this->updateWordPressOption ( 'wp-piwik-notices', $notices );
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Show all notices defined previously
|
265 |
+
*
|
266 |
+
* @see addNotice()
|
267 |
+
*/
|
268 |
+
public function showNotices() {
|
269 |
+
$link = sprintf ( '<a href="' . $this->getSettingsURL () . '">%s</a>', __ ( 'Settings', 'wp-piwik' ) );
|
270 |
+
if ($notices = $this->getWordPressOption ( 'wp-piwik-notices' )) {
|
271 |
+
foreach ( $notices as $type => $notice ) {
|
272 |
+
printf ( '<div class="updated fade"><p>%s <strong>%s:</strong> %s: %s</p></div>', $notice ['subject'], __ ( 'Important', 'wp-piwik' ), $notice ['text'], $link );
|
273 |
+
if (! $notice ['stay'])
|
274 |
+
unset ( $notices [$type] );
|
275 |
+
}
|
276 |
+
}
|
277 |
+
$this->updateWordPressOption ( 'wp-piwik-notices', $notices );
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Get the settings page URL
|
282 |
+
*
|
283 |
+
* @return string settings page URL
|
284 |
+
*/
|
285 |
+
private function getSettingsURL() {
|
286 |
+
return (self::$settings->checkNetworkActivation () ? 'settings' : 'options-general') . '.php?page=' . self::$pluginBasename;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Echo javascript tracking code
|
291 |
+
*/
|
292 |
+
public function addJavascriptCode() {
|
293 |
+
if ($this->isHiddenUser ()) {
|
294 |
+
self::$logger->log ( 'Do not add tracking code to site (user should not be tracked) Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
|
295 |
+
return;
|
296 |
+
}
|
297 |
+
$trackingCode = new WP_Piwik\TrackingCode ( $this );
|
298 |
+
$trackingCode->is404 = (is_404 () && self::$settings->getGlobalOption ( 'track_404' ));
|
299 |
+
$trackingCode->isUsertracking = self::$settings->getGlobalOption ( 'track_user_id' ) != 'disabled';
|
300 |
+
$trackingCode->isSearch = (is_search () && self::$settings->getGlobalOption ( 'track_search' ));
|
301 |
+
self::$logger->log ( 'Add tracking code. Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
|
302 |
+
if ($this->isNetworkMode () && self::$settings->getGlobalOption ( 'track_mode' ) == 'manually') {
|
303 |
+
$siteId = $this->getPiwikSiteId ();
|
304 |
+
if ($siteId != 'n/a')
|
305 |
+
echo str_replace ( '{ID}', $siteId, $trackingCode->getTrackingCode () );
|
306 |
+
else
|
307 |
+
echo '<!-- Site will be created and tracking code added on next request -->';
|
308 |
+
} else
|
309 |
+
echo $trackingCode->getTrackingCode ();
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Echo DNS prefetch tag
|
314 |
+
*/
|
315 |
+
public function addDNSPrefetchTag() {
|
316 |
+
echo '<link rel="dns-prefetch" href="'.$this->getPiwikDomain().'" />';
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Get Piwik Domain
|
321 |
+
*/
|
322 |
+
public function getPiwikDomain() {
|
323 |
+
switch (self::$settings->getGlobalOption ( 'piwik_mode' )) {
|
324 |
+
case 'php' :
|
325 |
+
return '//' . parse_url(self::$settings->getGlobalOption ( 'proxy_url' ), PHP_URL_HOST);
|
326 |
+
case 'cloud' :
|
327 |
+
return '//' . self::$settings->getGlobalOption ( 'piwik_user' ) . '.innocraft.cloud';
|
328 |
+
case 'cloud-matomo' :
|
329 |
+
return '//' . self::$settings->getGlobalOption ( 'matomo_user' ) . '.matomo.cloud';
|
330 |
+
default :
|
331 |
+
return '//' . parse_url(self::$settings->getGlobalOption ( 'piwik_url' ), PHP_URL_HOST);
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Echo noscript tracking code
|
337 |
+
*/
|
338 |
+
public function addNoscriptCode() {
|
339 |
+
if (self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy')
|
340 |
+
return;
|
341 |
+
if ($this->isHiddenUser ()) {
|
342 |
+
self::$logger->log ( 'Do not add noscript code to site (user should not be tracked) Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
|
343 |
+
return;
|
344 |
+
}
|
345 |
+
self::$logger->log ( 'Add noscript code. Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
|
346 |
+
echo self::$settings->getOption ( 'noscript_code' ) . "\n";
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Register post view meta boxes
|
351 |
+
*/
|
352 |
+
public function addPostMetaboxes() {
|
353 |
+
if (self::$settings->getGlobalOption ( 'add_customvars_box' )) {
|
354 |
+
add_action ( 'add_meta_boxes', array (
|
355 |
+
new WP_Piwik\Template\MetaBoxCustomVars ( $this, self::$settings ),
|
356 |
+
'addMetabox'
|
357 |
+
) );
|
358 |
+
add_action ( 'save_post', array (
|
359 |
+
new WP_Piwik\Template\MetaBoxCustomVars ( $this, self::$settings ),
|
360 |
+
'saveCustomVars'
|
361 |
+
), 10, 2 );
|
362 |
+
}
|
363 |
+
if (self::$settings->getGlobalOption ( 'perpost_stats' )) {
|
364 |
+
add_action ( 'add_meta_boxes', array (
|
365 |
+
$this,
|
366 |
+
'onloadPostPage'
|
367 |
+
) );
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Register admin menu components
|
373 |
+
*/
|
374 |
+
public function buildAdminMenu() {
|
375 |
+
if (self::isConfigured ()) {
|
376 |
+
$cap = 'wp-piwik_read_stats';
|
377 |
+
if (self::$settings->checkNetworkActivation ()) {
|
378 |
+
global $current_user;
|
379 |
+
$userRoles = $current_user->roles;
|
380 |
+
$allowed = self::$settings->getGlobalOption ( 'capability_read_stats' );
|
381 |
+
if (is_array($userRoles) && is_array($allowed))
|
382 |
+
foreach ($userRoles as $userRole)
|
383 |
+
if (isset( $allowed[$userRole] ) && $allowed[$userRole]) {
|
384 |
+
$cap = 'read';
|
385 |
+
break;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
$statsPage = new WP_Piwik\Admin\Statistics ( $this, self::$settings );
|
389 |
+
$this->statsPageId = add_dashboard_page ( __ ( 'Piwik Statistics', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), $cap, 'wp-piwik_stats', array (
|
390 |
+
$statsPage,
|
391 |
+
'show'
|
392 |
+
) );
|
393 |
+
$this->loadAdminStatsHeader ( $this->statsPageId, $statsPage );
|
394 |
+
}
|
395 |
+
if (! self::$settings->checkNetworkActivation ()) {
|
396 |
+
$optionsPage = new WP_Piwik\Admin\Settings ( $this, self::$settings );
|
397 |
+
self::$optionsPageId = add_options_page ( self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'activate_plugins', __FILE__, array (
|
398 |
+
$optionsPage,
|
399 |
+
'show'
|
400 |
+
) );
|
401 |
+
$this->loadAdminSettingsHeader ( self::$optionsPageId, $optionsPage );
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Register network admin menu components
|
407 |
+
*/
|
408 |
+
public function buildNetworkAdminMenu() {
|
409 |
+
if (self::isConfigured ()) {
|
410 |
+
$statsPage = new WP_Piwik\Admin\Network ( $this, self::$settings );
|
411 |
+
$this->statsPageId = add_dashboard_page ( __ ( 'Piwik Statistics', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'manage_sites', 'wp-piwik_stats', array (
|
412 |
+
$statsPage,
|
413 |
+
'show'
|
414 |
+
) );
|
415 |
+
$this->loadAdminStatsHeader ( $this->statsPageId, $statsPage );
|
416 |
+
}
|
417 |
+
$optionsPage = new WP_Piwik\Admin\Settings ( $this, self::$settings );
|
418 |
+
self::$optionsPageId = add_submenu_page ( 'settings.php', self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'manage_sites', __FILE__, array (
|
419 |
+
$optionsPage,
|
420 |
+
'show'
|
421 |
+
) );
|
422 |
+
$this->loadAdminSettingsHeader ( self::$optionsPageId, $optionsPage );
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Register admin header extensions for stats page
|
427 |
+
*
|
428 |
+
* @param $optionsPageId options
|
429 |
+
* page id
|
430 |
+
* @param $optionsPage options
|
431 |
+
* page object
|
432 |
+
*/
|
433 |
+
public function loadAdminStatsHeader($statsPageId, $statsPage) {
|
434 |
+
add_action ( 'admin_print_scripts-' . $statsPageId, array (
|
435 |
+
$statsPage,
|
436 |
+
'printAdminScripts'
|
437 |
+
) );
|
438 |
+
add_action ( 'admin_print_styles-' . $statsPageId, array (
|
439 |
+
$statsPage,
|
440 |
+
'printAdminStyles'
|
441 |
+
) );
|
442 |
+
add_action ( 'admin_head-' . $statsPageId, array (
|
443 |
+
$statsPage,
|
444 |
+
'extendAdminHeader'
|
445 |
+
) );
|
446 |
+
add_action ( 'load-' . $statsPageId, array (
|
447 |
+
$this,
|
448 |
+
'onloadStatsPage'
|
449 |
+
) );
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Register admin header extensions for settings page
|
454 |
+
*
|
455 |
+
* @param $optionsPageId options
|
456 |
+
* page id
|
457 |
+
* @param $optionsPage options
|
458 |
+
* page object
|
459 |
+
*/
|
460 |
+
public function loadAdminSettingsHeader($optionsPageId, $optionsPage) {
|
461 |
+
add_action ( 'admin_head-' . $optionsPageId, array (
|
462 |
+
$optionsPage,
|
463 |
+
'extendAdminHeader'
|
464 |
+
) );
|
465 |
+
add_action ( 'admin_print_styles-' . $optionsPageId, array (
|
466 |
+
$optionsPage,
|
467 |
+
'printAdminStyles'
|
468 |
+
) );
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* Register WordPress dashboard widgets
|
473 |
+
*/
|
474 |
+
public function extendWordPressDashboard() {
|
475 |
+
if (current_user_can ( 'wp-piwik_read_stats' )) {
|
476 |
+
if (self::$settings->getGlobalOption ( 'dashboard_widget' ) != 'disabled')
|
477 |
+
new WP_Piwik\Widget\Overview ( $this, self::$settings, 'dashboard', 'side', 'default', array (
|
478 |
+
'date' => self::$settings->getGlobalOption ( 'dashboard_widget' ),
|
479 |
+
'period' => 'day'
|
480 |
+
) );
|
481 |
+
if (self::$settings->getGlobalOption ( 'dashboard_chart' ))
|
482 |
+
new WP_Piwik\Widget\Chart ( $this, self::$settings );
|
483 |
+
if (self::$settings->getGlobalOption ( 'dashboard_ecommerce' ))
|
484 |
+
new WP_Piwik\Widget\Ecommerce ( $this, self::$settings );
|
485 |
+
if (self::$settings->getGlobalOption ( 'dashboard_seo' ))
|
486 |
+
new WP_Piwik\Widget\Seo ( $this, self::$settings );
|
487 |
+
}
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Register WordPress toolbar components
|
492 |
+
*/
|
493 |
+
public function extendWordPressToolbar($toolbar) {
|
494 |
+
if (current_user_can ( 'wp-piwik_read_stats' ) && is_admin_bar_showing ()) {
|
495 |
+
$id = WP_Piwik\Request::register ( 'VisitsSummary.getUniqueVisitors', array (
|
496 |
+
'period' => 'day',
|
497 |
+
'date' => 'last30'
|
498 |
+
) );
|
499 |
+
$unique = $this->request ( $id );
|
500 |
+
$url = is_network_admin () ? $this->getSettingsURL () : false;
|
501 |
+
$content = is_network_admin () ? __('Configure WP-Piwik', 'wp-piwik') : '';
|
502 |
+
// Leave if result array does contain a message instead of valid data
|
503 |
+
if (isset($unique['result']))
|
504 |
+
$content .= '<!-- '.$unique['result'].': '.($unique['message']?$unique['message']:'...').' -->';
|
505 |
+
elseif (is_array ( $unique ) ) {
|
506 |
+
$content = "<script type='text/javascript'>var \$jSpark = jQuery.noConflict();\$jSpark(function() {var piwikSparkVals=[" . implode ( ',', $unique ) . "];\$jSpark('.wp-piwik_dynbar').sparkline(piwikSparkVals, {type: 'bar', barColor: '#ccc', barWidth:2});});</script><span class='wp-piwik_dynbar'>Loading...</span>";
|
507 |
+
$url = $this->getStatsURL ();
|
508 |
+
}
|
509 |
+
$toolbar->add_menu ( array (
|
510 |
+
'id' => 'wp-piwik_stats',
|
511 |
+
'title' => $content,
|
512 |
+
'href' => $url
|
513 |
+
) );
|
514 |
+
}
|
515 |
+
}
|
516 |
+
|
517 |
+
/**
|
518 |
+
* Add plugin meta data
|
519 |
+
*
|
520 |
+
* @param array $links
|
521 |
+
* list of already defined plugin meta data
|
522 |
+
* @param string $file
|
523 |
+
* handled file
|
524 |
+
* @return array complete list of plugin meta data
|
525 |
+
*/
|
526 |
+
public function setPluginMeta($links, $file) {
|
527 |
+
if ($file == 'wp-piwik/wp-piwik.php' && (!$this->isNetworkMode () || is_network_admin()) )
|
528 |
+
return array_merge ( $links, array (
|
529 |
+
sprintf ( '<a href="%s">%s</a>', self::getSettingsURL (), __ ( 'Settings', 'wp-piwik' ) )
|
530 |
+
) );
|
531 |
+
return $links;
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* Prepare toolbar widget requirements
|
536 |
+
*/
|
537 |
+
public function loadToolbarRequirements() {
|
538 |
+
if (is_admin_bar_showing ()) {
|
539 |
+
wp_enqueue_script ( 'wp-piwik-sparkline', $this->getPluginURL () . 'js/sparkline/jquery.sparkline.min.js', array (
|
540 |
+
'jquery'
|
541 |
+
), self::$version );
|
542 |
+
wp_enqueue_style ( 'wp-piwik', $this->getPluginURL () . 'css/wp-piwik-spark.css', array (), $this->getPluginVersion () );
|
543 |
+
}
|
544 |
+
}
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Add tracking pixels to feed content
|
548 |
+
*
|
549 |
+
* @param string $content
|
550 |
+
* post content
|
551 |
+
* @return string post content extended by tracking pixel
|
552 |
+
*/
|
553 |
+
public function addFeedTracking($content) {
|
554 |
+
global $post;
|
555 |
+
if (is_feed ()) {
|
556 |
+
self::$logger->log ( 'Add tracking image to feed entry.' );
|
557 |
+
if (! self::$settings->getOption ( 'site_id' )) {
|
558 |
+
$siteId = $this->requestPiwikSiteId ();
|
559 |
+
if ($siteId != 'n/a')
|
560 |
+
self::$settings->setOption ( 'site_id', $siteId );
|
561 |
+
else
|
562 |
+
return false;
|
563 |
+
}
|
564 |
+
$title = the_title ( null, null, false );
|
565 |
+
$posturl = get_permalink ( $post->ID );
|
566 |
+
$urlref = get_bloginfo ( 'rss2_url' );
|
567 |
+
if (self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy')
|
568 |
+
$url = plugins_url ( 'wp-piwik' ) . '/proxy/piwik.php';
|
569 |
+
else {
|
570 |
+
$url = self::$settings->getGlobalOption ( 'piwik_url' );
|
571 |
+
if (substr($url, -10, 10) == '/index.php')
|
572 |
+
$url = str_replace('/index.php', '/piwik.php', $url);
|
573 |
+
else
|
574 |
+
$url .= 'piwik.php';
|
575 |
+
}
|
576 |
+
$trackingImage = $url . '?idsite=' . self::$settings->getOption ( 'site_id' ) . '&rec=1&url=' . urlencode ( $posturl ) . '&action_name=' . urlencode ( $title ) . '&urlref=' . urlencode ( $urlref );
|
577 |
+
$content .= '<img src="' . $trackingImage . '" style="border:0;width:0;height:0" width="0" height="0" alt="" />';
|
578 |
+
}
|
579 |
+
return $content;
|
580 |
+
}
|
581 |
+
|
582 |
+
/**
|
583 |
+
* Add a campaign parameter to feed permalink
|
584 |
+
*
|
585 |
+
* @param string $permalink
|
586 |
+
* permalink
|
587 |
+
* @return string permalink extended by campaign parameter
|
588 |
+
*/
|
589 |
+
public function addFeedCampaign($permalink) {
|
590 |
+
global $post;
|
591 |
+
if (is_feed ()) {
|
592 |
+
self::$logger->log ( 'Add campaign to feed permalink.' );
|
593 |
+
$sep = (strpos ( $permalink, '?' ) === false ? '?' : '&');
|
594 |
+
$permalink .= $sep . 'pk_campaign=' . urlencode ( self::$settings->getGlobalOption ( 'track_feed_campaign' ) ) . '&pk_kwd=' . urlencode ( $post->post_name );
|
595 |
+
}
|
596 |
+
return $permalink;
|
597 |
+
}
|
598 |
+
|
599 |
+
/**
|
600 |
+
* Forwards the cross domain parameter pk_vid if the URL parameter is set and a user is about to be redirected.
|
601 |
+
* When another website links to WooCommerce with a pk_vid parameter, and WooCommerce redirects the user to another
|
602 |
+
* URL, the pk_vid parameter would get lost and the visitorId would later not be applied by the tracking code
|
603 |
+
* due to the lost pk_vid URL parameter. If the URL parameter is set, we make sure to forward this parameter.
|
604 |
+
*
|
605 |
+
* @param string $location
|
606 |
+
*
|
607 |
+
* @return string location extended by pk_vid URL parameter if the URL parameter is set
|
608 |
+
*/
|
609 |
+
public function forwardCrossDomainVisitorId($location) {
|
610 |
+
|
611 |
+
if (!empty($_GET['pk_vid'])
|
612 |
+
&& preg_match('/^[a-zA-Z0-9]{24,48}$/', $_GET['pk_vid'])) {
|
613 |
+
// currently, the pk_vid parameter is 32 characters long, but it may vary over time.
|
614 |
+
$location = add_query_arg( 'pk_vid', $_GET['pk_vid'], $location );
|
615 |
+
}
|
616 |
+
|
617 |
+
return $location;
|
618 |
+
}
|
619 |
+
|
620 |
+
/**
|
621 |
+
* Apply settings update
|
622 |
+
*
|
623 |
+
* @return boolean settings update applied
|
624 |
+
*/
|
625 |
+
private function applySettings() {
|
626 |
+
self::$settings->applyChanges ( $_POST ['wp-piwik'] );
|
627 |
+
if (self::$settings->getGlobalOption ( 'auto_site_config' ) && self::isConfigured ()) {
|
628 |
+
if ($this->isPHPMode () && ! defined ( 'PIWIK_INCLUDE_PATH' ))
|
629 |
+
self::definePiwikConstants ();
|
630 |
+
$siteId = $this->getPiwikSiteId ();
|
631 |
+
$trackingCode = $this->updateTrackingCode ( $siteId );
|
632 |
+
self::$settings->setOption ( 'site_id', $siteId );
|
633 |
+
}
|
634 |
+
self::$settings->setGlobalOption ( 'revision', self::$revisionId );
|
635 |
+
self::$settings->setGlobalOption ( 'last_settings_update', time () );
|
636 |
+
return true;
|
637 |
+
}
|
638 |
+
|
639 |
+
/**
|
640 |
+
* Check if WP-Piwik is configured
|
641 |
+
*
|
642 |
+
* @return boolean Is WP-Piwik configured?
|
643 |
+
*/
|
644 |
+
public static function isConfigured() {
|
645 |
+
return (self::$settings->getGlobalOption ( 'piwik_token' ) && (self::$settings->getGlobalOption ( 'piwik_mode' ) != 'disabled') && (((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'http') && (self::$settings->getGlobalOption ( 'piwik_url' ))) || ((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'php') && (self::$settings->getGlobalOption ( 'piwik_path' ))) || ((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'cloud') && (self::$settings->getGlobalOption ( 'piwik_user' ))) || ((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'cloud-matomo') && (self::$settings->getGlobalOption ( 'matomo_user' )))));
|
646 |
+
}
|
647 |
+
|
648 |
+
/**
|
649 |
+
* Check if WP-Piwik was updated
|
650 |
+
*
|
651 |
+
* @return boolean Was WP-Piwik updated?
|
652 |
+
*/
|
653 |
+
private function isUpdated() {
|
654 |
+
return self::$settings->getGlobalOption ( 'revision' ) && self::$settings->getGlobalOption ( 'revision' ) < self::$revisionId;
|
655 |
+
}
|
656 |
+
|
657 |
+
/**
|
658 |
+
* Check if WP-Piwik is already installed
|
659 |
+
*
|
660 |
+
* @return boolean Is WP-Piwik installed?
|
661 |
+
*/
|
662 |
+
private function isInstalled() {
|
663 |
+
$oldSettings = $this->getWordPressOption ( 'wp-piwik_global-settings', false );
|
664 |
+
if ($oldSettings && isset( $oldSettings['revision'] )) {
|
665 |
+
self::log('Save old settings');
|
666 |
+
self::$settings->setGlobalOption ( 'revision', $oldSettings['revision'] );
|
667 |
+
} else self::log( 'Current revision '.self::$settings->getGlobalOption ( 'revision' ) );
|
668 |
+
return self::$settings->getGlobalOption ( 'revision' ) > 0;
|
669 |
+
}
|
670 |
+
|
671 |
+
/**
|
672 |
+
* Check if new settings were submitted
|
673 |
+
*
|
674 |
+
* @return boolean Are new settings submitted?
|
675 |
+
*/
|
676 |
+
public static function isConfigSubmitted() {
|
677 |
+
return isset ( $_POST ) && isset ( $_POST ['wp-piwik'] ) && self::isValidOptionsPost();
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* Check if PHP mode is chosen
|
682 |
+
*
|
683 |
+
* @return Is PHP mode chosen?
|
684 |
+
*/
|
685 |
+
public function isPHPMode() {
|
686 |
+
return self::$settings->getGlobalOption ( 'piwik_mode' ) && self::$settings->getGlobalOption ( 'piwik_mode' ) == 'php';
|
687 |
+
}
|
688 |
+
|
689 |
+
/**
|
690 |
+
* Check if WordPress is running in network mode
|
691 |
+
*
|
692 |
+
* @return boolean Is WordPress running in network mode?
|
693 |
+
*/
|
694 |
+
public function isNetworkMode() {
|
695 |
+
return self::$settings->checkNetworkActivation ();
|
696 |
+
}
|
697 |
+
|
698 |
+
/**
|
699 |
+
* Check if a WP-Piwik dashboard widget is enabled
|
700 |
+
*
|
701 |
+
* @return boolean Is a dashboard widget enabled?
|
702 |
+
*/
|
703 |
+
private function isDashboardActive() {
|
704 |
+
return self::$settings->getGlobalOption ( 'dashboard_widget' ) || self::$settings->getGlobalOption ( 'dashboard_chart' ) || self::$settings->getGlobalOption ( 'dashboard_seo' );
|
705 |
+
}
|
706 |
+
|
707 |
+
/**
|
708 |
+
* Check if a WP-Piwik toolbar widget is enabled
|
709 |
+
*
|
710 |
+
* @return boolean Is a toolbar widget enabled?
|
711 |
+
*/
|
712 |
+
private function isToolbarActive() {
|
713 |
+
return self::$settings->getGlobalOption ( 'toolbar' );
|
714 |
+
}
|
715 |
+
|
716 |
+
/**
|
717 |
+
* Check if WP-Piwik tracking code insertion is enabled
|
718 |
+
*
|
719 |
+
* @return boolean Insert tracking code?
|
720 |
+
*/
|
721 |
+
private function isTrackingActive() {
|
722 |
+
return self::$settings->getGlobalOption ( 'track_mode' ) != 'disabled';
|
723 |
+
}
|
724 |
+
|
725 |
+
/**
|
726 |
+
* Check if admin tracking is enabled
|
727 |
+
*
|
728 |
+
* @return boolean Is admin tracking enabled?
|
729 |
+
*/
|
730 |
+
private function isAdminTrackingActive() {
|
731 |
+
return self::$settings->getGlobalOption ( 'track_admin' ) && is_admin ();
|
732 |
+
}
|
733 |
+
|
734 |
+
/**
|
735 |
+
* Check if WP-Piwik noscript code insertion is enabled
|
736 |
+
*
|
737 |
+
* @return boolean Insert noscript code?
|
738 |
+
*/
|
739 |
+
private function isAddNoScriptCode() {
|
740 |
+
return self::$settings->getGlobalOption ( 'track_noscript' );
|
741 |
+
}
|
742 |
+
|
743 |
+
/**
|
744 |
+
* Check if feed tracking is enabled
|
745 |
+
*
|
746 |
+
* @return boolean Is feed tracking enabled?
|
747 |
+
*/
|
748 |
+
private function isTrackFeed() {
|
749 |
+
return self::$settings->getGlobalOption ( 'track_feed' );
|
750 |
+
}
|
751 |
+
|
752 |
+
/**
|
753 |
+
* Check if feed permalinks get a campaign parameter
|
754 |
+
*
|
755 |
+
* @return boolean Add campaign parameter to feed permalinks?
|
756 |
+
*/
|
757 |
+
private function isAddFeedCampaign() {
|
758 |
+
return self::$settings->getGlobalOption ( 'track_feed_addcampaign' );
|
759 |
+
}
|
760 |
+
|
761 |
+
/**
|
762 |
+
* Check if feed permalinks get a campaign parameter
|
763 |
+
*
|
764 |
+
* @return boolean Add campaign parameter to feed permalinks?
|
765 |
+
*/
|
766 |
+
private function isCrossDomainLinkingEnabled() {
|
767 |
+
return self::$settings->getGlobalOption ( 'track_crossdomain_linking' );
|
768 |
+
}
|
769 |
+
|
770 |
+
/**
|
771 |
+
* Check if WP-Piwik shortcodes are enabled
|
772 |
+
*
|
773 |
+
* @return boolean Are shortcodes enabled?
|
774 |
+
*/
|
775 |
+
private function isAddShortcode() {
|
776 |
+
return self::$settings->getGlobalOption ( 'shortcodes' );
|
777 |
+
}
|
778 |
+
|
779 |
+
/**
|
780 |
+
* Define Piwik constants for PHP reporting API
|
781 |
+
*/
|
782 |
+
public static function definePiwikConstants() {
|
783 |
+
if (! defined ( 'PIWIK_INCLUDE_PATH' )) {
|
784 |
+
//@header('Content-type: text/html');
|
785 |
+
define ( 'PIWIK_INCLUDE_PATH', self::$settings->getGlobalOption ( 'piwik_path' ) );
|
786 |
+
define ( 'PIWIK_USER_PATH', self::$settings->getGlobalOption ( 'piwik_path' ) );
|
787 |
+
define ( 'PIWIK_ENABLE_DISPATCH', false );
|
788 |
+
define ( 'PIWIK_ENABLE_ERROR_HANDLER', false );
|
789 |
+
define ( 'PIWIK_ENABLE_SESSION_START', false );
|
790 |
+
}
|
791 |
+
}
|
792 |
+
|
793 |
+
/**
|
794 |
+
* Start chosen logging method
|
795 |
+
*/
|
796 |
+
private function openLogger() {
|
797 |
+
switch (WP_PIWIK_ACTIVATE_LOGGER) {
|
798 |
+
case 1 :
|
799 |
+
self::$logger = new WP_Piwik\Logger\Screen ( __CLASS__ );
|
800 |
+
break;
|
801 |
+
case 2 :
|
802 |
+
self::$logger = new WP_Piwik\Logger\File ( __CLASS__ );
|
803 |
+
break;
|
804 |
+
default :
|
805 |
+
self::$logger = new WP_Piwik\Logger\Dummy ( __CLASS__ );
|
806 |
+
}
|
807 |
+
}
|
808 |
+
|
809 |
+
/**
|
810 |
+
* Log a message
|
811 |
+
*
|
812 |
+
* @param string $message
|
813 |
+
* logger message
|
814 |
+
*/
|
815 |
+
public static function log($message) {
|
816 |
+
self::$logger->log ( $message );
|
817 |
+
}
|
818 |
+
|
819 |
+
/**
|
820 |
+
* End logging
|
821 |
+
*/
|
822 |
+
private function closeLogger() {
|
823 |
+
self::$logger = null;
|
824 |
+
}
|
825 |
+
|
826 |
+
/**
|
827 |
+
* Load WP-Piwik settings
|
828 |
+
*/
|
829 |
+
private function openSettings() {
|
830 |
+
self::$settings = new WP_Piwik\Settings ( $this, self::$logger );
|
831 |
+
if (! $this->isConfigSubmitted () && $this->isPHPMode () && ! defined ( 'PIWIK_INCLUDE_PATH' ))
|
832 |
+
self::definePiwikConstants ();
|
833 |
+
}
|
834 |
+
|
835 |
+
/**
|
836 |
+
* Include a WP-Piwik file
|
837 |
+
*/
|
838 |
+
private function includeFile($strFile) {
|
839 |
+
self::$logger->log ( 'Include ' . $strFile . '.php' );
|
840 |
+
if (WP_PIWIK_PATH . $strFile . '.php')
|
841 |
+
include (WP_PIWIK_PATH . $strFile . '.php');
|
842 |
+
}
|
843 |
+
|
844 |
+
/**
|
845 |
+
* Check if user should not be tracked
|
846 |
+
*
|
847 |
+
* @return boolean Do not track user?
|
848 |
+
*/
|
849 |
+
private function isHiddenUser() {
|
850 |
+
if (is_multisite ())
|
851 |
+
foreach ( self::$settings->getGlobalOption ( 'capability_stealth' ) as $key => $val )
|
852 |
+
if ($val && current_user_can ( $key ))
|
853 |
+
return true;
|
854 |
+
return current_user_can ( 'wp-piwik_stealth' );
|
855 |
+
}
|
856 |
+
|
857 |
+
/**
|
858 |
+
* Check if tracking code is up to date
|
859 |
+
*
|
860 |
+
* @return boolean Is tracking code up to date?
|
861 |
+
*/
|
862 |
+
public function isCurrentTrackingCode() {
|
863 |
+
return (self::$settings->getOption ( 'last_tracking_code_update' ) && self::$settings->getOption ( 'last_tracking_code_update' ) > self::$settings->getGlobalOption ( 'last_settings_update' ));
|
864 |
+
}
|
865 |
+
|
866 |
+
/**
|
867 |
+
* DEPRECTAED Add javascript code to site header
|
868 |
+
*
|
869 |
+
* @deprecated
|
870 |
+
*
|
871 |
+
*/
|
872 |
+
public function site_header() {
|
873 |
+
self::$logger->log ( 'Using deprecated function site_header' );
|
874 |
+
$this->addJavascriptCode ();
|
875 |
+
}
|
876 |
+
|
877 |
+
/**
|
878 |
+
* DEPRECTAED Add javascript code to site footer
|
879 |
+
*
|
880 |
+
* @deprecated
|
881 |
+
*
|
882 |
+
*/
|
883 |
+
public function site_footer() {
|
884 |
+
self::$logger->log ( 'Using deprecated function site_footer' );
|
885 |
+
$this->addNoscriptCode ();
|
886 |
+
}
|
887 |
+
|
888 |
+
/**
|
889 |
+
* Identify new posts if an annotation is required
|
890 |
+
* and create Piwik annotation
|
891 |
+
*
|
892 |
+
* @param string $newStatus
|
893 |
+
* new post status
|
894 |
+
* @param strint $oldStatus
|
895 |
+
* new post status
|
896 |
+
* @param object $post
|
897 |
+
* current post object
|
898 |
+
*/
|
899 |
+
public function addPiwikAnnotation($newStatus, $oldStatus, $post) {
|
900 |
+
$enabledPostTypes = self::$settings->getGlobalOption ( 'add_post_annotations' );
|
901 |
+
if (isset($enabledPostTypes[$post->post_type]) && $enabledPostTypes[$post->post_type] && $newStatus == 'publish' && $oldStatus != 'publish') {
|
902 |
+
$note = 'Published: ' . $post->post_title . ' - URL: ' . get_permalink ( $post->ID );
|
903 |
+
$id = WP_Piwik\Request::register ( 'Annotations.add', array (
|
904 |
+
'idSite' => $this->getPiwikSiteId (),
|
905 |
+
'date' => date ( 'Y-m-d' ),
|
906 |
+
'note' => $note
|
907 |
+
) );
|
908 |
+
$result = $this->request ( $id );
|
909 |
+
self::$logger->log ( 'Add post annotation. ' . $note . ' - ' . serialize ( $result ) );
|
910 |
+
}
|
911 |
+
}
|
912 |
+
|
913 |
+
/**
|
914 |
+
* Get WP-Piwik's URL
|
915 |
+
*/
|
916 |
+
public function getPluginURL() {
|
917 |
+
return trailingslashit ( plugins_url () . '/wp-piwik/' );
|
918 |
+
}
|
919 |
+
|
920 |
+
/**
|
921 |
+
* Get WP-Piwik's version
|
922 |
+
*/
|
923 |
+
public function getPluginVersion() {
|
924 |
+
return self::$version;
|
925 |
+
}
|
926 |
+
|
927 |
+
/**
|
928 |
+
* Enable three columns for WP-Piwik stats screen
|
929 |
+
*
|
930 |
+
* @param
|
931 |
+
* array full list of column settings
|
932 |
+
* @param
|
933 |
+
* mixed current screen id
|
934 |
+
* @return array updated list of column settings
|
935 |
+
*/
|
936 |
+
public function onScreenLayoutColumns($columns, $screen) {
|
937 |
+
if (isset( $this->statsPageId ) && $screen == $this->statsPageId)
|
938 |
+
$columns [$this->statsPageId] = 3;
|
939 |
+
return $columns;
|
940 |
+
}
|
941 |
+
|
942 |
+
/**
|
943 |
+
* Add tracking code to admin header
|
944 |
+
*/
|
945 |
+
function addAdminHeaderTracking() {
|
946 |
+
$this->addJavascriptCode ();
|
947 |
+
}
|
948 |
+
|
949 |
+
/**
|
950 |
+
* Get option value
|
951 |
+
*
|
952 |
+
* @param string $key
|
953 |
+
* option key
|
954 |
+
* @return mixed option value
|
955 |
+
*/
|
956 |
+
public function getOption($key) {
|
957 |
+
return self::$settings->getOption ( $key );
|
958 |
+
}
|
959 |
+
|
960 |
+
/**
|
961 |
+
* Get global option value
|
962 |
+
*
|
963 |
+
* @param string $key
|
964 |
+
* global option key
|
965 |
+
* @return mixed global option value
|
966 |
+
*/
|
967 |
+
public function getGlobalOption($key) {
|
968 |
+
return self::$settings->getGlobalOption ( $key );
|
969 |
+
}
|
970 |
+
|
971 |
+
/**
|
972 |
+
* Get stats page URL
|
973 |
+
*
|
974 |
+
* @return string stats page URL
|
975 |
+
*/
|
976 |
+
public function getStatsURL() {
|
977 |
+
return admin_url () . '?page=wp-piwik_stats';
|
978 |
+
}
|
979 |
+
|
980 |
+
/**
|
981 |
+
* Execute WP-Piwik test script
|
982 |
+
*/
|
983 |
+
private function loadTestscript() {
|
984 |
+
$this->includeFile ( 'debug' . DIRECTORY_SEPARATOR . 'testscript' );
|
985 |
+
}
|
986 |
+
|
987 |
+
/**
|
988 |
+
* Echo an error message
|
989 |
+
*
|
990 |
+
* @param string $message
|
991 |
+
* message content
|
992 |
+
*/
|
993 |
+
private static function showErrorMessage($message) {
|
994 |
+
echo '<strong class="wp-piwik-error">' . __ ( 'An error occured', 'wp-piwik' ) . ':</strong> ' . $message . ' [<a href="' . (self::$settings->checkNetworkActivation () ? 'network/settings' : 'options-general') . '.php?page=wp-piwik/classes/WP_Piwik.php&tab=support">' . __ ( 'Support', 'wp-piwik' ) . '</a>]';
|
995 |
+
}
|
996 |
+
|
997 |
+
/**
|
998 |
+
* Perform a Piwik request
|
999 |
+
*
|
1000 |
+
* @param string $id
|
1001 |
+
* request ID
|
1002 |
+
* @return mixed request result
|
1003 |
+
*/
|
1004 |
+
public function request($id, $debug = false) {
|
1005 |
+
if ( self::$settings->getGlobalOption ( 'piwik_mode' ) == 'disabled' )
|
1006 |
+
return 'n/a';
|
1007 |
+
if (! isset ( self::$request ) || empty ( self::$request ))
|
1008 |
+
self::$request = (self::$settings->getGlobalOption ( 'piwik_mode' ) == 'http' || self::$settings->getGlobalOption ( 'piwik_mode' ) == 'cloud' || self::$settings->getGlobalOption ( 'piwik_mode' ) == 'cloud-matomo' ? new WP_Piwik\Request\Rest ( $this, self::$settings ) : new WP_Piwik\Request\Php ( $this, self::$settings ));
|
1009 |
+
if ($debug)
|
1010 |
+
return self::$request->getDebug ( $id );
|
1011 |
+
return self::$request->perform ( $id );
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
/**
|
1015 |
+
* Reset request object
|
1016 |
+
*/
|
1017 |
+
public function resetRequest() {
|
1018 |
+
if (is_object(self::$request))
|
1019 |
+
self::$request->reset();
|
1020 |
+
self::$request = NULL;
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
/**
|
1024 |
+
* Execute WP-Piwik shortcode
|
1025 |
+
*
|
1026 |
+
* @param array $attributes
|
1027 |
+
* attribute list
|
1028 |
+
*/
|
1029 |
+
public function shortcode($attributes) {
|
1030 |
+
shortcode_atts ( array (
|
1031 |
+
'title' => '',
|
1032 |
+
'module' => 'overview',
|
1033 |
+
'period' => 'day',
|
1034 |
+
'date' => 'yesterday',
|
1035 |
+
'limit' => 10,
|
1036 |
+
'width' => '100%',
|
1037 |
+
'height' => '200px',
|
1038 |
+
'idsite' => '',
|
1039 |
+
'language' => 'en',
|
1040 |
+
'range' => false,
|
1041 |
+
'key' => 'sum_daily_nb_uniq_visitors'
|
1042 |
+
), $attributes );
|
1043 |
+
$shortcodeObject = new \WP_Piwik\Shortcode ( $attributes, $this, self::$settings );
|
1044 |
+
return $shortcodeObject->get();
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
/**
|
1048 |
+
* Get Piwik site ID by blog ID
|
1049 |
+
*
|
1050 |
+
* @param int $blogId
|
1051 |
+
* which blog's Piwik site ID to get, default is the current blog
|
1052 |
+
* @return mixed Piwik site ID or n/a
|
1053 |
+
*/
|
1054 |
+
public function getPiwikSiteId($blogId = null) {
|
1055 |
+
if (! $blogId && $this->isNetworkMode ())
|
1056 |
+
$blogId = get_current_blog_id ();
|
1057 |
+
$result = self::$settings->getOption ( 'site_id', $blogId );
|
1058 |
+
self::$logger->log ( 'Database result: ' . $result );
|
1059 |
+
return (! empty ( $result ) ? $result : $this->requestPiwikSiteId ( $blogId ));
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
/**
|
1063 |
+
* Get a detailed list of all Piwik sites
|
1064 |
+
*
|
1065 |
+
* @return array Piwik sites
|
1066 |
+
*/
|
1067 |
+
public function getPiwikSiteDetails() {
|
1068 |
+
$id = WP_Piwik\Request::register ( 'SitesManager.getSitesWithAtLeastViewAccess', array () );
|
1069 |
+
$piwikSiteDetails = $this->request ( $id );
|
1070 |
+
return $piwikSiteDetails;
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
/**
|
1074 |
+
* Estimate a Piwik site ID by blog ID
|
1075 |
+
*
|
1076 |
+
* @param int $blogId
|
1077 |
+
* which blog's Piwik site ID to estimate, default is the current blog
|
1078 |
+
* @return mixed Piwik site ID or n/a
|
1079 |
+
*/
|
1080 |
+
private function requestPiwikSiteId($blogId = null) {
|
1081 |
+
$isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
|
1082 |
+
if (self::$settings->getGlobalOption ( 'auto_site_config' )) {
|
1083 |
+
$id = WP_Piwik\Request::register ( 'SitesManager.getSitesIdFromSiteUrl', array (
|
1084 |
+
'url' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl
|
1085 |
+
) );
|
1086 |
+
$result = $this->request ( $id );
|
1087 |
+
$this->log ( 'Tried to identify current site, result: ' . serialize ( $result ) );
|
1088 |
+
if (is_array( $result ) && empty( $result ))
|
1089 |
+
$result = $this->addPiwikSite ( $blogId );
|
1090 |
+
elseif ( $result != 'n/a' && isset($result [0]) )
|
1091 |
+
$result = $result [0] ['idsite'];
|
1092 |
+
else $result = null;
|
1093 |
+
} else $result = null;
|
1094 |
+
self::$logger->log ( 'Get Piwik ID: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl) . ' = Piwik ID ' . $result );
|
1095 |
+
if ($result !== null) {
|
1096 |
+
self::$settings->setOption ( 'site_id', $result, $blogId );
|
1097 |
+
if (self::$settings->getGlobalOption ( 'track_mode' ) != 'disabled' && self::$settings->getGlobalOption ( 'track_mode' ) != 'manually') {
|
1098 |
+
$code = $this->updateTrackingCode ( $result, $blogId );
|
1099 |
+
}
|
1100 |
+
$this::$settings->save ();
|
1101 |
+
return $result;
|
1102 |
+
}
|
1103 |
+
return 'n/a';
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
/**
|
1107 |
+
* Add a new Piwik
|
1108 |
+
*
|
1109 |
+
* @param int $blogId
|
1110 |
+
* which blog's Piwik site to create, default is the current blog
|
1111 |
+
* @return int Piwik site ID
|
1112 |
+
*/
|
1113 |
+
public function addPiwikSite($blogId = null) {
|
1114 |
+
$isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
|
1115 |
+
// Do not add site if Piwik connection is unreliable
|
1116 |
+
if (! $this->request ( 'global.getPiwikVersion' ))
|
1117 |
+
return null;
|
1118 |
+
$id = WP_Piwik\Request::register ( 'SitesManager.addSite', array (
|
1119 |
+
'urls' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl,
|
1120 |
+
'siteName' => urlencode( $isCurrent ? get_bloginfo ( 'name' ) : get_blog_details ( $blogId )->blogname )
|
1121 |
+
) );
|
1122 |
+
$result = (int) $this->request ( $id );
|
1123 |
+
self::$logger->log ( 'Create Piwik ID: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl) . ' = Piwik ID ' . $result );
|
1124 |
+
if (empty ( $result ))
|
1125 |
+
return null;
|
1126 |
+
else {
|
1127 |
+
do_action('wp-piwik_site_created', $result);
|
1128 |
+
return $result;
|
1129 |
+
}
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
/**
|
1133 |
+
* Update a Piwik site's detail information
|
1134 |
+
*
|
1135 |
+
* @param int $siteId
|
1136 |
+
* which Piwik site to updated
|
1137 |
+
* @param int $blogId
|
1138 |
+
* which blog's Piwik site ID to get, default is the current blog
|
1139 |
+
*/
|
1140 |
+
private function updatePiwikSite($siteId, $blogId = null) {
|
1141 |
+
$isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
|
1142 |
+
$id = WP_Piwik\Request::register ( 'SitesManager.updateSite', array (
|
1143 |
+
'idSite' => $siteId,
|
1144 |
+
'urls' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl,
|
1145 |
+
'siteName' => $isCurrent ? get_bloginfo ( 'name' ) : get_blog_details ( $blogId )->blogname
|
1146 |
+
) );
|
1147 |
+
$this->request ( $id );
|
1148 |
+
self::$logger->log ( 'Update Piwik site: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl) );
|
1149 |
+
}
|
1150 |
+
|
1151 |
+
/**
|
1152 |
+
* Update a site's tracking code
|
1153 |
+
*
|
1154 |
+
* @param int $siteId
|
1155 |
+
* which Piwik site to updated
|
1156 |
+
* @param int $blogId
|
1157 |
+
* which blog's Piwik site ID to get, default is the current blog
|
1158 |
+
* @return string tracking code
|
1159 |
+
*/
|
1160 |
+
public function updateTrackingCode($siteId = false, $blogId = null) {
|
1161 |
+
if (!$siteId)
|
1162 |
+
$siteId = $this->getPiwikSiteId ();
|
1163 |
+
if (self::$settings->getGlobalOption ( 'track_mode' ) == 'disabled' || self::$settings->getGlobalOption ( 'track_mode' ) == 'manually')
|
1164 |
+
return false;
|
1165 |
+
$id = WP_Piwik\Request::register ( 'SitesManager.getJavascriptTag', array (
|
1166 |
+
'idSite' => $siteId,
|
1167 |
+
'mergeSubdomains' => self::$settings->getGlobalOption ( 'track_across' ) ? 1 : 0,
|
1168 |
+
'mergeAliasUrls' => self::$settings->getGlobalOption ( 'track_across_alias' ) ? 1 : 0,
|
1169 |
+
'disableCookies' => self::$settings->getGlobalOption ( 'disable_cookies' ) ? 1 : 0,
|
1170 |
+
'crossDomain' => self::$settings->getGlobalOption ( 'track_crossdomain_linking' ) ? 1 : 0,
|
1171 |
+
'trackNoScript' => 1
|
1172 |
+
) );
|
1173 |
+
$code = $this->request ( $id );
|
1174 |
+
if (is_array($code) && isset($code['value']))
|
1175 |
+
$code = $code['value'];
|
1176 |
+
$result = !is_array ( $code ) ? html_entity_decode ( $code ) : '<!-- '.json_encode($code).' -->';
|
1177 |
+
self::$logger->log ( 'Delivered tracking code: ' . $result );
|
1178 |
+
$result = WP_Piwik\TrackingCode::prepareTrackingCode ( $result, self::$settings, self::$logger, true );
|
1179 |
+
if (isset ( $result ['script'] ) && ! empty ( $result ['script'] )) {
|
1180 |
+
self::$settings->setOption ( 'tracking_code', $result ['script'], $blogId );
|
1181 |
+
self::$settings->setOption ( 'noscript_code', $result ['noscript'], $blogId );
|
1182 |
+
self::$settings->setGlobalOption ( 'proxy_url', $result ['proxy'], $blogId );
|
1183 |
+
}
|
1184 |
+
return $result;
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
/**
|
1188 |
+
* Update Piwik site if blog name changes
|
1189 |
+
*
|
1190 |
+
* @param string $oldValue
|
1191 |
+
* old blog name
|
1192 |
+
* @param string $newValue
|
1193 |
+
* new blog name
|
1194 |
+
*/
|
1195 |
+
public function onBlogNameChange($oldValue, $newValue = null) {
|
1196 |
+
$this->updatePiwikSite ( self::$settings->getOption ( 'site_id' ) );
|
1197 |
+
}
|
1198 |
+
|
1199 |
+
/**
|
1200 |
+
* Update Piwik site if blog URL changes
|
1201 |
+
*
|
1202 |
+
* @param string $oldValue
|
1203 |
+
* old blog URL
|
1204 |
+
* @param string $newValue
|
1205 |
+
* new blog URL
|
1206 |
+
*/
|
1207 |
+
public function onSiteUrlChange($oldValue, $newValue = null) {
|
1208 |
+
$this->updatePiwikSite ( self::$settings->getOption ( 'site_id' ) );
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
/**
|
1212 |
+
* Register stats page meta boxes
|
1213 |
+
*
|
1214 |
+
* @param mixed $statsPageId
|
1215 |
+
* WordPress stats page ID
|
1216 |
+
*/
|
1217 |
+
public function onloadStatsPage($statsPageId) {
|
1218 |
+
if (self::$settings->getGlobalOption ( 'disable_timelimit' ))
|
1219 |
+
set_time_limit ( 0 );
|
1220 |
+
wp_enqueue_script ( 'common' );
|
1221 |
+
wp_enqueue_script ( 'wp-lists' );
|
1222 |
+
wp_enqueue_script ( 'postbox' );
|
1223 |
+
wp_enqueue_script ( 'wp-piwik', $this->getPluginURL () . 'js/wp-piwik.js', array (), self::$version, true );
|
1224 |
+
wp_enqueue_script ( 'wp-piwik-jqplot', $this->getPluginURL () . 'js/jqplot/wp-piwik.jqplot.js', array (
|
1225 |
+
'jquery'
|
1226 |
+
), self::$version );
|
1227 |
+
new \WP_Piwik\Widget\Chart ( $this, self::$settings, $this->statsPageId );
|
1228 |
+
new \WP_Piwik\Widget\Visitors ( $this, self::$settings, $this->statsPageId );
|
1229 |
+
new \WP_Piwik\Widget\Overview ( $this, self::$settings, $this->statsPageId );
|
1230 |
+
if (self::$settings->getGlobalOption ( 'stats_ecommerce' )) {
|
1231 |
+
new \WP_Piwik\Widget\Ecommerce ($this, self::$settings, $this->statsPageId);
|
1232 |
+
new \WP_Piwik\Widget\Items ($this, self::$settings, $this->statsPageId);
|
1233 |
+
new \WP_Piwik\Widget\ItemsCategory ($this, self::$settings, $this->statsPageId);
|
1234 |
+
}
|
1235 |
+
if (self::$settings->getGlobalOption ( 'stats_seo' ))
|
1236 |
+
new \WP_Piwik\Widget\Seo ( $this, self::$settings, $this->statsPageId );
|
1237 |
+
new \WP_Piwik\Widget\Pages ( $this, self::$settings, $this->statsPageId );
|
1238 |
+
new \WP_Piwik\Widget\Keywords ( $this, self::$settings, $this->statsPageId );
|
1239 |
+
new \WP_Piwik\Widget\Referrers ( $this, self::$settings, $this->statsPageId );
|
1240 |
+
new \WP_Piwik\Widget\Plugins ( $this, self::$settings, $this->statsPageId );
|
1241 |
+
new \WP_Piwik\Widget\Search ( $this, self::$settings, $this->statsPageId );
|
1242 |
+
new \WP_Piwik\Widget\Noresult ( $this, self::$settings, $this->statsPageId );
|
1243 |
+
new \WP_Piwik\Widget\Browsers ( $this, self::$settings, $this->statsPageId );
|
1244 |
+
new \WP_Piwik\Widget\BrowserDetails ( $this, self::$settings, $this->statsPageId );
|
1245 |
+
new \WP_Piwik\Widget\Screens ( $this, self::$settings, $this->statsPageId );
|
1246 |
+
new \WP_Piwik\Widget\Types ( $this, self::$settings, $this->statsPageId );
|
1247 |
+
new \WP_Piwik\Widget\Models ( $this, self::$settings, $this->statsPageId );
|
1248 |
+
new \WP_Piwik\Widget\Systems ( $this, self::$settings, $this->statsPageId );
|
1249 |
+
new \WP_Piwik\Widget\SystemDetails ( $this, self::$settings, $this->statsPageId );
|
1250 |
+
new \WP_Piwik\Widget\City ( $this, self::$settings, $this->statsPageId );
|
1251 |
+
new \WP_Piwik\Widget\Country ( $this, self::$settings, $this->statsPageId );
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
/**
|
1255 |
+
* Add per post statistics to a post's page
|
1256 |
+
*
|
1257 |
+
* @param mixed $postPageId
|
1258 |
+
* WordPress post page ID
|
1259 |
+
*/
|
1260 |
+
public function onloadPostPage($postPageId) {
|
1261 |
+
global $post;
|
1262 |
+
$postUrl = get_permalink ( $post->ID );
|
1263 |
+
$this->log ( 'Load per post statistics: ' . $postUrl );
|
1264 |
+
array (
|
1265 |
+
new \WP_Piwik\Widget\Post ( $this, self::$settings, array('post', 'page', 'custom_post_type'), 'side', 'default', array (
|
1266 |
+
'url' => $postUrl
|
1267 |
+
) ),
|
1268 |
+
'show'
|
1269 |
+
);
|
1270 |
+
}
|
1271 |
+
|
1272 |
+
/**
|
1273 |
+
* Stats page changes by POST submit
|
1274 |
+
*
|
1275 |
+
* @see http://tinyurl.com/5r5vnzs
|
1276 |
+
*/
|
1277 |
+
function onStatsPageSaveChanges() {
|
1278 |
+
if (! current_user_can ( 'manage_options' ))
|
1279 |
+
wp_die ( __ ( 'Cheatin’ uh?' ) );
|
1280 |
+
check_admin_referer ( 'wp-piwik_stats' );
|
1281 |
+
wp_redirect ( $_POST ['_wp_http_referer'] );
|
1282 |
+
}
|
1283 |
+
|
1284 |
+
/**
|
1285 |
+
* Get option value, choose method depending on network mode
|
1286 |
+
*
|
1287 |
+
* @param string $option option key
|
1288 |
+
* @return string option value
|
1289 |
+
*/
|
1290 |
+
private function getWordPressOption($option, $default = null) {
|
1291 |
+
return ($this->isNetworkMode () ? get_site_option ( $option, $default ) : get_option ( $option, $default ));
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
/**
|
1295 |
+
* Delete option, choose method depending on network mode
|
1296 |
+
*
|
1297 |
+
* @param string $option option key
|
1298 |
+
*/
|
1299 |
+
private function deleteWordPressOption($option) {
|
1300 |
+
if ( $this->isNetworkMode () )
|
1301 |
+
delete_site_option ( $option );
|
1302 |
+
else
|
1303 |
+
delete_option ( $option );
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
/**
|
1307 |
+
* Set option value, choose method depending on network mode
|
1308 |
+
*
|
1309 |
+
* @param string $option option key
|
1310 |
+
* @param mixed $value option value
|
1311 |
+
*/
|
1312 |
+
private function updateWordPressOption($option, $value) {
|
1313 |
+
if ( $this->isNetworkMode () )
|
1314 |
+
update_site_option ( $option, $value );
|
1315 |
+
else
|
1316 |
+
update_option ( $option, $value );
|
1317 |
+
}
|
1318 |
+
|
1319 |
+
/**
|
1320 |
+
* Check if WP-Piwik options page
|
1321 |
+
*
|
1322 |
+
* @return boolean True if current page is WP-Piwik's option page
|
1323 |
+
*/
|
1324 |
+
public static function isValidOptionsPost() {
|
1325 |
+
return is_admin() && check_admin_referer( 'wp-piwik_settings' ) && current_user_can( 'manage_options' ) ;
|
1326 |
+
}
|
1327 |
+
}
|
classes/WP_Piwik/Admin.php
CHANGED
File without changes
|
classes/WP_Piwik/Admin/Network.php
CHANGED
File without changes
|
classes/WP_Piwik/Admin/Settings.php
CHANGED
@@ -1,718 +1,720 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WP_Piwik\Admin;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* WordPress Admin settings page
|
7 |
-
*
|
8 |
-
* @package WP_Piwik\Admin
|
9 |
-
* @author André Bräkling <webmaster@braekling.de>
|
10 |
-
*/
|
11 |
-
class Settings extends \WP_Piwik\Admin {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Builds and displays the settings page
|
15 |
-
*/
|
16 |
-
public function show() {
|
17 |
-
if (isset($_GET['sitebrowser']) && $_GET['sitebrowser']) {
|
18 |
-
new \WP_Piwik\Admin\Sitebrowser(self::$wpPiwik);
|
19 |
-
return;
|
20 |
-
}
|
21 |
-
if (isset($_GET['clear']) && $_GET['clear']) {
|
22 |
-
$this->clear($_GET['clear'] == 2);
|
23 |
-
self::$wpPiwik->resetRequest();
|
24 |
-
echo '<form method="post" action="?page='.htmlentities($_GET['page']).'"><input type="submit" value="'.__('Reload', 'wp-piwik').'" /></form>';
|
25 |
-
return;
|
26 |
-
} elseif (self::$wpPiwik->isConfigSubmitted()) {
|
27 |
-
$this->showBox ( 'updated', 'yes', __ ( 'Changes saved.' ) );
|
28 |
-
self::$wpPiwik->resetRequest();
|
29 |
-
self::$wpPiwik->updateTrackingCode();
|
30 |
-
}
|
31 |
-
global $wp_roles;
|
32 |
-
?>
|
33 |
-
<div id="plugin-options-wrap" class="widefat">
|
34 |
-
<?php
|
35 |
-
echo $this->getHeadline ( 1, 'admin-generic', 'Settings', true );
|
36 |
-
if (isset($_GET['testscript']) && $_GET['testscript'])
|
37 |
-
$this->runTestscript();
|
38 |
-
?>
|
39 |
-
<?php
|
40 |
-
if (self::$wpPiwik->isConfigured ()) {
|
41 |
-
$piwikVersion = self::$wpPiwik->request ( 'global.getPiwikVersion' );
|
42 |
-
if (is_array ( $piwikVersion ) && isset( $piwikVersion['value'] ))
|
43 |
-
$piwikVersion = $piwikVersion['value'];
|
44 |
-
if (! empty ( $piwikVersion ) && !is_array( $piwikVersion ))
|
45 |
-
$this->showDonation();
|
46 |
-
}
|
47 |
-
?>
|
48 |
-
<form method="post" action="?page=<?php echo htmlentities($_GET['page']); ?>">
|
49 |
-
<input type="hidden" name="wp-piwik[revision]" value="<?php echo self::$settings->getGlobalOption('revision'); ?>" />
|
50 |
-
<?php wp_nonce_field('wp-piwik_settings'); ?>
|
51 |
-
<table class="wp-piwik-form">
|
52 |
-
<tbody>
|
53 |
-
<?php
|
54 |
-
$submitButton = '<tr><td colspan="2"><p class="submit"><input name="Submit" type="submit" class="button-primary" value="' . esc_attr__ ( 'Save Changes' ) . '" /></p></td></tr>';
|
55 |
-
printf ( '<tr><td colspan="2">%s</td></tr>', __ ( 'Thanks for using WP-Matomo!', 'wp-piwik' ) );
|
56 |
-
if (self::$wpPiwik->isConfigured ()) {
|
57 |
-
if (! empty ( $piwikVersion ) && !is_array( $piwikVersion )) {
|
58 |
-
$this->showText ( sprintf ( __ ( 'WP-Matomo %s is successfully connected to Matomo %s.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion (), $piwikVersion ) . ' ' . (! self::$wpPiwik->isNetworkMode () ? sprintf ( __ ( 'You are running WordPress %s.', 'wp-piwik' ), get_bloginfo ( 'version' ) ) : sprintf ( __ ( 'You are running a WordPress %s blog network (WPMU). WP-Matomo will handle your sites as different websites.', 'wp-piwik' ), get_bloginfo ( 'version' ) )) );
|
59 |
-
} else {
|
60 |
-
$errorMessage = \WP_Piwik\Request::getLastError();
|
61 |
-
if ( empty( $errorMessage ) )
|
62 |
-
$this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Matomo %s was not able to connect to Matomo using your configuration. Check the »Connect to Matomo« section below.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion () ) );
|
63 |
-
else
|
64 |
-
$this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Matomo %s was not able to connect to Matomo using your configuration. During connection the following error occured: <br /><code>%s</code>', 'wp-piwik' ), self::$wpPiwik->getPluginVersion (), $errorMessage ) );
|
65 |
-
}
|
66 |
-
} else
|
67 |
-
$this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Matomo %s has to be connected to Matomo first. Check the »Connect to Matomo« section below.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion () ) );
|
68 |
-
|
69 |
-
$tabs ['connect'] = array (
|
70 |
-
'icon' => 'admin-plugins',
|
71 |
-
'name' => __('Connect to Matomo', 'wp-piwik')
|
72 |
-
);
|
73 |
-
if (self::$wpPiwik->isConfigured ()) {
|
74 |
-
$tabs ['statistics'] = array (
|
75 |
-
'icon' => 'chart-pie',
|
76 |
-
'name' => __('Show Statistics', 'wp-piwik')
|
77 |
-
);
|
78 |
-
$tabs ['tracking'] = array (
|
79 |
-
'icon' => 'location-alt',
|
80 |
-
'name' => __('Enable Tracking', 'wp-piwik')
|
81 |
-
);
|
82 |
-
}
|
83 |
-
$tabs ['expert'] = array (
|
84 |
-
'icon' => 'shield',
|
85 |
-
'name' => __('Expert Settings', 'wp-piwik')
|
86 |
-
);
|
87 |
-
$tabs ['support'] = array (
|
88 |
-
'icon' => 'lightbulb',
|
89 |
-
'name' => __('Support', 'wp-piwik')
|
90 |
-
);
|
91 |
-
$tabs ['credits'] = array (
|
92 |
-
'icon' => 'groups',
|
93 |
-
'name' => __('Credits', 'wp-piwik')
|
94 |
-
);
|
95 |
-
|
96 |
-
echo '<tr><td colspan="2"><h2 class="nav-tab-wrapper">';
|
97 |
-
foreach ( $tabs as $tab => $details ) {
|
98 |
-
$class = ($tab == 'connect') ? ' nav-tab-active' : '';
|
99 |
-
echo '<a style="cursor:pointer;" id="tab-' . $tab . '" class="nav-tab' . $class . '" onclick="javascript:$j(\'table.wp-piwik_menu-tab\').addClass(\'hidden\');$j(\'#' . $tab . '\').removeClass(\'hidden\');$j(\'a.nav-tab\').removeClass(\'nav-tab-active\');$j(\'#tab-' . $tab . '\').addClass(\'nav-tab-active\');">';
|
100 |
-
$this->showHeadline ( 0, $details ['icon'], $details ['name'] );
|
101 |
-
echo "</a>";
|
102 |
-
}
|
103 |
-
echo '</h2></td></tr></tbody></table><table id="connect" class="wp-piwik_menu-tab"><tbody>';
|
104 |
-
|
105 |
-
if (! self::$wpPiwik->isConfigured ())
|
106 |
-
$this->showBox ( 'updated', 'info', sprintf ( '%s <a href="%s">%s</a> %s <a href="%s">%s</a>.', __ ( 'WP-Matomo is a WordPress plugin to show a selection of Matomo stats in your WordPress admin dashboard and to add and configure your Matomo tracking code. To use this you will need your own Matomo instance. If you do not already have a Matomo setup, you have two simple options: use either', 'wp-piwik' ), 'http://piwik.org/', __ ( 'a self-hosted Matomo', 'wp-piwik' ), __ ( 'or', 'wp-piwik' ), 'https://www.innocraft.cloud/?pk_campaign=WP-Matomo', __ ( 'a cloud-hosted Matomo by InnoCraft', 'wp-piwik' ) ) );
|
107 |
-
|
108 |
-
if (! function_exists ( 'curl_init' ) && ! ini_get ( 'allow_url_fopen' ))
|
109 |
-
$this->showBox ( 'error', 'no', __ ( 'Neither cURL nor fopen are available. So WP-Matomo can not use the HTTP API and not connect to InnoCraft Cloud.' ) . ' ' . sprintf ( '<a href="%s">%s.</a>', 'https://wordpress.org/plugins/wp-piwik/faq/', __ ( 'More information', 'wp-piwik' ) ) );
|
110 |
-
|
111 |
-
$description = sprintf ( '%s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s', __ ( 'You can choose between three connection methods:', 'wp-piwik' ), __ ( 'Self-hosted (HTTP API, default)', 'wp-piwik' ), __ ( 'This is the default option for a self-hosted Matomo and should work for most configurations. WP-Matomo will connect to Matomo using http(s).', 'wp-piwik' ), __ ( 'Self-hosted (PHP API)', 'wp-piwik' ), __ ( 'Choose this, if your self-hosted Matomo and WordPress are running on the same machine and you know the full server path to your Matomo instance.', 'wp-piwik' ), __ ( 'Cloud-hosted', 'wp-piwik' ), __ ( 'If you are using a cloud-hosted Matomo by InnoCraft, you can simply use this option. Be carefull to choose the option which fits to your cloud domain (matomo.cloud or innocraft.cloud).', 'wp-piwik' ) );
|
112 |
-
$this->showSelect ( 'piwik_mode', __ ( 'Matomo Mode', 'wp-piwik' ), array (
|
113 |
-
'disabled' => __ ( 'Disabled (WP-Matomo will not connect to Matomo)', 'wp-piwik' ),
|
114 |
-
'http' => __ ( 'Self-hosted (HTTP API, default)', 'wp-piwik' ),
|
115 |
-
'php' => __ ( 'Self-hosted (PHP API)', 'wp-piwik' ),
|
116 |
-
'cloud-matomo' => __('Cloud-hosted (Innocraft Cloud, *.matomo.cloud)', 'wp-piwik'),
|
117 |
-
'cloud' => __ ( 'Cloud-hosted (InnoCraft Cloud, *.innocraft.cloud)', 'wp-piwik' )
|
118 |
-
), $description, '$j(\'tr.wp-piwik-mode-option\').addClass(\'hidden\'); $j(\'#wp-piwik-mode-option-\' + $j(\'#piwik_mode\').val()).removeClass(\'hidden\');', false, '', self::$wpPiwik->isConfigured () );
|
119 |
-
|
120 |
-
$this->showInput ( 'piwik_url', __ ( 'Matomo URL', 'wp-piwik' ), __( 'Enter your Matomo URL. This is the same URL you use to access your Matomo instance, e.g. http://www.example.com/matomo/.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'http', 'wp-piwik-mode-option', 'http', self::$wpPiwik->isConfigured (), true );
|
121 |
-
$this->showInput ( 'piwik_path', __ ( 'Matomo path', 'wp-piwik' ), __( 'Enter the file path to your Matomo instance, e.g. /var/www/matomo/.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'php', 'wp-piwik-mode-option', 'php', self::$wpPiwik->isConfigured (), true );
|
122 |
-
$this->showInput ( 'piwik_user', __ ( 'Innocraft subdomain', 'wp-piwik' ), __( 'Enter your InnoCraft Cloud subdomain. It is also part of your URL: https://SUBDOMAIN.innocraft.cloud.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'cloud', 'wp-piwik-mode-option', 'cloud', self::$wpPiwik->isConfigured () );
|
123 |
-
$this->showInput ( 'matomo_user', __ ( 'Matomo subdomain', 'wp-piwik' ), __( 'Enter your Matomo Cloud subdomain. It is also part of your URL: https://SUBDOMAIN.matomo.cloud.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'cloud-matomo', 'wp-piwik-mode-option', 'cloud-matomo', self::$wpPiwik->isConfigured () );
|
124 |
-
$this->showInput ( 'piwik_token', __ ( 'Auth token', 'wp-piwik' ), __( 'Enter your Matomo auth token here. It is an alphanumerical code like 0a1b2c34d56e78901fa2bc3d45678efa.', 'wp-piwik' ).' '.sprintf ( __ ( 'See %sWP-Matomo FAQ%s.', 'wp-piwik' ), '<a href="https://wordpress.org/plugins/wp-piwik/faq/" target="_BLANK">', '</a>' ), false, '', '', self::$wpPiwik->isConfigured (), true );
|
125 |
-
|
126 |
-
// Site configuration
|
127 |
-
$piwikSiteId = self::$wpPiwik->isConfigured () ? self::$wpPiwik->getPiwikSiteId () : false;
|
128 |
-
if (! self::$wpPiwik->isNetworkMode() ) {
|
129 |
-
$this->showCheckbox ( 'auto_site_config', __ ( 'Auto config', 'wp-piwik' ), __ ( 'Check this to automatically choose your blog from your Matomo sites by URL. If your blog is not added to Matomo yet, WP-Matomo will add a new site.', 'wp-piwik' ), false, '$j(\'tr.wp-piwik-auto-option\').toggle(\'hidden\');' . ($piwikSiteId ? '$j(\'#site_id\').val(' . $piwikSiteId . ');' : '') );
|
130 |
-
if (self::$wpPiwik->isConfigured ()) {
|
131 |
-
$piwikSiteList = self::$wpPiwik->getPiwikSiteDetails ();
|
132 |
-
if (isset($piwikSiteList['result']) && $piwikSiteList['result'] == 'error') {
|
133 |
-
$this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Matomo %s was not able to get sites with at least view access: <br /><code>%s</code>', 'wp-piwik' ), self::$wpPiwik->getPluginVersion (), $errorMessage ) );
|
134 |
-
} else {
|
135 |
-
if (is_array($piwikSiteList))
|
136 |
-
foreach ($piwikSiteList as $details)
|
137 |
-
$piwikSiteDetails[$details['idsite']] = $details;
|
138 |
-
unset($piwikSiteList);
|
139 |
-
if ($piwikSiteId != 'n/a' && isset($piwikSiteDetails) && is_array($piwikSiteDetails))
|
140 |
-
$piwikSiteDescription = $piwikSiteDetails [$piwikSiteId] ['name'] . ' (' . $piwikSiteDetails [$piwikSiteId] ['main_url'] . ')';
|
141 |
-
else
|
142 |
-
$piwikSiteDescription = 'n/a';
|
143 |
-
echo '<tr class="wp-piwik-auto-option' . (!self::$settings->getGlobalOption('auto_site_config') ? ' hidden' : '') . '"><th scope="row">' . __('Determined site', 'wp-piwik') . ':</th><td>' . $piwikSiteDescription . '</td></tr>';
|
144 |
-
if (isset ($piwikSiteDetails) && is_array($piwikSiteDetails))
|
145 |
-
foreach ($piwikSiteDetails as $key => $siteData)
|
146 |
-
$siteList [$siteData['idsite']] = $siteData ['name'] . ' (' . $siteData ['main_url'] . ')';
|
147 |
-
if (isset($siteList))
|
148 |
-
$this->showSelect('site_id', __('Select site', 'wp-piwik'), $siteList, 'Choose the Matomo site corresponding to this blog.', '', self::$settings->getGlobalOption('auto_site_config'), 'wp-piwik-auto-option', true, false);
|
149 |
-
}
|
150 |
-
}
|
151 |
-
} else echo '<tr class="hidden"><td colspan="2"><input type="hidden" name="wp-piwik[auto_site_config]" value="1" /></td></tr>';
|
152 |
-
|
153 |
-
echo $submitButton;
|
154 |
-
|
155 |
-
echo '</tbody></table><table id="statistics" class="wp-piwik_menu-tab hidden"><tbody>';
|
156 |
-
// Stats configuration
|
157 |
-
$this->showSelect ( 'default_date', __ ( 'Matomo default date', 'wp-piwik' ), array (
|
158 |
-
'today' => __ ( 'Today', 'wp-piwik' ),
|
159 |
-
'yesterday' => __ ( 'Yesterday', 'wp-piwik' ),
|
160 |
-
'current_month' => __ ( 'Current month', 'wp-piwik' ),
|
161 |
-
'last_month' => __ ( 'Last month', 'wp-piwik' ),
|
162 |
-
'current_week' => __ ( 'Current week', 'wp-piwik' ),
|
163 |
-
'last_week' => __ ( 'Last week', 'wp-piwik' )
|
164 |
-
), __ ( 'Default date shown on statistics page.', 'wp-piwik' ) );
|
165 |
-
|
166 |
-
$this->showCheckbox ( 'stats_seo', __ ( 'Show SEO data', 'wp-piwik' ), __ ( 'Display SEO ranking data on statistics page.', 'wp-piwik' ) . ' (' . __ ( 'Slow!', 'wp-piwik' ) . ')' );
|
167 |
-
$this->showCheckbox ( 'stats_ecommerce', __ ( 'Show e-commerce data', 'wp-piwik' ), __ ( 'Display e-commerce data on statistics page.', 'wp-piwik' ) );
|
168 |
-
|
169 |
-
$this->showSelect ( 'dashboard_widget', __ ( 'Dashboard overview', 'wp-piwik' ), array (
|
170 |
-
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
|
171 |
-
'yesterday' => __ ( 'Yesterday', 'wp-piwik' ),
|
172 |
-
'today' => __ ( 'Today', 'wp-piwik' ),
|
173 |
-
'last30' => __ ( 'Last 30 days', 'wp-piwik' )
|
174 |
-
), __ ( 'Enable WP-Matomo dashboard widget "Overview".', 'wp-piwik' ) );
|
175 |
-
|
176 |
-
$this->showCheckbox ( 'dashboard_chart', __ ( 'Dashboard graph', 'wp-piwik' ), __ ( 'Enable WP-Matomo dashboard widget "Graph".', 'wp-piwik' ) );
|
177 |
-
|
178 |
-
$this->showCheckbox ( 'dashboard_seo', __ ( 'Dashboard SEO', 'wp-piwik' ), __ ( 'Enable WP-Matomo dashboard widget "SEO".', 'wp-piwik' ) . ' (' . __ ( 'Slow!', 'wp-piwik' ) . ')' );
|
179 |
-
|
180 |
-
$this->showCheckbox ( 'dashboard_ecommerce', __ ( 'Dashboard e-commerce', 'wp-piwik' ), __ ( 'Enable WP-Matomo dashboard widget "E-commerce".', 'wp-piwik' ) );
|
181 |
-
|
182 |
-
$this->showCheckbox ( 'toolbar', __ ( 'Show graph on WordPress Toolbar', 'wp-piwik' ), __ ( 'Display a last 30 days visitor graph on WordPress\' toolbar.', 'wp-piwik' ) );
|
183 |
-
|
184 |
-
echo '<tr><th scope="row"><label for="capability_read_stats">' . __ ( 'Display stats to', 'wp-piwik' ) . '</label>:</th><td>';
|
185 |
-
$filter = self::$settings->getGlobalOption ( 'capability_read_stats' );
|
186 |
-
foreach ( $wp_roles->role_names as $key => $name ) {
|
187 |
-
echo '<input type="checkbox" ' . (isset ( $filter [$key] ) && $filter [$key] ? 'checked="checked" ' : '') . 'value="1" onchange="$j(\'#capability_read_stats-' . $key . '-input\').val(this.checked?1:0);" />';
|
188 |
-
echo '<input id="capability_read_stats-' . $key . '-input" type="hidden" name="wp-piwik[capability_read_stats][' . $key . ']" value="' . ( int ) (isset ( $filter [$key] ) && $filter [$key]) . '" />';
|
189 |
-
echo $name . ' ';
|
190 |
-
}
|
191 |
-
echo '<span class="dashicons dashicons-editor-help" onclick="$j(\'#capability_read_stats-desc\').toggleClass(\'hidden\');"></span> <p class="description hidden" id="capability_read_stats-desc">' . __ ( 'Choose user roles allowed to see the statistics page.', 'wp-piwik' ) . '</p></td></tr>';
|
192 |
-
|
193 |
-
$this->showCheckbox ( 'perpost_stats', __ ( 'Show per post stats', 'wp-piwik' ), __ ( 'Show stats about single posts at the post edit admin page.', 'wp-piwik' ) );
|
194 |
-
|
195 |
-
$this->showCheckbox ( 'piwik_shortcut', __ ( 'Matomo shortcut', 'wp-piwik' ), __ ( 'Display a shortcut to Matomo itself.', 'wp-piwik' ) );
|
196 |
-
|
197 |
-
$this->showInput ( 'plugin_display_name', __ ( 'WP-Matomo display name', 'wp-piwik' ), __ ( 'Plugin name shown in WordPress.', 'wp-piwik' ) );
|
198 |
-
|
199 |
-
$this->showCheckbox ( 'shortcodes', __ ( 'Enable shortcodes', 'wp-piwik' ), __ ( 'Enable shortcodes in post or page content.', 'wp-piwik' ) );
|
200 |
-
|
201 |
-
echo $submitButton;
|
202 |
-
|
203 |
-
echo '</tbody></table><table id="tracking" class="wp-piwik_menu-tab hidden"><tbody>';
|
204 |
-
|
205 |
-
// Tracking Configuration
|
206 |
-
$isNotTracking = self::$settings->getGlobalOption ( 'track_mode' ) == 'disabled';
|
207 |
-
$isNotGeneratedTracking = $isNotTracking || self::$settings->getGlobalOption ( 'track_mode' ) == 'manually';
|
208 |
-
$fullGeneratedTrackingGroup = 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy';
|
209 |
-
|
210 |
-
$description = sprintf ( '%s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s', __ ( 'You can choose between four tracking code modes:', 'wp-piwik' ), __ ( 'Disabled', 'wp-piwik' ), __ ( 'WP-Matomo will not add the tracking code. Use this, if you want to add the tracking code to your template files or you use another plugin to add the tracking code.', 'wp-piwik' ), __ ( 'Default tracking', 'wp-piwik' ), __ ( 'WP-Matomo will use Matomo\'s standard tracking code.', 'wp-piwik' ), __ ( 'Use js/index.php', 'wp-piwik' ), __ ( 'You can choose this tracking code, to deliver a minified proxy code and to avoid using the files called piwik.js or piwik.php.', 'wp-piwik' ).' '.sprintf( __( 'See %sreadme file%s.', 'wp-piwik' ), '<a href="http://demo.piwik.org/js/README" target="_BLANK">', '</a>'), __ ( 'Use proxy script', 'wp-piwik' ), __ ( 'Use this tracking code to not reveal the Matomo server URL.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/#faq_132" target="_BLANK">', '</a>' ) , __ ( 'Enter manually', 'wp-piwik' ), __ ( 'Enter your own tracking code manually. You can choose one of the prior options, pre-configure your tracking code and switch to manually editing at last.', 'wp-piwik' ).( self::$wpPiwik->isNetworkMode() ? ' '.__ ( 'Use the placeholder {ID} to add the Matomo site ID.', 'wp-piwik' ) : '' ) );
|
211 |
-
$this->showSelect ( 'track_mode', __ ( 'Add tracking code', 'wp-piwik' ), array (
|
212 |
-
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
|
213 |
-
'default' => __ ( 'Default tracking', 'wp-piwik' ),
|
214 |
-
'js' => __ ( 'Use js/index.php', 'wp-piwik' ),
|
215 |
-
'proxy' => __ ( 'Use proxy script', 'wp-piwik' ),
|
216 |
-
'manually' => __ ( 'Enter manually', 'wp-piwik' )
|
217 |
-
), $description, '$j(\'tr.wp-piwik-track-option\').addClass(\'hidden\'); $j(\'tr.wp-piwik-track-option-\' + $j(\'#track_mode\').val()).removeClass(\'hidden\'); $j(\'#tracking_code, #noscript_code\').prop(\'readonly\', $j(\'#track_mode\').val() != \'manually\');' );
|
218 |
-
|
219 |
-
$this->showTextarea ( 'tracking_code', __ ( 'Tracking code', 'wp-piwik' ), 15, 'This is a preview of your current tracking code. If you choose to enter your tracking code manually, you can change it here.', $isNotTracking, 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy wp-piwik-track-option-manually', true, '', (self::$settings->getGlobalOption ( 'track_mode' ) != 'manually'), false );
|
220 |
-
|
221 |
-
$this->showSelect ( 'track_codeposition', __ ( 'JavaScript code position', 'wp-piwik' ), array (
|
222 |
-
'footer' => __ ( 'Footer', 'wp-piwik' ),
|
223 |
-
'header' => __ ( 'Header', 'wp-piwik' )
|
224 |
-
), __ ( 'Choose whether the JavaScript code is added to the footer or the header.', 'wp-piwik' ), '', $isNotTracking, 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy wp-piwik-track-option-manually' );
|
225 |
-
|
226 |
-
$this->showTextarea ( 'noscript_code', __ ( 'Noscript code', 'wp-piwik' ), 2, 'This is a preview of your <noscript> code which is part of your tracking code.', self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-manually', true, '', (self::$settings->getGlobalOption ( 'track_mode' ) != 'manually'), false );
|
227 |
-
|
228 |
-
$this->showCheckbox ( 'track_noscript', __ ( 'Add <noscript>', 'wp-piwik' ), __ ( 'Adds the <noscript> code to your footer.', 'wp-piwik' ) . ' ' . __ ( 'Disabled in proxy mode.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-manually' );
|
229 |
-
|
230 |
-
$this->showCheckbox ( 'track_nojavascript', __ ( 'Add rec parameter to noscript code', 'wp-piwik' ), __ ( 'Enable tracking for visitors without JavaScript (not recommended).', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/#faq_176" target="_BLANK">', '</a>' ) . ' ' . __ ( 'Disabled in proxy mode.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-manually' );
|
231 |
-
|
232 |
-
$this->showSelect ( 'track_content', __ ( 'Enable content tracking', 'wp-piwik' ), array (
|
233 |
-
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
|
234 |
-
'all' => __ ( 'Track all content blocks', 'wp-piwik' ),
|
235 |
-
'visible' => __ ( 'Track only visible content blocks', 'wp-piwik' )
|
236 |
-
), __ ( 'Content tracking allows you to track interaction with the content of a web page or application.' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/content-tracking" target="_BLANK">', '</a>' ), '', $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
237 |
-
|
238 |
-
$this->showCheckbox ( 'track_search', __ ( 'Track search', 'wp-piwik' ), __ ( 'Use Matomo\'s advanced Site Search Analytics feature.' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/site-search/#track-site-search-using-the-tracking-api-advanced-users-only" target="_BLANK">', '</a>' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
239 |
-
|
240 |
-
$this->showCheckbox ( 'track_404', __ ( 'Track 404', 'wp-piwik' ), __ ( 'WP-Matomo can automatically add a 404-category to track 404-page-visits.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/faq_60/" target="_BLANK">', '</a>' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
241 |
-
|
242 |
-
echo '<tr class="' . $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' . ($isNotTracking ? ' hidden' : '') . '">';
|
243 |
-
echo '<th scope="row"><label for="add_post_annotations">' . __ ( 'Add annotation on new post of type', 'wp-piwik' ) . '</label>:</th><td>';
|
244 |
-
$filter = self::$settings->getGlobalOption ( 'add_post_annotations' );
|
245 |
-
foreach ( get_post_types(array(), 'objects') as $post_type )
|
246 |
-
echo '<input type="checkbox" ' . (isset ( $filter [$post_type->name] ) && $filter [$post_type->name] ? 'checked="checked" ' : '') . 'value="1" name="wp-piwik[add_post_annotations][' . $post_type->name . ']" /> ' . $post_type->label . ' ';
|
247 |
-
echo '<span class="dashicons dashicons-editor-help" onclick="$j(\'#add_post_annotations-desc\').toggleClass(\'hidden\');"></span> <p class="description hidden" id="add_post_annotations-desc">' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/annotations/" target="_BLANK">', '</a>' ) . '</p></td></tr>';
|
248 |
-
|
249 |
-
$this->showCheckbox ( 'add_customvars_box', __ ( 'Show custom variables box', 'wp-piwik' ), __ ( ' Show a "custom variables" edit box on post edit page.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/custom-variables/" target="_BLANK">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
250 |
-
|
251 |
-
$this->showInput ( 'add_download_extensions', __ ( 'Add new file types for download tracking', 'wp-piwik' ), __ ( 'Add file extensions for download tracking, divided by a vertical bar (|).', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#file-extensions-for-tracking-downloads" target="_BLANK">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
252 |
-
|
253 |
-
$this->showCheckbox ( 'disable_cookies', __ ( 'Disable cookies', 'wp-piwik' ), __ ( 'Disable all tracking cookies for a visitor.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
254 |
-
|
255 |
-
$this->showCheckbox ( 'limit_cookies', __ ( 'Limit cookie lifetime', 'wp-piwik' ), __ ( 'You can limit the cookie lifetime to avoid tracking your users over a longer period as necessary.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup, true, '$j(\'tr.wp-piwik-cookielifetime-option\').toggleClass(\'wp-piwik-hidden\');' );
|
256 |
-
|
257 |
-
$this->showInput ( 'limit_cookies_visitor', __ ( 'Visitor timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup.' wp-piwik-cookielifetime-option'. (self::$settings->getGlobalOption ( 'limit_cookies' )? '': ' wp-piwik-hidden') );
|
258 |
-
|
259 |
-
$this->showInput ( 'limit_cookies_session', __ ( 'Session timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup .' wp-piwik-cookielifetime-option'. (self::$settings->getGlobalOption ( 'limit_cookies' )? '': ' wp-piwik-hidden') );
|
260 |
-
|
261 |
-
$this->showInput ( 'limit_cookies_referral', __ ( 'Referral timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup .' wp-piwik-cookielifetime-option'. (self::$settings->getGlobalOption ( 'limit_cookies' )? '': ' wp-piwik-hidden') );
|
262 |
-
|
263 |
-
$this->showCheckbox ( 'track_admin', __ ( 'Track admin pages', 'wp-piwik' ), __ ( 'Enable to track users on admin pages (remember to configure the tracking filter appropriately).', 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
264 |
-
|
265 |
-
echo '<tr class="' . $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' . ($isNotTracking ? ' hidden' : '') . '">';
|
266 |
-
echo '<th scope="row"><label for="capability_stealth">' . __ ( 'Tracking filter', 'wp-piwik' ) . '</label>:</th><td>';
|
267 |
-
$filter = self::$settings->getGlobalOption ( 'capability_stealth' );
|
268 |
-
foreach ( $wp_roles->role_names as $key => $name )
|
269 |
-
echo '<input type="checkbox" ' . (isset ( $filter [$key] ) && $filter [$key] ? 'checked="checked" ' : '') . 'value="1" name="wp-piwik[capability_stealth][' . $key . ']" /> ' . $name . ' ';
|
270 |
-
echo '<span class="dashicons dashicons-editor-help" onclick="$j(\'#capability_stealth-desc\').toggleClass(\'hidden\');"></span> <p class="description hidden" id="capability_stealth-desc">' . __ ( 'Choose users by user role you do <strong>not</strong> want to track.', 'wp-piwik' ) . '</p></td></tr>';
|
271 |
-
|
272 |
-
$this->showCheckbox ( 'track_across', __ ( 'Track subdomains in the same website', 'wp-piwik' ), __ ( 'Adds *.-prefix to cookie domain.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#tracking-subdomains-in-the-same-website" tagert="_BLANK">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
273 |
-
|
274 |
-
$this->showCheckbox ( 'track_across_alias', __ ( 'Do not count subdomains as outlink', 'wp-piwik' ), __ ( 'Adds *.-prefix to tracked domain.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#outlink-tracking-exclusions" target="_BLANK">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
275 |
-
|
276 |
-
$this->showCheckbox ( 'track_crossdomain_linking', __ ( 'Enable cross domain linking', 'wp-piwik' ), __ ( 'When enabled, it will make sure to use the same visitor ID for the same visitor across several domains. This works only when this feature is enabled because the visitor ID is stored in a cookie and cannot be read on the other domain by default. When this feature is enabled, it will append a URL parameter "pk_vid" that contains the visitor ID when a user clicks on a URL that belongs to one of your domains. For this feature to work, you also have to configure which domains should be treated as local in your Matomo website settings. This feature requires Matomo 3.0.2.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-manually');
|
277 |
-
|
278 |
-
$this->showCheckbox ( 'track_feed', __ ( 'Track RSS feeds', 'wp-piwik' ), __ ( 'Enable to track posts in feeds via tracking pixel.', 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
279 |
-
|
280 |
-
$this->showCheckbox ( 'track_feed_addcampaign', __ ( 'Track RSS feed links as campaign', 'wp-piwik' ), __ ( 'This will add Matomo campaign parameters to the RSS feed links.' . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/tracking-campaigns/" target="_BLANK">', '</a>' ), 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually', true, '$j(\'tr.wp-piwik-feed_campaign-option\').toggle(\'hidden\');' );
|
281 |
-
|
282 |
-
$this->showInput ( 'track_feed_campaign', __ ( 'RSS feed campaign', 'wp-piwik' ), __ ( 'Keyword: post name.', 'wp-piwik' ), $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'track_feed_addcampaign' ), $fullGeneratedTrackingGroup . ' wp-piwik-feed_campaign-option' );
|
283 |
-
|
284 |
-
$this->showInput ( 'track_heartbeat', __ ( 'Enable heartbeat timer', 'wp-piwik' ), __ ( 'Enable a heartbeat timer to get more accurate visit lengths by sending periodical HTTP ping requests as long as the site is opened. Enter the time between the pings in seconds (Matomo default: 15) to enable or 0 to disable this feature. <strong>Note:</strong> This will cause a lot of additional HTTP requests on your site.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
285 |
-
|
286 |
-
$this->showSelect ( 'track_user_id', __ ( 'User ID Tracking', 'wp-piwik' ), array (
|
287 |
-
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
|
288 |
-
'uid' => __ ( 'WP User ID', 'wp-piwik' ),
|
289 |
-
'email' => __ ( 'Email Address', 'wp-piwik' ),
|
290 |
-
'username' => __ ( 'Username', 'wp-piwik' ),
|
291 |
-
'displayname' => __ ( 'Display Name (Not Recommended!)', 'wp-piwik' )
|
292 |
-
), __ ( 'When a user is logged in to WordPress, track their "User ID". You can select which field from the User\'s profile is tracked as the "User ID". When enabled, Tracking based on Email Address is recommended.', 'wp-piwik' ), '', $isNotTracking, $fullGeneratedTrackingGroup );
|
293 |
-
|
294 |
-
echo $submitButton;
|
295 |
-
echo '</tbody></table><table id="expert" class="wp-piwik_menu-tab hidden"><tbody>';
|
296 |
-
|
297 |
-
$this->showText ( __ ( 'Usually, you do not need to change these settings. If you want to do so, you should know what you do or you got an expert\'s advice.', 'wp-piwik' ) );
|
298 |
-
|
299 |
-
$this->showCheckbox ( 'cache', __ ( 'Enable cache', 'wp-piwik' ), __ ( 'Cache API calls, which not contain today\'s values, for a week.', 'wp-piwik' ) );
|
300 |
-
|
301 |
-
if (function_exists('curl_init') && ini_get('allow_url_fopen'))
|
302 |
-
$this->showSelect ( 'http_connection', __ ( 'HTTP connection via', 'wp-piwik' ), array (
|
303 |
-
'curl' => __ ( 'cURL', 'wp-piwik' ),
|
304 |
-
'fopen' => __ ( 'fopen', 'wp-piwik' )
|
305 |
-
), __('Choose whether WP-Matomo should use cURL or fopen to connect to Matomo in HTTP or Cloud mode.', 'wp-piwik' ) );
|
306 |
-
|
307 |
-
$this->showSelect ( 'http_method', __ ( 'HTTP method', 'wp-piwik' ), array (
|
308 |
-
'post' => __ ( 'POST', 'wp-piwik' ),
|
309 |
-
'get' => __ ( 'GET', 'wp-piwik' )
|
310 |
-
), __('Choose whether WP-Matomo should use POST or GET in HTTP or Cloud mode.', 'wp-piwik' ) );
|
311 |
-
|
312 |
-
$this->showCheckbox ( 'disable_timelimit', __ ( 'Disable time limit', 'wp-piwik' ), __ ( 'Use set_time_limit(0) if stats page causes a time out.', 'wp-piwik' ) );
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
$this->
|
317 |
-
|
318 |
-
|
319 |
-
$this->
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
$this->showCheckbox ( '
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
$this->showInput ( '
|
332 |
-
|
333 |
-
$this->
|
334 |
-
|
335 |
-
|
336 |
-
'
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
'
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
$this->showInput ( '
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
*
|
380 |
-
*
|
381 |
-
* @param
|
382 |
-
* @
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
*
|
392 |
-
*
|
393 |
-
* @param string $
|
394 |
-
* @param
|
395 |
-
* @param string $
|
396 |
-
* @param boolean $
|
397 |
-
* @param string $
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
*
|
407 |
-
*
|
408 |
-
* @param
|
409 |
-
* @param string $
|
410 |
-
* @param
|
411 |
-
* @param string $
|
412 |
-
* @param boolean $
|
413 |
-
* @param string $
|
414 |
-
* @param boolean $
|
415 |
-
* @param
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
*
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
*
|
435 |
-
*
|
436 |
-
* @param string $
|
437 |
-
* @param
|
438 |
-
* @param string $
|
439 |
-
* @param
|
440 |
-
* @param
|
441 |
-
* @param
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
*
|
451 |
-
*
|
452 |
-
* @param
|
453 |
-
* @param string $
|
454 |
-
* @param
|
455 |
-
* @param
|
456 |
-
* @param string $
|
457 |
-
* @param boolean $
|
458 |
-
* @param
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
*
|
473 |
-
*
|
474 |
-
* @param string $
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
*
|
484 |
-
* @param
|
485 |
-
* @param string $
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
*
|
495 |
-
*
|
496 |
-
* @param
|
497 |
-
* @param string $
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
<input type="
|
524 |
-
<
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
</
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
*
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
*
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
<p><?php _e('Thank you very much','wp-piwik');
|
566 |
-
<p><?php _e('
|
567 |
-
<p><?php _e('Thank
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
<
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
_e('
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
_e('
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
<li><a href="<?php echo admin_url( (self::$settings->checkNetworkActivation () ? 'network/settings' : 'options-general').'.php?page='.$_GET['page'].'&
|
603 |
-
<li><a
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
*
|
619 |
-
*
|
620 |
-
* @param
|
621 |
-
*
|
622 |
-
* @
|
623 |
-
*
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
$
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
*
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
$
|
694 |
-
|
695 |
-
$GLOBALS ['wp-piwik_debug'] =
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
$
|
700 |
-
|
701 |
-
$GLOBALS ['wp-piwik_debug'] =
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
echo "\n\n"; var_dump( self::$
|
708 |
-
$
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
}
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WP_Piwik\Admin;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* WordPress Admin settings page
|
7 |
+
*
|
8 |
+
* @package WP_Piwik\Admin
|
9 |
+
* @author André Bräkling <webmaster@braekling.de>
|
10 |
+
*/
|
11 |
+
class Settings extends \WP_Piwik\Admin {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Builds and displays the settings page
|
15 |
+
*/
|
16 |
+
public function show() {
|
17 |
+
if (isset($_GET['sitebrowser']) && $_GET['sitebrowser']) {
|
18 |
+
new \WP_Piwik\Admin\Sitebrowser(self::$wpPiwik);
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
if (isset($_GET['clear']) && $_GET['clear']) {
|
22 |
+
$this->clear($_GET['clear'] == 2);
|
23 |
+
self::$wpPiwik->resetRequest();
|
24 |
+
echo '<form method="post" action="?page='.htmlentities($_GET['page']).'"><input type="submit" value="'.__('Reload', 'wp-piwik').'" /></form>';
|
25 |
+
return;
|
26 |
+
} elseif (self::$wpPiwik->isConfigSubmitted()) {
|
27 |
+
$this->showBox ( 'updated', 'yes', __ ( 'Changes saved.' ) );
|
28 |
+
self::$wpPiwik->resetRequest();
|
29 |
+
self::$wpPiwik->updateTrackingCode();
|
30 |
+
}
|
31 |
+
global $wp_roles;
|
32 |
+
?>
|
33 |
+
<div id="plugin-options-wrap" class="widefat">
|
34 |
+
<?php
|
35 |
+
echo $this->getHeadline ( 1, 'admin-generic', 'Settings', true );
|
36 |
+
if (isset($_GET['testscript']) && $_GET['testscript'])
|
37 |
+
$this->runTestscript();
|
38 |
+
?>
|
39 |
+
<?php
|
40 |
+
if (self::$wpPiwik->isConfigured ()) {
|
41 |
+
$piwikVersion = self::$wpPiwik->request ( 'global.getPiwikVersion' );
|
42 |
+
if (is_array ( $piwikVersion ) && isset( $piwikVersion['value'] ))
|
43 |
+
$piwikVersion = $piwikVersion['value'];
|
44 |
+
if (! empty ( $piwikVersion ) && !is_array( $piwikVersion ))
|
45 |
+
$this->showDonation();
|
46 |
+
}
|
47 |
+
?>
|
48 |
+
<form method="post" action="?page=<?php echo htmlentities($_GET['page']); ?>">
|
49 |
+
<input type="hidden" name="wp-piwik[revision]" value="<?php echo self::$settings->getGlobalOption('revision'); ?>" />
|
50 |
+
<?php wp_nonce_field('wp-piwik_settings'); ?>
|
51 |
+
<table class="wp-piwik-form">
|
52 |
+
<tbody>
|
53 |
+
<?php
|
54 |
+
$submitButton = '<tr><td colspan="2"><p class="submit"><input name="Submit" type="submit" class="button-primary" value="' . esc_attr__ ( 'Save Changes' ) . '" /></p></td></tr>';
|
55 |
+
printf ( '<tr><td colspan="2">%s</td></tr>', __ ( 'Thanks for using WP-Matomo!', 'wp-piwik' ) );
|
56 |
+
if (self::$wpPiwik->isConfigured ()) {
|
57 |
+
if (! empty ( $piwikVersion ) && !is_array( $piwikVersion )) {
|
58 |
+
$this->showText ( sprintf ( __ ( 'WP-Matomo %s is successfully connected to Matomo %s.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion (), $piwikVersion ) . ' ' . (! self::$wpPiwik->isNetworkMode () ? sprintf ( __ ( 'You are running WordPress %s.', 'wp-piwik' ), get_bloginfo ( 'version' ) ) : sprintf ( __ ( 'You are running a WordPress %s blog network (WPMU). WP-Matomo will handle your sites as different websites.', 'wp-piwik' ), get_bloginfo ( 'version' ) )) );
|
59 |
+
} else {
|
60 |
+
$errorMessage = \WP_Piwik\Request::getLastError();
|
61 |
+
if ( empty( $errorMessage ) )
|
62 |
+
$this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Matomo %s was not able to connect to Matomo using your configuration. Check the »Connect to Matomo« section below.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion () ) );
|
63 |
+
else
|
64 |
+
$this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Matomo %s was not able to connect to Matomo using your configuration. During connection the following error occured: <br /><code>%s</code>', 'wp-piwik' ), self::$wpPiwik->getPluginVersion (), $errorMessage ) );
|
65 |
+
}
|
66 |
+
} else
|
67 |
+
$this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Matomo %s has to be connected to Matomo first. Check the »Connect to Matomo« section below.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion () ) );
|
68 |
+
|
69 |
+
$tabs ['connect'] = array (
|
70 |
+
'icon' => 'admin-plugins',
|
71 |
+
'name' => __('Connect to Matomo', 'wp-piwik')
|
72 |
+
);
|
73 |
+
if (self::$wpPiwik->isConfigured ()) {
|
74 |
+
$tabs ['statistics'] = array (
|
75 |
+
'icon' => 'chart-pie',
|
76 |
+
'name' => __('Show Statistics', 'wp-piwik')
|
77 |
+
);
|
78 |
+
$tabs ['tracking'] = array (
|
79 |
+
'icon' => 'location-alt',
|
80 |
+
'name' => __('Enable Tracking', 'wp-piwik')
|
81 |
+
);
|
82 |
+
}
|
83 |
+
$tabs ['expert'] = array (
|
84 |
+
'icon' => 'shield',
|
85 |
+
'name' => __('Expert Settings', 'wp-piwik')
|
86 |
+
);
|
87 |
+
$tabs ['support'] = array (
|
88 |
+
'icon' => 'lightbulb',
|
89 |
+
'name' => __('Support', 'wp-piwik')
|
90 |
+
);
|
91 |
+
$tabs ['credits'] = array (
|
92 |
+
'icon' => 'groups',
|
93 |
+
'name' => __('Credits', 'wp-piwik')
|
94 |
+
);
|
95 |
+
|
96 |
+
echo '<tr><td colspan="2"><h2 class="nav-tab-wrapper">';
|
97 |
+
foreach ( $tabs as $tab => $details ) {
|
98 |
+
$class = ($tab == 'connect') ? ' nav-tab-active' : '';
|
99 |
+
echo '<a style="cursor:pointer;" id="tab-' . $tab . '" class="nav-tab' . $class . '" onclick="javascript:$j(\'table.wp-piwik_menu-tab\').addClass(\'hidden\');$j(\'#' . $tab . '\').removeClass(\'hidden\');$j(\'a.nav-tab\').removeClass(\'nav-tab-active\');$j(\'#tab-' . $tab . '\').addClass(\'nav-tab-active\');">';
|
100 |
+
$this->showHeadline ( 0, $details ['icon'], $details ['name'] );
|
101 |
+
echo "</a>";
|
102 |
+
}
|
103 |
+
echo '</h2></td></tr></tbody></table><table id="connect" class="wp-piwik_menu-tab"><tbody>';
|
104 |
+
|
105 |
+
if (! self::$wpPiwik->isConfigured ())
|
106 |
+
$this->showBox ( 'updated', 'info', sprintf ( '%s <a href="%s">%s</a> %s <a href="%s">%s</a>.', __ ( 'WP-Matomo is a WordPress plugin to show a selection of Matomo stats in your WordPress admin dashboard and to add and configure your Matomo tracking code. To use this you will need your own Matomo instance. If you do not already have a Matomo setup, you have two simple options: use either', 'wp-piwik' ), 'http://piwik.org/', __ ( 'a self-hosted Matomo', 'wp-piwik' ), __ ( 'or', 'wp-piwik' ), 'https://www.innocraft.cloud/?pk_campaign=WP-Matomo', __ ( 'a cloud-hosted Matomo by InnoCraft', 'wp-piwik' ) ) );
|
107 |
+
|
108 |
+
if (! function_exists ( 'curl_init' ) && ! ini_get ( 'allow_url_fopen' ))
|
109 |
+
$this->showBox ( 'error', 'no', __ ( 'Neither cURL nor fopen are available. So WP-Matomo can not use the HTTP API and not connect to InnoCraft Cloud.' ) . ' ' . sprintf ( '<a href="%s">%s.</a>', 'https://wordpress.org/plugins/wp-piwik/faq/', __ ( 'More information', 'wp-piwik' ) ) );
|
110 |
+
|
111 |
+
$description = sprintf ( '%s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s', __ ( 'You can choose between three connection methods:', 'wp-piwik' ), __ ( 'Self-hosted (HTTP API, default)', 'wp-piwik' ), __ ( 'This is the default option for a self-hosted Matomo and should work for most configurations. WP-Matomo will connect to Matomo using http(s).', 'wp-piwik' ), __ ( 'Self-hosted (PHP API)', 'wp-piwik' ), __ ( 'Choose this, if your self-hosted Matomo and WordPress are running on the same machine and you know the full server path to your Matomo instance.', 'wp-piwik' ), __ ( 'Cloud-hosted', 'wp-piwik' ), __ ( 'If you are using a cloud-hosted Matomo by InnoCraft, you can simply use this option. Be carefull to choose the option which fits to your cloud domain (matomo.cloud or innocraft.cloud).', 'wp-piwik' ) );
|
112 |
+
$this->showSelect ( 'piwik_mode', __ ( 'Matomo Mode', 'wp-piwik' ), array (
|
113 |
+
'disabled' => __ ( 'Disabled (WP-Matomo will not connect to Matomo)', 'wp-piwik' ),
|
114 |
+
'http' => __ ( 'Self-hosted (HTTP API, default)', 'wp-piwik' ),
|
115 |
+
'php' => __ ( 'Self-hosted (PHP API)', 'wp-piwik' ),
|
116 |
+
'cloud-matomo' => __('Cloud-hosted (Innocraft Cloud, *.matomo.cloud)', 'wp-piwik'),
|
117 |
+
'cloud' => __ ( 'Cloud-hosted (InnoCraft Cloud, *.innocraft.cloud)', 'wp-piwik' )
|
118 |
+
), $description, '$j(\'tr.wp-piwik-mode-option\').addClass(\'hidden\'); $j(\'#wp-piwik-mode-option-\' + $j(\'#piwik_mode\').val()).removeClass(\'hidden\');', false, '', self::$wpPiwik->isConfigured () );
|
119 |
+
|
120 |
+
$this->showInput ( 'piwik_url', __ ( 'Matomo URL', 'wp-piwik' ), __( 'Enter your Matomo URL. This is the same URL you use to access your Matomo instance, e.g. http://www.example.com/matomo/.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'http', 'wp-piwik-mode-option', 'http', self::$wpPiwik->isConfigured (), true );
|
121 |
+
$this->showInput ( 'piwik_path', __ ( 'Matomo path', 'wp-piwik' ), __( 'Enter the file path to your Matomo instance, e.g. /var/www/matomo/.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'php', 'wp-piwik-mode-option', 'php', self::$wpPiwik->isConfigured (), true );
|
122 |
+
$this->showInput ( 'piwik_user', __ ( 'Innocraft subdomain', 'wp-piwik' ), __( 'Enter your InnoCraft Cloud subdomain. It is also part of your URL: https://SUBDOMAIN.innocraft.cloud.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'cloud', 'wp-piwik-mode-option', 'cloud', self::$wpPiwik->isConfigured () );
|
123 |
+
$this->showInput ( 'matomo_user', __ ( 'Matomo subdomain', 'wp-piwik' ), __( 'Enter your Matomo Cloud subdomain. It is also part of your URL: https://SUBDOMAIN.matomo.cloud.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'cloud-matomo', 'wp-piwik-mode-option', 'cloud-matomo', self::$wpPiwik->isConfigured () );
|
124 |
+
$this->showInput ( 'piwik_token', __ ( 'Auth token', 'wp-piwik' ), __( 'Enter your Matomo auth token here. It is an alphanumerical code like 0a1b2c34d56e78901fa2bc3d45678efa.', 'wp-piwik' ).' '.sprintf ( __ ( 'See %sWP-Matomo FAQ%s.', 'wp-piwik' ), '<a href="https://wordpress.org/plugins/wp-piwik/faq/" target="_BLANK">', '</a>' ), false, '', '', self::$wpPiwik->isConfigured (), true );
|
125 |
+
|
126 |
+
// Site configuration
|
127 |
+
$piwikSiteId = self::$wpPiwik->isConfigured () ? self::$wpPiwik->getPiwikSiteId () : false;
|
128 |
+
if (! self::$wpPiwik->isNetworkMode() ) {
|
129 |
+
$this->showCheckbox ( 'auto_site_config', __ ( 'Auto config', 'wp-piwik' ), __ ( 'Check this to automatically choose your blog from your Matomo sites by URL. If your blog is not added to Matomo yet, WP-Matomo will add a new site.', 'wp-piwik' ), false, '$j(\'tr.wp-piwik-auto-option\').toggle(\'hidden\');' . ($piwikSiteId ? '$j(\'#site_id\').val(' . $piwikSiteId . ');' : '') );
|
130 |
+
if (self::$wpPiwik->isConfigured ()) {
|
131 |
+
$piwikSiteList = self::$wpPiwik->getPiwikSiteDetails ();
|
132 |
+
if (isset($piwikSiteList['result']) && $piwikSiteList['result'] == 'error') {
|
133 |
+
$this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Matomo %s was not able to get sites with at least view access: <br /><code>%s</code>', 'wp-piwik' ), self::$wpPiwik->getPluginVersion (), $errorMessage ) );
|
134 |
+
} else {
|
135 |
+
if (is_array($piwikSiteList))
|
136 |
+
foreach ($piwikSiteList as $details)
|
137 |
+
$piwikSiteDetails[$details['idsite']] = $details;
|
138 |
+
unset($piwikSiteList);
|
139 |
+
if ($piwikSiteId != 'n/a' && isset($piwikSiteDetails) && is_array($piwikSiteDetails))
|
140 |
+
$piwikSiteDescription = $piwikSiteDetails [$piwikSiteId] ['name'] . ' (' . $piwikSiteDetails [$piwikSiteId] ['main_url'] . ')';
|
141 |
+
else
|
142 |
+
$piwikSiteDescription = 'n/a';
|
143 |
+
echo '<tr class="wp-piwik-auto-option' . (!self::$settings->getGlobalOption('auto_site_config') ? ' hidden' : '') . '"><th scope="row">' . __('Determined site', 'wp-piwik') . ':</th><td>' . $piwikSiteDescription . '</td></tr>';
|
144 |
+
if (isset ($piwikSiteDetails) && is_array($piwikSiteDetails))
|
145 |
+
foreach ($piwikSiteDetails as $key => $siteData)
|
146 |
+
$siteList [$siteData['idsite']] = $siteData ['name'] . ' (' . $siteData ['main_url'] . ')';
|
147 |
+
if (isset($siteList))
|
148 |
+
$this->showSelect('site_id', __('Select site', 'wp-piwik'), $siteList, 'Choose the Matomo site corresponding to this blog.', '', self::$settings->getGlobalOption('auto_site_config'), 'wp-piwik-auto-option', true, false);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
} else echo '<tr class="hidden"><td colspan="2"><input type="hidden" name="wp-piwik[auto_site_config]" value="1" /></td></tr>';
|
152 |
+
|
153 |
+
echo $submitButton;
|
154 |
+
|
155 |
+
echo '</tbody></table><table id="statistics" class="wp-piwik_menu-tab hidden"><tbody>';
|
156 |
+
// Stats configuration
|
157 |
+
$this->showSelect ( 'default_date', __ ( 'Matomo default date', 'wp-piwik' ), array (
|
158 |
+
'today' => __ ( 'Today', 'wp-piwik' ),
|
159 |
+
'yesterday' => __ ( 'Yesterday', 'wp-piwik' ),
|
160 |
+
'current_month' => __ ( 'Current month', 'wp-piwik' ),
|
161 |
+
'last_month' => __ ( 'Last month', 'wp-piwik' ),
|
162 |
+
'current_week' => __ ( 'Current week', 'wp-piwik' ),
|
163 |
+
'last_week' => __ ( 'Last week', 'wp-piwik' )
|
164 |
+
), __ ( 'Default date shown on statistics page.', 'wp-piwik' ) );
|
165 |
+
|
166 |
+
$this->showCheckbox ( 'stats_seo', __ ( 'Show SEO data', 'wp-piwik' ), __ ( 'Display SEO ranking data on statistics page.', 'wp-piwik' ) . ' (' . __ ( 'Slow!', 'wp-piwik' ) . ')' );
|
167 |
+
$this->showCheckbox ( 'stats_ecommerce', __ ( 'Show e-commerce data', 'wp-piwik' ), __ ( 'Display e-commerce data on statistics page.', 'wp-piwik' ) );
|
168 |
+
|
169 |
+
$this->showSelect ( 'dashboard_widget', __ ( 'Dashboard overview', 'wp-piwik' ), array (
|
170 |
+
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
|
171 |
+
'yesterday' => __ ( 'Yesterday', 'wp-piwik' ),
|
172 |
+
'today' => __ ( 'Today', 'wp-piwik' ),
|
173 |
+
'last30' => __ ( 'Last 30 days', 'wp-piwik' )
|
174 |
+
), __ ( 'Enable WP-Matomo dashboard widget "Overview".', 'wp-piwik' ) );
|
175 |
+
|
176 |
+
$this->showCheckbox ( 'dashboard_chart', __ ( 'Dashboard graph', 'wp-piwik' ), __ ( 'Enable WP-Matomo dashboard widget "Graph".', 'wp-piwik' ) );
|
177 |
+
|
178 |
+
$this->showCheckbox ( 'dashboard_seo', __ ( 'Dashboard SEO', 'wp-piwik' ), __ ( 'Enable WP-Matomo dashboard widget "SEO".', 'wp-piwik' ) . ' (' . __ ( 'Slow!', 'wp-piwik' ) . ')' );
|
179 |
+
|
180 |
+
$this->showCheckbox ( 'dashboard_ecommerce', __ ( 'Dashboard e-commerce', 'wp-piwik' ), __ ( 'Enable WP-Matomo dashboard widget "E-commerce".', 'wp-piwik' ) );
|
181 |
+
|
182 |
+
$this->showCheckbox ( 'toolbar', __ ( 'Show graph on WordPress Toolbar', 'wp-piwik' ), __ ( 'Display a last 30 days visitor graph on WordPress\' toolbar.', 'wp-piwik' ) );
|
183 |
+
|
184 |
+
echo '<tr><th scope="row"><label for="capability_read_stats">' . __ ( 'Display stats to', 'wp-piwik' ) . '</label>:</th><td>';
|
185 |
+
$filter = self::$settings->getGlobalOption ( 'capability_read_stats' );
|
186 |
+
foreach ( $wp_roles->role_names as $key => $name ) {
|
187 |
+
echo '<input type="checkbox" ' . (isset ( $filter [$key] ) && $filter [$key] ? 'checked="checked" ' : '') . 'value="1" onchange="$j(\'#capability_read_stats-' . $key . '-input\').val(this.checked?1:0);" />';
|
188 |
+
echo '<input id="capability_read_stats-' . $key . '-input" type="hidden" name="wp-piwik[capability_read_stats][' . $key . ']" value="' . ( int ) (isset ( $filter [$key] ) && $filter [$key]) . '" />';
|
189 |
+
echo $name . ' ';
|
190 |
+
}
|
191 |
+
echo '<span class="dashicons dashicons-editor-help" onclick="$j(\'#capability_read_stats-desc\').toggleClass(\'hidden\');"></span> <p class="description hidden" id="capability_read_stats-desc">' . __ ( 'Choose user roles allowed to see the statistics page.', 'wp-piwik' ) . '</p></td></tr>';
|
192 |
+
|
193 |
+
$this->showCheckbox ( 'perpost_stats', __ ( 'Show per post stats', 'wp-piwik' ), __ ( 'Show stats about single posts at the post edit admin page.', 'wp-piwik' ) );
|
194 |
+
|
195 |
+
$this->showCheckbox ( 'piwik_shortcut', __ ( 'Matomo shortcut', 'wp-piwik' ), __ ( 'Display a shortcut to Matomo itself.', 'wp-piwik' ) );
|
196 |
+
|
197 |
+
$this->showInput ( 'plugin_display_name', __ ( 'WP-Matomo display name', 'wp-piwik' ), __ ( 'Plugin name shown in WordPress.', 'wp-piwik' ) );
|
198 |
+
|
199 |
+
$this->showCheckbox ( 'shortcodes', __ ( 'Enable shortcodes', 'wp-piwik' ), __ ( 'Enable shortcodes in post or page content.', 'wp-piwik' ) );
|
200 |
+
|
201 |
+
echo $submitButton;
|
202 |
+
|
203 |
+
echo '</tbody></table><table id="tracking" class="wp-piwik_menu-tab hidden"><tbody>';
|
204 |
+
|
205 |
+
// Tracking Configuration
|
206 |
+
$isNotTracking = self::$settings->getGlobalOption ( 'track_mode' ) == 'disabled';
|
207 |
+
$isNotGeneratedTracking = $isNotTracking || self::$settings->getGlobalOption ( 'track_mode' ) == 'manually';
|
208 |
+
$fullGeneratedTrackingGroup = 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy';
|
209 |
+
|
210 |
+
$description = sprintf ( '%s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s', __ ( 'You can choose between four tracking code modes:', 'wp-piwik' ), __ ( 'Disabled', 'wp-piwik' ), __ ( 'WP-Matomo will not add the tracking code. Use this, if you want to add the tracking code to your template files or you use another plugin to add the tracking code.', 'wp-piwik' ), __ ( 'Default tracking', 'wp-piwik' ), __ ( 'WP-Matomo will use Matomo\'s standard tracking code.', 'wp-piwik' ), __ ( 'Use js/index.php', 'wp-piwik' ), __ ( 'You can choose this tracking code, to deliver a minified proxy code and to avoid using the files called piwik.js or piwik.php.', 'wp-piwik' ).' '.sprintf( __( 'See %sreadme file%s.', 'wp-piwik' ), '<a href="http://demo.piwik.org/js/README" target="_BLANK">', '</a>'), __ ( 'Use proxy script', 'wp-piwik' ), __ ( 'Use this tracking code to not reveal the Matomo server URL.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/#faq_132" target="_BLANK">', '</a>' ) , __ ( 'Enter manually', 'wp-piwik' ), __ ( 'Enter your own tracking code manually. You can choose one of the prior options, pre-configure your tracking code and switch to manually editing at last.', 'wp-piwik' ).( self::$wpPiwik->isNetworkMode() ? ' '.__ ( 'Use the placeholder {ID} to add the Matomo site ID.', 'wp-piwik' ) : '' ) );
|
211 |
+
$this->showSelect ( 'track_mode', __ ( 'Add tracking code', 'wp-piwik' ), array (
|
212 |
+
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
|
213 |
+
'default' => __ ( 'Default tracking', 'wp-piwik' ),
|
214 |
+
'js' => __ ( 'Use js/index.php', 'wp-piwik' ),
|
215 |
+
'proxy' => __ ( 'Use proxy script', 'wp-piwik' ),
|
216 |
+
'manually' => __ ( 'Enter manually', 'wp-piwik' )
|
217 |
+
), $description, '$j(\'tr.wp-piwik-track-option\').addClass(\'hidden\'); $j(\'tr.wp-piwik-track-option-\' + $j(\'#track_mode\').val()).removeClass(\'hidden\'); $j(\'#tracking_code, #noscript_code\').prop(\'readonly\', $j(\'#track_mode\').val() != \'manually\');' );
|
218 |
+
|
219 |
+
$this->showTextarea ( 'tracking_code', __ ( 'Tracking code', 'wp-piwik' ), 15, 'This is a preview of your current tracking code. If you choose to enter your tracking code manually, you can change it here.', $isNotTracking, 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy wp-piwik-track-option-manually', true, '', (self::$settings->getGlobalOption ( 'track_mode' ) != 'manually'), false );
|
220 |
+
|
221 |
+
$this->showSelect ( 'track_codeposition', __ ( 'JavaScript code position', 'wp-piwik' ), array (
|
222 |
+
'footer' => __ ( 'Footer', 'wp-piwik' ),
|
223 |
+
'header' => __ ( 'Header', 'wp-piwik' )
|
224 |
+
), __ ( 'Choose whether the JavaScript code is added to the footer or the header.', 'wp-piwik' ), '', $isNotTracking, 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy wp-piwik-track-option-manually' );
|
225 |
+
|
226 |
+
$this->showTextarea ( 'noscript_code', __ ( 'Noscript code', 'wp-piwik' ), 2, 'This is a preview of your <noscript> code which is part of your tracking code.', self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-manually', true, '', (self::$settings->getGlobalOption ( 'track_mode' ) != 'manually'), false );
|
227 |
+
|
228 |
+
$this->showCheckbox ( 'track_noscript', __ ( 'Add <noscript>', 'wp-piwik' ), __ ( 'Adds the <noscript> code to your footer.', 'wp-piwik' ) . ' ' . __ ( 'Disabled in proxy mode.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-manually' );
|
229 |
+
|
230 |
+
$this->showCheckbox ( 'track_nojavascript', __ ( 'Add rec parameter to noscript code', 'wp-piwik' ), __ ( 'Enable tracking for visitors without JavaScript (not recommended).', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/#faq_176" target="_BLANK">', '</a>' ) . ' ' . __ ( 'Disabled in proxy mode.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-manually' );
|
231 |
+
|
232 |
+
$this->showSelect ( 'track_content', __ ( 'Enable content tracking', 'wp-piwik' ), array (
|
233 |
+
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
|
234 |
+
'all' => __ ( 'Track all content blocks', 'wp-piwik' ),
|
235 |
+
'visible' => __ ( 'Track only visible content blocks', 'wp-piwik' )
|
236 |
+
), __ ( 'Content tracking allows you to track interaction with the content of a web page or application.' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/content-tracking" target="_BLANK">', '</a>' ), '', $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
237 |
+
|
238 |
+
$this->showCheckbox ( 'track_search', __ ( 'Track search', 'wp-piwik' ), __ ( 'Use Matomo\'s advanced Site Search Analytics feature.' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/site-search/#track-site-search-using-the-tracking-api-advanced-users-only" target="_BLANK">', '</a>' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
239 |
+
|
240 |
+
$this->showCheckbox ( 'track_404', __ ( 'Track 404', 'wp-piwik' ), __ ( 'WP-Matomo can automatically add a 404-category to track 404-page-visits.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/faq_60/" target="_BLANK">', '</a>' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
241 |
+
|
242 |
+
echo '<tr class="' . $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' . ($isNotTracking ? ' hidden' : '') . '">';
|
243 |
+
echo '<th scope="row"><label for="add_post_annotations">' . __ ( 'Add annotation on new post of type', 'wp-piwik' ) . '</label>:</th><td>';
|
244 |
+
$filter = self::$settings->getGlobalOption ( 'add_post_annotations' );
|
245 |
+
foreach ( get_post_types(array(), 'objects') as $post_type )
|
246 |
+
echo '<input type="checkbox" ' . (isset ( $filter [$post_type->name] ) && $filter [$post_type->name] ? 'checked="checked" ' : '') . 'value="1" name="wp-piwik[add_post_annotations][' . $post_type->name . ']" /> ' . $post_type->label . ' ';
|
247 |
+
echo '<span class="dashicons dashicons-editor-help" onclick="$j(\'#add_post_annotations-desc\').toggleClass(\'hidden\');"></span> <p class="description hidden" id="add_post_annotations-desc">' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/annotations/" target="_BLANK">', '</a>' ) . '</p></td></tr>';
|
248 |
+
|
249 |
+
$this->showCheckbox ( 'add_customvars_box', __ ( 'Show custom variables box', 'wp-piwik' ), __ ( ' Show a "custom variables" edit box on post edit page.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/custom-variables/" target="_BLANK">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
250 |
+
|
251 |
+
$this->showInput ( 'add_download_extensions', __ ( 'Add new file types for download tracking', 'wp-piwik' ), __ ( 'Add file extensions for download tracking, divided by a vertical bar (|).', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#file-extensions-for-tracking-downloads" target="_BLANK">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
252 |
+
|
253 |
+
$this->showCheckbox ( 'disable_cookies', __ ( 'Disable cookies', 'wp-piwik' ), __ ( 'Disable all tracking cookies for a visitor.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
254 |
+
|
255 |
+
$this->showCheckbox ( 'limit_cookies', __ ( 'Limit cookie lifetime', 'wp-piwik' ), __ ( 'You can limit the cookie lifetime to avoid tracking your users over a longer period as necessary.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup, true, '$j(\'tr.wp-piwik-cookielifetime-option\').toggleClass(\'wp-piwik-hidden\');' );
|
256 |
+
|
257 |
+
$this->showInput ( 'limit_cookies_visitor', __ ( 'Visitor timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup.' wp-piwik-cookielifetime-option'. (self::$settings->getGlobalOption ( 'limit_cookies' )? '': ' wp-piwik-hidden') );
|
258 |
+
|
259 |
+
$this->showInput ( 'limit_cookies_session', __ ( 'Session timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup .' wp-piwik-cookielifetime-option'. (self::$settings->getGlobalOption ( 'limit_cookies' )? '': ' wp-piwik-hidden') );
|
260 |
+
|
261 |
+
$this->showInput ( 'limit_cookies_referral', __ ( 'Referral timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup .' wp-piwik-cookielifetime-option'. (self::$settings->getGlobalOption ( 'limit_cookies' )? '': ' wp-piwik-hidden') );
|
262 |
+
|
263 |
+
$this->showCheckbox ( 'track_admin', __ ( 'Track admin pages', 'wp-piwik' ), __ ( 'Enable to track users on admin pages (remember to configure the tracking filter appropriately).', 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
264 |
+
|
265 |
+
echo '<tr class="' . $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' . ($isNotTracking ? ' hidden' : '') . '">';
|
266 |
+
echo '<th scope="row"><label for="capability_stealth">' . __ ( 'Tracking filter', 'wp-piwik' ) . '</label>:</th><td>';
|
267 |
+
$filter = self::$settings->getGlobalOption ( 'capability_stealth' );
|
268 |
+
foreach ( $wp_roles->role_names as $key => $name )
|
269 |
+
echo '<input type="checkbox" ' . (isset ( $filter [$key] ) && $filter [$key] ? 'checked="checked" ' : '') . 'value="1" name="wp-piwik[capability_stealth][' . $key . ']" /> ' . $name . ' ';
|
270 |
+
echo '<span class="dashicons dashicons-editor-help" onclick="$j(\'#capability_stealth-desc\').toggleClass(\'hidden\');"></span> <p class="description hidden" id="capability_stealth-desc">' . __ ( 'Choose users by user role you do <strong>not</strong> want to track.', 'wp-piwik' ) . '</p></td></tr>';
|
271 |
+
|
272 |
+
$this->showCheckbox ( 'track_across', __ ( 'Track subdomains in the same website', 'wp-piwik' ), __ ( 'Adds *.-prefix to cookie domain.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#tracking-subdomains-in-the-same-website" tagert="_BLANK">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
273 |
+
|
274 |
+
$this->showCheckbox ( 'track_across_alias', __ ( 'Do not count subdomains as outlink', 'wp-piwik' ), __ ( 'Adds *.-prefix to tracked domain.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#outlink-tracking-exclusions" target="_BLANK">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
275 |
+
|
276 |
+
$this->showCheckbox ( 'track_crossdomain_linking', __ ( 'Enable cross domain linking', 'wp-piwik' ), __ ( 'When enabled, it will make sure to use the same visitor ID for the same visitor across several domains. This works only when this feature is enabled because the visitor ID is stored in a cookie and cannot be read on the other domain by default. When this feature is enabled, it will append a URL parameter "pk_vid" that contains the visitor ID when a user clicks on a URL that belongs to one of your domains. For this feature to work, you also have to configure which domains should be treated as local in your Matomo website settings. This feature requires Matomo 3.0.2.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-manually');
|
277 |
+
|
278 |
+
$this->showCheckbox ( 'track_feed', __ ( 'Track RSS feeds', 'wp-piwik' ), __ ( 'Enable to track posts in feeds via tracking pixel.', 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
|
279 |
+
|
280 |
+
$this->showCheckbox ( 'track_feed_addcampaign', __ ( 'Track RSS feed links as campaign', 'wp-piwik' ), __ ( 'This will add Matomo campaign parameters to the RSS feed links.' . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/tracking-campaigns/" target="_BLANK">', '</a>' ), 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually', true, '$j(\'tr.wp-piwik-feed_campaign-option\').toggle(\'hidden\');' );
|
281 |
+
|
282 |
+
$this->showInput ( 'track_feed_campaign', __ ( 'RSS feed campaign', 'wp-piwik' ), __ ( 'Keyword: post name.', 'wp-piwik' ), $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'track_feed_addcampaign' ), $fullGeneratedTrackingGroup . ' wp-piwik-feed_campaign-option' );
|
283 |
+
|
284 |
+
$this->showInput ( 'track_heartbeat', __ ( 'Enable heartbeat timer', 'wp-piwik' ), __ ( 'Enable a heartbeat timer to get more accurate visit lengths by sending periodical HTTP ping requests as long as the site is opened. Enter the time between the pings in seconds (Matomo default: 15) to enable or 0 to disable this feature. <strong>Note:</strong> This will cause a lot of additional HTTP requests on your site.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
|
285 |
+
|
286 |
+
$this->showSelect ( 'track_user_id', __ ( 'User ID Tracking', 'wp-piwik' ), array (
|
287 |
+
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
|
288 |
+
'uid' => __ ( 'WP User ID', 'wp-piwik' ),
|
289 |
+
'email' => __ ( 'Email Address', 'wp-piwik' ),
|
290 |
+
'username' => __ ( 'Username', 'wp-piwik' ),
|
291 |
+
'displayname' => __ ( 'Display Name (Not Recommended!)', 'wp-piwik' )
|
292 |
+
), __ ( 'When a user is logged in to WordPress, track their "User ID". You can select which field from the User\'s profile is tracked as the "User ID". When enabled, Tracking based on Email Address is recommended.', 'wp-piwik' ), '', $isNotTracking, $fullGeneratedTrackingGroup );
|
293 |
+
|
294 |
+
echo $submitButton;
|
295 |
+
echo '</tbody></table><table id="expert" class="wp-piwik_menu-tab hidden"><tbody>';
|
296 |
+
|
297 |
+
$this->showText ( __ ( 'Usually, you do not need to change these settings. If you want to do so, you should know what you do or you got an expert\'s advice.', 'wp-piwik' ) );
|
298 |
+
|
299 |
+
$this->showCheckbox ( 'cache', __ ( 'Enable cache', 'wp-piwik' ), __ ( 'Cache API calls, which not contain today\'s values, for a week.', 'wp-piwik' ) );
|
300 |
+
|
301 |
+
if (function_exists('curl_init') && ini_get('allow_url_fopen'))
|
302 |
+
$this->showSelect ( 'http_connection', __ ( 'HTTP connection via', 'wp-piwik' ), array (
|
303 |
+
'curl' => __ ( 'cURL', 'wp-piwik' ),
|
304 |
+
'fopen' => __ ( 'fopen', 'wp-piwik' )
|
305 |
+
), __('Choose whether WP-Matomo should use cURL or fopen to connect to Matomo in HTTP or Cloud mode.', 'wp-piwik' ) );
|
306 |
+
|
307 |
+
$this->showSelect ( 'http_method', __ ( 'HTTP method', 'wp-piwik' ), array (
|
308 |
+
'post' => __ ( 'POST', 'wp-piwik' ),
|
309 |
+
'get' => __ ( 'GET', 'wp-piwik' )
|
310 |
+
), __('Choose whether WP-Matomo should use POST or GET in HTTP or Cloud mode.', 'wp-piwik' ) );
|
311 |
+
|
312 |
+
$this->showCheckbox ( 'disable_timelimit', __ ( 'Disable time limit', 'wp-piwik' ), __ ( 'Use set_time_limit(0) if stats page causes a time out.', 'wp-piwik' ) );
|
313 |
+
|
314 |
+
$this->showInput ( 'filter_limit', __ ( 'Filter limit', 'wp-piwik' ), __ ( 'Use filter_limit if you need to get more than 100 results per page.', 'wp-piwik' ) );
|
315 |
+
|
316 |
+
$this->showInput ( 'connection_timeout', __ ( 'Connection timeout', 'wp-piwik' ), 'Define a connection timeout for all HTTP requests done by WP-Matomo in seconds.' );
|
317 |
+
|
318 |
+
$this->showCheckbox ( 'disable_ssl_verify', __ ( 'Disable SSL peer verification', 'wp-piwik' ), '(' . __ ( 'not recommended', 'wp-piwik' ) . ')' );
|
319 |
+
$this->showCheckbox ( 'disable_ssl_verify_host', __ ( 'Disable SSL host verification', 'wp-piwik' ), '(' . __ ( 'not recommended', 'wp-piwik' ) . ')' );
|
320 |
+
|
321 |
+
$this->showSelect ( 'piwik_useragent', __ ( 'User agent', 'wp-piwik' ), array (
|
322 |
+
'php' => __ ( 'Use the PHP default user agent', 'wp-piwik' ) . (ini_get ( 'user_agent' ) ? '(' . ini_get ( 'user_agent' ) . ')' : ' (' . __ ( 'empty', 'wp-piwik' ) . ')'),
|
323 |
+
'own' => __ ( 'Define a specific user agent', 'wp-piwik' )
|
324 |
+
), 'WP-Matomo can send the default user agent defined by your PHP settings or use a specific user agent below. The user agent is send by WP-Matomo if HTTP requests are performed.', '$j(\'tr.wp-piwik-useragent-option\').toggleClass(\'hidden\');' );
|
325 |
+
$this->showInput ( 'piwik_useragent_string', __ ( 'Specific user agent', 'wp-piwik' ), 'Define a user agent description which is send by WP-Matomo if HTTP requests are performed.', self::$settings->getGlobalOption ( 'piwik_useragent' ) != 'own', 'wp-piwik-useragent-option' );
|
326 |
+
|
327 |
+
$this->showCheckbox ( 'dnsprefetch', __ ( 'Enable DNS prefetch', 'wp-piwik' ), __ ( 'Add a DNS prefetch tag.' . ' ' . sprintf ( __ ( 'See %sMatomo Blog%s.', 'wp-piwik' ), '<a target="_BLANK" href="https://piwik.org/blog/2017/04/important-performance-optimizations-load-piwik-javascript-tracker-faster/">', '</a>' ), 'wp-piwik' ) );
|
328 |
+
|
329 |
+
$this->showCheckbox ( 'track_datacfasync', __ ( 'Add data-cfasync=false', 'wp-piwik' ), __ ( 'Adds data-cfasync=false to the script tag, e.g., to ask Rocket Loader to ignore the script.' . ' ' . sprintf ( __ ( 'See %sCloudFlare Knowledge Base%s.', 'wp-piwik' ), '<a href="https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode-" target="_BLANK">', '</a>' ), 'wp-piwik' ) );
|
330 |
+
|
331 |
+
$this->showInput ( 'track_cdnurl', __ ( 'CDN URL', 'wp-piwik' ).' http://', 'Enter URL if you want to load the tracking code via CDN.' );
|
332 |
+
|
333 |
+
$this->showInput ( 'track_cdnurlssl', __ ( 'CDN URL (SSL)', 'wp-piwik' ).' https://', 'Enter URL if you want to load the tracking code via a separate SSL CDN.' );
|
334 |
+
|
335 |
+
$this->showSelect ( 'force_protocol', __ ( 'Force Matomo to use a specific protocol', 'wp-piwik' ), array (
|
336 |
+
'disabled' => __ ( 'Disabled (default)', 'wp-piwik' ),
|
337 |
+
'http' => __ ( 'http', 'wp-piwik' ),
|
338 |
+
'https' => __ ( 'https (SSL)', 'wp-piwik' )
|
339 |
+
), __ ( 'Choose if you want to explicitly force Matomo to use HTTP or HTTPS. Does not work with a CDN URL.', 'wp-piwik' ) );
|
340 |
+
|
341 |
+
$this->showSelect ( 'update_notice', __ ( 'Update notice', 'wp-piwik' ), array (
|
342 |
+
'enabled' => __ ( 'Show always if WP-Matomo is updated', 'wp-piwik' ),
|
343 |
+
'script' => __ ( 'Show only if WP-Matomo is updated and settings were changed', 'wp-piwik' ),
|
344 |
+
'disabled' => __ ( 'Disabled', 'wp-piwik' )
|
345 |
+
), __ ( 'Choose if you want to get an update notice if WP-Matomo is updated.', 'wp-piwik' ) );
|
346 |
+
|
347 |
+
$this->showInput ( 'set_download_extensions', __ ( 'Define all file types for download tracking', 'wp-piwik' ), __ ( 'Replace Matomo\'s default file extensions for download tracking, divided by a vertical bar (|). Leave blank to keep Matomo\'s default settings.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#file-extensions-for-tracking-downloads" target="_BLANK">', '</a>' ) );
|
348 |
+
|
349 |
+
$this->showInput ( 'set_download_classes', __ ( 'Set classes to be treated as downloads', 'wp-piwik' ), __ ( 'Set classes to be treated as downloads (in addition to piwik_download), divided by a vertical bar (|). Leave blank to keep Matomo\'s default settings.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo JavaScript Tracking Client reference%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/api-reference/tracking-javascript" target="_BLANK">', '</a>' ) );
|
350 |
+
|
351 |
+
$this->showInput ( 'set_link_classes', __ ( 'Set classes to be treated as outlinks', 'wp-piwik' ), __ ( 'Set classes to be treated as outlinks (in addition to piwik_link), divided by a vertical bar (|). Leave blank to keep Matomo\'s default settings.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo JavaScript Tracking Client reference%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/api-reference/tracking-javascript" target="_BLANK">', '</a>' ) );
|
352 |
+
|
353 |
+
echo $submitButton;
|
354 |
+
?>
|
355 |
+
</tbody>
|
356 |
+
</table>
|
357 |
+
<table id="support" class="wp-piwik_menu-tab hidden">
|
358 |
+
<tbody>
|
359 |
+
<tr><td colspan="2"><?php
|
360 |
+
echo $this->showSupport();
|
361 |
+
?></td></tr>
|
362 |
+
</tbody>
|
363 |
+
</table>
|
364 |
+
<table id="credits" class="wp-piwik_menu-tab hidden">
|
365 |
+
<tbody>
|
366 |
+
<tr><td colspan="2"><?php
|
367 |
+
echo $this->showCredits();
|
368 |
+
?></td></tr>
|
369 |
+
</tbody>
|
370 |
+
</table>
|
371 |
+
<input type="hidden" name="wp-piwik[proxy_url]"
|
372 |
+
value="<?php echo self::$settings->getGlobalOption('proxy_url'); ?>" />
|
373 |
+
</form>
|
374 |
+
</div>
|
375 |
+
<?php
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Show an option's description
|
380 |
+
*
|
381 |
+
* @param string $id option id
|
382 |
+
* @param string $description option description
|
383 |
+
* @param boolean $hideDescription set to false to show description initially (default: true)
|
384 |
+
* @return string full description HTML
|
385 |
+
*/
|
386 |
+
private function getDescription($id, $description, $hideDescription = true) {
|
387 |
+
return sprintf ( '<span class="dashicons dashicons-editor-help" onclick="$j(\'#%s-desc\').toggleClass(\'hidden\');"></span> <p class="description' . ($hideDescription ? ' hidden' : '') . '" id="%1$s-desc">%s</p>', $id, $description );
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Show a checkbox option
|
392 |
+
*
|
393 |
+
* @param string $id option id
|
394 |
+
* @param string $name descriptive option name
|
395 |
+
* @param string $description option description
|
396 |
+
* @param boolean $isHidden set to true to initially hide the option (default: false)
|
397 |
+
* @param string $groupName define a class name to access a group of option rows by javascript (default: empty)
|
398 |
+
* @param boolean $hideDescription $hideDescription set to false to show description initially (default: true)
|
399 |
+
* @param string $onChange javascript for onchange event (default: empty)
|
400 |
+
*/
|
401 |
+
private function showCheckbox($id, $name, $description, $isHidden = false, $groupName = '', $hideDescription = true, $onChange = '') {
|
402 |
+
printf ( '<tr class="' . $groupName . ($isHidden ? ' hidden' : '') . '"><th scope="row"><label for="%2$s">%s</label>:</th><td><input type="checkbox" value="1"' . (self::$settings->getGlobalOption ( $id ) ? ' checked="checked"' : '') . ' onchange="$j(\'#%s\').val(this.checked?1:0);%s" /><input id="%2$s" type="hidden" name="wp-piwik[%2$s]" value="' . ( int ) self::$settings->getGlobalOption ( $id ) . '" /> %s</td></tr>', $name, $id, $onChange, $this->getDescription ( $id, $description, $hideDescription ) );
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Show a textarea option
|
407 |
+
*
|
408 |
+
* @param string $id option id
|
409 |
+
* @param string $name descriptive option name
|
410 |
+
* @param int $rows number of rows to show
|
411 |
+
* @param string $description option description
|
412 |
+
* @param boolean $isHidden set to true to initially hide the option (default: false)
|
413 |
+
* @param string $groupName define a class name to access a group of option rows by javascript (default: empty)
|
414 |
+
* @param boolean $hideDescription $hideDescription set to false to show description initially (default: true)
|
415 |
+
* @param string $onChange javascript for onchange event (default: empty)
|
416 |
+
* @param boolean $isReadonly set textarea to read only (default: false)
|
417 |
+
* @param boolean $global set to false if the textarea shows a site-specific option (default: true)
|
418 |
+
*/
|
419 |
+
private function showTextarea($id, $name, $rows, $description, $isHidden, $groupName, $hideDescription = true, $onChange = '', $isReadonly = false, $global = true) {
|
420 |
+
printf (
|
421 |
+
'<tr class="' . $groupName . ($isHidden ? ' hidden' : '') . '"><th scope="row"><label for="%2$s">%s</label>:</th><td><textarea cols="80" rows="' . $rows . '" id="%s" name="wp-piwik[%2$s]" onchange="%s"' . ($isReadonly ? ' readonly="readonly"' : '') . '>%s</textarea> %s</td></tr>', $name, $id, $onChange, ($global ? self::$settings->getGlobalOption ( $id ) : self::$settings->getOption ( $id )), $this->getDescription ( $id, $description, $hideDescription ) );
|
422 |
+
}
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Show a simple text
|
426 |
+
*
|
427 |
+
* @param string $text Text to show
|
428 |
+
*/
|
429 |
+
private function showText($text) {
|
430 |
+
printf ( '<tr><td colspan="2"><p>%s</p></td></tr>', $text );
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Show an input option
|
435 |
+
*
|
436 |
+
* @param string $id option id
|
437 |
+
* @param string $name descriptive option name
|
438 |
+
* @param string $description option description
|
439 |
+
* @param boolean $isHidden set to true to initially hide the option (default: false)
|
440 |
+
* @param string $groupName define a class name to access a group of option rows by javascript (default: empty)
|
441 |
+
* @param string $rowName define a class name to access the specific option row by javascript (default: empty)
|
442 |
+
* @param boolean $hideDescription $hideDescription set to false to show description initially (default: true)
|
443 |
+
* @param boolean $wide Create a wide box (default: false)
|
444 |
+
*/
|
445 |
+
private function showInput($id, $name, $description, $isHidden = false, $groupName = '', $rowName = false, $hideDescription = true, $wide = false) {
|
446 |
+
printf ( '<tr class="%s%s"%s><th scope="row"><label for="%5$s">%s:</label></th><td><input '.($wide?'class="wp-piwik-wide" ':'').'name="wp-piwik[%s]" id="%5$s" value="%s" /> %s</td></tr>', $isHidden ? 'hidden ' : '', $groupName ? $groupName : '', $rowName ? ' id="' . $groupName . '-' . $rowName . '"' : '', $name, $id, htmlentities(self::$settings->getGlobalOption( $id ), ENT_QUOTES, 'UTF-8', false), !empty($description) ? $this->getDescription ( $id, $description, $hideDescription ) : '' );
|
447 |
+
}
|
448 |
+
|
449 |
+
/**
|
450 |
+
* Show a select box option
|
451 |
+
*
|
452 |
+
* @param string $id option id
|
453 |
+
* @param string $name descriptive option name
|
454 |
+
* @param array $options list of options to show array[](option id => descriptive name)
|
455 |
+
* @param string $description option description
|
456 |
+
* @param string $onChange javascript for onchange event (default: empty)
|
457 |
+
* @param boolean $isHidden set to true to initially hide the option (default: false)
|
458 |
+
* @param string $groupName define a class name to access a group of option rows by javascript (default: empty)
|
459 |
+
* @param boolean $hideDescription $hideDescription set to false to show description initially (default: true)
|
460 |
+
* @param boolean $global set to false if the textarea shows a site-specific option (default: true)
|
461 |
+
*/
|
462 |
+
private function showSelect($id, $name, $options = array(), $description = '', $onChange = '', $isHidden = false, $groupName = '', $hideDescription = true, $global = true) {
|
463 |
+
$optionList = '';
|
464 |
+
$default = $global ? self::$settings->getGlobalOption ( $id ) : self::$settings->getOption ( $id );
|
465 |
+
if (is_array ( $options ))
|
466 |
+
foreach ( $options as $key => $value )
|
467 |
+
$optionList .= sprintf ( '<option value="%s"' . ($key == $default ? ' selected="selected"' : '') . '>%s</option>', $key, $value );
|
468 |
+
printf ( '<tr class="' . $groupName . ($isHidden ? ' hidden' : '') . '"><th scope="row"><label for="%2$s">%s:</label></th><td><select name="wp-piwik[%s]" id="%2$s" onchange="%s">%s</select> %s</td></tr>', $name, $id, $onChange, $optionList, $this->getDescription ( $id, $description, $hideDescription ) );
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* Show an info box
|
473 |
+
*
|
474 |
+
* @param string $type box style (e.g., updated, error)
|
475 |
+
* @param string $icon box icon, see https://developer.wordpress.org/resource/dashicons/
|
476 |
+
* @param string $content box message
|
477 |
+
*/
|
478 |
+
private function showBox($type, $icon, $content) {
|
479 |
+
printf ( '<tr><td colspan="2"><div class="%s"><p><span class="dashicons dashicons-%s"></span> %s</p></div></td></tr>', $type, $icon, $content );
|
480 |
+
}
|
481 |
+
|
482 |
+
/**
|
483 |
+
* Show headline
|
484 |
+
* @param int $order headline order (h?-tag), set to 0 to avoid headline-tagging
|
485 |
+
* @param string $icon headline icon, see https://developer.wordpress.org/resource/dashicons/
|
486 |
+
* @param string $headline headline text
|
487 |
+
* @param string $addPluginName set to true to add the plugin name to the headline (default: false)
|
488 |
+
*/
|
489 |
+
private function showHeadline($order, $icon, $headline, $addPluginName = false) {
|
490 |
+
echo $this->getHeadline ( $order, $icon, $headline, $addPluginName = false );
|
491 |
+
}
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Get headline HTML
|
495 |
+
*
|
496 |
+
* @param int $order headline order (h?-tag), set to 0 to avoid headline-tagging
|
497 |
+
* @param string $icon headline icon, see https://developer.wordpress.org/resource/dashicons/
|
498 |
+
* @param string $headline headline text
|
499 |
+
* @param string $addPluginName set to true to add the plugin name to the headline (default: false)
|
500 |
+
*/
|
501 |
+
private function getHeadline($order, $icon, $headline, $addPluginName = false) {
|
502 |
+
echo ($order > 0 ? "<h$order>" : '') . sprintf ( '<span class="dashicons dashicons-%s"></span> %s%s', $icon, ($addPluginName ? self::$settings->getGlobalOption ( 'plugin_display_name' ) . ' ' : ''), __ ( $headline, 'wp-piwik' ) ) . ($order > 0 ? "</h$order>" : '');
|
503 |
+
}
|
504 |
+
|
505 |
+
/**
|
506 |
+
* Show donation info
|
507 |
+
*/
|
508 |
+
private function showDonation() {
|
509 |
+
?>
|
510 |
+
<div class="wp-piwik-donate">
|
511 |
+
<p>
|
512 |
+
<strong><?php _e('Donate','wp-piwik'); ?></strong>
|
513 |
+
</p>
|
514 |
+
<p>
|
515 |
+
<?php _e('If you like WP-Matomo, you can support its development by a donation:', 'wp-piwik'); ?>
|
516 |
+
</p>
|
517 |
+
<div>
|
518 |
+
<script id='fb0ahsp'>(function(i){var f,s=document.getElementById(i);f=document.createElement('iframe');f.src='//button.flattr.com/view/?fid=mkdp7z&url=https%3A%2F%2Fwww.braekling.de%2Fwp-piwik-wpmu-piwik-wordpress';f.title='Flattr';f.height=62;f.width=55;f.style.borderWidth=0;s.parentNode.insertBefore(f,s);})('fb0ahsp');</script>
|
519 |
+
</div>
|
520 |
+
<div>
|
521 |
+
Paypal
|
522 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
523 |
+
<input type="hidden" name="cmd" value="_s-xclick" />
|
524 |
+
<input type="hidden" name="hosted_button_id" value="6046779" />
|
525 |
+
<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." />
|
526 |
+
<img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1" />
|
527 |
+
</form>
|
528 |
+
</div>
|
529 |
+
<div>
|
530 |
+
<a href="bitcoin:32FMBngRne9wQ7XPFP2CfR25tjp3oa4roN">Bitcoin<br />
|
531 |
+
<img style="border:none;" src="<?php echo self::$wpPiwik->getPluginURL(); ?>bitcoin.png" width="100" height="100" alt="Bitcoin Address" title="32FMBngRne9wQ7XPFP2CfR25tjp3oa4roN" /></a>
|
532 |
+
</div>
|
533 |
+
<div>
|
534 |
+
<a href="http://www.amazon.de/gp/registry/wishlist/111VUJT4HP1RA?reveal=unpurchased&filter=all&sort=priority&layout=standard&x=12&y=14"><?php _e('My Amazon.de wishlist', 'wp-piwik'); ?></a>
|
535 |
+
</div>
|
536 |
+
<div>
|
537 |
+
<?php _e('Please don\'t forget to vote the compatibility at the','wp-piwik'); ?> <a target="_BLANK" href="http://wordpress.org/extend/plugins/wp-piwik/">WordPress.org Plugin Directory</a>.
|
538 |
+
</div>
|
539 |
+
</div><?php
|
540 |
+
}
|
541 |
+
|
542 |
+
/**
|
543 |
+
* Register admin scripts
|
544 |
+
*
|
545 |
+
* @see \WP_Piwik\Admin::printAdminScripts()
|
546 |
+
*/
|
547 |
+
public function printAdminScripts() {
|
548 |
+
wp_enqueue_script ( 'jquery' );
|
549 |
+
}
|
550 |
+
|
551 |
+
/**
|
552 |
+
* Extend admin header
|
553 |
+
*
|
554 |
+
* @see \WP_Piwik\Admin::extendAdminHeader()
|
555 |
+
*/
|
556 |
+
public function extendAdminHeader() {
|
557 |
+
echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
|
558 |
+
}
|
559 |
+
|
560 |
+
/**
|
561 |
+
* Show credits
|
562 |
+
*/
|
563 |
+
public function showCredits() {
|
564 |
+
?>
|
565 |
+
<p><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., Daniel K., James L., Jochen K., Cyril P., Thomas K., Patrik K., Zach, Sebastian W., Peakkom, Patrik K., Kati K., Helmut O., Valerie S., Jochen D., Atlas R., Harald W., Jan M., Addy K., Hans-Georg E.-B., Yvonne K., Andrew D., Nicolas, J., Andre M., Steve J., Jakub P., ditho.berlin, Robert R., Simon B., Grzegorz O., Bjarne O., <?php _e('the Matomo team itself','wp-piwik');?><?php _e(', and all people flattering this','wp-piwik'); ?>!</p>
|
566 |
+
<p><?php _e('Graphs powered by <a href="http://www.jqplot.com/" target="_BLANK">jqPlot</a> (License: GPL 2.0 and MIT) and <a href="http://omnipotent.net/jquery.sparkline/" target="_BLANK">jQuery Sparklines</a> (License: New BSD License).','wp-piwik'); ?></p>
|
567 |
+
<p><?php _e('Thank you very much','wp-piwik'); ?>, <?php _e('Transifex and WordPress translation community for your translation work.','wp-piwik'); ?>!</p>
|
568 |
+
<p><?php _e('Thank you very much, all users who send me mails containing criticism, commendation, feature requests and bug reports! You help me to make WP-Matomo much better.','wp-piwik'); ?></p>
|
569 |
+
<p><?php _e('Thank <strong>you</strong> for using my plugin. It is the best commendation if my piece of code is really used!','wp-piwik'); ?></p>
|
570 |
+
<?php
|
571 |
+
}
|
572 |
+
|
573 |
+
/**
|
574 |
+
* Show support information
|
575 |
+
*/
|
576 |
+
public function showSupport() {
|
577 |
+
?><ul>
|
578 |
+
<li><?php _e('The best place to get help:', 'wp-piwik'); ?> <a href="https://wordpress.org/support/plugin/wp-piwik" target="_BLANK"><?php _e('WP-Matomo support forum','wp-piwik'); ?></a></li>
|
579 |
+
<li><?php _e('Please don\'t forget to vote the compatibility at the','wp-piwik'); ?> <a href="http://wordpress.org/extend/plugins/wp-piwik/" target="_BLANK">WordPress.org Plugin Directory</a>.</li>
|
580 |
+
</ul>
|
581 |
+
<h3><?php _e('Debugging', 'wp-piwik'); ?></h3>
|
582 |
+
<p><?php _e('Either allow_url_fopen has to be enabled <em>or</em> cURL has to be available:', 'wp-piwik'); ?></p>
|
583 |
+
<ol>
|
584 |
+
<li><?php
|
585 |
+
_e('cURL is','wp-piwik');
|
586 |
+
echo ' <strong>'.(function_exists('curl_init')?'':__('not','wp-piwik')).' ';
|
587 |
+
_e('available','wp-piwik');
|
588 |
+
?></strong>.</li>
|
589 |
+
<li><?php
|
590 |
+
_e('allow_url_fopen is','wp-piwik');
|
591 |
+
echo ' <strong>'.(ini_get('allow_url_fopen')?'':__('not','wp-piwik')).' ';
|
592 |
+
_e('enabled','wp-piwik');
|
593 |
+
?></strong>.</li>
|
594 |
+
<li><strong><?php echo (((function_exists('curl_init') && ini_get('allow_url_fopen') && self::$settings->getGlobalOption('http_connection') == 'curl') || (function_exists('curl_init') && !ini_get('allow_url_fopen')))?__('cURL', 'wp-piwik'):__('fopen', 'wp-piwik')).' ('.(self::$settings->getGlobalOption('http_method')=='post'?__('POST','wp-piwik'):__('GET','wp-piwik')).')</strong> '.__('is used.', 'wp-piwik'); ?></li>
|
595 |
+
<?php if (self::$settings->getGlobalOption('piwik_mode') == 'php') { ?><li><?php
|
596 |
+
_e('Determined Matomo base URL is', 'wp-piwik');
|
597 |
+
echo ' <strong>'.(self::$settings->getGlobalOption('proxy_url')).'</strong>';
|
598 |
+
?></li><?php } ?>
|
599 |
+
</ol>
|
600 |
+
<p><?php _e('Tools', 'wp-piwik'); ?>:</p>
|
601 |
+
<ol>
|
602 |
+
<li><a href="<?php echo admin_url( (self::$settings->checkNetworkActivation () ? 'network/settings' : 'options-general').'.php?page='.$_GET['page'].'&testscript=1' ); ?>"><?php _e('Run testscript', 'wp-piwik'); ?></a></li>
|
603 |
+
<li><a href="<?php echo admin_url( (self::$settings->checkNetworkActivation () ? 'network/settings' : 'options-general').'.php?page='.$_GET['page'].'&sitebrowser=1' ); ?>"><?php _e('Sitebrowser', 'wp-piwik'); ?></a></li>
|
604 |
+
<li><a href="<?php echo admin_url( (self::$settings->checkNetworkActivation () ? 'network/settings' : 'options-general').'.php?page='.$_GET['page'].'&clear=1' ); ?>"><?php _e('Clear cache', 'wp-piwik'); ?></a></li>
|
605 |
+
<li><a onclick="return confirm('<?php _e('Are you sure you want to clear all settings?', 'wp-piwik'); ?>')" href="<?php echo admin_url( (self::$settings->checkNetworkActivation () ? 'network/settings' : 'options-general').'.php?page='.$_GET['page'].'&clear=2' ); ?>"><?php _e('Reset WP-Matomo', 'wp-piwik'); ?></a></li>
|
606 |
+
</ol>
|
607 |
+
<h3><?php _e('Latest support threads on WordPress.org', 'wp-piwik'); ?></h3><?php
|
608 |
+
$supportThreads = $this->readRSSFeed('http://wordpress.org/support/rss/plugin/wp-piwik');
|
609 |
+
if (!empty($supportThreads)) {
|
610 |
+
echo '<ol>';
|
611 |
+
foreach ($supportThreads as $supportThread)
|
612 |
+
echo '<li><a href="'.$supportThread['url'].'">'.$supportThread['title'].'</a></li>';
|
613 |
+
echo '</ol>';
|
614 |
+
}
|
615 |
+
}
|
616 |
+
|
617 |
+
/**
|
618 |
+
* Read RSS feed
|
619 |
+
*
|
620 |
+
* @param string $feed
|
621 |
+
* feed URL
|
622 |
+
* @param int $cnt
|
623 |
+
* item limit
|
624 |
+
* @return array feed items array[](title, url)
|
625 |
+
*
|
626 |
+
*/
|
627 |
+
private function readRSSFeed($feed, $cnt = 5) {
|
628 |
+
$result = array ();
|
629 |
+
if (function_exists ( 'simplexml_load_file' ) && ! empty ( $feed )) {
|
630 |
+
$xml = @simplexml_load_file ( $feed );
|
631 |
+
if (! $xml || ! isset ( $xml->channel [0]->item ))
|
632 |
+
return array (
|
633 |
+
array (
|
634 |
+
'title' => 'Can\'t read RSS feed.',
|
635 |
+
'url' => $xml
|
636 |
+
)
|
637 |
+
);
|
638 |
+
foreach ( $xml->channel [0]->item as $item ) {
|
639 |
+
if ($cnt -- == 0)
|
640 |
+
break;
|
641 |
+
$result [] = array (
|
642 |
+
'title' => $item->title [0],
|
643 |
+
'url' => $item->link [0]
|
644 |
+
);
|
645 |
+
}
|
646 |
+
}
|
647 |
+
return $result;
|
648 |
+
}
|
649 |
+
|
650 |
+
/**
|
651 |
+
* Clear cache and reset settings
|
652 |
+
*
|
653 |
+
* @param boolean $clearSettings set to true to reset settings (default: false)
|
654 |
+
*/
|
655 |
+
private function clear($clearSettings = false) {
|
656 |
+
if ($clearSettings) {
|
657 |
+
self::$settings->resetSettings();
|
658 |
+
$this->showBox ( 'updated', 'yes', __ ( 'Settings cleared (except connection settings).' ) );
|
659 |
+
}
|
660 |
+
global $wpdb;
|
661 |
+
if (self::$settings->checkNetworkActivation()) {
|
662 |
+
$aryBlogs = \WP_Piwik\Settings::getBlogList();
|
663 |
+
if (is_array($aryBlogs))
|
664 |
+
foreach ($aryBlogs as $aryBlog) {
|
665 |
+
switch_to_blog($aryBlog['blog_id']);
|
666 |
+
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_wp-piwik_%'");
|
667 |
+
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_wp-piwik_%'");
|
668 |
+
restore_current_blog();
|
669 |
+
}
|
670 |
+
} else {
|
671 |
+
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_wp-piwik_%'");
|
672 |
+
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_wp-piwik_%'");
|
673 |
+
}
|
674 |
+
$this->showBox ( 'updated', 'yes', __ ( 'Cache cleared.' ) );
|
675 |
+
}
|
676 |
+
|
677 |
+
/**
|
678 |
+
* Execute test script and display results
|
679 |
+
*/
|
680 |
+
private function runTestscript() { ?>
|
681 |
+
<div class="wp-piwik-debug">
|
682 |
+
<h2>Testscript Result</h2>
|
683 |
+
<?php
|
684 |
+
if (self::$wpPiwik->isConfigured()) {
|
685 |
+
if (isset($_GET['testscript_id']) && $_GET['testscript_id'])
|
686 |
+
switch_to_blog((int) $_GET['testscript_id']);
|
687 |
+
?>
|
688 |
+
<textarea cols="80" rows="10"><?php
|
689 |
+
echo '`WP-Matomo '.self::$wpPiwik->getPluginVersion()."\nMode: ".self::$settings->getGlobalOption('piwik_mode')."\n\n";
|
690 |
+
?>Test 1/3: global.getPiwikVersion<?php
|
691 |
+
$GLOBALS ['wp-piwik_debug'] = true;
|
692 |
+
$id = \WP_Piwik\Request::register ( 'API.getPiwikVersion', array() );
|
693 |
+
echo "\n\n"; var_dump( self::$wpPiwik->request( $id ) ); echo "\n";
|
694 |
+
var_dump( self::$wpPiwik->request( $id, true ) ); echo "\n";
|
695 |
+
$GLOBALS ['wp-piwik_debug'] = false;
|
696 |
+
?>Test 2/3: SitesManager.getSitesWithAtLeastViewAccess<?php
|
697 |
+
$GLOBALS ['wp-piwik_debug'] = true;
|
698 |
+
$id = \WP_Piwik\Request::register ( 'SitesManager.getSitesWithAtLeastViewAccess', array() );
|
699 |
+
echo "\n\n"; var_dump( self::$wpPiwik->request( $id ) ); echo "\n";
|
700 |
+
var_dump( self::$wpPiwik->request( $id, true ) ); echo "\n";
|
701 |
+
$GLOBALS ['wp-piwik_debug'] = false;
|
702 |
+
?>Test 3/3: SitesManager.getSitesIdFromSiteUrl<?php
|
703 |
+
$GLOBALS ['wp-piwik_debug'] = true;
|
704 |
+
$id = \WP_Piwik\Request::register ( 'SitesManager.getSitesIdFromSiteUrl', array (
|
705 |
+
'url' => get_bloginfo ( 'url' )
|
706 |
+
) );
|
707 |
+
echo "\n\n"; var_dump( self::$wpPiwik->request( $id ) ); echo "\n";
|
708 |
+
var_dump( self::$wpPiwik->request( $id, true ) ); echo "\n";
|
709 |
+
echo "\n\n"; var_dump( self::$settings->getDebugData() ); echo "`";
|
710 |
+
$GLOBALS ['wp-piwik_debug'] = false;
|
711 |
+
?></textarea>
|
712 |
+
<?php
|
713 |
+
if (isset($_GET['testscript_id']) && $_GET['testscript_id'])
|
714 |
+
restore_current_blog();
|
715 |
+
} else echo '<p>Please configure WP-Matomo first.</p>';
|
716 |
+
?>
|
717 |
+
</div>
|
718 |
+
<?php }
|
719 |
+
|
720 |
+
}
|
classes/WP_Piwik/Admin/Sitebrowser.php
CHANGED
@@ -1,112 +1,112 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WP_Piwik\Admin;
|
4 |
-
|
5 |
-
if (! class_exists ( 'WP_List_Table' ))
|
6 |
-
require_once (ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
7 |
-
|
8 |
-
class Sitebrowser extends \WP_List_Table {
|
9 |
-
|
10 |
-
private $data = array (), $wpPiwik;
|
11 |
-
|
12 |
-
public function __construct($wpPiwik) {
|
13 |
-
$this->wpPiwik = $wpPiwik;
|
14 |
-
if( isset($_POST['s']) ){
|
15 |
-
$cnt = $this->prepare_items ($_POST['s']);
|
16 |
-
} else {
|
17 |
-
$cnt = $this->prepare_items ();
|
18 |
-
}
|
19 |
-
global $status, $page;
|
20 |
-
$this->showSearchForm();
|
21 |
-
parent::__construct ( array (
|
22 |
-
'singular' => __ ( 'site', 'wp-piwik' ),
|
23 |
-
'plural' => __ ( 'sites', 'wp-piwik' ),
|
24 |
-
'ajax' => false
|
25 |
-
) );
|
26 |
-
if ($cnt > 0)
|
27 |
-
$this->display ();
|
28 |
-
else
|
29 |
-
echo '<p>' . __ ( 'No site configured yet.', 'wp-piwik' ) . '</p>';
|
30 |
-
}
|
31 |
-
|
32 |
-
public function get_columns() {
|
33 |
-
$columns = array (
|
34 |
-
'id' => __ ( 'Blog ID', 'wp-piwik' ),
|
35 |
-
'name' => __ ( 'Title', 'wp-piwik' ),
|
36 |
-
'siteurl' => __ ( 'URL', 'wp-piwik' ),
|
37 |
-
'piwikid' => __ ( 'Site ID (Piwik)', 'wp-piwik' )
|
38 |
-
);
|
39 |
-
return $columns;
|
40 |
-
}
|
41 |
-
|
42 |
-
public function prepare_items($search = '') {
|
43 |
-
$current_page = $this->get_pagenum ();
|
44 |
-
$per_page = 10;
|
45 |
-
global $blog_id;
|
46 |
-
global $wpdb;
|
47 |
-
global $pagenow;
|
48 |
-
if (is_plugin_active_for_network ( 'wp-piwik/wp-piwik.php' )) {
|
49 |
-
$total_items = $wpdb->get_var ( $wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->blogs . ' WHERE CONCAT(domain, path) LIKE "%%%s%%" AND spam = 0 AND deleted = 0', $search));
|
50 |
-
$blogs = \WP_Piwik\Settings::getBlogList($per_page, $current_page, $search);
|
51 |
-
foreach ( $blogs as $blog ) {
|
52 |
-
$blogDetails = get_blog_details ( $blog['blog_id'], true );
|
53 |
-
$this->data [] = array (
|
54 |
-
'name' => $blogDetails->blogname,
|
55 |
-
'id' => $blogDetails->blog_id,
|
56 |
-
'siteurl' => $blogDetails->siteurl,
|
57 |
-
'piwikid' => $this->wpPiwik->getPiwikSiteId ( $blogDetails->blog_id )
|
58 |
-
);
|
59 |
-
}
|
60 |
-
} else {
|
61 |
-
$blogDetails = get_bloginfo ();
|
62 |
-
$this->data [] = array (
|
63 |
-
'name' => get_bloginfo ( 'name' ),
|
64 |
-
'id' => '-',
|
65 |
-
'siteurl' => get_bloginfo ( 'url' ),
|
66 |
-
'piwikid' => $this->wpPiwik->getPiwikSiteId ()
|
67 |
-
);
|
68 |
-
$total_items = 1;
|
69 |
-
}
|
70 |
-
$columns = $this->get_columns ();
|
71 |
-
$hidden = array ();
|
72 |
-
$sortable = array ();
|
73 |
-
$this->_column_headers = array (
|
74 |
-
$columns,
|
75 |
-
$hidden,
|
76 |
-
$sortable
|
77 |
-
);
|
78 |
-
$this->set_pagination_args ( array (
|
79 |
-
'total_items' => $total_items,
|
80 |
-
'per_page' => $per_page
|
81 |
-
) );
|
82 |
-
foreach ( $this->data as $key => $dataset ) {
|
83 |
-
if (empty ( $dataset ['piwikid'] ) || $dataset ['piwikid'] == 'n/a')
|
84 |
-
$this->data [$key] ['piwikid'] = __ ( 'Site not created yet.', 'wp-piwik' );
|
85 |
-
if ($this->wpPiwik->isNetworkMode ())
|
86 |
-
$this->data [$key] ['name'] = '<a href="index.php?page=wp-piwik_stats&wpmu_show_stats=' . $dataset ['id'] . '">' . $dataset ['name'] . '</a>';
|
87 |
-
}
|
88 |
-
$this->items = $this->data;
|
89 |
-
return count ( $this->items );
|
90 |
-
}
|
91 |
-
|
92 |
-
public function column_default($item, $column_name) {
|
93 |
-
switch ($column_name) {
|
94 |
-
case 'id' :
|
95 |
-
case 'name' :
|
96 |
-
case 'siteurl' :
|
97 |
-
case 'piwikid' :
|
98 |
-
return $item [$column_name];
|
99 |
-
default :
|
100 |
-
return print_r ( $item, true );
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
private function showSearchForm() {
|
105 |
-
?>
|
106 |
-
<form method="post">
|
107 |
-
<input type="hidden" name="page" value="<?php echo filter_var($_REQUEST['page'], FILTER_SANITIZE_STRING) ?>" />
|
108 |
-
<?php $this->search_box('Search domain and path', 'wpPiwikSiteSearch'); ?>
|
109 |
-
</form>
|
110 |
-
<?php
|
111 |
-
}
|
112 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WP_Piwik\Admin;
|
4 |
+
|
5 |
+
if (! class_exists ( 'WP_List_Table' ))
|
6 |
+
require_once (ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
7 |
+
|
8 |
+
class Sitebrowser extends \WP_List_Table {
|
9 |
+
|
10 |
+
private $data = array (), $wpPiwik;
|
11 |
+
|
12 |
+
public function __construct($wpPiwik) {
|
13 |
+
$this->wpPiwik = $wpPiwik;
|
14 |
+
if( isset($_POST['s']) ){
|
15 |
+
$cnt = $this->prepare_items ($_POST['s']);
|
16 |
+
} else {
|
17 |
+
$cnt = $this->prepare_items ();
|
18 |
+
}
|
19 |
+
global $status, $page;
|
20 |
+
$this->showSearchForm();
|
21 |
+
parent::__construct ( array (
|
22 |
+
'singular' => __ ( 'site', 'wp-piwik' ),
|
23 |
+
'plural' => __ ( 'sites', 'wp-piwik' ),
|
24 |
+
'ajax' => false
|
25 |
+
) );
|
26 |
+
if ($cnt > 0)
|
27 |
+
$this->display ();
|
28 |
+
else
|
29 |
+
echo '<p>' . __ ( 'No site configured yet.', 'wp-piwik' ) . '</p>';
|
30 |
+
}
|
31 |
+
|
32 |
+
public function get_columns() {
|
33 |
+
$columns = array (
|
34 |
+
'id' => __ ( 'Blog ID', 'wp-piwik' ),
|
35 |
+
'name' => __ ( 'Title', 'wp-piwik' ),
|
36 |
+
'siteurl' => __ ( 'URL', 'wp-piwik' ),
|
37 |
+
'piwikid' => __ ( 'Site ID (Piwik)', 'wp-piwik' )
|
38 |
+
);
|
39 |
+
return $columns;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function prepare_items($search = '') {
|
43 |
+
$current_page = $this->get_pagenum ();
|
44 |
+
$per_page = 10;
|
45 |
+
global $blog_id;
|
46 |
+
global $wpdb;
|
47 |
+
global $pagenow;
|
48 |
+
if (is_plugin_active_for_network ( 'wp-piwik/wp-piwik.php' )) {
|
49 |
+
$total_items = $wpdb->get_var ( $wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->blogs . ' WHERE CONCAT(domain, path) LIKE "%%%s%%" AND spam = 0 AND deleted = 0', $search));
|
50 |
+
$blogs = \WP_Piwik\Settings::getBlogList($per_page, $current_page, $search);
|
51 |
+
foreach ( $blogs as $blog ) {
|
52 |
+
$blogDetails = get_blog_details ( $blog['blog_id'], true );
|
53 |
+
$this->data [] = array (
|
54 |
+
'name' => $blogDetails->blogname,
|
55 |
+
'id' => $blogDetails->blog_id,
|
56 |
+
'siteurl' => $blogDetails->siteurl,
|
57 |
+
'piwikid' => $this->wpPiwik->getPiwikSiteId ( $blogDetails->blog_id )
|
58 |
+
);
|
59 |
+
}
|
60 |
+
} else {
|
61 |
+
$blogDetails = get_bloginfo ();
|
62 |
+
$this->data [] = array (
|
63 |
+
'name' => get_bloginfo ( 'name' ),
|
64 |
+
'id' => '-',
|
65 |
+
'siteurl' => get_bloginfo ( 'url' ),
|
66 |
+
'piwikid' => $this->wpPiwik->getPiwikSiteId ()
|
67 |
+
);
|
68 |
+
$total_items = 1;
|
69 |
+
}
|
70 |
+
$columns = $this->get_columns ();
|
71 |
+
$hidden = array ();
|
72 |
+
$sortable = array ();
|
73 |
+
$this->_column_headers = array (
|
74 |
+
$columns,
|
75 |
+
$hidden,
|
76 |
+
$sortable
|
77 |
+
);
|
78 |
+
$this->set_pagination_args ( array (
|
79 |
+
'total_items' => $total_items,
|
80 |
+
'per_page' => $per_page
|
81 |
+
) );
|
82 |
+
foreach ( $this->data as $key => $dataset ) {
|
83 |
+
if (empty ( $dataset ['piwikid'] ) || $dataset ['piwikid'] == 'n/a')
|
84 |
+
$this->data [$key] ['piwikid'] = __ ( 'Site not created yet.', 'wp-piwik' );
|
85 |
+
if ($this->wpPiwik->isNetworkMode ())
|
86 |
+
$this->data [$key] ['name'] = '<a href="index.php?page=wp-piwik_stats&wpmu_show_stats=' . $dataset ['id'] . '">' . $dataset ['name'] . '</a>';
|
87 |
+
}
|
88 |
+
$this->items = $this->data;
|
89 |
+
return count ( $this->items );
|
90 |
+
}
|
91 |
+
|
92 |
+
public function column_default($item, $column_name) {
|
93 |
+
switch ($column_name) {
|
94 |
+
case 'id' :
|
95 |
+
case 'name' :
|
96 |
+
case 'siteurl' :
|
97 |
+
case 'piwikid' :
|
98 |
+
return $item [$column_name];
|
99 |
+
default :
|
100 |
+
return print_r ( $item, true );
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
private function showSearchForm() {
|
105 |
+
?>
|
106 |
+
<form method="post">
|
107 |
+
<input type="hidden" name="page" value="<?php echo filter_var($_REQUEST['page'], FILTER_SANITIZE_STRING) ?>" />
|
108 |
+
<?php $this->search_box('Search domain and path', 'wpPiwikSiteSearch'); ?>
|
109 |
+
</form>
|
110 |
+
<?php
|
111 |
+
}
|
112 |
}
|
classes/WP_Piwik/Admin/Statistics.php
CHANGED
File without changes
|
classes/WP_Piwik/Logger.php
CHANGED
File without changes
|
classes/WP_Piwik/Logger/Dummy.php
CHANGED
File without changes
|
classes/WP_Piwik/Logger/File.php
CHANGED
File without changes
|
classes/WP_Piwik/Logger/Screen.php
CHANGED
File without changes
|
classes/WP_Piwik/Request.php
CHANGED
File without changes
|
classes/WP_Piwik/Request/Php.php
CHANGED
@@ -11,8 +11,10 @@
|
|
11 |
$url = self::$settings->getGlobalOption('piwik_url');
|
12 |
foreach (self::$requests as $requestID => $config) {
|
13 |
if (!isset(self::$results[$requestID])) {
|
|
|
|
|
14 |
$params = 'module=API&format=json&'.$this->buildURL($config, true);
|
15 |
-
|
16 |
$result = $this->call($id, $url, $params);
|
17 |
self::$results[$map[$count]] = $result;
|
18 |
$count++;
|
11 |
$url = self::$settings->getGlobalOption('piwik_url');
|
12 |
foreach (self::$requests as $requestID => $config) {
|
13 |
if (!isset(self::$results[$requestID])) {
|
14 |
+
if (self::$settings->getGlobalOption('filter_limit') != "" && self::$settings->getGlobalOption('filter_limit') == (int) self::$settings->getGlobalOption('filter_limit'))
|
15 |
+
$config['parameter']['filter_limit'] = self::$settings->getGlobalOption('filter_limit');
|
16 |
$params = 'module=API&format=json&'.$this->buildURL($config, true);
|
17 |
+
$map[$count] = $requestID;
|
18 |
$result = $this->call($id, $url, $params);
|
19 |
self::$results[$map[$count]] = $result;
|
20 |
$count++;
|
classes/WP_Piwik/Request/Rest.php
CHANGED
@@ -6,12 +6,14 @@
|
|
6 |
|
7 |
protected function request($id) {
|
8 |
$count = 0;
|
9 |
-
|
10 |
-
self::$settings->getGlobalOption('piwik_url')
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
$params = 'module=API&method=API.getBulkRequest&format=json';
|
|
|
|
|
15 |
foreach (self::$requests as $requestID => $config) {
|
16 |
if (!isset(self::$results[$requestID])) {
|
17 |
$params .= '&urls['.$count.']='.urlencode($this->buildURL($config));
|
6 |
|
7 |
protected function request($id) {
|
8 |
$count = 0;
|
9 |
+
if (self::$settings->getGlobalOption('piwik_mode') == 'http')
|
10 |
+
$url = self::$settings->getGlobalOption('piwik_url');
|
11 |
+
else if (self::$settings->getGlobalOption('piwik_mode') == 'cloud')
|
12 |
+
$url = 'https://'.self::$settings->getGlobalOption('piwik_user').'.innocraft.cloud/';
|
13 |
+
else $url = 'https://'.self::$settings->getGlobalOption('matomo_user').'.matomo.cloud/';
|
14 |
$params = 'module=API&method=API.getBulkRequest&format=json';
|
15 |
+
if (self::$settings->getGlobalOption('filter_limit') != "" && self::$settings->getGlobalOption('filter_limit') == (int) self::$settings->getGlobalOption('filter_limit'))
|
16 |
+
$params .= '&filter_limit='.self::$settings->getGlobalOption('filter_limit');
|
17 |
foreach (self::$requests as $requestID => $config) {
|
18 |
if (!isset(self::$results[$requestID])) {
|
19 |
$params .= '&urls['.$count.']='.urlencode($this->buildURL($config));
|
classes/WP_Piwik/Settings.php
CHANGED
@@ -1,407 +1,408 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WP_Piwik;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Manage WP-Piwik settings
|
7 |
-
*
|
8 |
-
* @author André Bräkling
|
9 |
-
* @package WP_Piwik
|
10 |
-
*/
|
11 |
-
class Settings {
|
12 |
-
|
13 |
-
/**
|
14 |
-
*
|
15 |
-
* @var Environment variables and default settings container
|
16 |
-
*/
|
17 |
-
private static $wpPiwik, $defaultSettings;
|
18 |
-
|
19 |
-
/**
|
20 |
-
*
|
21 |
-
* @var Define callback functions for changed settings
|
22 |
-
*/
|
23 |
-
private $checkSettings = array (
|
24 |
-
'piwik_url' => 'checkPiwikUrl',
|
25 |
-
'piwik_token' => 'checkPiwikToken',
|
26 |
-
'site_id' => 'requestPiwikSiteID',
|
27 |
-
'tracking_code' => 'prepareTrackingCode',
|
28 |
-
'noscript_code' => 'prepareNocscriptCode'
|
29 |
-
);
|
30 |
-
|
31 |
-
/**
|
32 |
-
*
|
33 |
-
* @var Register default configuration set
|
34 |
-
*/
|
35 |
-
private $globalSettings = array (
|
36 |
-
// Plugin settings
|
37 |
-
'revision' => 0,
|
38 |
-
'last_settings_update' => 0,
|
39 |
-
// User settings: Piwik configuration
|
40 |
-
'piwik_mode' => 'http',
|
41 |
-
'piwik_url' => '',
|
42 |
-
'piwik_path' => '',
|
43 |
-
'piwik_user' => '',
|
44 |
-
'matomo_user' => '',
|
45 |
-
'piwik_token' => '',
|
46 |
-
'auto_site_config' => true,
|
47 |
-
// User settings: Stats configuration
|
48 |
-
'default_date' => 'yesterday',
|
49 |
-
'stats_seo' => false,
|
50 |
-
'stats_ecommerce' => false,
|
51 |
-
'dashboard_widget' => false,
|
52 |
-
'dashboard_ecommerce' => false,
|
53 |
-
'dashboard_chart' => false,
|
54 |
-
'dashboard_seo' => false,
|
55 |
-
'toolbar' => false,
|
56 |
-
'capability_read_stats' => array (
|
57 |
-
'administrator' => true
|
58 |
-
),
|
59 |
-
'perpost_stats' => false,
|
60 |
-
'plugin_display_name' => 'WP-Piwik',
|
61 |
-
'piwik_shortcut' => false,
|
62 |
-
'shortcodes' => false,
|
63 |
-
// User settings: Tracking configuration
|
64 |
-
'track_mode' => 'disabled',
|
65 |
-
'track_codeposition' => 'footer',
|
66 |
-
'track_noscript' => false,
|
67 |
-
'track_nojavascript' => false,
|
68 |
-
'proxy_url' => '',
|
69 |
-
'track_content' => 'disabled',
|
70 |
-
'track_search' => false,
|
71 |
-
'track_404' => false,
|
72 |
-
'add_post_annotations' => array(),
|
73 |
-
'add_customvars_box' => false,
|
74 |
-
'add_download_extensions' => '',
|
75 |
-
'set_download_extensions' => '',
|
76 |
-
'set_link_classes' => '',
|
77 |
-
'set_download_classes' => '',
|
78 |
-
'disable_cookies' => false,
|
79 |
-
'limit_cookies' => false,
|
80 |
-
'limit_cookies_visitor' => 34186669, // Piwik default 13 months
|
81 |
-
'limit_cookies_session' => 1800, // Piwik default 30 minutes
|
82 |
-
'limit_cookies_referral' => 15778463, // Piwik default 6 months
|
83 |
-
'track_admin' => false,
|
84 |
-
'capability_stealth' => array (),
|
85 |
-
'track_across' => false,
|
86 |
-
'track_across_alias' => false,
|
87 |
-
'track_crossdomain_linking' => false,
|
88 |
-
'track_feed' => false,
|
89 |
-
'track_feed_addcampaign' => false,
|
90 |
-
'track_feed_campaign' => 'feed',
|
91 |
-
'track_heartbeat' => 0,
|
92 |
-
'track_user_id' => 'disabled',
|
93 |
-
// User settings: Expert configuration
|
94 |
-
'cache' => true,
|
95 |
-
'http_connection' => 'curl',
|
96 |
-
'http_method' => 'post',
|
97 |
-
'disable_timelimit' => false,
|
98 |
-
'
|
99 |
-
'
|
100 |
-
'
|
101 |
-
'
|
102 |
-
'
|
103 |
-
|
104 |
-
|
105 |
-
'
|
106 |
-
'
|
107 |
-
'
|
108 |
-
'
|
109 |
-
|
110 |
-
|
111 |
-
'
|
112 |
-
'
|
113 |
-
'
|
114 |
-
'
|
115 |
-
'
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
*
|
121 |
-
*
|
122 |
-
*
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
self::$wpPiwik
|
127 |
-
self::$
|
128 |
-
|
129 |
-
'
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
'
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
*
|
180 |
-
*
|
181 |
-
*
|
182 |
-
*
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
*
|
191 |
-
*
|
192 |
-
*
|
193 |
-
*
|
194 |
-
*
|
195 |
-
*
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
*
|
207 |
-
*
|
208 |
-
*
|
209 |
-
*
|
210 |
-
*
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
*
|
221 |
-
*
|
222 |
-
*
|
223 |
-
*
|
224 |
-
*
|
225 |
-
*
|
226 |
-
*
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
*
|
269 |
-
*
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
*
|
280 |
-
*
|
281 |
-
*
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
$this->
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
*
|
299 |
-
*
|
300 |
-
*
|
301 |
-
*
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
$
|
309 |
-
|
310 |
-
|
311 |
-
$in
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
*
|
319 |
-
*
|
320 |
-
*
|
321 |
-
*
|
322 |
-
*
|
323 |
-
*
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
*
|
332 |
-
*
|
333 |
-
*
|
334 |
-
*
|
335 |
-
*
|
336 |
-
*
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
*
|
345 |
-
*
|
346 |
-
*
|
347 |
-
*
|
348 |
-
*
|
349 |
-
*
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
*
|
360 |
-
*
|
361 |
-
*
|
362 |
-
*
|
363 |
-
*
|
364 |
-
*
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
*
|
382 |
-
*
|
383 |
-
*
|
384 |
-
*
|
385 |
-
*
|
386 |
-
*
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
*
|
397 |
-
*
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
'
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
}
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WP_Piwik;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Manage WP-Piwik settings
|
7 |
+
*
|
8 |
+
* @author André Bräkling
|
9 |
+
* @package WP_Piwik
|
10 |
+
*/
|
11 |
+
class Settings {
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
* @var Environment variables and default settings container
|
16 |
+
*/
|
17 |
+
private static $wpPiwik, $defaultSettings;
|
18 |
+
|
19 |
+
/**
|
20 |
+
*
|
21 |
+
* @var Define callback functions for changed settings
|
22 |
+
*/
|
23 |
+
private $checkSettings = array (
|
24 |
+
'piwik_url' => 'checkPiwikUrl',
|
25 |
+
'piwik_token' => 'checkPiwikToken',
|
26 |
+
'site_id' => 'requestPiwikSiteID',
|
27 |
+
'tracking_code' => 'prepareTrackingCode',
|
28 |
+
'noscript_code' => 'prepareNocscriptCode'
|
29 |
+
);
|
30 |
+
|
31 |
+
/**
|
32 |
+
*
|
33 |
+
* @var Register default configuration set
|
34 |
+
*/
|
35 |
+
private $globalSettings = array (
|
36 |
+
// Plugin settings
|
37 |
+
'revision' => 0,
|
38 |
+
'last_settings_update' => 0,
|
39 |
+
// User settings: Piwik configuration
|
40 |
+
'piwik_mode' => 'http',
|
41 |
+
'piwik_url' => '',
|
42 |
+
'piwik_path' => '',
|
43 |
+
'piwik_user' => '',
|
44 |
+
'matomo_user' => '',
|
45 |
+
'piwik_token' => '',
|
46 |
+
'auto_site_config' => true,
|
47 |
+
// User settings: Stats configuration
|
48 |
+
'default_date' => 'yesterday',
|
49 |
+
'stats_seo' => false,
|
50 |
+
'stats_ecommerce' => false,
|
51 |
+
'dashboard_widget' => false,
|
52 |
+
'dashboard_ecommerce' => false,
|
53 |
+
'dashboard_chart' => false,
|
54 |
+
'dashboard_seo' => false,
|
55 |
+
'toolbar' => false,
|
56 |
+
'capability_read_stats' => array (
|
57 |
+
'administrator' => true
|
58 |
+
),
|
59 |
+
'perpost_stats' => false,
|
60 |
+
'plugin_display_name' => 'WP-Piwik',
|
61 |
+
'piwik_shortcut' => false,
|
62 |
+
'shortcodes' => false,
|
63 |
+
// User settings: Tracking configuration
|
64 |
+
'track_mode' => 'disabled',
|
65 |
+
'track_codeposition' => 'footer',
|
66 |
+
'track_noscript' => false,
|
67 |
+
'track_nojavascript' => false,
|
68 |
+
'proxy_url' => '',
|
69 |
+
'track_content' => 'disabled',
|
70 |
+
'track_search' => false,
|
71 |
+
'track_404' => false,
|
72 |
+
'add_post_annotations' => array(),
|
73 |
+
'add_customvars_box' => false,
|
74 |
+
'add_download_extensions' => '',
|
75 |
+
'set_download_extensions' => '',
|
76 |
+
'set_link_classes' => '',
|
77 |
+
'set_download_classes' => '',
|
78 |
+
'disable_cookies' => false,
|
79 |
+
'limit_cookies' => false,
|
80 |
+
'limit_cookies_visitor' => 34186669, // Piwik default 13 months
|
81 |
+
'limit_cookies_session' => 1800, // Piwik default 30 minutes
|
82 |
+
'limit_cookies_referral' => 15778463, // Piwik default 6 months
|
83 |
+
'track_admin' => false,
|
84 |
+
'capability_stealth' => array (),
|
85 |
+
'track_across' => false,
|
86 |
+
'track_across_alias' => false,
|
87 |
+
'track_crossdomain_linking' => false,
|
88 |
+
'track_feed' => false,
|
89 |
+
'track_feed_addcampaign' => false,
|
90 |
+
'track_feed_campaign' => 'feed',
|
91 |
+
'track_heartbeat' => 0,
|
92 |
+
'track_user_id' => 'disabled',
|
93 |
+
// User settings: Expert configuration
|
94 |
+
'cache' => true,
|
95 |
+
'http_connection' => 'curl',
|
96 |
+
'http_method' => 'post',
|
97 |
+
'disable_timelimit' => false,
|
98 |
+
'filter_limit' => '',
|
99 |
+
'connection_timeout' => 5,
|
100 |
+
'disable_ssl_verify' => false,
|
101 |
+
'disable_ssl_verify_host' => false,
|
102 |
+
'piwik_useragent' => 'php',
|
103 |
+
'piwik_useragent_string' => 'WP-Piwik',
|
104 |
+
'dnsprefetch' => false,
|
105 |
+
'track_datacfasync' => false,
|
106 |
+
'track_cdnurl' => '',
|
107 |
+
'track_cdnurlssl' => '',
|
108 |
+
'force_protocol' => 'disabled',
|
109 |
+
'update_notice' => 'enabled'
|
110 |
+
), $settings = array (
|
111 |
+
'name' => '',
|
112 |
+
'site_id' => NULL,
|
113 |
+
'noscript_code' => '',
|
114 |
+
'tracking_code' => '',
|
115 |
+
'last_tracking_code_update' => 0,
|
116 |
+
'dashboard_revision' => 0
|
117 |
+
), $settingsChanged = false;
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Constructor class to prepare settings manager
|
121 |
+
*
|
122 |
+
* @param WP_Piwik $wpPiwik
|
123 |
+
* active WP-Piwik instance
|
124 |
+
*/
|
125 |
+
public function __construct($wpPiwik) {
|
126 |
+
self::$wpPiwik = $wpPiwik;
|
127 |
+
self::$wpPiwik->log ( 'Store default settings' );
|
128 |
+
self::$defaultSettings = array (
|
129 |
+
'globalSettings' => $this->globalSettings,
|
130 |
+
'settings' => $this->settings
|
131 |
+
);
|
132 |
+
self::$wpPiwik->log ( 'Load settings' );
|
133 |
+
foreach ( $this->globalSettings as $key => $default ) {
|
134 |
+
$this->globalSettings [$key] = ($this->checkNetworkActivation () ? get_site_option ( 'wp-piwik_global-' . $key, $default ) : get_option ( 'wp-piwik_global-' . $key, $default ));
|
135 |
+
}
|
136 |
+
foreach ( $this->settings as $key => $default )
|
137 |
+
$this->settings [$key] = get_option ( 'wp-piwik-' . $key, $default );
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Save all settings as WordPress options
|
142 |
+
*/
|
143 |
+
public function save() {
|
144 |
+
if (! $this->settingsChanged) {
|
145 |
+
self::$wpPiwik->log ( 'No settings changed yet' );
|
146 |
+
return;
|
147 |
+
}
|
148 |
+
self::$wpPiwik->log ( 'Save settings' );
|
149 |
+
foreach ( $this->globalSettings as $key => $value ) {
|
150 |
+
if ( $this->checkNetworkActivation() )
|
151 |
+
update_site_option ( 'wp-piwik_global-' . $key, $value );
|
152 |
+
else
|
153 |
+
update_option ( 'wp-piwik_global-' . $key, $value );
|
154 |
+
}
|
155 |
+
foreach ( $this->settings as $key => $value ) {
|
156 |
+
update_option ( 'wp-piwik-' . $key, $value );
|
157 |
+
}
|
158 |
+
global $wp_roles;
|
159 |
+
if (! is_object ( $wp_roles ))
|
160 |
+
$wp_roles = new \WP_Roles ();
|
161 |
+
if (! is_object ( $wp_roles ))
|
162 |
+
die ( "STILL NO OBJECT" );
|
163 |
+
foreach ( $wp_roles->role_names as $strKey => $strName ) {
|
164 |
+
$objRole = get_role ( $strKey );
|
165 |
+
foreach ( array (
|
166 |
+
'stealth',
|
167 |
+
'read_stats'
|
168 |
+
) as $strCap ) {
|
169 |
+
$aryCaps = $this->getGlobalOption ( 'capability_' . $strCap );
|
170 |
+
if (isset ( $aryCaps [$strKey] ) && $aryCaps [$strKey])
|
171 |
+
$wp_roles->add_cap ( $strKey, 'wp-piwik_' . $strCap );
|
172 |
+
else $wp_roles->remove_cap ( $strKey, 'wp-piwik_' . $strCap );
|
173 |
+
}
|
174 |
+
}
|
175 |
+
$this->settingsChanged = false;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Get a global option's value
|
180 |
+
*
|
181 |
+
* @param string $key
|
182 |
+
* option key
|
183 |
+
* @return string option value
|
184 |
+
*/
|
185 |
+
public function getGlobalOption($key) {
|
186 |
+
return isset ( $this->globalSettings [$key] ) ? $this->globalSettings [$key] : self::$defaultSettings ['globalSettings'] [$key];
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Get an option's value related to a specific blog
|
191 |
+
*
|
192 |
+
* @param string $key
|
193 |
+
* option key
|
194 |
+
* @param int $blogID
|
195 |
+
* blog ID (default: current blog)
|
196 |
+
* @return \WP_Piwik\Register
|
197 |
+
*/
|
198 |
+
public function getOption($key, $blogID = null) {
|
199 |
+
if ($this->checkNetworkActivation () && ! empty ( $blogID )) {
|
200 |
+
return get_blog_option ( $blogID, 'wp-piwik-'.$key );
|
201 |
+
}
|
202 |
+
return isset ( $this->settings [$key] ) ? $this->settings [$key] : self::$defaultSettings ['settings'] [$key];
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Set a global option's value
|
207 |
+
*
|
208 |
+
* @param string $key
|
209 |
+
* option key
|
210 |
+
* @param string $value
|
211 |
+
* new option value
|
212 |
+
*/
|
213 |
+
public function setGlobalOption($key, $value) {
|
214 |
+
$this->settingsChanged = true;
|
215 |
+
self::$wpPiwik->log ( 'Changed global option ' . $key . ': ' . (is_array ( $value ) ? serialize ( $value ) : $value) );
|
216 |
+
$this->globalSettings [$key] = $value;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Set an option's value related to a specific blog
|
221 |
+
*
|
222 |
+
* @param string $key
|
223 |
+
* option key
|
224 |
+
* @param int $blogID
|
225 |
+
* blog ID (default: current blog)
|
226 |
+
* @param string $value
|
227 |
+
* new option value
|
228 |
+
*/
|
229 |
+
public function setOption($key, $value, $blogID = null) {
|
230 |
+
$this->settingsChanged = true;
|
231 |
+
self::$wpPiwik->log ( 'Changed option ' . $key . ': ' . $value );
|
232 |
+
if ($this->checkNetworkActivation () && ! empty ( $blogID )) {
|
233 |
+
add_blog_option ( $blogID, 'wp-piwik-'.$key, $value );
|
234 |
+
} else
|
235 |
+
$this->settings [$key] = $value;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Reset settings to default
|
240 |
+
*/
|
241 |
+
public function resetSettings() {
|
242 |
+
self::$wpPiwik->log ( 'Reset WP-Piwik settings' );
|
243 |
+
global $wpdb;
|
244 |
+
if ( $this->checkNetworkActivation() ) {
|
245 |
+
$aryBlogs = self::getBlogList();
|
246 |
+
if (is_array($aryBlogs))
|
247 |
+
foreach ($aryBlogs as $aryBlog) {
|
248 |
+
switch_to_blog($aryBlog['blog_id']);
|
249 |
+
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'wp-piwik-%'");
|
250 |
+
restore_current_blog();
|
251 |
+
}
|
252 |
+
$wpdb->query("DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE 'wp-piwik_global-%'");
|
253 |
+
}
|
254 |
+
else $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'wp-piwik_global-%'");
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Get blog list
|
259 |
+
*/
|
260 |
+
public static function getBlogList($limit = null, $page = null, $search = '') {
|
261 |
+
if ($limit && $page)
|
262 |
+
$queryLimit = ' LIMIT '.(int) (($page - 1) * $limit).','.(int) $limit;
|
263 |
+
global $wpdb;
|
264 |
+
return $wpdb->get_results($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs.' WHERE CONCAT(domain, path) LIKE "%%%s%%" AND spam = 0 AND deleted = 0 ORDER BY blog_id'.$queryLimit, $search), ARRAY_A);
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Check if plugin is network activated
|
269 |
+
*
|
270 |
+
* @return boolean Is network activated?
|
271 |
+
*/
|
272 |
+
public function checkNetworkActivation() {
|
273 |
+
if (! function_exists ( "is_plugin_active_for_network" ))
|
274 |
+
require_once (ABSPATH . 'wp-admin/includes/plugin.php');
|
275 |
+
return is_plugin_active_for_network ( 'wp-piwik/wp-piwik.php' );
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Apply new configuration
|
280 |
+
*
|
281 |
+
* @param array $in
|
282 |
+
* new configuration set
|
283 |
+
*/
|
284 |
+
public function applyChanges($in) {
|
285 |
+
if (!self::$wpPiwik->isValidOptionsPost())
|
286 |
+
die("Invalid config changes.");
|
287 |
+
$in = $this->checkSettings ( $in );
|
288 |
+
self::$wpPiwik->log ( 'Apply changed settings:' );
|
289 |
+
foreach ( self::$defaultSettings ['globalSettings'] as $key => $val )
|
290 |
+
$this->setGlobalOption ( $key, isset ( $in [$key] ) ? $in [$key] : $val );
|
291 |
+
foreach ( self::$defaultSettings ['settings'] as $key => $val )
|
292 |
+
$this->setOption ( $key, isset ( $in [$key] ) ? $in [$key] : $val );
|
293 |
+
$this->setGlobalOption ( 'last_settings_update', time () );
|
294 |
+
$this->save ();
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Apply callback function on new settings
|
299 |
+
*
|
300 |
+
* @param array $in
|
301 |
+
* new configuration set
|
302 |
+
* @return array configuration set after callback functions were applied
|
303 |
+
*/
|
304 |
+
private function checkSettings($in) {
|
305 |
+
foreach ( $this->checkSettings as $key => $value )
|
306 |
+
if (isset ( $in [$key] ))
|
307 |
+
$in [$key] = call_user_func_array ( array (
|
308 |
+
$this,
|
309 |
+
$value
|
310 |
+
), array (
|
311 |
+
$in [$key],
|
312 |
+
$in
|
313 |
+
) );
|
314 |
+
return $in;
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Add slash to Piwik URL if necessary
|
319 |
+
*
|
320 |
+
* @param string $value
|
321 |
+
* Piwik URL
|
322 |
+
* @param array $in
|
323 |
+
* configuration set
|
324 |
+
* @return string Piwik URL
|
325 |
+
*/
|
326 |
+
private function checkPiwikUrl($value, $in) {
|
327 |
+
return substr ( $value, - 1, 1 ) != '/' ? $value . '/' : $value;
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Remove &token_auth= from auth token
|
332 |
+
*
|
333 |
+
* @param string $value
|
334 |
+
* Piwik auth token
|
335 |
+
* @param array $in
|
336 |
+
* configuration set
|
337 |
+
* @return string Piwik auth token
|
338 |
+
*/
|
339 |
+
private function checkPiwikToken($value, $in) {
|
340 |
+
return str_replace ( '&token_auth=', '', $value );
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Request the site ID (if not set before)
|
345 |
+
*
|
346 |
+
* @param string $value
|
347 |
+
* tracking code
|
348 |
+
* @param array $in
|
349 |
+
* configuration set
|
350 |
+
* @return int Piwik site ID
|
351 |
+
*/
|
352 |
+
private function requestPiwikSiteID($value, $in) {
|
353 |
+
if ($in ['auto_site_config'] && ! $value)
|
354 |
+
return self::$wpPiwik->getPiwikSiteId();
|
355 |
+
return $value;
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Prepare the tracking code
|
360 |
+
*
|
361 |
+
* @param string $value
|
362 |
+
* tracking code
|
363 |
+
* @param array $in
|
364 |
+
* configuration set
|
365 |
+
* @return string tracking code
|
366 |
+
*/
|
367 |
+
private function prepareTrackingCode($value, $in) {
|
368 |
+
if ($in ['track_mode'] == 'manually' || $in ['track_mode'] == 'disabled') {
|
369 |
+
$value = stripslashes ( $value );
|
370 |
+
if ($this->checkNetworkActivation ())
|
371 |
+
add_site_option ( 'wp-piwik-manually', $value );
|
372 |
+
return $value;
|
373 |
+
}
|
374 |
+
/*$result = self::$wpPiwik->updateTrackingCode ();
|
375 |
+
echo '<pre>'; print_r($result); echo '</pre>';
|
376 |
+
$this->setOption ( 'noscript_code', $result ['noscript'] );*/
|
377 |
+
return; // $result ['script'];
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Prepare the nocscript code
|
382 |
+
*
|
383 |
+
* @param string $value
|
384 |
+
* noscript code
|
385 |
+
* @param array $in
|
386 |
+
* configuration set
|
387 |
+
* @return string noscript code
|
388 |
+
*/
|
389 |
+
private function prepareNocscriptCode($value, $in) {
|
390 |
+
if ($in ['track_mode'] == 'manually')
|
391 |
+
return stripslashes ( $value );
|
392 |
+
return $this->getOption ( 'noscript_code' );
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Get debug data
|
397 |
+
*
|
398 |
+
* @return array WP-Piwik settings for debug output
|
399 |
+
*/
|
400 |
+
public function getDebugData() {
|
401 |
+
$debug = array(
|
402 |
+
'global_settings' => $this->globalSettings,
|
403 |
+
'settings' => $this->settings
|
404 |
+
);
|
405 |
+
$debug['global_settings']['piwik_token'] = !empty($debug['global_settings']['piwik_token'])?'set':'not set';
|
406 |
+
return $debug;
|
407 |
+
}
|
408 |
+
}
|
classes/WP_Piwik/Shortcode.php
CHANGED
File without changes
|
classes/WP_Piwik/Template.php
CHANGED
File without changes
|
classes/WP_Piwik/Template/MetaBoxCustomVars.php
CHANGED
File without changes
|
classes/WP_Piwik/TrackingCode.php
CHANGED
@@ -1,150 +1,150 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WP_Piwik;
|
4 |
-
|
5 |
-
class TrackingCode {
|
6 |
-
|
7 |
-
private static $wpPiwik, $piwikUrl = false;
|
8 |
-
|
9 |
-
private $trackingCode;
|
10 |
-
|
11 |
-
public $is404 = false, $isSearch = false, $isUsertracking = false;
|
12 |
-
|
13 |
-
public function __construct($wpPiwik) {
|
14 |
-
self::$wpPiwik = $wpPiwik;
|
15 |
-
if (! self::$wpPiwik->isCurrentTrackingCode () || ! self::$wpPiwik->getOption ( 'tracking_code' ) || strpos( self::$wpPiwik->getOption ( 'tracking_code' ), '{"result":"error",' ) !== false )
|
16 |
-
self::$wpPiwik->updateTrackingCode ();
|
17 |
-
$this->trackingCode = (self::$wpPiwik->isNetworkMode () && self::$wpPiwik->getGlobalOption ( 'track_mode' ) == 'manually') ? get_site_option ( 'wp-piwik-manually' ) : self::$wpPiwik->getOption ( 'tracking_code' );
|
18 |
-
}
|
19 |
-
|
20 |
-
public function getTrackingCode() {
|
21 |
-
if ($this->isUsertracking)
|
22 |
-
$this->applyUserTracking ();
|
23 |
-
if ($this->is404)
|
24 |
-
$this->apply404Changes ();
|
25 |
-
if ($this->isSearch)
|
26 |
-
$this->applySearchChanges ();
|
27 |
-
if (is_single () || is_page())
|
28 |
-
$this->addCustomValues ();
|
29 |
-
$this->trackingCode = apply_filters('wp-piwik_tracking_code', $this->trackingCode);
|
30 |
-
return $this->trackingCode;
|
31 |
-
}
|
32 |
-
|
33 |
-
public static function prepareTrackingCode($code, $settings, $logger) {
|
34 |
-
global $current_user;
|
35 |
-
$logger->log ( 'Apply tracking code changes:' );
|
36 |
-
$settings->setOption ( 'last_tracking_code_update', time () );
|
37 |
-
if (preg_match ( '/var u="([^"]*)";/', $code, $hits )) {
|
38 |
-
$fetchedProxyUrl = $hits [1];
|
39 |
-
} else $fetchedProxyUrl = '';
|
40 |
-
if ($settings->getGlobalOption ( 'track_mode' ) == 'js')
|
41 |
-
$code = str_replace ( array (
|
42 |
-
'piwik.js',
|
43 |
-
'piwik.php'
|
44 |
-
), 'js/index.php', $code );
|
45 |
-
elseif ($settings->getGlobalOption ( 'track_mode' ) == 'proxy') {
|
46 |
-
$code = str_replace ( 'piwik.js', 'piwik.php', $code );
|
47 |
-
$proxy = str_replace ( array (
|
48 |
-
'https://',
|
49 |
-
'http://'
|
50 |
-
), '//', plugins_url ( 'wp-piwik' ) . '/proxy' ) . '/';
|
51 |
-
$code = preg_replace ( '/var u="([^"]*)";/', 'var u="' . $proxy . '"', $code );
|
52 |
-
$code = preg_replace ( '/img src="([^"]*)piwik.php/', 'img src="' . $proxy . 'piwik.php', $code );
|
53 |
-
}
|
54 |
-
if ($settings->getGlobalOption ( 'track_cdnurl' ) || $settings->getGlobalOption ( 'track_cdnurlssl' ))
|
55 |
-
$code = str_replace ( array (
|
56 |
-
"var d=doc",
|
57 |
-
"g.src=u+"
|
58 |
-
), array (
|
59 |
-
"var ucdn=(('https:' == document.location.protocol) ? 'https://" . ($settings->getGlobalOption ( 'track_cdnurlssl' ) ? $settings->getGlobalOption ( 'track_cdnurlssl' ) : $settings->getGlobalOption ( 'track_cdnurl' )) . "/' : 'http://" . ($settings->getGlobalOption ( 'track_cdnurl' ) ? $settings->getGlobalOption ( 'track_cdnurl' ) : $settings->getGlobalOption ( 'track_cdnurlssl' )) . "/');\nvar d=doc",
|
60 |
-
"g.src=ucdn+"
|
61 |
-
), $code );
|
62 |
-
|
63 |
-
if ($settings->getGlobalOption ( 'track_datacfasync' ))
|
64 |
-
$code = str_replace ( '<script type', '<script data-cfasync="false" type', $code );
|
65 |
-
if ($settings->getGlobalOption ( 'set_download_extensions' ))
|
66 |
-
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setDownloadExtensions', '" . ($settings->getGlobalOption ( 'set_download_extensions' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
67 |
-
if ($settings->getGlobalOption ( 'add_download_extensions' ))
|
68 |
-
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['addDownloadExtensions', '" . ($settings->getGlobalOption ( 'add_download_extensions' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
69 |
-
if ($settings->getGlobalOption ( 'set_download_classes' ))
|
70 |
-
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setDownloadClasses', '" . ($settings->getGlobalOption ( 'set_download_classes' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
71 |
-
if ($settings->getGlobalOption ( 'set_link_classes' ))
|
72 |
-
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setLinkClasses', '" . ($settings->getGlobalOption ( 'set_link_classes' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
73 |
-
if ($settings->getGlobalOption ( 'limit_cookies' ))
|
74 |
-
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setVisitorCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_visitor' ) . "']);\n_paq.push(['setSessionCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_session' ) . "']);\n_paq.push(['setReferralCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_referral' ) . "']);\n_paq.push(['trackPageView']);", $code );
|
75 |
-
if ($settings->getGlobalOption ( 'force_protocol' ) != 'disabled')
|
76 |
-
$code = str_replace ( '"//', '"' . $settings->getGlobalOption ( 'force_protocol' ) . '://', $code );
|
77 |
-
if ($settings->getGlobalOption ( 'track_content' ) == 'all')
|
78 |
-
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['trackAllContentImpressions']);", $code );
|
79 |
-
elseif ($settings->getGlobalOption ( 'track_content' ) == 'visible')
|
80 |
-
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['trackVisibleContentImpressions']);", $code );
|
81 |
-
if ((int) $settings->getGlobalOption ( 'track_heartbeat' ) > 0)
|
82 |
-
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['enableHeartBeatTimer', ".(int) $settings->getGlobalOption ( 'track_heartbeat' )."]);", $code );
|
83 |
-
|
84 |
-
$noScript = array ();
|
85 |
-
preg_match ( '/<noscript>(.*)<\/noscript>/', $code, $noScript );
|
86 |
-
if (isset ( $noScript [0] )) {
|
87 |
-
if ($settings->getGlobalOption ( 'track_nojavascript' ))
|
88 |
-
$noScript [0] = str_replace ( '?idsite', '?rec=1&idsite', $noScript [0] );
|
89 |
-
$noScript = $noScript [0];
|
90 |
-
} else
|
91 |
-
$noScript = '';
|
92 |
-
$script = preg_replace ( '/<noscript>(.*)<\/noscript>/', '', $code );
|
93 |
-
$script = preg_replace ( '/\s+(\r\n|\r|\n)/', '$1', $script );
|
94 |
-
$logger->log ( 'Finished tracking code: ' . $script );
|
95 |
-
$logger->log ( 'Finished noscript code: ' . $noScript );
|
96 |
-
return array (
|
97 |
-
'script' => $script,
|
98 |
-
'noscript' => $noScript,
|
99 |
-
'proxy' => $fetchedProxyUrl
|
100 |
-
);
|
101 |
-
}
|
102 |
-
|
103 |
-
private function apply404Changes() {
|
104 |
-
self::$wpPiwik->log ( 'Apply 404 changes. Blog ID: ' . get_current_blog_id () . ' Site ID: ' . self::$wpPiwik->getOption ( 'site_id' ) );
|
105 |
-
$this->trackingCode = 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']);", $this->trackingCode );
|
106 |
-
}
|
107 |
-
|
108 |
-
private function applySearchChanges() {
|
109 |
-
self::$wpPiwik->log ( 'Apply search tracking changes. Blog ID: ' . get_current_blog_id () . ' Site ID: ' . self::$wpPiwik->getOption ( 'site_id' ) );
|
110 |
-
$objSearch = new \WP_Query ( "s=" . get_search_query () . '&showposts=-1' );
|
111 |
-
$intResultCount = $objSearch->post_count;
|
112 |
-
$this->trackingCode = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackSiteSearch','" . get_search_query () . "', false, " . $intResultCount . "]);\n_paq.push(['trackPageView']);", $this->trackingCode );
|
113 |
-
}
|
114 |
-
|
115 |
-
private function applyUserTracking() {
|
116 |
-
$pkUserId = null;
|
117 |
-
if (\is_user_logged_in()) {
|
118 |
-
// Get the User ID Admin option, and the current user's data
|
119 |
-
$uidFrom = self::$wpPiwik->getGlobalOption ( 'track_user_id' );
|
120 |
-
$current_user = wp_get_current_user(); // current user
|
121 |
-
// Get the user ID based on the admin setting
|
122 |
-
if ( $uidFrom == 'uid' ) {
|
123 |
-
$pkUserId = $current_user->ID;
|
124 |
-
} elseif ( $uidFrom == 'email' ) {
|
125 |
-
$pkUserId = $current_user->user_email;
|
126 |
-
} elseif ( $uidFrom == 'username' ) {
|
127 |
-
$pkUserId = $current_user->user_login;
|
128 |
-
} elseif ( $uidFrom == 'displayname' ) {
|
129 |
-
$pkUserId = $current_user->display_name;
|
130 |
-
}
|
131 |
-
}
|
132 |
-
$pkUserId = apply_filters('wp-piwik_tracking_user_id', $pkUserId);
|
133 |
-
// Check we got a User ID to track, and track it
|
134 |
-
if ( isset( $pkUserId ) && ! empty( $pkUserId ))
|
135 |
-
$this->trackingCode = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setUserId', '" . esc_js( $pkUserId ) . "']);\n_paq.push(['trackPageView']);", $this->trackingCode );
|
136 |
-
}
|
137 |
-
|
138 |
-
private function addCustomValues() {
|
139 |
-
$customVars = '';
|
140 |
-
for($i = 1; $i <= 5; $i ++) {
|
141 |
-
$postId = get_the_ID ();
|
142 |
-
$metaKey = get_post_meta ( $postId, 'wp-piwik_custom_cat' . $i, true );
|
143 |
-
$metaVal = get_post_meta ( $postId, 'wp-piwik_custom_val' . $i, true );
|
144 |
-
if (! empty ( $metaKey ) && ! empty ( $metaVal ))
|
145 |
-
$customVars .= "_paq.push(['setCustomVariable'," . $i . ", '" . $metaKey . "', '" . $metaVal . "', 'page']);\n";
|
146 |
-
}
|
147 |
-
if (! empty ( $customVars ))
|
148 |
-
$this->trackingCode = str_replace ( "_paq.push(['trackPageView']);", $customVars . "_paq.push(['trackPageView']);", $this->trackingCode );
|
149 |
-
}
|
150 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WP_Piwik;
|
4 |
+
|
5 |
+
class TrackingCode {
|
6 |
+
|
7 |
+
private static $wpPiwik, $piwikUrl = false;
|
8 |
+
|
9 |
+
private $trackingCode;
|
10 |
+
|
11 |
+
public $is404 = false, $isSearch = false, $isUsertracking = false;
|
12 |
+
|
13 |
+
public function __construct($wpPiwik) {
|
14 |
+
self::$wpPiwik = $wpPiwik;
|
15 |
+
if (! self::$wpPiwik->isCurrentTrackingCode () || ! self::$wpPiwik->getOption ( 'tracking_code' ) || strpos( self::$wpPiwik->getOption ( 'tracking_code' ), '{"result":"error",' ) !== false )
|
16 |
+
self::$wpPiwik->updateTrackingCode ();
|
17 |
+
$this->trackingCode = (self::$wpPiwik->isNetworkMode () && self::$wpPiwik->getGlobalOption ( 'track_mode' ) == 'manually') ? get_site_option ( 'wp-piwik-manually' ) : self::$wpPiwik->getOption ( 'tracking_code' );
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getTrackingCode() {
|
21 |
+
if ($this->isUsertracking)
|
22 |
+
$this->applyUserTracking ();
|
23 |
+
if ($this->is404)
|
24 |
+
$this->apply404Changes ();
|
25 |
+
if ($this->isSearch)
|
26 |
+
$this->applySearchChanges ();
|
27 |
+
if (is_single () || is_page())
|
28 |
+
$this->addCustomValues ();
|
29 |
+
$this->trackingCode = apply_filters('wp-piwik_tracking_code', $this->trackingCode);
|
30 |
+
return $this->trackingCode;
|
31 |
+
}
|
32 |
+
|
33 |
+
public static function prepareTrackingCode($code, $settings, $logger) {
|
34 |
+
global $current_user;
|
35 |
+
$logger->log ( 'Apply tracking code changes:' );
|
36 |
+
$settings->setOption ( 'last_tracking_code_update', time () );
|
37 |
+
if (preg_match ( '/var u="([^"]*)";/', $code, $hits )) {
|
38 |
+
$fetchedProxyUrl = $hits [1];
|
39 |
+
} else $fetchedProxyUrl = '';
|
40 |
+
if ($settings->getGlobalOption ( 'track_mode' ) == 'js')
|
41 |
+
$code = str_replace ( array (
|
42 |
+
'piwik.js',
|
43 |
+
'piwik.php'
|
44 |
+
), 'js/index.php', $code );
|
45 |
+
elseif ($settings->getGlobalOption ( 'track_mode' ) == 'proxy') {
|
46 |
+
$code = str_replace ( 'piwik.js', 'piwik.php', $code );
|
47 |
+
$proxy = str_replace ( array (
|
48 |
+
'https://',
|
49 |
+
'http://'
|
50 |
+
), '//', plugins_url ( 'wp-piwik' ) . '/proxy' ) . '/';
|
51 |
+
$code = preg_replace ( '/var u="([^"]*)";/', 'var u="' . $proxy . '"', $code );
|
52 |
+
$code = preg_replace ( '/img src="([^"]*)piwik.php/', 'img src="' . $proxy . 'piwik.php', $code );
|
53 |
+
}
|
54 |
+
if ($settings->getGlobalOption ( 'track_cdnurl' ) || $settings->getGlobalOption ( 'track_cdnurlssl' ))
|
55 |
+
$code = str_replace ( array (
|
56 |
+
"var d=doc",
|
57 |
+
"g.src=u+"
|
58 |
+
), array (
|
59 |
+
"var ucdn=(('https:' == document.location.protocol) ? 'https://" . ($settings->getGlobalOption ( 'track_cdnurlssl' ) ? $settings->getGlobalOption ( 'track_cdnurlssl' ) : $settings->getGlobalOption ( 'track_cdnurl' )) . "/' : 'http://" . ($settings->getGlobalOption ( 'track_cdnurl' ) ? $settings->getGlobalOption ( 'track_cdnurl' ) : $settings->getGlobalOption ( 'track_cdnurlssl' )) . "/');\nvar d=doc",
|
60 |
+
"g.src=ucdn+"
|
61 |
+
), $code );
|
62 |
+
|
63 |
+
if ($settings->getGlobalOption ( 'track_datacfasync' ))
|
64 |
+
$code = str_replace ( '<script type', '<script data-cfasync="false" type', $code );
|
65 |
+
if ($settings->getGlobalOption ( 'set_download_extensions' ))
|
66 |
+
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setDownloadExtensions', '" . ($settings->getGlobalOption ( 'set_download_extensions' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
67 |
+
if ($settings->getGlobalOption ( 'add_download_extensions' ))
|
68 |
+
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['addDownloadExtensions', '" . ($settings->getGlobalOption ( 'add_download_extensions' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
69 |
+
if ($settings->getGlobalOption ( 'set_download_classes' ))
|
70 |
+
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setDownloadClasses', '" . ($settings->getGlobalOption ( 'set_download_classes' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
71 |
+
if ($settings->getGlobalOption ( 'set_link_classes' ))
|
72 |
+
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setLinkClasses', '" . ($settings->getGlobalOption ( 'set_link_classes' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
73 |
+
if ($settings->getGlobalOption ( 'limit_cookies' ))
|
74 |
+
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setVisitorCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_visitor' ) . "']);\n_paq.push(['setSessionCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_session' ) . "']);\n_paq.push(['setReferralCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_referral' ) . "']);\n_paq.push(['trackPageView']);", $code );
|
75 |
+
if ($settings->getGlobalOption ( 'force_protocol' ) != 'disabled')
|
76 |
+
$code = str_replace ( '"//', '"' . $settings->getGlobalOption ( 'force_protocol' ) . '://', $code );
|
77 |
+
if ($settings->getGlobalOption ( 'track_content' ) == 'all')
|
78 |
+
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['trackAllContentImpressions']);", $code );
|
79 |
+
elseif ($settings->getGlobalOption ( 'track_content' ) == 'visible')
|
80 |
+
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['trackVisibleContentImpressions']);", $code );
|
81 |
+
if ((int) $settings->getGlobalOption ( 'track_heartbeat' ) > 0)
|
82 |
+
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['enableHeartBeatTimer', ".(int) $settings->getGlobalOption ( 'track_heartbeat' )."]);", $code );
|
83 |
+
|
84 |
+
$noScript = array ();
|
85 |
+
preg_match ( '/<noscript>(.*)<\/noscript>/', $code, $noScript );
|
86 |
+
if (isset ( $noScript [0] )) {
|
87 |
+
if ($settings->getGlobalOption ( 'track_nojavascript' ))
|
88 |
+
$noScript [0] = str_replace ( '?idsite', '?rec=1&idsite', $noScript [0] );
|
89 |
+
$noScript = $noScript [0];
|
90 |
+
} else
|
91 |
+
$noScript = '';
|
92 |
+
$script = preg_replace ( '/<noscript>(.*)<\/noscript>/', '', $code );
|
93 |
+
$script = preg_replace ( '/\s+(\r\n|\r|\n)/', '$1', $script );
|
94 |
+
$logger->log ( 'Finished tracking code: ' . $script );
|
95 |
+
$logger->log ( 'Finished noscript code: ' . $noScript );
|
96 |
+
return array (
|
97 |
+
'script' => $script,
|
98 |
+
'noscript' => $noScript,
|
99 |
+
'proxy' => $fetchedProxyUrl
|
100 |
+
);
|
101 |
+
}
|
102 |
+
|
103 |
+
private function apply404Changes() {
|
104 |
+
self::$wpPiwik->log ( 'Apply 404 changes. Blog ID: ' . get_current_blog_id () . ' Site ID: ' . self::$wpPiwik->getOption ( 'site_id' ) );
|
105 |
+
$this->trackingCode = 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']);", $this->trackingCode );
|
106 |
+
}
|
107 |
+
|
108 |
+
private function applySearchChanges() {
|
109 |
+
self::$wpPiwik->log ( 'Apply search tracking changes. Blog ID: ' . get_current_blog_id () . ' Site ID: ' . self::$wpPiwik->getOption ( 'site_id' ) );
|
110 |
+
$objSearch = new \WP_Query ( "s=" . get_search_query () . '&showposts=-1' );
|
111 |
+
$intResultCount = $objSearch->post_count;
|
112 |
+
$this->trackingCode = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackSiteSearch','" . get_search_query () . "', false, " . $intResultCount . "]);\n_paq.push(['trackPageView']);", $this->trackingCode );
|
113 |
+
}
|
114 |
+
|
115 |
+
private function applyUserTracking() {
|
116 |
+
$pkUserId = null;
|
117 |
+
if (\is_user_logged_in()) {
|
118 |
+
// Get the User ID Admin option, and the current user's data
|
119 |
+
$uidFrom = self::$wpPiwik->getGlobalOption ( 'track_user_id' );
|
120 |
+
$current_user = wp_get_current_user(); // current user
|
121 |
+
// Get the user ID based on the admin setting
|
122 |
+
if ( $uidFrom == 'uid' ) {
|
123 |
+
$pkUserId = $current_user->ID;
|
124 |
+
} elseif ( $uidFrom == 'email' ) {
|
125 |
+
$pkUserId = $current_user->user_email;
|
126 |
+
} elseif ( $uidFrom == 'username' ) {
|
127 |
+
$pkUserId = $current_user->user_login;
|
128 |
+
} elseif ( $uidFrom == 'displayname' ) {
|
129 |
+
$pkUserId = $current_user->display_name;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$pkUserId = apply_filters('wp-piwik_tracking_user_id', $pkUserId);
|
133 |
+
// Check we got a User ID to track, and track it
|
134 |
+
if ( isset( $pkUserId ) && ! empty( $pkUserId ))
|
135 |
+
$this->trackingCode = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setUserId', '" . esc_js( $pkUserId ) . "']);\n_paq.push(['trackPageView']);", $this->trackingCode );
|
136 |
+
}
|
137 |
+
|
138 |
+
private function addCustomValues() {
|
139 |
+
$customVars = '';
|
140 |
+
for($i = 1; $i <= 5; $i ++) {
|
141 |
+
$postId = get_the_ID ();
|
142 |
+
$metaKey = get_post_meta ( $postId, 'wp-piwik_custom_cat' . $i, true );
|
143 |
+
$metaVal = get_post_meta ( $postId, 'wp-piwik_custom_val' . $i, true );
|
144 |
+
if (! empty ( $metaKey ) && ! empty ( $metaVal ))
|
145 |
+
$customVars .= "_paq.push(['setCustomVariable'," . $i . ", '" . $metaKey . "', '" . $metaVal . "', 'page']);\n";
|
146 |
+
}
|
147 |
+
if (! empty ( $customVars ))
|
148 |
+
$this->trackingCode = str_replace ( "_paq.push(['trackPageView']);", $customVars . "_paq.push(['trackPageView']);", $this->trackingCode );
|
149 |
+
}
|
150 |
+
}
|
classes/WP_Piwik/Widget.php
CHANGED
@@ -1,376 +1,376 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WP_Piwik;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Abstract widget class
|
7 |
-
*
|
8 |
-
* @author André Bräkling
|
9 |
-
* @package WP_Piwik
|
10 |
-
*/
|
11 |
-
abstract class Widget {
|
12 |
-
|
13 |
-
/**
|
14 |
-
*
|
15 |
-
* @var Environment variables
|
16 |
-
*/
|
17 |
-
protected static $wpPiwik, $settings;
|
18 |
-
|
19 |
-
/**
|
20 |
-
*
|
21 |
-
* @var Configuration parameters
|
22 |
-
*/
|
23 |
-
protected $isShortcode = false, $method = '', $title = '', $context = 'side', $priority = 'core', $parameter = array (), $apiID = array (), $pageId = 'dashboard', $blogId = null, $name = 'Value', $limit = 10, $content = '', $output = '';
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Widget constructor
|
27 |
-
*
|
28 |
-
* @param WP_Piwik $wpPiwik
|
29 |
-
* current WP-Piwik object
|
30 |
-
* @param WP_Piwik\Settings $settings
|
31 |
-
* current WP-Piwik settings
|
32 |
-
* @param string $pageId
|
33 |
-
* WordPress page ID (default: dashboard)
|
34 |
-
* @param string $context
|
35 |
-
* WordPress meta box context (defualt: side)
|
36 |
-
* @param string $priority
|
37 |
-
* WordPress meta box priority (default: default)
|
38 |
-
* @param array $params
|
39 |
-
* widget parameters (default: empty array)
|
40 |
-
* @param boolean $isShortcode
|
41 |
-
* is the widget shown inline? (default: false)
|
42 |
-
*/
|
43 |
-
public function __construct($wpPiwik, $settings, $pageId = 'dashboard', $context = 'side', $priority = 'default', $params = array(), $isShortcode = false) {
|
44 |
-
self::$wpPiwik = $wpPiwik;
|
45 |
-
self::$settings = $settings;
|
46 |
-
$this->pageId = $pageId;
|
47 |
-
$this->context = $context;
|
48 |
-
$this->priority = $priority;
|
49 |
-
if (self::$settings->checkNetworkActivation () && function_exists ( 'is_super_admin' ) && is_super_admin () && isset ( $_GET ['wpmu_show_stats'] )) {
|
50 |
-
switch_to_blog ( ( int ) $_GET ['wpmu_show_stats'] );
|
51 |
-
$this->blogId = get_current_blog_id ();
|
52 |
-
restore_current_blog ();
|
53 |
-
}
|
54 |
-
$this->isShortcode = $isShortcode;
|
55 |
-
$prefix = ($this->pageId == 'dashboard' ? self::$settings->getGlobalOption ( 'plugin_display_name' ) . ' - ' : '');
|
56 |
-
$this->configure ( $prefix, $params );
|
57 |
-
if (is_array ( $this->method ))
|
58 |
-
foreach ( $this->method as $method ) {
|
59 |
-
$this->apiID [$method] = \WP_Piwik\Request::register ( $method, $this->parameter );
|
60 |
-
self::$wpPiwik->log ( "Register request: " . $this->apiID [$method] );
|
61 |
-
}
|
62 |
-
else {
|
63 |
-
$this->apiID [$this->method] = \WP_Piwik\Request::register ( $this->method, $this->parameter );
|
64 |
-
self::$wpPiwik->log ( "Register request: " . $this->apiID [$this->method] );
|
65 |
-
}
|
66 |
-
if ($this->isShortcode)
|
67 |
-
return;
|
68 |
-
add_meta_box ( $this->getName (), $this->title, array (
|
69 |
-
$this,
|
70 |
-
'show'
|
71 |
-
), $pageId, $this->context, $this->priority );
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Conifguration dummy method
|
76 |
-
*
|
77 |
-
* @param string $prefix
|
78 |
-
* metabox title prefix (default: empty)
|
79 |
-
* @param array $params
|
80 |
-
* widget parameters (default: empty array)
|
81 |
-
*/
|
82 |
-
protected function configure($prefix = '', $params = array()) {
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Default show widget method, handles default Piwik output
|
87 |
-
*/
|
88 |
-
public function show() {
|
89 |
-
$response = self::$wpPiwik->request ( $this->apiID [$this->method] );
|
90 |
-
if (! empty ( $response ['result'] ) && $response ['result'] == 'error')
|
91 |
-
$this->out( '<strong>' . __ ( 'Piwik error', 'wp-piwik' ) . ':</strong> ' . htmlentities ( $response ['message'], ENT_QUOTES, 'utf-8' ) );
|
92 |
-
else {
|
93 |
-
if (isset ( $response [0] ['nb_uniq_visitors'] ))
|
94 |
-
$unique = 'nb_uniq_visitors';
|
95 |
-
else
|
96 |
-
$unique = 'sum_daily_nb_uniq_visitors';
|
97 |
-
$tableHead = array (
|
98 |
-
'label' => __ ( $this->name, 'wp-piwik' )
|
99 |
-
);
|
100 |
-
$tableHead [$unique] = __ ( 'Unique', 'wp-piwik' );
|
101 |
-
if (isset ( $response [0] ['nb_visits'] ))
|
102 |
-
$tableHead ['nb_visits'] = __ ( 'Visits', 'wp-piwik' );
|
103 |
-
if (isset ( $response [0] ['nb_hits'] ))
|
104 |
-
$tableHead ['nb_hits'] = __ ( 'Hits', 'wp-piwik' );
|
105 |
-
if (isset ( $response [0] ['nb_actions'] ))
|
106 |
-
$tableHead ['nb_actions'] = __ ( 'Actions', 'wp-piwik' );
|
107 |
-
$tableBody = array ();
|
108 |
-
$count = 0;
|
109 |
-
if (is_array($response))
|
110 |
-
foreach ( $response as $rowKey => $row ) {
|
111 |
-
$count ++;
|
112 |
-
$tableBody [$rowKey] = array ();
|
113 |
-
foreach ( $tableHead as $key => $value )
|
114 |
-
$tableBody [$rowKey] [] = isset ( $row [$key] ) ? $row [$key] : '-';
|
115 |
-
if ($count == 10)
|
116 |
-
break;
|
117 |
-
}
|
118 |
-
$this->table ( $tableHead, $tableBody, null );
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Display or store shortcode output
|
124 |
-
*/
|
125 |
-
protected function out($output) {
|
126 |
-
if ($this->isShortcode)
|
127 |
-
$this->output .= $output;
|
128 |
-
else echo $output;
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Return shortcode output
|
133 |
-
*/
|
134 |
-
public function get() {
|
135 |
-
return $this->output;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Display a HTML table
|
140 |
-
*
|
141 |
-
* @param array $thead
|
142 |
-
* table header content (array of cells)
|
143 |
-
* @param array $tbody
|
144 |
-
* table body content (array of rows)
|
145 |
-
* @param array $tfoot
|
146 |
-
* table footer content (array of cells)
|
147 |
-
* @param string $class
|
148 |
-
* CSSclass name to apply on table sections
|
149 |
-
* @param string $javaScript
|
150 |
-
* array of javascript code to apply on body rows
|
151 |
-
*/
|
152 |
-
protected function table($thead, $tbody = array(), $tfoot = array(), $class = false, $javaScript = array(), $classes = array()) {
|
153 |
-
$this->out( '<div class="table"><table class="widefat wp-piwik-table">' );
|
154 |
-
if ($this->isShortcode && $this->title) {
|
155 |
-
$colspan = !empty ( $tbody ) ? count( $tbody[0] ) : 2 ;
|
156 |
-
$this->out( '<tr><th colspan="'.$colspan.'">' . $this->title . '</th></tr>' );
|
157 |
-
}
|
158 |
-
if (! empty ( $thead ))
|
159 |
-
$this->tabHead ( $thead, $class );
|
160 |
-
if (! empty ( $tbody ))
|
161 |
-
$this->tabBody ( $tbody, $class, $javaScript, $classes );
|
162 |
-
else
|
163 |
-
$this->out( '<tr><td colspan="10">' . __ ( 'No data available.', 'wp-piwik' ) . '</td></tr>' );
|
164 |
-
if (! empty ( $tfoot ))
|
165 |
-
$this->tabFoot ( $tfoot, $class );
|
166 |
-
$this->out( '</table></div>' );
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Display a HTML table header
|
171 |
-
*
|
172 |
-
* @param array $thead
|
173 |
-
* array of cells
|
174 |
-
* @param string $class
|
175 |
-
* CSS class to apply
|
176 |
-
*/
|
177 |
-
private function tabHead($thead, $class = false) {
|
178 |
-
$this->out( '<thead' . ($class ? ' class="' . $class . '"' : '') . '><tr>' );
|
179 |
-
$count = 0;
|
180 |
-
foreach ( $thead as $value )
|
181 |
-
$this->out( '<th' . ($count ++ ? ' class="right"' : '') . '>' . $value . '</th>' );
|
182 |
-
$this->out( '</tr></thead>' );
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Display a HTML table body
|
187 |
-
*
|
188 |
-
* @param array $tbody
|
189 |
-
* array of rows, each row containing an array of cells
|
190 |
-
* @param string $class
|
191 |
-
* CSS class to apply
|
192 |
-
* @param unknown $javaScript
|
193 |
-
* array of javascript code to apply (one item per row)
|
194 |
-
*/
|
195 |
-
private function tabBody($tbody, $class = false, $javaScript = array(), $classes = array()) {
|
196 |
-
$this->out( '<tbody' . ($class ? ' class="' . $class . '"' : '') . '>' );
|
197 |
-
foreach ( $tbody as $key => $trow )
|
198 |
-
$this->tabRow ( $trow, isset( $javaScript [$key] ) ?$javaScript [$key] : '', isset ( $classes [$key] ) ?$classes [$key] : '');
|
199 |
-
$this->out( '</tbody>' );
|
200 |
-
}
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Display a HTML table footer
|
204 |
-
*
|
205 |
-
* @param array $tfoor
|
206 |
-
* array of cells
|
207 |
-
* @param string $class
|
208 |
-
* CSS class to apply
|
209 |
-
*/
|
210 |
-
private function tabFoot($tfoot, $class = false) {
|
211 |
-
$this->out( '<tfoot' . ($class ? ' class="' . $class . '"' : '') . '><tr>' );
|
212 |
-
$count = 0;
|
213 |
-
foreach ( $tfoot as $value )
|
214 |
-
$this->out( '<td' . ($count ++ ? ' class="right"' : '') . '>' . $value . '</td>' );
|
215 |
-
$this->out( '</tr></tfoot>' );
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Display a HTML table row
|
220 |
-
*
|
221 |
-
* @param array $trow
|
222 |
-
* array of cells
|
223 |
-
* @param string $javaScript
|
224 |
-
* javascript code to apply
|
225 |
-
*/
|
226 |
-
private function tabRow($trow, $javaScript = '', $class = '') {
|
227 |
-
$this->out( '<tr' . (! empty ( $javaScript ) ? ' onclick="' . $javaScript . '"' : '') . (! empty ( $class ) ? ' class="' . $class . '"' : '') . '>' );
|
228 |
-
$count = 0;
|
229 |
-
foreach ( $trow as $tcell )
|
230 |
-
$this->out( '<td' . ($count ++ ? ' class="right"' : '') . '>' . $tcell . '</td>' );
|
231 |
-
$this->out( '</tr>' );
|
232 |
-
}
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Get the current request's Piwik time settings
|
236 |
-
*
|
237 |
-
* @return array time settings: period => Piwik period, date => requested date, description => time description to show in widget title
|
238 |
-
*/
|
239 |
-
protected function getTimeSettings() {
|
240 |
-
switch (self::$settings->getGlobalOption ( 'default_date' )) {
|
241 |
-
case 'today' :
|
242 |
-
$period = 'day';
|
243 |
-
$date = 'today';
|
244 |
-
$description = __('today', 'wp-piwik' );
|
245 |
-
break;
|
246 |
-
case 'current_month' :
|
247 |
-
$period = 'month';
|
248 |
-
$date = 'today';
|
249 |
-
$description = __('current month', 'wp-piwik' );
|
250 |
-
break;
|
251 |
-
case 'last_month' :
|
252 |
-
$period = 'month';
|
253 |
-
$date = date ( "Y-m-d", strtotime ( "last day of previous month" ) );
|
254 |
-
$description = __('last month', 'wp-piwik' );
|
255 |
-
break;
|
256 |
-
case 'current_week' :
|
257 |
-
$period = 'week';
|
258 |
-
$date = 'today';
|
259 |
-
$description = __('current week', 'wp-piwik' );
|
260 |
-
break;
|
261 |
-
case 'last_week' :
|
262 |
-
$period = 'week';
|
263 |
-
$date = date ( "Y-m-d", strtotime ( "-1 week" ) );
|
264 |
-
$description = __('last week', 'wp-piwik' );
|
265 |
-
break;
|
266 |
-
case 'yesterday' :
|
267 |
-
$period = 'day';
|
268 |
-
$date = 'yesterday';
|
269 |
-
$description = __('yesterday', 'wp-piwik' );
|
270 |
-
break;
|
271 |
-
default :
|
272 |
-
break;
|
273 |
-
}
|
274 |
-
return array (
|
275 |
-
'period' => $period,
|
276 |
-
'date' => isset ( $_GET ['date'] ) ? ( int ) $_GET ['date'] : $date,
|
277 |
-
'description' => isset ( $_GET ['date'] ) ? $this->dateFormat ( $_GET ['date'], $period ) : $description
|
278 |
-
);
|
279 |
-
}
|
280 |
-
|
281 |
-
/**
|
282 |
-
* Format a date to show in widget
|
283 |
-
*
|
284 |
-
* @param string $date
|
285 |
-
* date string
|
286 |
-
* @param string $period
|
287 |
-
* Piwik period
|
288 |
-
* @return string formatted date
|
289 |
-
*/
|
290 |
-
protected function dateFormat($date, $period = 'day') {
|
291 |
-
$prefix = '';
|
292 |
-
switch ($period) {
|
293 |
-
case 'week' :
|
294 |
-
$prefix = __ ( 'week', 'wp-piwik' ) . ' ';
|
295 |
-
$format = 'W/Y';
|
296 |
-
break;
|
297 |
-
case 'short_week' :
|
298 |
-
$format = 'W';
|
299 |
-
break;
|
300 |
-
case 'month' :
|
301 |
-
$format = 'F Y';
|
302 |
-
$date = date ( 'Y-m-d', strtotime ( $date ) );
|
303 |
-
break;
|
304 |
-
default :
|
305 |
-
$format = get_option ( 'date_format' );
|
306 |
-
}
|
307 |
-
return $prefix . date_i18n ( $format, strtotime ( $date ) );
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* Format time to show in widget
|
312 |
-
*
|
313 |
-
* @param int $time
|
314 |
-
* time in seconds
|
315 |
-
* @return string formatted time
|
316 |
-
*/
|
317 |
-
protected function timeFormat($time) {
|
318 |
-
return floor ( $time / 3600 ) . 'h ' . floor ( ($time % 3600) / 60 ) . 'm ' . floor ( ($time % 3600) % 60 ) . 's';
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* Convert Piwik range into meaningful text
|
323 |
-
*
|
324 |
-
* @return string range description
|
325 |
-
*/
|
326 |
-
public function rangeName() {
|
327 |
-
switch ($this->parameter ['date']) {
|
328 |
-
case 'last30' :
|
329 |
-
return __('last 30 days', 'wp-piwik' );
|
330 |
-
case 'last12' :
|
331 |
-
return __('last 12 ' . $this->parameter ['period'] . 's', 'wp-piwik' );
|
332 |
-
default :
|
333 |
-
return $this->parameter ['date'];
|
334 |
-
}
|
335 |
-
}
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Get the widget name
|
339 |
-
*
|
340 |
-
* @return string widget name
|
341 |
-
*/
|
342 |
-
public function getName() {
|
343 |
-
return str_replace ( '\\', '-', get_called_class () );
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* Display a pie chart
|
348 |
-
*
|
349 |
-
* @param
|
350 |
-
* array chart data array(array(0 => name, 1 => value))
|
351 |
-
*/
|
352 |
-
public function pieChart($data) {
|
353 |
-
$this->out( '<div id="wp-piwik_stats_' . $this->getName () . '_graph" style="height:310px;width:100%"></div>' );
|
354 |
-
$this->out( '<script type="text/javascript">$plotBrowsers = $j.jqplot("wp-piwik_stats_' . $this->getName () . '_graph", [[' );
|
355 |
-
$list = '';
|
356 |
-
foreach ( $data as $key => $dataSet ) {
|
357 |
-
$list .= '["' . $dataSet [0] . '", ' . $dataSet [1] . '],';
|
358 |
-
if ($key == 'Others') break;
|
359 |
-
}
|
360 |
-
$this->out( substr ( $list, 0, - 1 ) );
|
361 |
-
$this->out( ']], {seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},legend:{show:true}});</script>' );
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Return an array value by key, return '-' if not set
|
366 |
-
*
|
367 |
-
* @param array $array
|
368 |
-
* array to get a value from
|
369 |
-
* @param string $key
|
370 |
-
* key of the value to get from array
|
371 |
-
* @return string found value or '-' as a placeholder
|
372 |
-
*/
|
373 |
-
protected function value($array, $key) {
|
374 |
-
return (isset ( $array [$key] ) ? $array [$key] : '-');
|
375 |
-
}
|
376 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WP_Piwik;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Abstract widget class
|
7 |
+
*
|
8 |
+
* @author André Bräkling
|
9 |
+
* @package WP_Piwik
|
10 |
+
*/
|
11 |
+
abstract class Widget {
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
* @var Environment variables
|
16 |
+
*/
|
17 |
+
protected static $wpPiwik, $settings;
|
18 |
+
|
19 |
+
/**
|
20 |
+
*
|
21 |
+
* @var Configuration parameters
|
22 |
+
*/
|
23 |
+
protected $isShortcode = false, $method = '', $title = '', $context = 'side', $priority = 'core', $parameter = array (), $apiID = array (), $pageId = 'dashboard', $blogId = null, $name = 'Value', $limit = 10, $content = '', $output = '';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Widget constructor
|
27 |
+
*
|
28 |
+
* @param WP_Piwik $wpPiwik
|
29 |
+
* current WP-Piwik object
|
30 |
+
* @param WP_Piwik\Settings $settings
|
31 |
+
* current WP-Piwik settings
|
32 |
+
* @param string $pageId
|
33 |
+
* WordPress page ID (default: dashboard)
|
34 |
+
* @param string $context
|
35 |
+
* WordPress meta box context (defualt: side)
|
36 |
+
* @param string $priority
|
37 |
+
* WordPress meta box priority (default: default)
|
38 |
+
* @param array $params
|
39 |
+
* widget parameters (default: empty array)
|
40 |
+
* @param boolean $isShortcode
|
41 |
+
* is the widget shown inline? (default: false)
|
42 |
+
*/
|
43 |
+
public function __construct($wpPiwik, $settings, $pageId = 'dashboard', $context = 'side', $priority = 'default', $params = array(), $isShortcode = false) {
|
44 |
+
self::$wpPiwik = $wpPiwik;
|
45 |
+
self::$settings = $settings;
|
46 |
+
$this->pageId = $pageId;
|
47 |
+
$this->context = $context;
|
48 |
+
$this->priority = $priority;
|
49 |
+
if (self::$settings->checkNetworkActivation () && function_exists ( 'is_super_admin' ) && is_super_admin () && isset ( $_GET ['wpmu_show_stats'] )) {
|
50 |
+
switch_to_blog ( ( int ) $_GET ['wpmu_show_stats'] );
|
51 |
+
$this->blogId = get_current_blog_id ();
|
52 |
+
restore_current_blog ();
|
53 |
+
}
|
54 |
+
$this->isShortcode = $isShortcode;
|
55 |
+
$prefix = ($this->pageId == 'dashboard' ? self::$settings->getGlobalOption ( 'plugin_display_name' ) . ' - ' : '');
|
56 |
+
$this->configure ( $prefix, $params );
|
57 |
+
if (is_array ( $this->method ))
|
58 |
+
foreach ( $this->method as $method ) {
|
59 |
+
$this->apiID [$method] = \WP_Piwik\Request::register ( $method, $this->parameter );
|
60 |
+
self::$wpPiwik->log ( "Register request: " . $this->apiID [$method] );
|
61 |
+
}
|
62 |
+
else {
|
63 |
+
$this->apiID [$this->method] = \WP_Piwik\Request::register ( $this->method, $this->parameter );
|
64 |
+
self::$wpPiwik->log ( "Register request: " . $this->apiID [$this->method] );
|
65 |
+
}
|
66 |
+
if ($this->isShortcode)
|
67 |
+
return;
|
68 |
+
add_meta_box ( $this->getName (), $this->title, array (
|
69 |
+
$this,
|
70 |
+
'show'
|
71 |
+
), $pageId, $this->context, $this->priority );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Conifguration dummy method
|
76 |
+
*
|
77 |
+
* @param string $prefix
|
78 |
+
* metabox title prefix (default: empty)
|
79 |
+
* @param array $params
|
80 |
+
* widget parameters (default: empty array)
|
81 |
+
*/
|
82 |
+
protected function configure($prefix = '', $params = array()) {
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Default show widget method, handles default Piwik output
|
87 |
+
*/
|
88 |
+
public function show() {
|
89 |
+
$response = self::$wpPiwik->request ( $this->apiID [$this->method] );
|
90 |
+
if (! empty ( $response ['result'] ) && $response ['result'] == 'error')
|
91 |
+
$this->out( '<strong>' . __ ( 'Piwik error', 'wp-piwik' ) . ':</strong> ' . htmlentities ( $response ['message'], ENT_QUOTES, 'utf-8' ) );
|
92 |
+
else {
|
93 |
+
if (isset ( $response [0] ['nb_uniq_visitors'] ))
|
94 |
+
$unique = 'nb_uniq_visitors';
|
95 |
+
else
|
96 |
+
$unique = 'sum_daily_nb_uniq_visitors';
|
97 |
+
$tableHead = array (
|
98 |
+
'label' => __ ( $this->name, 'wp-piwik' )
|
99 |
+
);
|
100 |
+
$tableHead [$unique] = __ ( 'Unique', 'wp-piwik' );
|
101 |
+
if (isset ( $response [0] ['nb_visits'] ))
|
102 |
+
$tableHead ['nb_visits'] = __ ( 'Visits', 'wp-piwik' );
|
103 |
+
if (isset ( $response [0] ['nb_hits'] ))
|
104 |
+
$tableHead ['nb_hits'] = __ ( 'Hits', 'wp-piwik' );
|
105 |
+
if (isset ( $response [0] ['nb_actions'] ))
|
106 |
+
$tableHead ['nb_actions'] = __ ( 'Actions', 'wp-piwik' );
|
107 |
+
$tableBody = array ();
|
108 |
+
$count = 0;
|
109 |
+
if (is_array($response))
|
110 |
+
foreach ( $response as $rowKey => $row ) {
|
111 |
+
$count ++;
|
112 |
+
$tableBody [$rowKey] = array ();
|
113 |
+
foreach ( $tableHead as $key => $value )
|
114 |
+
$tableBody [$rowKey] [] = isset ( $row [$key] ) ? $row [$key] : '-';
|
115 |
+
if ($count == 10)
|
116 |
+
break;
|
117 |
+
}
|
118 |
+
$this->table ( $tableHead, $tableBody, null );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Display or store shortcode output
|
124 |
+
*/
|
125 |
+
protected function out($output) {
|
126 |
+
if ($this->isShortcode)
|
127 |
+
$this->output .= $output;
|
128 |
+
else echo $output;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Return shortcode output
|
133 |
+
*/
|
134 |
+
public function get() {
|
135 |
+
return $this->output;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Display a HTML table
|
140 |
+
*
|
141 |
+
* @param array $thead
|
142 |
+
* table header content (array of cells)
|
143 |
+
* @param array $tbody
|
144 |
+
* table body content (array of rows)
|
145 |
+
* @param array $tfoot
|
146 |
+
* table footer content (array of cells)
|
147 |
+
* @param string $class
|
148 |
+
* CSSclass name to apply on table sections
|
149 |
+
* @param string $javaScript
|
150 |
+
* array of javascript code to apply on body rows
|
151 |
+
*/
|
152 |
+
protected function table($thead, $tbody = array(), $tfoot = array(), $class = false, $javaScript = array(), $classes = array()) {
|
153 |
+
$this->out( '<div class="table"><table class="widefat wp-piwik-table">' );
|
154 |
+
if ($this->isShortcode && $this->title) {
|
155 |
+
$colspan = !empty ( $tbody ) ? count( $tbody[0] ) : 2 ;
|
156 |
+
$this->out( '<tr><th colspan="'.$colspan.'">' . $this->title . '</th></tr>' );
|
157 |
+
}
|
158 |
+
if (! empty ( $thead ))
|
159 |
+
$this->tabHead ( $thead, $class );
|
160 |
+
if (! empty ( $tbody ))
|
161 |
+
$this->tabBody ( $tbody, $class, $javaScript, $classes );
|
162 |
+
else
|
163 |
+
$this->out( '<tr><td colspan="10">' . __ ( 'No data available.', 'wp-piwik' ) . '</td></tr>' );
|
164 |
+
if (! empty ( $tfoot ))
|
165 |
+
$this->tabFoot ( $tfoot, $class );
|
166 |
+
$this->out( '</table></div>' );
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Display a HTML table header
|
171 |
+
*
|
172 |
+
* @param array $thead
|
173 |
+
* array of cells
|
174 |
+
* @param string $class
|
175 |
+
* CSS class to apply
|
176 |
+
*/
|
177 |
+
private function tabHead($thead, $class = false) {
|
178 |
+
$this->out( '<thead' . ($class ? ' class="' . $class . '"' : '') . '><tr>' );
|
179 |
+
$count = 0;
|
180 |
+
foreach ( $thead as $value )
|
181 |
+
$this->out( '<th' . ($count ++ ? ' class="right"' : '') . '>' . $value . '</th>' );
|
182 |
+
$this->out( '</tr></thead>' );
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Display a HTML table body
|
187 |
+
*
|
188 |
+
* @param array $tbody
|
189 |
+
* array of rows, each row containing an array of cells
|
190 |
+
* @param string $class
|
191 |
+
* CSS class to apply
|
192 |
+
* @param unknown $javaScript
|
193 |
+
* array of javascript code to apply (one item per row)
|
194 |
+
*/
|
195 |
+
private function tabBody($tbody, $class = false, $javaScript = array(), $classes = array()) {
|
196 |
+
$this->out( '<tbody' . ($class ? ' class="' . $class . '"' : '') . '>' );
|
197 |
+
foreach ( $tbody as $key => $trow )
|
198 |
+
$this->tabRow ( $trow, isset( $javaScript [$key] ) ?$javaScript [$key] : '', isset ( $classes [$key] ) ?$classes [$key] : '');
|
199 |
+
$this->out( '</tbody>' );
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Display a HTML table footer
|
204 |
+
*
|
205 |
+
* @param array $tfoor
|
206 |
+
* array of cells
|
207 |
+
* @param string $class
|
208 |
+
* CSS class to apply
|
209 |
+
*/
|
210 |
+
private function tabFoot($tfoot, $class = false) {
|
211 |
+
$this->out( '<tfoot' . ($class ? ' class="' . $class . '"' : '') . '><tr>' );
|
212 |
+
$count = 0;
|
213 |
+
foreach ( $tfoot as $value )
|
214 |
+
$this->out( '<td' . ($count ++ ? ' class="right"' : '') . '>' . $value . '</td>' );
|
215 |
+
$this->out( '</tr></tfoot>' );
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Display a HTML table row
|
220 |
+
*
|
221 |
+
* @param array $trow
|
222 |
+
* array of cells
|
223 |
+
* @param string $javaScript
|
224 |
+
* javascript code to apply
|
225 |
+
*/
|
226 |
+
private function tabRow($trow, $javaScript = '', $class = '') {
|
227 |
+
$this->out( '<tr' . (! empty ( $javaScript ) ? ' onclick="' . $javaScript . '"' : '') . (! empty ( $class ) ? ' class="' . $class . '"' : '') . '>' );
|
228 |
+
$count = 0;
|
229 |
+
foreach ( $trow as $tcell )
|
230 |
+
$this->out( '<td' . ($count ++ ? ' class="right"' : '') . '>' . $tcell . '</td>' );
|
231 |
+
$this->out( '</tr>' );
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Get the current request's Piwik time settings
|
236 |
+
*
|
237 |
+
* @return array time settings: period => Piwik period, date => requested date, description => time description to show in widget title
|
238 |
+
*/
|
239 |
+
protected function getTimeSettings() {
|
240 |
+
switch (self::$settings->getGlobalOption ( 'default_date' )) {
|
241 |
+
case 'today' :
|
242 |
+
$period = 'day';
|
243 |
+
$date = 'today';
|
244 |
+
$description = __('today', 'wp-piwik' );
|
245 |
+
break;
|
246 |
+
case 'current_month' :
|
247 |
+
$period = 'month';
|
248 |
+
$date = 'today';
|
249 |
+
$description = __('current month', 'wp-piwik' );
|
250 |
+
break;
|
251 |
+
case 'last_month' :
|
252 |
+
$period = 'month';
|
253 |
+
$date = date ( "Y-m-d", strtotime ( "last day of previous month" ) );
|
254 |
+
$description = __('last month', 'wp-piwik' );
|
255 |
+
break;
|
256 |
+
case 'current_week' :
|
257 |
+
$period = 'week';
|
258 |
+
$date = 'today';
|
259 |
+
$description = __('current week', 'wp-piwik' );
|
260 |
+
break;
|
261 |
+
case 'last_week' :
|
262 |
+
$period = 'week';
|
263 |
+
$date = date ( "Y-m-d", strtotime ( "-1 week" ) );
|
264 |
+
$description = __('last week', 'wp-piwik' );
|
265 |
+
break;
|
266 |
+
case 'yesterday' :
|
267 |
+
$period = 'day';
|
268 |
+
$date = 'yesterday';
|
269 |
+
$description = __('yesterday', 'wp-piwik' );
|
270 |
+
break;
|
271 |
+
default :
|
272 |
+
break;
|
273 |
+
}
|
274 |
+
return array (
|
275 |
+
'period' => $period,
|
276 |
+
'date' => isset ( $_GET ['date'] ) ? ( int ) $_GET ['date'] : $date,
|
277 |
+
'description' => isset ( $_GET ['date'] ) ? $this->dateFormat ( $_GET ['date'], $period ) : $description
|
278 |
+
);
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Format a date to show in widget
|
283 |
+
*
|
284 |
+
* @param string $date
|
285 |
+
* date string
|
286 |
+
* @param string $period
|
287 |
+
* Piwik period
|
288 |
+
* @return string formatted date
|
289 |
+
*/
|
290 |
+
protected function dateFormat($date, $period = 'day') {
|
291 |
+
$prefix = '';
|
292 |
+
switch ($period) {
|
293 |
+
case 'week' :
|
294 |
+
$prefix = __ ( 'week', 'wp-piwik' ) . ' ';
|
295 |
+
$format = 'W/Y';
|
296 |
+
break;
|
297 |
+
case 'short_week' :
|
298 |
+
$format = 'W';
|
299 |
+
break;
|
300 |
+
case 'month' :
|
301 |
+
$format = 'F Y';
|
302 |
+
$date = date ( 'Y-m-d', strtotime ( $date ) );
|
303 |
+
break;
|
304 |
+
default :
|
305 |
+
$format = get_option ( 'date_format' );
|
306 |
+
}
|
307 |
+
return $prefix . date_i18n ( $format, strtotime ( $date ) );
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Format time to show in widget
|
312 |
+
*
|
313 |
+
* @param int $time
|
314 |
+
* time in seconds
|
315 |
+
* @return string formatted time
|
316 |
+
*/
|
317 |
+
protected function timeFormat($time) {
|
318 |
+
return floor ( $time / 3600 ) . 'h ' . floor ( ($time % 3600) / 60 ) . 'm ' . floor ( ($time % 3600) % 60 ) . 's';
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Convert Piwik range into meaningful text
|
323 |
+
*
|
324 |
+
* @return string range description
|
325 |
+
*/
|
326 |
+
public function rangeName() {
|
327 |
+
switch ($this->parameter ['date']) {
|
328 |
+
case 'last30' :
|
329 |
+
return __('last 30 days', 'wp-piwik' );
|
330 |
+
case 'last12' :
|
331 |
+
return __('last 12 ' . $this->parameter ['period'] . 's', 'wp-piwik' );
|
332 |
+
default :
|
333 |
+
return $this->parameter ['date'];
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Get the widget name
|
339 |
+
*
|
340 |
+
* @return string widget name
|
341 |
+
*/
|
342 |
+
public function getName() {
|
343 |
+
return str_replace ( '\\', '-', get_called_class () );
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Display a pie chart
|
348 |
+
*
|
349 |
+
* @param
|
350 |
+
* array chart data array(array(0 => name, 1 => value))
|
351 |
+
*/
|
352 |
+
public function pieChart($data) {
|
353 |
+
$this->out( '<div id="wp-piwik_stats_' . $this->getName () . '_graph" style="height:310px;width:100%"></div>' );
|
354 |
+
$this->out( '<script type="text/javascript">$plotBrowsers = $j.jqplot("wp-piwik_stats_' . $this->getName () . '_graph", [[' );
|
355 |
+
$list = '';
|
356 |
+
foreach ( $data as $key => $dataSet ) {
|
357 |
+
$list .= '["' . $dataSet [0] . '", ' . $dataSet [1] . '],';
|
358 |
+
if ($key == 'Others') break;
|
359 |
+
}
|
360 |
+
$this->out( substr ( $list, 0, - 1 ) );
|
361 |
+
$this->out( ']], {seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},legend:{show:true}});</script>' );
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Return an array value by key, return '-' if not set
|
366 |
+
*
|
367 |
+
* @param array $array
|
368 |
+
* array to get a value from
|
369 |
+
* @param string $key
|
370 |
+
* key of the value to get from array
|
371 |
+
* @return string found value or '-' as a placeholder
|
372 |
+
*/
|
373 |
+
protected function value($array, $key) {
|
374 |
+
return (isset ( $array [$key] ) ? $array [$key] : '-');
|
375 |
+
}
|
376 |
}
|
classes/WP_Piwik/Widget/BrowserDetails.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Browsers.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Chart.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/City.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Country.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Ecommerce.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Items.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/ItemsCategory.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Keywords.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Models.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Noresult.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/OptOut.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Overview.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Pages.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Plugins.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Post.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Referrers.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Screens.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Search.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Seo.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/SystemDetails.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Systems.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Types.php
CHANGED
File without changes
|
classes/WP_Piwik/Widget/Visitors.php
CHANGED
File without changes
|
config.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/******************************************************
|
4 |
-
* Configure WP-Piwik Logger
|
5 |
-
* 0: Logger disabled
|
6 |
-
* 1: Log to screen
|
7 |
-
* 2: Log to file (logs/YYYYMMDD_wp-piwik.log)
|
8 |
-
******************************************************/
|
9 |
define ( 'WP_PIWIK_ACTIVATE_LOGGER', 0 );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/******************************************************
|
4 |
+
* Configure WP-Piwik Logger
|
5 |
+
* 0: Logger disabled
|
6 |
+
* 1: Log to screen
|
7 |
+
* 2: Log to file (logs/YYYYMMDD_wp-piwik.log)
|
8 |
+
******************************************************/
|
9 |
define ( 'WP_PIWIK_ACTIVATE_LOGGER', 0 );
|
css/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
// Nothing to see...
|
1 |
+
<?php
|
2 |
// Nothing to see...
|
css/wp-piwik-spark.css
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
.wp-piwik_dynbar canvas {
|
2 |
-
padding-top: 5px !important
|
3 |
}
|
1 |
+
.wp-piwik_dynbar canvas {
|
2 |
+
padding-top: 5px !important
|
3 |
}
|
css/wp-piwik.css
CHANGED
File without changes
|
gpl-3.0.html
CHANGED
File without changes
|
index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
// Nothing to see...
|
1 |
+
<?php
|
2 |
// Nothing to see...
|
js/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
// Nothing to see...
|
1 |
+
<?php
|
2 |
// Nothing to see...
|
js/jqplot/IMPORTANT_NOTICE.txt
CHANGED
File without changes
|
js/jqplot/MIT-LICENSE.txt
CHANGED
File without changes
|
js/jqplot/README.txt
CHANGED
File without changes
|
js/jqplot/changes.txt
CHANGED
File without changes
|
js/jqplot/copyright.txt
CHANGED
File without changes
|
js/jqplot/excanvas.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
/* jqPlot @VERSION | (c) 2009-2013 Chris Leonello | jplot.com
|
2 |
-
jsDate | (c) 2010-2013 Chris Leonello
|
3 |
*/if(!document.createElement("canvas").getContext){(function(){var ab=Math;var n=ab.round;var l=ab.sin;var A=ab.cos;var H=ab.abs;var N=ab.sqrt;var d=10;var f=d/2;var z=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];function y(){return this.context_||(this.context_=new D(this))}var t=Array.prototype.slice;function g(j,m,p){var i=t.call(arguments,2);return function(){return j.apply(m,i.concat(t.call(arguments)))}}function af(i){return String(i).replace(/&/g,"&").replace(/"/g,""")}function Y(m,j,i){if(!m.namespaces[j]){m.namespaces.add(j,i,"#default#VML")}}function R(j){Y(j,"g_vml_","urn:schemas-microsoft-com:vml");Y(j,"g_o_","urn:schemas-microsoft-com:office:office");if(!j.styleSheets.ex_canvas_){var i=j.createStyleSheet();i.owningElement.id="ex_canvas_";i.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}R(document);var e={init:function(i){var j=i||document;j.createElement("canvas");j.attachEvent("onreadystatechange",g(this.init_,this,j))},init_:function(p){var m=p.getElementsByTagName("canvas");for(var j=0;j<m.length;j++){this.initElement(m[j])}},initElement:function(j){if(!j.getContext){j.getContext=y;R(j.ownerDocument);j.innerHTML="";j.attachEvent("onpropertychange",x);j.attachEvent("onresize",W);var i=j.attributes;if(i.width&&i.width.specified){j.style.width=i.width.nodeValue+"px"}else{j.width=j.clientWidth}if(i.height&&i.height.specified){j.style.height=i.height.nodeValue+"px"}else{j.height=j.clientHeight}}return j},uninitElement:function(j){if(j.getContext){var i=j.getContext();delete i.element_;delete i.canvas;j.innerHTML="";j.context_=null;j.getContext=null;j.detachEvent("onpropertychange",x);j.detachEvent("onresize",W)}}};function x(j){var i=j.srcElement;switch(j.propertyName){case"width":i.getContext().clearRect();i.style.width=i.attributes.width.nodeValue+"px";i.firstChild.style.width=i.clientWidth+"px";break;case"height":i.getContext().clearRect();i.style.height=i.attributes.height.nodeValue+"px";i.firstChild.style.height=i.clientHeight+"px";break}}function W(j){var i=j.srcElement;if(i.firstChild){i.firstChild.style.width=i.clientWidth+"px";i.firstChild.style.height=i.clientHeight+"px"}}e.init();var k=[];for(var ae=0;ae<16;ae++){for(var ad=0;ad<16;ad++){k[ae*16+ad]=ae.toString(16)+ad.toString(16)}}function B(){return[[1,0,0],[0,1,0],[0,0,1]]}function J(p,m){var j=B();for(var i=0;i<3;i++){for(var ah=0;ah<3;ah++){var Z=0;for(var ag=0;ag<3;ag++){Z+=p[i][ag]*m[ag][ah]}j[i][ah]=Z}}return j}function v(j,i){i.fillStyle=j.fillStyle;i.lineCap=j.lineCap;i.lineJoin=j.lineJoin;i.lineWidth=j.lineWidth;i.miterLimit=j.miterLimit;i.shadowBlur=j.shadowBlur;i.shadowColor=j.shadowColor;i.shadowOffsetX=j.shadowOffsetX;i.shadowOffsetY=j.shadowOffsetY;i.strokeStyle=j.strokeStyle;i.globalAlpha=j.globalAlpha;i.font=j.font;i.textAlign=j.textAlign;i.textBaseline=j.textBaseline;i.arcScaleX_=j.arcScaleX_;i.arcScaleY_=j.arcScaleY_;i.lineScale_=j.lineScale_}var b={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"};function M(j){var p=j.indexOf("(",3);var i=j.indexOf(")",p+1);var m=j.substring(p+1,i).split(",");if(m.length!=4||j.charAt(3)!="a"){m[3]=1}return m}function c(i){return parseFloat(i)/100}function r(j,m,i){return Math.min(i,Math.max(m,j))}function I(ag){var i,ai,aj,ah,ak,Z;ah=parseFloat(ag[0])/360%360;if(ah<0){ah++}ak=r(c(ag[1]),0,1);Z=r(c(ag[2]),0,1);if(ak==0){i=ai=aj=Z}else{var j=Z<0.5?Z*(1+ak):Z+ak-Z*ak;var m=2*Z-j;i=a(m,j,ah+1/3);ai=a(m,j,ah);aj=a(m,j,ah-1/3)}return"#"+k[Math.floor(i*255)]+k[Math.floor(ai*255)]+k[Math.floor(aj*255)]}function a(j,i,m){if(m<0){m++}if(m>1){m--}if(6*m<1){return j+(i-j)*6*m}else{if(2*m<1){return i}else{if(3*m<2){return j+(i-j)*(2/3-m)*6}else{return j}}}}var C={};function F(j){if(j in C){return C[j]}var ag,Z=1;j=String(j);if(j.charAt(0)=="#"){ag=j}else{if(/^rgb/.test(j)){var p=M(j);var ag="#",ah;for(var m=0;m<3;m++){if(p[m].indexOf("%")!=-1){ah=Math.floor(c(p[m])*255)}else{ah=+p[m]}ag+=k[r(ah,0,255)]}Z=+p[3]}else{if(/^hsl/.test(j)){var p=M(j);ag=I(p);Z=p[3]}else{ag=b[j]||j}}}return C[j]={color:ag,alpha:Z}}var o={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"};var L={};function E(i){if(L[i]){return L[i]}var p=document.createElement("div");var m=p.style;try{m.font=i}catch(j){}return L[i]={style:m.fontStyle||o.style,variant:m.fontVariant||o.variant,weight:m.fontWeight||o.weight,size:m.fontSize||o.size,family:m.fontFamily||o.family}}function u(m,j){var i={};for(var ah in m){i[ah]=m[ah]}var ag=parseFloat(j.currentStyle.fontSize),Z=parseFloat(m.size);if(typeof m.size=="number"){i.size=m.size}else{if(m.size.indexOf("px")!=-1){i.size=Z}else{if(m.size.indexOf("em")!=-1){i.size=ag*Z}else{if(m.size.indexOf("%")!=-1){i.size=(ag/100)*Z}else{if(m.size.indexOf("pt")!=-1){i.size=Z/0.75}else{i.size=ag}}}}}i.size*=0.981;i.family="'"+i.family.replace(/(\'|\")/g,"").replace(/\s*,\s*/g,"', '")+"'";return i}function ac(i){return i.style+" "+i.variant+" "+i.weight+" "+i.size+"px "+i.family}var s={butt:"flat",round:"round"};function S(i){return s[i]||"square"}function D(i){this.m_=B();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=d*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=i;var m="width:"+i.clientWidth+"px;height:"+i.clientHeight+"px;overflow:hidden;position:absolute";var j=i.ownerDocument.createElement("div");j.style.cssText=m;i.appendChild(j);var p=j.cloneNode(false);p.style.backgroundColor="red";p.style.filter="alpha(opacity=0)";i.appendChild(p);this.element_=j;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var q=D.prototype;q.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null}this.element_.innerHTML=""};q.beginPath=function(){this.currentPath_=[]};q.moveTo=function(j,i){var m=V(this,j,i);this.currentPath_.push({type:"moveTo",x:m.x,y:m.y});this.currentX_=m.x;this.currentY_=m.y};q.lineTo=function(j,i){var m=V(this,j,i);this.currentPath_.push({type:"lineTo",x:m.x,y:m.y});this.currentX_=m.x;this.currentY_=m.y};q.bezierCurveTo=function(m,j,ak,aj,ai,ag){var i=V(this,ai,ag);var ah=V(this,m,j);var Z=V(this,ak,aj);K(this,ah,Z,i)};function K(i,Z,m,j){i.currentPath_.push({type:"bezierCurveTo",cp1x:Z.x,cp1y:Z.y,cp2x:m.x,cp2y:m.y,x:j.x,y:j.y});i.currentX_=j.x;i.currentY_=j.y}q.quadraticCurveTo=function(ai,m,j,i){var ah=V(this,ai,m);var ag=V(this,j,i);var aj={x:this.currentX_+2/3*(ah.x-this.currentX_),y:this.currentY_+2/3*(ah.y-this.currentY_)};var Z={x:aj.x+(ag.x-this.currentX_)/3,y:aj.y+(ag.y-this.currentY_)/3};K(this,aj,Z,ag)};q.arc=function(al,aj,ak,ag,j,m){ak*=d;var ap=m?"at":"wa";var am=al+A(ag)*ak-f;var ao=aj+l(ag)*ak-f;var i=al+A(j)*ak-f;var an=aj+l(j)*ak-f;if(am==i&&!m){am+=0.125}var Z=V(this,al,aj);var ai=V(this,am,ao);var ah=V(this,i,an);this.currentPath_.push({type:ap,x:Z.x,y:Z.y,radius:ak,xStart:ai.x,yStart:ai.y,xEnd:ah.x,yEnd:ah.y})};q.rect=function(m,j,i,p){this.moveTo(m,j);this.lineTo(m+i,j);this.lineTo(m+i,j+p);this.lineTo(m,j+p);this.closePath()};q.strokeRect=function(m,j,i,p){var Z=this.currentPath_;this.beginPath();this.moveTo(m,j);this.lineTo(m+i,j);this.lineTo(m+i,j+p);this.lineTo(m,j+p);this.closePath();this.stroke();this.currentPath_=Z};q.fillRect=function(m,j,i,p){var Z=this.currentPath_;this.beginPath();this.moveTo(m,j);this.lineTo(m+i,j);this.lineTo(m+i,j+p);this.lineTo(m,j+p);this.closePath();this.fill();this.currentPath_=Z};q.createLinearGradient=function(j,p,i,m){var Z=new U("gradient");Z.x0_=j;Z.y0_=p;Z.x1_=i;Z.y1_=m;return Z};q.createRadialGradient=function(p,ag,m,j,Z,i){var ah=new U("gradientradial");ah.x0_=p;ah.y0_=ag;ah.r0_=m;ah.x1_=j;ah.y1_=Z;ah.r1_=i;return ah};q.drawImage=function(aq,m){var aj,ah,al,ay,ao,am,at,aA;var ak=aq.runtimeStyle.width;var ap=aq.runtimeStyle.height;aq.runtimeStyle.width="auto";aq.runtimeStyle.height="auto";var ai=aq.width;var aw=aq.height;aq.runtimeStyle.width=ak;aq.runtimeStyle.height=ap;if(arguments.length==3){aj=arguments[1];ah=arguments[2];ao=am=0;at=al=ai;aA=ay=aw}else{if(arguments.length==5){aj=arguments[1];ah=arguments[2];al=arguments[3];ay=arguments[4];ao=am=0;at=ai;aA=aw}else{if(arguments.length==9){ao=arguments[1];am=arguments[2];at=arguments[3];aA=arguments[4];aj=arguments[5];ah=arguments[6];al=arguments[7];ay=arguments[8]}else{throw Error("Invalid number of arguments")}}}var az=V(this,aj,ah);var p=at/2;var j=aA/2;var ax=[];var i=10;var ag=10;ax.push(" <g_vml_:group",' coordsize="',d*i,",",d*ag,'"',' coordorigin="0,0"',' style="width:',i,"px;height:",ag,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var Z=[];Z.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",n(az.x/d),",","Dy=",n(az.y/d),"");var av=az;var au=V(this,aj+al,ah);var ar=V(this,aj,ah+ay);var an=V(this,aj+al,ah+ay);av.x=ab.max(av.x,au.x,ar.x,an.x);av.y=ab.max(av.y,au.y,ar.y,an.y);ax.push("padding:0 ",n(av.x/d),"px ",n(av.y/d),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",Z.join(""),", sizingmethod='clip');")}else{ax.push("top:",n(az.y/d),"px;left:",n(az.x/d),"px;")}ax.push(' ">','<g_vml_:image src="',aq.src,'"',' style="width:',d*al,"px;"," height:",d*ay,'px"',' cropleft="',ao/ai,'"',' croptop="',am/aw,'"',' cropright="',(ai-ao-at)/ai,'"',' cropbottom="',(aw-am-aA)/aw,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",ax.join(""))};q.stroke=function(al){var aj=[];var Z=false;var m=10;var am=10;aj.push("<g_vml_:shape",' filled="',!!al,'"',' style="position:absolute;width:',m,"px;height:",am,'px;"',' coordorigin="0,0"',' coordsize="',d*m,",",d*am,'"',' stroked="',!al,'"',' path="');var an=false;var ag={x:null,y:null};var ak={x:null,y:null};for(var ah=0;ah<this.currentPath_.length;ah++){var j=this.currentPath_[ah];var ai;switch(j.type){case"moveTo":ai=j;aj.push(" m ",n(j.x),",",n(j.y));break;case"lineTo":aj.push(" l ",n(j.x),",",n(j.y));break;case"close":aj.push(" x ");j=null;break;case"bezierCurveTo":aj.push(" c ",n(j.cp1x),",",n(j.cp1y),",",n(j.cp2x),",",n(j.cp2y),",",n(j.x),",",n(j.y));break;case"at":case"wa":aj.push(" ",j.type," ",n(j.x-this.arcScaleX_*j.radius),",",n(j.y-this.arcScaleY_*j.radius)," ",n(j.x+this.arcScaleX_*j.radius),",",n(j.y+this.arcScaleY_*j.radius)," ",n(j.xStart),",",n(j.yStart)," ",n(j.xEnd),",",n(j.yEnd));break}if(j){if(ag.x==null||j.x<ag.x){ag.x=j.x}if(ak.x==null||j.x>ak.x){ak.x=j.x}if(ag.y==null||j.y<ag.y){ag.y=j.y}if(ak.y==null||j.y>ak.y){ak.y=j.y}}}aj.push(' ">');if(!al){w(this,aj)}else{G(this,aj,ag,ak)}aj.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",aj.join(""))};function w(m,ag){var j=F(m.strokeStyle);var p=j.color;var Z=j.alpha*m.globalAlpha;var i=m.lineScale_*m.lineWidth;if(i<1){Z*=i}ag.push("<g_vml_:stroke",' opacity="',Z,'"',' joinstyle="',m.lineJoin,'"',' miterlimit="',m.miterLimit,'"',' endcap="',S(m.lineCap),'"',' weight="',i,'px"',' color="',p,'" />')}function G(aq,ai,aK,ar){var aj=aq.fillStyle;var aB=aq.arcScaleX_;var aA=aq.arcScaleY_;var j=ar.x-aK.x;var p=ar.y-aK.y;if(aj instanceof U){var an=0;var aF={x:0,y:0};var ax=0;var am=1;if(aj.type_=="gradient"){var al=aj.x0_/aB;var m=aj.y0_/aA;var ak=aj.x1_/aB;var aM=aj.y1_/aA;var aJ=V(aq,al,m);var aI=V(aq,ak,aM);var ag=aI.x-aJ.x;var Z=aI.y-aJ.y;an=Math.atan2(ag,Z)*180/Math.PI;if(an<0){an+=360}if(an<0.000001){an=0}}else{var aJ=V(aq,aj.x0_,aj.y0_);aF={x:(aJ.x-aK.x)/j,y:(aJ.y-aK.y)/p};j/=aB*d;p/=aA*d;var aD=ab.max(j,p);ax=2*aj.r0_/aD;am=2*aj.r1_/aD-ax}var av=aj.colors_;av.sort(function(aN,i){return aN.offset-i.offset});var ap=av.length;var au=av[0].color;var at=av[ap-1].color;var az=av[0].alpha*aq.globalAlpha;var ay=av[ap-1].alpha*aq.globalAlpha;var aE=[];for(var aH=0;aH<ap;aH++){var ao=av[aH];aE.push(ao.offset*am+ax+" "+ao.color)}ai.push('<g_vml_:fill type="',aj.type_,'"',' method="none" focus="100%"',' color="',au,'"',' color2="',at,'"',' colors="',aE.join(","),'"',' opacity="',ay,'"',' g_o_:opacity2="',az,'"',' angle="',an,'"',' focusposition="',aF.x,",",aF.y,'" />')}else{if(aj instanceof T){if(j&&p){var ah=-aK.x;var aC=-aK.y;ai.push("<g_vml_:fill",' position="',ah/j*aB*aB,",",aC/p*aA*aA,'"',' type="tile"',' src="',aj.src_,'" />')}}else{var aL=F(aq.fillStyle);var aw=aL.color;var aG=aL.alpha*aq.globalAlpha;ai.push('<g_vml_:fill color="',aw,'" opacity="',aG,'" />')}}}q.fill=function(){this.stroke(true)};q.closePath=function(){this.currentPath_.push({type:"close"})};function V(j,Z,p){var i=j.m_;return{x:d*(Z*i[0][0]+p*i[1][0]+i[2][0])-f,y:d*(Z*i[0][1]+p*i[1][1]+i[2][1])-f}}q.save=function(){var i={};v(this,i);this.aStack_.push(i);this.mStack_.push(this.m_);this.m_=J(B(),this.m_)};q.restore=function(){if(this.aStack_.length){v(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};function h(i){return isFinite(i[0][0])&&isFinite(i[0][1])&&isFinite(i[1][0])&&isFinite(i[1][1])&&isFinite(i[2][0])&&isFinite(i[2][1])}function aa(j,i,p){if(!h(i)){return}j.m_=i;if(p){var Z=i[0][0]*i[1][1]-i[0][1]*i[1][0];j.lineScale_=N(H(Z))}}q.translate=function(m,j){var i=[[1,0,0],[0,1,0],[m,j,1]];aa(this,J(i,this.m_),false)};q.rotate=function(j){var p=A(j);var m=l(j);var i=[[p,m,0],[-m,p,0],[0,0,1]];aa(this,J(i,this.m_),false)};q.scale=function(m,j){this.arcScaleX_*=m;this.arcScaleY_*=j;var i=[[m,0,0],[0,j,0],[0,0,1]];aa(this,J(i,this.m_),true)};q.transform=function(Z,p,ah,ag,j,i){var m=[[Z,p,0],[ah,ag,0],[j,i,1]];aa(this,J(m,this.m_),true)};q.setTransform=function(ag,Z,ai,ah,p,j){var i=[[ag,Z,0],[ai,ah,0],[p,j,1]];aa(this,i,true)};q.drawText_=function(am,ak,aj,ap,ai){var ao=this.m_,at=1000,j=0,ar=at,ah={x:0,y:0},ag=[];var i=u(E(this.font),this.element_);var p=ac(i);var au=this.element_.currentStyle;var Z=this.textAlign.toLowerCase();switch(Z){case"left":case"center":case"right":break;case"end":Z=au.direction=="ltr"?"right":"left";break;case"start":Z=au.direction=="rtl"?"right":"left";break;default:Z="left"}switch(this.textBaseline){case"hanging":case"top":ah.y=i.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":ah.y=-i.size/2.25;break}switch(Z){case"right":j=at;ar=0.05;break;case"center":j=ar=at/2;break}var aq=V(this,ak+ah.x,aj+ah.y);ag.push('<g_vml_:line from="',-j,' 0" to="',ar,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!ai,'" stroked="',!!ai,'" style="position:absolute;width:1px;height:1px;">');if(ai){w(this,ag)}else{G(this,ag,{x:-j,y:0},{x:ar,y:i.size})}var an=ao[0][0].toFixed(3)+","+ao[1][0].toFixed(3)+","+ao[0][1].toFixed(3)+","+ao[1][1].toFixed(3)+",0,0";var al=n(aq.x/d+1-ao[0][0])+","+n(aq.y/d-2*ao[1][0]);ag.push('<g_vml_:skew on="t" matrix="',an,'" ',' offset="',al,'" origin="',j,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',af(am),'" style="v-text-align:',Z,";font:",af(p),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",ag.join(""))};q.fillText=function(m,i,p,j){this.drawText_(m,i,p,j,false)};q.strokeText=function(m,i,p,j){this.drawText_(m,i,p,j,true)};q.measureText=function(m){if(!this.textMeasureEl_){var i='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",i);this.textMeasureEl_=this.element_.lastChild}var j=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(j.createTextNode(m));return{width:this.textMeasureEl_.offsetWidth}};q.clip=function(){};q.arcTo=function(){};q.createPattern=function(j,i){return new T(j,i)};function U(i){this.type_=i;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}U.prototype.addColorStop=function(j,i){i=F(i);this.colors_.push({offset:j,color:i.color,alpha:i.alpha})};function T(j,i){Q(j);switch(i){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=i;break;default:O("SYNTAX_ERR")}this.src_=j.src;this.width_=j.width;this.height_=j.height}function O(i){throw new P(i)}function Q(i){if(!i||i.nodeType!=1||i.tagName!="IMG"){O("TYPE_MISMATCH_ERR")}if(i.readyState!="complete"){O("INVALID_STATE_ERR")}}function P(i){this.code=this[i];this.message=i+": DOM Exception "+this.code}var X=P.prototype=new Error;X.INDEX_SIZE_ERR=1;X.DOMSTRING_SIZE_ERR=2;X.HIERARCHY_REQUEST_ERR=3;X.WRONG_DOCUMENT_ERR=4;X.INVALID_CHARACTER_ERR=5;X.NO_DATA_ALLOWED_ERR=6;X.NO_MODIFICATION_ALLOWED_ERR=7;X.NOT_FOUND_ERR=8;X.NOT_SUPPORTED_ERR=9;X.INUSE_ATTRIBUTE_ERR=10;X.INVALID_STATE_ERR=11;X.SYNTAX_ERR=12;X.INVALID_MODIFICATION_ERR=13;X.NAMESPACE_ERR=14;X.INVALID_ACCESS_ERR=15;X.VALIDATION_ERR=16;X.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=e;CanvasRenderingContext2D=D;CanvasGradient=U;CanvasPattern=T;DOMException=P;G_vmlCanvasManager._version=888})()};
|
1 |
+
/* jqPlot @VERSION | (c) 2009-2013 Chris Leonello | jplot.com
|
2 |
+
jsDate | (c) 2010-2013 Chris Leonello
|
3 |
*/if(!document.createElement("canvas").getContext){(function(){var ab=Math;var n=ab.round;var l=ab.sin;var A=ab.cos;var H=ab.abs;var N=ab.sqrt;var d=10;var f=d/2;var z=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];function y(){return this.context_||(this.context_=new D(this))}var t=Array.prototype.slice;function g(j,m,p){var i=t.call(arguments,2);return function(){return j.apply(m,i.concat(t.call(arguments)))}}function af(i){return String(i).replace(/&/g,"&").replace(/"/g,""")}function Y(m,j,i){if(!m.namespaces[j]){m.namespaces.add(j,i,"#default#VML")}}function R(j){Y(j,"g_vml_","urn:schemas-microsoft-com:vml");Y(j,"g_o_","urn:schemas-microsoft-com:office:office");if(!j.styleSheets.ex_canvas_){var i=j.createStyleSheet();i.owningElement.id="ex_canvas_";i.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}R(document);var e={init:function(i){var j=i||document;j.createElement("canvas");j.attachEvent("onreadystatechange",g(this.init_,this,j))},init_:function(p){var m=p.getElementsByTagName("canvas");for(var j=0;j<m.length;j++){this.initElement(m[j])}},initElement:function(j){if(!j.getContext){j.getContext=y;R(j.ownerDocument);j.innerHTML="";j.attachEvent("onpropertychange",x);j.attachEvent("onresize",W);var i=j.attributes;if(i.width&&i.width.specified){j.style.width=i.width.nodeValue+"px"}else{j.width=j.clientWidth}if(i.height&&i.height.specified){j.style.height=i.height.nodeValue+"px"}else{j.height=j.clientHeight}}return j},uninitElement:function(j){if(j.getContext){var i=j.getContext();delete i.element_;delete i.canvas;j.innerHTML="";j.context_=null;j.getContext=null;j.detachEvent("onpropertychange",x);j.detachEvent("onresize",W)}}};function x(j){var i=j.srcElement;switch(j.propertyName){case"width":i.getContext().clearRect();i.style.width=i.attributes.width.nodeValue+"px";i.firstChild.style.width=i.clientWidth+"px";break;case"height":i.getContext().clearRect();i.style.height=i.attributes.height.nodeValue+"px";i.firstChild.style.height=i.clientHeight+"px";break}}function W(j){var i=j.srcElement;if(i.firstChild){i.firstChild.style.width=i.clientWidth+"px";i.firstChild.style.height=i.clientHeight+"px"}}e.init();var k=[];for(var ae=0;ae<16;ae++){for(var ad=0;ad<16;ad++){k[ae*16+ad]=ae.toString(16)+ad.toString(16)}}function B(){return[[1,0,0],[0,1,0],[0,0,1]]}function J(p,m){var j=B();for(var i=0;i<3;i++){for(var ah=0;ah<3;ah++){var Z=0;for(var ag=0;ag<3;ag++){Z+=p[i][ag]*m[ag][ah]}j[i][ah]=Z}}return j}function v(j,i){i.fillStyle=j.fillStyle;i.lineCap=j.lineCap;i.lineJoin=j.lineJoin;i.lineWidth=j.lineWidth;i.miterLimit=j.miterLimit;i.shadowBlur=j.shadowBlur;i.shadowColor=j.shadowColor;i.shadowOffsetX=j.shadowOffsetX;i.shadowOffsetY=j.shadowOffsetY;i.strokeStyle=j.strokeStyle;i.globalAlpha=j.globalAlpha;i.font=j.font;i.textAlign=j.textAlign;i.textBaseline=j.textBaseline;i.arcScaleX_=j.arcScaleX_;i.arcScaleY_=j.arcScaleY_;i.lineScale_=j.lineScale_}var b={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"};function M(j){var p=j.indexOf("(",3);var i=j.indexOf(")",p+1);var m=j.substring(p+1,i).split(",");if(m.length!=4||j.charAt(3)!="a"){m[3]=1}return m}function c(i){return parseFloat(i)/100}function r(j,m,i){return Math.min(i,Math.max(m,j))}function I(ag){var i,ai,aj,ah,ak,Z;ah=parseFloat(ag[0])/360%360;if(ah<0){ah++}ak=r(c(ag[1]),0,1);Z=r(c(ag[2]),0,1);if(ak==0){i=ai=aj=Z}else{var j=Z<0.5?Z*(1+ak):Z+ak-Z*ak;var m=2*Z-j;i=a(m,j,ah+1/3);ai=a(m,j,ah);aj=a(m,j,ah-1/3)}return"#"+k[Math.floor(i*255)]+k[Math.floor(ai*255)]+k[Math.floor(aj*255)]}function a(j,i,m){if(m<0){m++}if(m>1){m--}if(6*m<1){return j+(i-j)*6*m}else{if(2*m<1){return i}else{if(3*m<2){return j+(i-j)*(2/3-m)*6}else{return j}}}}var C={};function F(j){if(j in C){return C[j]}var ag,Z=1;j=String(j);if(j.charAt(0)=="#"){ag=j}else{if(/^rgb/.test(j)){var p=M(j);var ag="#",ah;for(var m=0;m<3;m++){if(p[m].indexOf("%")!=-1){ah=Math.floor(c(p[m])*255)}else{ah=+p[m]}ag+=k[r(ah,0,255)]}Z=+p[3]}else{if(/^hsl/.test(j)){var p=M(j);ag=I(p);Z=p[3]}else{ag=b[j]||j}}}return C[j]={color:ag,alpha:Z}}var o={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"};var L={};function E(i){if(L[i]){return L[i]}var p=document.createElement("div");var m=p.style;try{m.font=i}catch(j){}return L[i]={style:m.fontStyle||o.style,variant:m.fontVariant||o.variant,weight:m.fontWeight||o.weight,size:m.fontSize||o.size,family:m.fontFamily||o.family}}function u(m,j){var i={};for(var ah in m){i[ah]=m[ah]}var ag=parseFloat(j.currentStyle.fontSize),Z=parseFloat(m.size);if(typeof m.size=="number"){i.size=m.size}else{if(m.size.indexOf("px")!=-1){i.size=Z}else{if(m.size.indexOf("em")!=-1){i.size=ag*Z}else{if(m.size.indexOf("%")!=-1){i.size=(ag/100)*Z}else{if(m.size.indexOf("pt")!=-1){i.size=Z/0.75}else{i.size=ag}}}}}i.size*=0.981;i.family="'"+i.family.replace(/(\'|\")/g,"").replace(/\s*,\s*/g,"', '")+"'";return i}function ac(i){return i.style+" "+i.variant+" "+i.weight+" "+i.size+"px "+i.family}var s={butt:"flat",round:"round"};function S(i){return s[i]||"square"}function D(i){this.m_=B();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=d*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=i;var m="width:"+i.clientWidth+"px;height:"+i.clientHeight+"px;overflow:hidden;position:absolute";var j=i.ownerDocument.createElement("div");j.style.cssText=m;i.appendChild(j);var p=j.cloneNode(false);p.style.backgroundColor="red";p.style.filter="alpha(opacity=0)";i.appendChild(p);this.element_=j;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var q=D.prototype;q.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null}this.element_.innerHTML=""};q.beginPath=function(){this.currentPath_=[]};q.moveTo=function(j,i){var m=V(this,j,i);this.currentPath_.push({type:"moveTo",x:m.x,y:m.y});this.currentX_=m.x;this.currentY_=m.y};q.lineTo=function(j,i){var m=V(this,j,i);this.currentPath_.push({type:"lineTo",x:m.x,y:m.y});this.currentX_=m.x;this.currentY_=m.y};q.bezierCurveTo=function(m,j,ak,aj,ai,ag){var i=V(this,ai,ag);var ah=V(this,m,j);var Z=V(this,ak,aj);K(this,ah,Z,i)};function K(i,Z,m,j){i.currentPath_.push({type:"bezierCurveTo",cp1x:Z.x,cp1y:Z.y,cp2x:m.x,cp2y:m.y,x:j.x,y:j.y});i.currentX_=j.x;i.currentY_=j.y}q.quadraticCurveTo=function(ai,m,j,i){var ah=V(this,ai,m);var ag=V(this,j,i);var aj={x:this.currentX_+2/3*(ah.x-this.currentX_),y:this.currentY_+2/3*(ah.y-this.currentY_)};var Z={x:aj.x+(ag.x-this.currentX_)/3,y:aj.y+(ag.y-this.currentY_)/3};K(this,aj,Z,ag)};q.arc=function(al,aj,ak,ag,j,m){ak*=d;var ap=m?"at":"wa";var am=al+A(ag)*ak-f;var ao=aj+l(ag)*ak-f;var i=al+A(j)*ak-f;var an=aj+l(j)*ak-f;if(am==i&&!m){am+=0.125}var Z=V(this,al,aj);var ai=V(this,am,ao);var ah=V(this,i,an);this.currentPath_.push({type:ap,x:Z.x,y:Z.y,radius:ak,xStart:ai.x,yStart:ai.y,xEnd:ah.x,yEnd:ah.y})};q.rect=function(m,j,i,p){this.moveTo(m,j);this.lineTo(m+i,j);this.lineTo(m+i,j+p);this.lineTo(m,j+p);this.closePath()};q.strokeRect=function(m,j,i,p){var Z=this.currentPath_;this.beginPath();this.moveTo(m,j);this.lineTo(m+i,j);this.lineTo(m+i,j+p);this.lineTo(m,j+p);this.closePath();this.stroke();this.currentPath_=Z};q.fillRect=function(m,j,i,p){var Z=this.currentPath_;this.beginPath();this.moveTo(m,j);this.lineTo(m+i,j);this.lineTo(m+i,j+p);this.lineTo(m,j+p);this.closePath();this.fill();this.currentPath_=Z};q.createLinearGradient=function(j,p,i,m){var Z=new U("gradient");Z.x0_=j;Z.y0_=p;Z.x1_=i;Z.y1_=m;return Z};q.createRadialGradient=function(p,ag,m,j,Z,i){var ah=new U("gradientradial");ah.x0_=p;ah.y0_=ag;ah.r0_=m;ah.x1_=j;ah.y1_=Z;ah.r1_=i;return ah};q.drawImage=function(aq,m){var aj,ah,al,ay,ao,am,at,aA;var ak=aq.runtimeStyle.width;var ap=aq.runtimeStyle.height;aq.runtimeStyle.width="auto";aq.runtimeStyle.height="auto";var ai=aq.width;var aw=aq.height;aq.runtimeStyle.width=ak;aq.runtimeStyle.height=ap;if(arguments.length==3){aj=arguments[1];ah=arguments[2];ao=am=0;at=al=ai;aA=ay=aw}else{if(arguments.length==5){aj=arguments[1];ah=arguments[2];al=arguments[3];ay=arguments[4];ao=am=0;at=ai;aA=aw}else{if(arguments.length==9){ao=arguments[1];am=arguments[2];at=arguments[3];aA=arguments[4];aj=arguments[5];ah=arguments[6];al=arguments[7];ay=arguments[8]}else{throw Error("Invalid number of arguments")}}}var az=V(this,aj,ah);var p=at/2;var j=aA/2;var ax=[];var i=10;var ag=10;ax.push(" <g_vml_:group",' coordsize="',d*i,",",d*ag,'"',' coordorigin="0,0"',' style="width:',i,"px;height:",ag,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var Z=[];Z.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",n(az.x/d),",","Dy=",n(az.y/d),"");var av=az;var au=V(this,aj+al,ah);var ar=V(this,aj,ah+ay);var an=V(this,aj+al,ah+ay);av.x=ab.max(av.x,au.x,ar.x,an.x);av.y=ab.max(av.y,au.y,ar.y,an.y);ax.push("padding:0 ",n(av.x/d),"px ",n(av.y/d),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",Z.join(""),", sizingmethod='clip');")}else{ax.push("top:",n(az.y/d),"px;left:",n(az.x/d),"px;")}ax.push(' ">','<g_vml_:image src="',aq.src,'"',' style="width:',d*al,"px;"," height:",d*ay,'px"',' cropleft="',ao/ai,'"',' croptop="',am/aw,'"',' cropright="',(ai-ao-at)/ai,'"',' cropbottom="',(aw-am-aA)/aw,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",ax.join(""))};q.stroke=function(al){var aj=[];var Z=false;var m=10;var am=10;aj.push("<g_vml_:shape",' filled="',!!al,'"',' style="position:absolute;width:',m,"px;height:",am,'px;"',' coordorigin="0,0"',' coordsize="',d*m,",",d*am,'"',' stroked="',!al,'"',' path="');var an=false;var ag={x:null,y:null};var ak={x:null,y:null};for(var ah=0;ah<this.currentPath_.length;ah++){var j=this.currentPath_[ah];var ai;switch(j.type){case"moveTo":ai=j;aj.push(" m ",n(j.x),",",n(j.y));break;case"lineTo":aj.push(" l ",n(j.x),",",n(j.y));break;case"close":aj.push(" x ");j=null;break;case"bezierCurveTo":aj.push(" c ",n(j.cp1x),",",n(j.cp1y),",",n(j.cp2x),",",n(j.cp2y),",",n(j.x),",",n(j.y));break;case"at":case"wa":aj.push(" ",j.type," ",n(j.x-this.arcScaleX_*j.radius),",",n(j.y-this.arcScaleY_*j.radius)," ",n(j.x+this.arcScaleX_*j.radius),",",n(j.y+this.arcScaleY_*j.radius)," ",n(j.xStart),",",n(j.yStart)," ",n(j.xEnd),",",n(j.yEnd));break}if(j){if(ag.x==null||j.x<ag.x){ag.x=j.x}if(ak.x==null||j.x>ak.x){ak.x=j.x}if(ag.y==null||j.y<ag.y){ag.y=j.y}if(ak.y==null||j.y>ak.y){ak.y=j.y}}}aj.push(' ">');if(!al){w(this,aj)}else{G(this,aj,ag,ak)}aj.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",aj.join(""))};function w(m,ag){var j=F(m.strokeStyle);var p=j.color;var Z=j.alpha*m.globalAlpha;var i=m.lineScale_*m.lineWidth;if(i<1){Z*=i}ag.push("<g_vml_:stroke",' opacity="',Z,'"',' joinstyle="',m.lineJoin,'"',' miterlimit="',m.miterLimit,'"',' endcap="',S(m.lineCap),'"',' weight="',i,'px"',' color="',p,'" />')}function G(aq,ai,aK,ar){var aj=aq.fillStyle;var aB=aq.arcScaleX_;var aA=aq.arcScaleY_;var j=ar.x-aK.x;var p=ar.y-aK.y;if(aj instanceof U){var an=0;var aF={x:0,y:0};var ax=0;var am=1;if(aj.type_=="gradient"){var al=aj.x0_/aB;var m=aj.y0_/aA;var ak=aj.x1_/aB;var aM=aj.y1_/aA;var aJ=V(aq,al,m);var aI=V(aq,ak,aM);var ag=aI.x-aJ.x;var Z=aI.y-aJ.y;an=Math.atan2(ag,Z)*180/Math.PI;if(an<0){an+=360}if(an<0.000001){an=0}}else{var aJ=V(aq,aj.x0_,aj.y0_);aF={x:(aJ.x-aK.x)/j,y:(aJ.y-aK.y)/p};j/=aB*d;p/=aA*d;var aD=ab.max(j,p);ax=2*aj.r0_/aD;am=2*aj.r1_/aD-ax}var av=aj.colors_;av.sort(function(aN,i){return aN.offset-i.offset});var ap=av.length;var au=av[0].color;var at=av[ap-1].color;var az=av[0].alpha*aq.globalAlpha;var ay=av[ap-1].alpha*aq.globalAlpha;var aE=[];for(var aH=0;aH<ap;aH++){var ao=av[aH];aE.push(ao.offset*am+ax+" "+ao.color)}ai.push('<g_vml_:fill type="',aj.type_,'"',' method="none" focus="100%"',' color="',au,'"',' color2="',at,'"',' colors="',aE.join(","),'"',' opacity="',ay,'"',' g_o_:opacity2="',az,'"',' angle="',an,'"',' focusposition="',aF.x,",",aF.y,'" />')}else{if(aj instanceof T){if(j&&p){var ah=-aK.x;var aC=-aK.y;ai.push("<g_vml_:fill",' position="',ah/j*aB*aB,",",aC/p*aA*aA,'"',' type="tile"',' src="',aj.src_,'" />')}}else{var aL=F(aq.fillStyle);var aw=aL.color;var aG=aL.alpha*aq.globalAlpha;ai.push('<g_vml_:fill color="',aw,'" opacity="',aG,'" />')}}}q.fill=function(){this.stroke(true)};q.closePath=function(){this.currentPath_.push({type:"close"})};function V(j,Z,p){var i=j.m_;return{x:d*(Z*i[0][0]+p*i[1][0]+i[2][0])-f,y:d*(Z*i[0][1]+p*i[1][1]+i[2][1])-f}}q.save=function(){var i={};v(this,i);this.aStack_.push(i);this.mStack_.push(this.m_);this.m_=J(B(),this.m_)};q.restore=function(){if(this.aStack_.length){v(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};function h(i){return isFinite(i[0][0])&&isFinite(i[0][1])&&isFinite(i[1][0])&&isFinite(i[1][1])&&isFinite(i[2][0])&&isFinite(i[2][1])}function aa(j,i,p){if(!h(i)){return}j.m_=i;if(p){var Z=i[0][0]*i[1][1]-i[0][1]*i[1][0];j.lineScale_=N(H(Z))}}q.translate=function(m,j){var i=[[1,0,0],[0,1,0],[m,j,1]];aa(this,J(i,this.m_),false)};q.rotate=function(j){var p=A(j);var m=l(j);var i=[[p,m,0],[-m,p,0],[0,0,1]];aa(this,J(i,this.m_),false)};q.scale=function(m,j){this.arcScaleX_*=m;this.arcScaleY_*=j;var i=[[m,0,0],[0,j,0],[0,0,1]];aa(this,J(i,this.m_),true)};q.transform=function(Z,p,ah,ag,j,i){var m=[[Z,p,0],[ah,ag,0],[j,i,1]];aa(this,J(m,this.m_),true)};q.setTransform=function(ag,Z,ai,ah,p,j){var i=[[ag,Z,0],[ai,ah,0],[p,j,1]];aa(this,i,true)};q.drawText_=function(am,ak,aj,ap,ai){var ao=this.m_,at=1000,j=0,ar=at,ah={x:0,y:0},ag=[];var i=u(E(this.font),this.element_);var p=ac(i);var au=this.element_.currentStyle;var Z=this.textAlign.toLowerCase();switch(Z){case"left":case"center":case"right":break;case"end":Z=au.direction=="ltr"?"right":"left";break;case"start":Z=au.direction=="rtl"?"right":"left";break;default:Z="left"}switch(this.textBaseline){case"hanging":case"top":ah.y=i.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":ah.y=-i.size/2.25;break}switch(Z){case"right":j=at;ar=0.05;break;case"center":j=ar=at/2;break}var aq=V(this,ak+ah.x,aj+ah.y);ag.push('<g_vml_:line from="',-j,' 0" to="',ar,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!ai,'" stroked="',!!ai,'" style="position:absolute;width:1px;height:1px;">');if(ai){w(this,ag)}else{G(this,ag,{x:-j,y:0},{x:ar,y:i.size})}var an=ao[0][0].toFixed(3)+","+ao[1][0].toFixed(3)+","+ao[0][1].toFixed(3)+","+ao[1][1].toFixed(3)+",0,0";var al=n(aq.x/d+1-ao[0][0])+","+n(aq.y/d-2*ao[1][0]);ag.push('<g_vml_:skew on="t" matrix="',an,'" ',' offset="',al,'" origin="',j,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',af(am),'" style="v-text-align:',Z,";font:",af(p),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",ag.join(""))};q.fillText=function(m,i,p,j){this.drawText_(m,i,p,j,false)};q.strokeText=function(m,i,p,j){this.drawText_(m,i,p,j,true)};q.measureText=function(m){if(!this.textMeasureEl_){var i='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",i);this.textMeasureEl_=this.element_.lastChild}var j=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(j.createTextNode(m));return{width:this.textMeasureEl_.offsetWidth}};q.clip=function(){};q.arcTo=function(){};q.createPattern=function(j,i){return new T(j,i)};function U(i){this.type_=i;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}U.prototype.addColorStop=function(j,i){i=F(i);this.colors_.push({offset:j,color:i.color,alpha:i.alpha})};function T(j,i){Q(j);switch(i){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=i;break;default:O("SYNTAX_ERR")}this.src_=j.src;this.width_=j.width;this.height_=j.height}function O(i){throw new P(i)}function Q(i){if(!i||i.nodeType!=1||i.tagName!="IMG"){O("TYPE_MISMATCH_ERR")}if(i.readyState!="complete"){O("INVALID_STATE_ERR")}}function P(i){this.code=this[i];this.message=i+": DOM Exception "+this.code}var X=P.prototype=new Error;X.INDEX_SIZE_ERR=1;X.DOMSTRING_SIZE_ERR=2;X.HIERARCHY_REQUEST_ERR=3;X.WRONG_DOCUMENT_ERR=4;X.INVALID_CHARACTER_ERR=5;X.NO_DATA_ALLOWED_ERR=6;X.NO_MODIFICATION_ALLOWED_ERR=7;X.NOT_FOUND_ERR=8;X.NOT_SUPPORTED_ERR=9;X.INUSE_ATTRIBUTE_ERR=10;X.INVALID_STATE_ERR=11;X.SYNTAX_ERR=12;X.INVALID_MODIFICATION_ERR=13;X.NAMESPACE_ERR=14;X.INVALID_ACCESS_ERR=15;X.VALIDATION_ERR=16;X.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=e;CanvasRenderingContext2D=D;CanvasGradient=U;CanvasPattern=T;DOMException=P;G_vmlCanvasManager._version=888})()};
|
js/jqplot/gpl-2.0.txt
CHANGED
File without changes
|
js/jqplot/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
// Nothing to see...
|
1 |
+
<?php
|
2 |
// Nothing to see...
|
js/jqplot/jquery.jqplot.min.css
CHANGED
File without changes
|
js/jqplot/jquery.jqplot.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
2 |
-
jsDate | (c) 2010-2013 Chris Leonello
|
3 |
*/(function(L){var u;L.fn.emptyForce=function(){for(var ah=0,ai;(ai=L(this)[ah])!=null;ah++){if(ai.nodeType===1){L.cleanData(ai.getElementsByTagName("*"))}if(L.jqplot.use_excanvas){ai.outerHTML=""}else{while(ai.firstChild){ai.removeChild(ai.firstChild)}}ai=null}return L(this)};L.fn.removeChildForce=function(ah){while(ah.firstChild){this.removeChildForce(ah.firstChild);ah.removeChild(ah.firstChild)}};L.fn.jqplot=function(){var ah=[];var aj=[];for(var ak=0,ai=arguments.length;ak<ai;ak++){if(L.isArray(arguments[ak])){ah.push(arguments[ak])}else{if(L.isPlainObject(arguments[ak])){aj.push(arguments[ak])}}}return this.each(function(an){var at,ar,aq=L(this),am=ah.length,al=aj.length,ap,ao;if(an<am){ap=ah[an]}else{ap=am?ah[am-1]:null}if(an<al){ao=aj[an]}else{ao=al?aj[al-1]:null}at=aq.attr("id");if(at===u){at="jqplot_target_"+L.jqplot.targetCounter++;aq.attr("id",at)}ar=L.jqplot(at,ap,ao);aq.data("jqplot",ar)})};L.jqplot=function(an,ak,ai){var aj=null,ah=null;if(arguments.length===3){aj=ak;ah=ai}else{if(arguments.length===2){if(L.isArray(ak)){aj=ak}else{if(L.isPlainObject(ak)){ah=ak}}}}if(aj===null&&ah!==null&&ah.data){aj=ah.data}var am=new R();L("#"+an).removeClass("jqplot-error");if(L.jqplot.config.catchErrors){try{am.init(an,aj,ah);am.draw();am.themeEngine.init.call(am);return am}catch(al){var ao=L.jqplot.config.errorMessage||al.message;L("#"+an).append('<div class="jqplot-error-message">'+ao+"</div>");L("#"+an).addClass("jqplot-error");document.getElementById(an).style.background=L.jqplot.config.errorBackground;document.getElementById(an).style.border=L.jqplot.config.errorBorder;document.getElementById(an).style.fontFamily=L.jqplot.config.errorFontFamily;document.getElementById(an).style.fontSize=L.jqplot.config.errorFontSize;document.getElementById(an).style.fontStyle=L.jqplot.config.errorFontStyle;document.getElementById(an).style.fontWeight=L.jqplot.config.errorFontWeight}}else{am.init(an,aj,ah);am.draw();am.themeEngine.init.call(am);return am}};L.jqplot.version="1.0.8";L.jqplot.revision="1250";L.jqplot.targetCounter=1;L.jqplot.CanvasManager=function(){if(typeof L.jqplot.CanvasManager.canvases=="undefined"){L.jqplot.CanvasManager.canvases=[];L.jqplot.CanvasManager.free=[]}var ah=[];this.getCanvas=function(){var ak;var aj=true;if(!L.jqplot.use_excanvas){for(var al=0,ai=L.jqplot.CanvasManager.canvases.length;al<ai;al++){if(L.jqplot.CanvasManager.free[al]===true){aj=false;ak=L.jqplot.CanvasManager.canvases[al];L.jqplot.CanvasManager.free[al]=false;ah.push(al);break}}}if(aj){ak=document.createElement("canvas");ah.push(L.jqplot.CanvasManager.canvases.length);L.jqplot.CanvasManager.canvases.push(ak);L.jqplot.CanvasManager.free.push(false)}return ak};this.initCanvas=function(ai){if(L.jqplot.use_excanvas){return window.G_vmlCanvasManager.initElement(ai)}return ai};this.freeAllCanvases=function(){for(var aj=0,ai=ah.length;aj<ai;aj++){this.freeCanvas(ah[aj])}ah=[]};this.freeCanvas=function(ai){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(L.jqplot.CanvasManager.canvases[ai]);L.jqplot.CanvasManager.canvases[ai]=null}else{var aj=L.jqplot.CanvasManager.canvases[ai];aj.getContext("2d").clearRect(0,0,aj.width,aj.height);L(aj).unbind().removeAttr("class").removeAttr("style");L(aj).css({left:"",top:"",position:""});aj.width=0;aj.height=0;L.jqplot.CanvasManager.free[ai]=true}}};L.jqplot.log=function(){if(window.console){window.console.log.apply(window.console,arguments)}};L.jqplot.config={addDomReference:false,enablePlugins:false,defaultHeight:300,defaultWidth:400,UTCAdjust:false,timezoneOffset:new Date(new Date().getTimezoneOffset()*60000),errorMessage:"",errorBackground:"",errorBorder:"",errorFontFamily:"",errorFontSize:"",errorFontStyle:"",errorFontWeight:"",catchErrors:false,defaultTickFormatString:"%.1f",defaultColors:["#4bb2c5","#EAA228","#c5b47f","#579575","#839557","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc","#c747a3","#cddf54","#FBD178","#26B4E3","#bd70c7"],defaultNegativeColors:["#498991","#C08840","#9F9274","#546D61","#646C4A","#6F6621","#6E3F5F","#4F64B0","#A89050","#C45923","#187399","#945381","#959E5C","#C7AF7B","#478396","#907294"],dashLength:4,gapLength:4,dotGapLength:2.5,srcLocation:"jqplot/src/",pluginLocation:"jqplot/src/plugins/"};L.jqplot.arrayMax=function(ah){return Math.max.apply(Math,ah)};L.jqplot.arrayMin=function(ah){return Math.min.apply(Math,ah)};L.jqplot.enablePlugins=L.jqplot.config.enablePlugins;L.jqplot.support_canvas=function(){if(typeof L.jqplot.support_canvas.result=="undefined"){L.jqplot.support_canvas.result=!!document.createElement("canvas").getContext}return L.jqplot.support_canvas.result};L.jqplot.support_canvas_text=function(){if(typeof L.jqplot.support_canvas_text.result=="undefined"){if(window.G_vmlCanvasManager!==u&&window.G_vmlCanvasManager._version>887){L.jqplot.support_canvas_text.result=true}else{L.jqplot.support_canvas_text.result=!!(document.createElement("canvas").getContext&&typeof document.createElement("canvas").getContext("2d").fillText=="function")}}return L.jqplot.support_canvas_text.result};L.jqplot.use_excanvas=((!L.support.boxModel||!L.support.objectAll||!$support.leadingWhitespace)&&!L.jqplot.support_canvas())?true:false;L.jqplot.preInitHooks=[];L.jqplot.postInitHooks=[];L.jqplot.preParseOptionsHooks=[];L.jqplot.postParseOptionsHooks=[];L.jqplot.preDrawHooks=[];L.jqplot.postDrawHooks=[];L.jqplot.preDrawSeriesHooks=[];L.jqplot.postDrawSeriesHooks=[];L.jqplot.preDrawLegendHooks=[];L.jqplot.addLegendRowHooks=[];L.jqplot.preSeriesInitHooks=[];L.jqplot.postSeriesInitHooks=[];L.jqplot.preParseSeriesOptionsHooks=[];L.jqplot.postParseSeriesOptionsHooks=[];L.jqplot.eventListenerHooks=[];L.jqplot.preDrawSeriesShadowHooks=[];L.jqplot.postDrawSeriesShadowHooks=[];L.jqplot.ElemContainer=function(){this._elem;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null}};L.jqplot.ElemContainer.prototype.createElement=function(ak,am,ai,aj,an){this._offsets=am;var ah=ai||"jqplot";var al=document.createElement(ak);this._elem=L(al);this._elem.addClass(ah);this._elem.css(aj);this._elem.attr(an);al=null;return this._elem};L.jqplot.ElemContainer.prototype.getWidth=function(){if(this._elem){return this._elem.outerWidth(true)}else{return null}};L.jqplot.ElemContainer.prototype.getHeight=function(){if(this._elem){return this._elem.outerHeight(true)}else{return null}};L.jqplot.ElemContainer.prototype.getPosition=function(){if(this._elem){return this._elem.position()}else{return{top:null,left:null,bottom:null,right:null}}};L.jqplot.ElemContainer.prototype.getTop=function(){return this.getPosition().top};L.jqplot.ElemContainer.prototype.getLeft=function(){return this.getPosition().left};L.jqplot.ElemContainer.prototype.getBottom=function(){return this._elem.css("bottom")};L.jqplot.ElemContainer.prototype.getRight=function(){return this._elem.css("right")};function w(ah){L.jqplot.ElemContainer.call(this);this.name=ah;this._series=[];this.show=false;this.tickRenderer=L.jqplot.AxisTickRenderer;this.tickOptions={};this.labelRenderer=L.jqplot.AxisLabelRenderer;this.labelOptions={};this.label=null;this.showLabel=true;this.min=null;this.max=null;this.autoscale=false;this.pad=1.2;this.padMax=null;this.padMin=null;this.ticks=[];this.numberTicks;this.tickInterval;this.renderer=L.jqplot.LinearAxisRenderer;this.rendererOptions={};this.showTicks=true;this.showTickMarks=true;this.showMinorTicks=true;this.drawMajorGridlines=true;this.drawMinorGridlines=false;this.drawMajorTickMarks=true;this.drawMinorTickMarks=true;this.useSeriesColor=false;this.borderWidth=null;this.borderColor=null;this.scaleToHiddenSeries=false;this._dataBounds={min:null,max:null};this._intervalStats=[];this._offsets={min:null,max:null};this._ticks=[];this._label=null;this.syncTicks=null;this.tickSpacing=75;this._min=null;this._max=null;this._tickInterval=null;this._numberTicks=null;this.__ticks=null;this._options={}}w.prototype=new L.jqplot.ElemContainer();w.prototype.constructor=w;w.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.tickOptions.axis=this.name;if(this.tickOptions.showMark==null){this.tickOptions.showMark=this.showTicks}if(this.tickOptions.showMark==null){this.tickOptions.showMark=this.showTickMarks}if(this.tickOptions.showLabel==null){this.tickOptions.showLabel=this.showTicks}if(this.label==null||this.label==""){this.showLabel=false}else{this.labelOptions.label=this.label}if(this.showLabel==false){this.labelOptions.show=false}if(this.pad==0){this.pad=1}if(this.padMax==0){this.padMax=1}if(this.padMin==0){this.padMin=1}if(this.padMax==null){this.padMax=(this.pad-1)/2+1}if(this.padMin==null){this.padMin=(this.pad-1)/2+1}this.pad=this.padMax+this.padMin-1;if(this.min!=null||this.max!=null){this.autoscale=false}if(this.syncTicks==null&&this.name.indexOf("y")>-1){this.syncTicks=true}else{if(this.syncTicks==null){this.syncTicks=false}}this.renderer.init.call(this,this.rendererOptions)};w.prototype.draw=function(ah,ai){if(this.__ticks){this.__ticks=null}return this.renderer.draw.call(this,ah,ai)};w.prototype.set=function(){this.renderer.set.call(this)};w.prototype.pack=function(ai,ah){if(this.show){this.renderer.pack.call(this,ai,ah)}if(this._min==null){this._min=this.min;this._max=this.max;this._tickInterval=this.tickInterval;this._numberTicks=this.numberTicks;this.__ticks=this._ticks}};w.prototype.reset=function(){this.renderer.reset.call(this)};w.prototype.resetScale=function(ah){L.extend(true,this,{min:null,max:null,numberTicks:null,tickInterval:null,_ticks:[],ticks:[]},ah);this.resetDataBounds()};w.prototype.resetDataBounds=function(){var ao=this._dataBounds;ao.min=null;ao.max=null;var ai,ap,am;var aj=(this.show)?true:false;for(var al=0;al<this._series.length;al++){ap=this._series[al];if(ap.show||this.scaleToHiddenSeries){am=ap._plotData;if(ap._type==="line"&&ap.renderer.bands.show&&this.name.charAt(0)!=="x"){am=[[0,ap.renderer.bands._min],[1,ap.renderer.bands._max]]}var ah=1,an=1;if(ap._type!=null&&ap._type=="ohlc"){ah=3;an=2}for(var ak=0,ai=am.length;ak<ai;ak++){if(this.name=="xaxis"||this.name=="x2axis"){if((am[ak][0]!=null&&am[ak][0]<ao.min)||ao.min==null){ao.min=am[ak][0]}if((am[ak][0]!=null&&am[ak][0]>ao.max)||ao.max==null){ao.max=am[ak][0]}}else{if((am[ak][ah]!=null&&am[ak][ah]<ao.min)||ao.min==null){ao.min=am[ak][ah]}if((am[ak][an]!=null&&am[ak][an]>ao.max)||ao.max==null){ao.max=am[ak][an]}}}if(aj&&ap.renderer.constructor!==L.jqplot.BarRenderer){aj=false}else{if(aj&&this._options.hasOwnProperty("forceTickAt0")&&this._options.forceTickAt0==false){aj=false}else{if(aj&&ap.renderer.constructor===L.jqplot.BarRenderer){if(ap.barDirection=="vertical"&&this.name!="xaxis"&&this.name!="x2axis"){if(this._options.pad!=null||this._options.padMin!=null){aj=false}}else{if(ap.barDirection=="horizontal"&&(this.name=="xaxis"||this.name=="x2axis")){if(this._options.pad!=null||this._options.padMin!=null){aj=false}}}}}}}}if(aj&&this.renderer.constructor===L.jqplot.LinearAxisRenderer&&ao.min>=0){this.padMin=1;this.forceTickAt0=true}};function q(ah){L.jqplot.ElemContainer.call(this);this.show=false;this.location="ne";this.labels=[];this.showLabels=true;this.showSwatches=true;this.placement="insideGrid";this.xoffset=0;this.yoffset=0;this.border;this.background;this.textColor;this.fontFamily;this.fontSize;this.rowSpacing="0.5em";this.renderer=L.jqplot.TableLegendRenderer;this.rendererOptions={};this.preDraw=false;this.marginTop=null;this.marginRight=null;this.marginBottom=null;this.marginLeft=null;this.escapeHtml=false;this._series=[];L.extend(true,this,ah)}q.prototype=new L.jqplot.ElemContainer();q.prototype.constructor=q;q.prototype.setOptions=function(ah){L.extend(true,this,ah);if(this.placement=="inside"){this.placement="insideGrid"}if(this.xoffset>0){if(this.placement=="insideGrid"){switch(this.location){case"nw":case"w":case"sw":if(this.marginLeft==null){this.marginLeft=this.xoffset+"px"}this.marginRight="0px";break;case"ne":case"e":case"se":default:if(this.marginRight==null){this.marginRight=this.xoffset+"px"}this.marginLeft="0px";break}}else{if(this.placement=="outside"){switch(this.location){case"nw":case"w":case"sw":if(this.marginRight==null){this.marginRight=this.xoffset+"px"}this.marginLeft="0px";break;case"ne":case"e":case"se":default:if(this.marginLeft==null){this.marginLeft=this.xoffset+"px"}this.marginRight="0px";break}}}this.xoffset=0}if(this.yoffset>0){if(this.placement=="outside"){switch(this.location){case"sw":case"s":case"se":if(this.marginTop==null){this.marginTop=this.yoffset+"px"}this.marginBottom="0px";break;case"ne":case"n":case"nw":default:if(this.marginBottom==null){this.marginBottom=this.yoffset+"px"}this.marginTop="0px";break}}else{if(this.placement=="insideGrid"){switch(this.location){case"sw":case"s":case"se":if(this.marginBottom==null){this.marginBottom=this.yoffset+"px"}this.marginTop="0px";break;case"ne":case"n":case"nw":default:if(this.marginTop==null){this.marginTop=this.yoffset+"px"}this.marginBottom="0px";break}}}this.yoffset=0}};q.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions)};q.prototype.draw=function(ai,aj){for(var ah=0;ah<L.jqplot.preDrawLegendHooks.length;ah++){L.jqplot.preDrawLegendHooks[ah].call(this,ai)}return this.renderer.draw.call(this,ai,aj)};q.prototype.pack=function(ah){this.renderer.pack.call(this,ah)};function y(ah){L.jqplot.ElemContainer.call(this);this.text=ah;this.show=true;this.fontFamily;this.fontSize;this.textAlign;this.textColor;this.renderer=L.jqplot.DivTitleRenderer;this.rendererOptions={};this.escapeHtml=false}y.prototype=new L.jqplot.ElemContainer();y.prototype.constructor=y;y.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions)};y.prototype.draw=function(ah){return this.renderer.draw.call(this,ah)};y.prototype.pack=function(){this.renderer.pack.call(this)};function S(ah){ah=ah||{};L.jqplot.ElemContainer.call(this);this.show=true;this.xaxis="xaxis";this._xaxis;this.yaxis="yaxis";this._yaxis;this.gridBorderWidth=2;this.renderer=L.jqplot.LineRenderer;this.rendererOptions={};this.data=[];this.gridData=[];this.label="";this.showLabel=true;this.color;this.negativeColor;this.lineWidth=2.5;this.lineJoin="round";this.lineCap="round";this.linePattern="solid";this.shadow=true;this.shadowAngle=45;this.shadowOffset=1.25;this.shadowDepth=3;this.shadowAlpha="0.1";this.breakOnNull=false;this.markerRenderer=L.jqplot.MarkerRenderer;this.markerOptions={};this.showLine=true;this.showMarker=true;this.index;this.fill=false;this.fillColor;this.fillAlpha;this.fillAndStroke=false;this.disableStack=false;this._stack=false;this.neighborThreshold=4;this.fillToZero=false;this.fillToValue=0;this.fillAxis="y";this.useNegativeColors=true;this._stackData=[];this._plotData=[];this._plotValues={x:[],y:[]};this._intervals={x:{},y:{}};this._prevPlotData=[];this._prevGridData=[];this._stackAxis="y";this._primaryAxis="_xaxis";this.canvas=new L.jqplot.GenericCanvas();this.shadowCanvas=new L.jqplot.GenericCanvas();this.plugins={};this._sumy=0;this._sumx=0;this._type=""}S.prototype=new L.jqplot.ElemContainer();S.prototype.constructor=S;S.prototype.init=function(ak,ao,am){this.index=ak;this.gridBorderWidth=ao;var an=this.data;var aj=[],al,ah;for(al=0,ah=an.length;al<ah;al++){if(!this.breakOnNull){if(an[al]==null||an[al][0]==null||an[al][1]==null){continue}else{aj.push(an[al])}}else{aj.push(an[al])}}this.data=aj;if(!this.color){this.color=am.colorGenerator.get(this.index)}if(!this.negativeColor){this.negativeColor=am.negativeColorGenerator.get(this.index)}if(!this.fillColor){this.fillColor=this.color}if(this.fillAlpha){var ai=L.jqplot.normalize2rgb(this.fillColor);var ai=L.jqplot.getColorComponents(ai);this.fillColor="rgba("+ai[0]+","+ai[1]+","+ai[2]+","+this.fillAlpha+")"}if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions,am);this.markerRenderer=new this.markerRenderer();if(!this.markerOptions.color){this.markerOptions.color=this.color}if(this.markerOptions.show==null){this.markerOptions.show=this.showMarker}this.showMarker=this.markerOptions.show;this.markerRenderer.init(this.markerOptions)};S.prototype.draw=function(an,ak,am){var ai=(ak==u)?{}:ak;an=(an==u)?this.canvas._ctx:an;var ah,al,aj;for(ah=0;ah<L.jqplot.preDrawSeriesHooks.length;ah++){L.jqplot.preDrawSeriesHooks[ah].call(this,an,ai)}if(this.show){this.renderer.setGridData.call(this,am);if(!ai.preventJqPlotSeriesDrawTrigger){L(an.canvas).trigger("jqplotSeriesDraw",[this.data,this.gridData])}al=[];if(ai.data){al=ai.data}else{if(!this._stack){al=this.data}else{al=this._plotData}}aj=ai.gridData||this.renderer.makeGridData.call(this,al,am);if(this._type==="line"&&this.renderer.smooth&&this.renderer._smoothedData.length){aj=this.renderer._smoothedData}this.renderer.draw.call(this,an,aj,ai,am)}for(ah=0;ah<L.jqplot.postDrawSeriesHooks.length;ah++){L.jqplot.postDrawSeriesHooks[ah].call(this,an,ai,am)}an=ak=am=ah=al=aj=null};S.prototype.drawShadow=function(an,ak,am){var ai=(ak==u)?{}:ak;an=(an==u)?this.shadowCanvas._ctx:an;var ah,al,aj;for(ah=0;ah<L.jqplot.preDrawSeriesShadowHooks.length;ah++){L.jqplot.preDrawSeriesShadowHooks[ah].call(this,an,ai)}if(this.shadow){this.renderer.setGridData.call(this,am);al=[];if(ai.data){al=ai.data}else{if(!this._stack){al=this.data}else{al=this._plotData}}aj=ai.gridData||this.renderer.makeGridData.call(this,al,am);this.renderer.drawShadow.call(this,an,aj,ai,am)}for(ah=0;ah<L.jqplot.postDrawSeriesShadowHooks.length;ah++){L.jqplot.postDrawSeriesShadowHooks[ah].call(this,an,ai)}an=ak=am=ah=al=aj=null};S.prototype.toggleDisplay=function(ai,ak){var ah,aj;if(ai.data.series){ah=ai.data.series}else{ah=this}if(ai.data.speed){aj=ai.data.speed}if(aj){if(ah.canvas._elem.is(":hidden")||!ah.show){ah.show=true;ah.canvas._elem.removeClass("jqplot-series-hidden");if(ah.shadowCanvas._elem){ah.shadowCanvas._elem.fadeIn(aj)}ah.canvas._elem.fadeIn(aj,ak);ah.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-"+ah.index).fadeIn(aj)}else{ah.show=false;ah.canvas._elem.addClass("jqplot-series-hidden");if(ah.shadowCanvas._elem){ah.shadowCanvas._elem.fadeOut(aj)}ah.canvas._elem.fadeOut(aj,ak);ah.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-"+ah.index).fadeOut(aj)}}else{if(ah.canvas._elem.is(":hidden")||!ah.show){ah.show=true;ah.canvas._elem.removeClass("jqplot-series-hidden");if(ah.shadowCanvas._elem){ah.shadowCanvas._elem.show()}ah.canvas._elem.show(0,ak);ah.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-"+ah.index).show()}else{ah.show=false;ah.canvas._elem.addClass("jqplot-series-hidden");if(ah.shadowCanvas._elem){ah.shadowCanvas._elem.hide()}ah.canvas._elem.hide(0,ak);ah.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-"+ah.index).hide()}}};function M(){L.jqplot.ElemContainer.call(this);this.drawGridlines=true;this.gridLineColor="#cccccc";this.gridLineWidth=1;this.background="#fffdf6";this.borderColor="#999999";this.borderWidth=2;this.drawBorder=true;this.shadow=true;this.shadowAngle=45;this.shadowOffset=1.5;this.shadowWidth=3;this.shadowDepth=3;this.shadowColor=null;this.shadowAlpha="0.07";this._left;this._top;this._right;this._bottom;this._width;this._height;this._axes=[];this.renderer=L.jqplot.CanvasGridRenderer;this.rendererOptions={};this._offsets={top:null,bottom:null,left:null,right:null}}M.prototype=new L.jqplot.ElemContainer();M.prototype.constructor=M;M.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions)};M.prototype.createElement=function(ah,ai){this._offsets=ah;return this.renderer.createElement.call(this,ai)};M.prototype.draw=function(){this.renderer.draw.call(this)};L.jqplot.GenericCanvas=function(){L.jqplot.ElemContainer.call(this);this._ctx};L.jqplot.GenericCanvas.prototype=new L.jqplot.ElemContainer();L.jqplot.GenericCanvas.prototype.constructor=L.jqplot.GenericCanvas;L.jqplot.GenericCanvas.prototype.createElement=function(al,aj,ai,am){this._offsets=al;var ah="jqplot";if(aj!=u){ah=aj}var ak;ak=am.canvasManager.getCanvas();if(ai!=null){this._plotDimensions=ai}ak.width=this._plotDimensions.width-this._offsets.left-this._offsets.right;ak.height=this._plotDimensions.height-this._offsets.top-this._offsets.bottom;this._elem=L(ak);this._elem.css({position:"absolute",left:this._offsets.left,top:this._offsets.top});this._elem.addClass(ah);ak=am.canvasManager.initCanvas(ak);ak=null;return this._elem};L.jqplot.GenericCanvas.prototype.setContext=function(){this._ctx=this._elem.get(0).getContext("2d");return this._ctx};L.jqplot.GenericCanvas.prototype.resetCanvas=function(){if(this._elem){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}this._elem.emptyForce()}this._ctx=null};L.jqplot.HooksManager=function(){this.hooks=[];this.args=[]};L.jqplot.HooksManager.prototype.addOnce=function(ak,ai){ai=ai||[];var al=false;for(var aj=0,ah=this.hooks.length;aj<ah;aj++){if(this.hooks[aj]==ak){al=true}}if(!al){this.hooks.push(ak);this.args.push(ai)}};L.jqplot.HooksManager.prototype.add=function(ai,ah){ah=ah||[];this.hooks.push(ai);this.args.push(ah)};L.jqplot.EventListenerManager=function(){this.hooks=[]};L.jqplot.EventListenerManager.prototype.addOnce=function(al,ak){var am=false,aj,ai;for(var ai=0,ah=this.hooks.length;ai<ah;ai++){aj=this.hooks[ai];if(aj[0]==al&&aj[1]==ak){am=true}}if(!am){this.hooks.push([al,ak])}};L.jqplot.EventListenerManager.prototype.add=function(ai,ah){this.hooks.push([ai,ah])};var U=["yMidAxis","xaxis","yaxis","x2axis","y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis"];function R(){this.animate=false;this.animateReplot=false;this.axes={xaxis:new w("xaxis"),yaxis:new w("yaxis"),x2axis:new w("x2axis"),y2axis:new w("y2axis"),y3axis:new w("y3axis"),y4axis:new w("y4axis"),y5axis:new w("y5axis"),y6axis:new w("y6axis"),y7axis:new w("y7axis"),y8axis:new w("y8axis"),y9axis:new w("y9axis"),yMidAxis:new w("yMidAxis")};this.baseCanvas=new L.jqplot.GenericCanvas();this.captureRightClick=false;this.data=[];this.dataRenderer;this.dataRendererOptions;this.defaults={axesDefaults:{},axes:{xaxis:{},yaxis:{},x2axis:{},y2axis:{},y3axis:{},y4axis:{},y5axis:{},y6axis:{},y7axis:{},y8axis:{},y9axis:{},yMidAxis:{}},seriesDefaults:{},series:[]};this.defaultAxisStart=1;this.drawIfHidden=false;this.eventCanvas=new L.jqplot.GenericCanvas();this.fillBetween={series1:null,series2:null,color:null,baseSeries:0,fill:true};this.fontFamily;this.fontSize;this.grid=new M();this.legend=new q();this.noDataIndicator={show:false,indicator:"Loading Data...",axes:{xaxis:{min:0,max:10,tickInterval:2,show:true},yaxis:{min:0,max:12,tickInterval:3,show:true}}};this.negativeSeriesColors=L.jqplot.config.defaultNegativeColors;this.options={};this.previousSeriesStack=[];this.plugins={};this.series=[];this.seriesStack=[];this.seriesColors=L.jqplot.config.defaultColors;this.sortData=true;this.stackSeries=false;this.syncXTicks=true;this.syncYTicks=true;this.target=null;this.targetId=null;this.textColor;this.title=new y();this._drawCount=0;this._sumy=0;this._sumx=0;this._stackData=[];this._plotData=[];this._width=null;this._height=null;this._plotDimensions={height:null,width:null};this._gridPadding={top:null,right:null,bottom:null,left:null};this._defaultGridPadding={top:10,right:10,bottom:23,left:10};this._addDomReference=L.jqplot.config.addDomReference;this.preInitHooks=new L.jqplot.HooksManager();this.postInitHooks=new L.jqplot.HooksManager();this.preParseOptionsHooks=new L.jqplot.HooksManager();this.postParseOptionsHooks=new L.jqplot.HooksManager();this.preDrawHooks=new L.jqplot.HooksManager();this.postDrawHooks=new L.jqplot.HooksManager();this.preDrawSeriesHooks=new L.jqplot.HooksManager();this.postDrawSeriesHooks=new L.jqplot.HooksManager();this.preDrawLegendHooks=new L.jqplot.HooksManager();this.addLegendRowHooks=new L.jqplot.HooksManager();this.preSeriesInitHooks=new L.jqplot.HooksManager();this.postSeriesInitHooks=new L.jqplot.HooksManager();this.preParseSeriesOptionsHooks=new L.jqplot.HooksManager();this.postParseSeriesOptionsHooks=new L.jqplot.HooksManager();this.eventListenerHooks=new L.jqplot.EventListenerManager();this.preDrawSeriesShadowHooks=new L.jqplot.HooksManager();this.postDrawSeriesShadowHooks=new L.jqplot.HooksManager();this.colorGenerator=new L.jqplot.ColorGenerator();this.negativeColorGenerator=new L.jqplot.ColorGenerator();this.canvasManager=new L.jqplot.CanvasManager();this.themeEngine=new L.jqplot.ThemeEngine();var aj=0;this.init=function(av,ar,ay){ay=ay||{};for(var at=0;at<L.jqplot.preInitHooks.length;at++){L.jqplot.preInitHooks[at].call(this,av,ar,ay)}for(var at=0;at<this.preInitHooks.hooks.length;at++){this.preInitHooks.hooks[at].call(this,av,ar,ay)}this.targetId="#"+av;this.target=L("#"+av);if(this._addDomReference){this.target.data("jqplot",this)}this.target.removeClass("jqplot-error");if(!this.target.get(0)){throw new Error("No plot target specified")}if(this.target.css("position")=="static"){this.target.css("position","relative")}if(!this.target.hasClass("jqplot-target")){this.target.addClass("jqplot-target")}if(!this.target.height()){var au;if(ay&&ay.height){au=parseInt(ay.height,10)}else{if(this.target.attr("data-height")){au=parseInt(this.target.attr("data-height"),10)}else{au=parseInt(L.jqplot.config.defaultHeight,10)}}this._height=au;this.target.css("height",au+"px")}else{this._height=au=this.target.height()}if(!this.target.width()){var aw;if(ay&&ay.width){aw=parseInt(ay.width,10)}else{if(this.target.attr("data-width")){aw=parseInt(this.target.attr("data-width"),10)}else{aw=parseInt(L.jqplot.config.defaultWidth,10)}}this._width=aw;this.target.css("width",aw+"px")}else{this._width=aw=this.target.width()}for(var at=0,ap=U.length;at<ap;at++){this.axes[U[at]]=new w(U[at])}this._plotDimensions.height=this._height;this._plotDimensions.width=this._width;this.grid._plotDimensions=this._plotDimensions;this.title._plotDimensions=this._plotDimensions;this.baseCanvas._plotDimensions=this._plotDimensions;this.eventCanvas._plotDimensions=this._plotDimensions;this.legend._plotDimensions=this._plotDimensions;if(this._height<=0||this._width<=0||!this._height||!this._width){throw new Error("Canvas dimension not set")}if(ay.dataRenderer&&L.isFunction(ay.dataRenderer)){if(ay.dataRendererOptions){this.dataRendererOptions=ay.dataRendererOptions}this.dataRenderer=ay.dataRenderer;ar=this.dataRenderer(ar,this,this.dataRendererOptions)}if(ay.noDataIndicator&&L.isPlainObject(ay.noDataIndicator)){L.extend(true,this.noDataIndicator,ay.noDataIndicator)}if(ar==null||L.isArray(ar)==false||ar.length==0||L.isArray(ar[0])==false||ar[0].length==0){if(this.noDataIndicator.show==false){throw new Error("No data specified")}else{for(var al in this.noDataIndicator.axes){for(var an in this.noDataIndicator.axes[al]){this.axes[al][an]=this.noDataIndicator.axes[al][an]}}this.postDrawHooks.add(function(){var aD=this.eventCanvas.getHeight();var aA=this.eventCanvas.getWidth();var az=L('<div class="jqplot-noData-container" style="position:absolute;"></div>');this.target.append(az);az.height(aD);az.width(aA);az.css("top",this.eventCanvas._offsets.top);az.css("left",this.eventCanvas._offsets.left);var aC=L('<div class="jqplot-noData-contents" style="text-align:center; position:relative; margin-left:auto; margin-right:auto;"></div>');az.append(aC);aC.html(this.noDataIndicator.indicator);var aB=aC.height();var ax=aC.width();aC.height(aB);aC.width(ax);aC.css("top",(aD-aB)/2+"px")})}}this.data=L.extend(true,[],ar);this.parseOptions(ay);if(this.textColor){this.target.css("color",this.textColor)}if(this.fontFamily){this.target.css("font-family",this.fontFamily)}if(this.fontSize){this.target.css("font-size",this.fontSize)}this.title.init();this.legend.init();this._sumy=0;this._sumx=0;this.computePlotData();for(var at=0;at<this.series.length;at++){this.seriesStack.push(at);this.previousSeriesStack.push(at);this.series[at].shadowCanvas._plotDimensions=this._plotDimensions;this.series[at].canvas._plotDimensions=this._plotDimensions;for(var aq=0;aq<L.jqplot.preSeriesInitHooks.length;aq++){L.jqplot.preSeriesInitHooks[aq].call(this.series[at],av,this.data,this.options.seriesDefaults,this.options.series[at],this)}for(var aq=0;aq<this.preSeriesInitHooks.hooks.length;aq++){this.preSeriesInitHooks.hooks[aq].call(this.series[at],av,this.data,this.options.seriesDefaults,this.options.series[at],this)}this.series[at]._plotDimensions=this._plotDimensions;this.series[at].init(at,this.grid.borderWidth,this);for(var aq=0;aq<L.jqplot.postSeriesInitHooks.length;aq++){L.jqplot.postSeriesInitHooks[aq].call(this.series[at],av,this.data,this.options.seriesDefaults,this.options.series[at],this)}for(var aq=0;aq<this.postSeriesInitHooks.hooks.length;aq++){this.postSeriesInitHooks.hooks[aq].call(this.series[at],av,this.data,this.options.seriesDefaults,this.options.series[at],this)}this._sumy+=this.series[at]._sumy;this._sumx+=this.series[at]._sumx}var am,ao;for(var at=0,ap=U.length;at<ap;at++){am=U[at];ao=this.axes[am];ao._plotDimensions=this._plotDimensions;ao.init();if(this.axes[am].borderColor==null){if(am.charAt(0)!=="x"&&ao.useSeriesColor===true&&ao.show){ao.borderColor=ao._series[0].color}else{ao.borderColor=this.grid.borderColor}}}if(this.sortData){ah(this.series)}this.grid.init();this.grid._axes=this.axes;this.legend._series=this.series;for(var at=0;at<L.jqplot.postInitHooks.length;at++){L.jqplot.postInitHooks[at].call(this,av,this.data,ay)}for(var at=0;at<this.postInitHooks.hooks.length;at++){this.postInitHooks.hooks[at].call(this,av,this.data,ay)}};this.resetAxesScale=function(aq,am){var ao=am||{};var ap=aq||this.axes;if(ap===true){ap=this.axes}if(L.isArray(ap)){for(var an=0;an<ap.length;an++){this.axes[ap[an]].resetScale(ao[ap[an]])}}else{if(typeof(ap)==="object"){for(var al in ap){this.axes[al].resetScale(ao[al])}}}};this.reInitialize=function(au,al){var ay=L.extend(true,{},this.options,al);var aw=this.targetId.substr(1);var ar=(au==null)?this.data:au;for(var av=0;av<L.jqplot.preInitHooks.length;av++){L.jqplot.preInitHooks[av].call(this,aw,ar,ay)}for(var av=0;av<this.preInitHooks.hooks.length;av++){this.preInitHooks.hooks[av].call(this,aw,ar,ay)}this._height=this.target.height();this._width=this.target.width();if(this._height<=0||this._width<=0||!this._height||!this._width){throw new Error("Target dimension not set")}this._plotDimensions.height=this._height;this._plotDimensions.width=this._width;this.grid._plotDimensions=this._plotDimensions;this.title._plotDimensions=this._plotDimensions;this.baseCanvas._plotDimensions=this._plotDimensions;this.eventCanvas._plotDimensions=this._plotDimensions;this.legend._plotDimensions=this._plotDimensions;var am,ax,at,ao;for(var av=0,aq=U.length;av<aq;av++){am=U[av];ao=this.axes[am];ax=ao._ticks;for(var at=0,ap=ax.length;at<ap;at++){var an=ax[at]._elem;if(an){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(an.get(0))}an.emptyForce();an=null;ax._elem=null}}ax=null;delete ao.ticks;delete ao._ticks;this.axes[am]=new w(am);this.axes[am]._plotWidth=this._width;this.axes[am]._plotHeight=this._height}if(au){if(ay.dataRenderer&&L.isFunction(ay.dataRenderer)){if(ay.dataRendererOptions){this.dataRendererOptions=ay.dataRendererOptions}this.dataRenderer=ay.dataRenderer;au=this.dataRenderer(au,this,this.dataRendererOptions)}this.data=L.extend(true,[],au)}if(al){this.parseOptions(ay)}this.title._plotWidth=this._width;if(this.textColor){this.target.css("color",this.textColor)}if(this.fontFamily){this.target.css("font-family",this.fontFamily)}if(this.fontSize){this.target.css("font-size",this.fontSize)}this.title.init();this.legend.init();this._sumy=0;this._sumx=0;this.seriesStack=[];this.previousSeriesStack=[];this.computePlotData();for(var av=0,aq=this.series.length;av<aq;av++){this.seriesStack.push(av);this.previousSeriesStack.push(av);this.series[av].shadowCanvas._plotDimensions=this._plotDimensions;this.series[av].canvas._plotDimensions=this._plotDimensions;for(var at=0;at<L.jqplot.preSeriesInitHooks.length;at++){L.jqplot.preSeriesInitHooks[at].call(this.series[av],aw,this.data,this.options.seriesDefaults,this.options.series[av],this)}for(var at=0;at<this.preSeriesInitHooks.hooks.length;at++){this.preSeriesInitHooks.hooks[at].call(this.series[av],aw,this.data,this.options.seriesDefaults,this.options.series[av],this)}this.series[av]._plotDimensions=this._plotDimensions;this.series[av].init(av,this.grid.borderWidth,this);for(var at=0;at<L.jqplot.postSeriesInitHooks.length;at++){L.jqplot.postSeriesInitHooks[at].call(this.series[av],aw,this.data,this.options.seriesDefaults,this.options.series[av],this)}for(var at=0;at<this.postSeriesInitHooks.hooks.length;at++){this.postSeriesInitHooks.hooks[at].call(this.series[av],aw,this.data,this.options.seriesDefaults,this.options.series[av],this)}this._sumy+=this.series[av]._sumy;this._sumx+=this.series[av]._sumx}for(var av=0,aq=U.length;av<aq;av++){am=U[av];ao=this.axes[am];ao._plotDimensions=this._plotDimensions;ao.init();if(ao.borderColor==null){if(am.charAt(0)!=="x"&&ao.useSeriesColor===true&&ao.show){ao.borderColor=ao._series[0].color}else{ao.borderColor=this.grid.borderColor}}}if(this.sortData){ah(this.series)}this.grid.init();this.grid._axes=this.axes;this.legend._series=this.series;for(var av=0,aq=L.jqplot.postInitHooks.length;av<aq;av++){L.jqplot.postInitHooks[av].call(this,aw,this.data,ay)}for(var av=0,aq=this.postInitHooks.hooks.length;av<aq;av++){this.postInitHooks.hooks[av].call(this,aw,this.data,ay)}};this.quickInit=function(){this._height=this.target.height();this._width=this.target.width();if(this._height<=0||this._width<=0||!this._height||!this._width){throw new Error("Target dimension not set")}this._plotDimensions.height=this._height;this._plotDimensions.width=this._width;this.grid._plotDimensions=this._plotDimensions;this.title._plotDimensions=this._plotDimensions;this.baseCanvas._plotDimensions=this._plotDimensions;this.eventCanvas._plotDimensions=this._plotDimensions;this.legend._plotDimensions=this._plotDimensions;for(var aq in this.axes){this.axes[aq]._plotWidth=this._width;this.axes[aq]._plotHeight=this._height}this.title._plotWidth=this._width;if(this.textColor){this.target.css("color",this.textColor)}if(this.fontFamily){this.target.css("font-family",this.fontFamily)}if(this.fontSize){this.target.css("font-size",this.fontSize)}this._sumy=0;this._sumx=0;this.computePlotData();for(var ao=0;ao<this.series.length;ao++){if(this.series[ao]._type==="line"&&this.series[ao].renderer.bands.show){this.series[ao].renderer.initBands.call(this.series[ao],this.series[ao].renderer.options,this)}this.series[ao]._plotDimensions=this._plotDimensions;this.series[ao].canvas._plotDimensions=this._plotDimensions;this._sumy+=this.series[ao]._sumy;this._sumx+=this.series[ao]._sumx}var am;for(var al=0;al<12;al++){am=U[al];var an=this.axes[am]._ticks;for(var ao=0;ao<an.length;ao++){var ap=an[ao]._elem;if(ap){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(ap.get(0))}ap.emptyForce();ap=null;an._elem=null}}an=null;this.axes[am]._plotDimensions=this._plotDimensions;this.axes[am]._ticks=[]}if(this.sortData){ah(this.series)}this.grid._axes=this.axes;this.legend._series=this.series};function ah(ap){var au,av,aw,al,at;for(var aq=0;aq<ap.length;aq++){var am;var ar=[ap[aq].data,ap[aq]._stackData,ap[aq]._plotData,ap[aq]._prevPlotData];for(var an=0;an<4;an++){am=true;au=ar[an];if(ap[aq]._stackAxis=="x"){for(var ao=0;ao<au.length;ao++){if(typeof(au[ao][1])!="number"){am=false;break}}if(am){au.sort(function(ay,ax){return ay[1]-ax[1]})}}else{for(var ao=0;ao<au.length;ao++){if(typeof(au[ao][0])!="number"){am=false;break}}if(am){au.sort(function(ay,ax){return ay[0]-ax[0]})}}}}}this.computePlotData=function(){this._plotData=[];this._stackData=[];var at,au,ao;for(au=0,ao=this.series.length;au<ao;au++){at=this.series[au];this._plotData.push([]);this._stackData.push([]);var am=at.data;this._plotData[au]=L.extend(true,[],am);this._stackData[au]=L.extend(true,[],am);at._plotData=this._plotData[au];at._stackData=this._stackData[au];var ax={x:[],y:[]};if(this.stackSeries&&!at.disableStack){at._stack=true;var av=(at._stackAxis==="x")?0:1;for(var ap=0,al=am.length;ap<al;ap++){var aw=am[ap][av];if(aw==null){aw=0}this._plotData[au][ap][av]=aw;this._stackData[au][ap][av]=aw;if(au>0){for(var aq=au;aq--;){var an=this._plotData[aq][ap][av];if(aw*an>=0){this._plotData[au][ap][av]+=an;this._stackData[au][ap][av]+=an;break}}}}}else{for(var ar=0;ar<at.data.length;ar++){ax.x.push(at.data[ar][0]);ax.y.push(at.data[ar][1])}this._stackData.push(at.data);this.series[au]._stackData=at.data;this._plotData.push(at.data);at._plotData=at.data;at._plotValues=ax}if(au>0){at._prevPlotData=this.series[au-1]._plotData}at._sumy=0;at._sumx=0;for(ar=at.data.length-1;ar>-1;ar--){at._sumy+=at.data[ar][1];at._sumx+=at.data[ar][0]}}};this.populatePlotData=function(au,av){this._plotData=[];this._stackData=[];au._stackData=[];au._plotData=[];var ay={x:[],y:[]};if(this.stackSeries&&!au.disableStack){au._stack=true;var ax=(au._stackAxis==="x")?0:1;var az=L.extend(true,[],au.data);var aA=L.extend(true,[],au.data);var an,am,ao,aw,al;for(var ar=0;ar<av;ar++){var ap=this.series[ar].data;for(var aq=0;aq<ap.length;aq++){ao=ap[aq];an=(ao[0]!=null)?ao[0]:0;am=(ao[1]!=null)?ao[1]:0;az[aq][0]+=an;az[aq][1]+=am;aw=(ax)?am:an;if(au.data[aq][ax]*aw>=0){aA[aq][ax]+=aw}}}for(var at=0;at<aA.length;at++){ay.x.push(aA[at][0]);ay.y.push(aA[at][1])}this._plotData.push(aA);this._stackData.push(az);au._stackData=az;au._plotData=aA;au._plotValues=ay}else{for(var at=0;at<au.data.length;at++){ay.x.push(au.data[at][0]);ay.y.push(au.data[at][1])}this._stackData.push(au.data);this.series[av]._stackData=au.data;this._plotData.push(au.data);au._plotData=au.data;au._plotValues=ay}if(av>0){au._prevPlotData=this.series[av-1]._plotData}au._sumy=0;au._sumx=0;for(at=au.data.length-1;at>-1;at--){au._sumy+=au.data[at][1];au._sumx+=au.data[at][0]}};this.getNextSeriesColor=(function(am){var al=0;var an=am.seriesColors;return function(){if(al<an.length){return an[al++]}else{al=0;return an[al++]}}})(this);this.parseOptions=function(ay){for(var at=0;at<this.preParseOptionsHooks.hooks.length;at++){this.preParseOptionsHooks.hooks[at].call(this,ay)}for(var at=0;at<L.jqplot.preParseOptionsHooks.length;at++){L.jqplot.preParseOptionsHooks[at].call(this,ay)}this.options=L.extend(true,{},this.defaults,ay);var am=this.options;this.animate=am.animate;this.animateReplot=am.animateReplot;this.stackSeries=am.stackSeries;if(L.isPlainObject(am.fillBetween)){var ax=["series1","series2","color","baseSeries","fill"],au;for(var at=0,aq=ax.length;at<aq;at++){au=ax[at];if(am.fillBetween[au]!=null){this.fillBetween[au]=am.fillBetween[au]}}}if(am.seriesColors){this.seriesColors=am.seriesColors}if(am.negativeSeriesColors){this.negativeSeriesColors=am.negativeSeriesColors}if(am.captureRightClick){this.captureRightClick=am.captureRightClick}this.defaultAxisStart=(ay&&ay.defaultAxisStart!=null)?ay.defaultAxisStart:this.defaultAxisStart;this.colorGenerator.setColors(this.seriesColors);this.negativeColorGenerator.setColors(this.negativeSeriesColors);L.extend(true,this._gridPadding,am.gridPadding);this.sortData=(am.sortData!=null)?am.sortData:this.sortData;for(var at=0;at<12;at++){var an=U[at];var ap=this.axes[an];ap._options=L.extend(true,{},am.axesDefaults,am.axes[an]);L.extend(true,ap,am.axesDefaults,am.axes[an]);ap._plotWidth=this._width;ap._plotHeight=this._height}var aw=function(aD,aB,aE){var aA=[];var aC,az;aB=aB||"vertical";if(!L.isArray(aD[0])){for(aC=0,az=aD.length;aC<az;aC++){if(aB=="vertical"){aA.push([aE+aC,aD[aC]])}else{aA.push([aD[aC],aE+aC])}}}else{L.extend(true,aA,aD)}return aA};var av=0;this.series=[];for(var at=0;at<this.data.length;at++){var al=L.extend(true,{index:at},{seriesColors:this.seriesColors,negativeSeriesColors:this.negativeSeriesColors},this.options.seriesDefaults,this.options.series[at],{rendererOptions:{animation:{show:this.animate}}});var ax=new S(al);for(var ar=0;ar<L.jqplot.preParseSeriesOptionsHooks.length;ar++){L.jqplot.preParseSeriesOptionsHooks[ar].call(ax,this.options.seriesDefaults,this.options.series[at])}for(var ar=0;ar<this.preParseSeriesOptionsHooks.hooks.length;ar++){this.preParseSeriesOptionsHooks.hooks[ar].call(ax,this.options.seriesDefaults,this.options.series[at])}L.extend(true,ax,al);var ao="vertical";if(ax.renderer===L.jqplot.BarRenderer&&ax.rendererOptions&&ax.rendererOptions.barDirection=="horizontal"){ao="horizontal";ax._stackAxis="x";ax._primaryAxis="_yaxis"}ax.data=aw(this.data[at],ao,this.defaultAxisStart);switch(ax.xaxis){case"xaxis":ax._xaxis=this.axes.xaxis;break;case"x2axis":ax._xaxis=this.axes.x2axis;break;default:break}ax._yaxis=this.axes[ax.yaxis];ax._xaxis._series.push(ax);ax._yaxis._series.push(ax);if(ax.show){ax._xaxis.show=true;ax._yaxis.show=true}else{if(ax._xaxis.scaleToHiddenSeries){ax._xaxis.show=true}if(ax._yaxis.scaleToHiddenSeries){ax._yaxis.show=true}}if(!ax.label){ax.label="Series "+(at+1).toString()}this.series.push(ax);for(var ar=0;ar<L.jqplot.postParseSeriesOptionsHooks.length;ar++){L.jqplot.postParseSeriesOptionsHooks[ar].call(this.series[at],this.options.seriesDefaults,this.options.series[at])}for(var ar=0;ar<this.postParseSeriesOptionsHooks.hooks.length;ar++){this.postParseSeriesOptionsHooks.hooks[ar].call(this.series[at],this.options.seriesDefaults,this.options.series[at])}}L.extend(true,this.grid,this.options.grid);for(var at=0,aq=U.length;at<aq;at++){var an=U[at];var ap=this.axes[an];if(ap.borderWidth==null){ap.borderWidth=this.grid.borderWidth}}if(typeof this.options.title=="string"){this.title.text=this.options.title}else{if(typeof this.options.title=="object"){L.extend(true,this.title,this.options.title)}}this.title._plotWidth=this._width;this.legend.setOptions(this.options.legend);for(var at=0;at<L.jqplot.postParseOptionsHooks.length;at++){L.jqplot.postParseOptionsHooks[at].call(this,ay)}for(var at=0;at<this.postParseOptionsHooks.hooks.length;at++){this.postParseOptionsHooks.hooks[at].call(this,ay)}};this.destroy=function(){this.canvasManager.freeAllCanvases();if(this.eventCanvas&&this.eventCanvas._elem){this.eventCanvas._elem.unbind()}this.target.empty();this.target[0].innerHTML=""};this.replot=function(am){var an=am||{};var ap=an.data||null;var al=(an.clear===false)?false:true;var ao=an.resetAxes||false;delete an.data;delete an.clear;delete an.resetAxes;this.target.trigger("jqplotPreReplot");if(al){this.destroy()}if(ap||!L.isEmptyObject(an)){this.reInitialize(ap,an)}else{this.quickInit()}if(ao){this.resetAxesScale(ao,an.axes)}this.draw();this.target.trigger("jqplotPostReplot")};this.redraw=function(al){al=(al!=null)?al:true;this.target.trigger("jqplotPreRedraw");if(al){this.canvasManager.freeAllCanvases();this.eventCanvas._elem.unbind();this.target.empty()}for(var an in this.axes){this.axes[an]._ticks=[]}this.computePlotData();this._sumy=0;this._sumx=0;for(var am=0,ao=this.series.length;am<ao;am++){this._sumy+=this.series[am]._sumy;this._sumx+=this.series[am]._sumx}this.draw();this.target.trigger("jqplotPostRedraw")};this.draw=function(){if(this.drawIfHidden||this.target.is(":visible")){this.target.trigger("jqplotPreDraw");var aH,aF,aE,ao;for(aH=0,aE=L.jqplot.preDrawHooks.length;aH<aE;aH++){L.jqplot.preDrawHooks[aH].call(this)}for(aH=0,aE=this.preDrawHooks.hooks.length;aH<aE;aH++){this.preDrawHooks.hooks[aH].apply(this,this.preDrawSeriesHooks.args[aH])}this.target.append(this.baseCanvas.createElement({left:0,right:0,top:0,bottom:0},"jqplot-base-canvas",null,this));this.baseCanvas.setContext();this.target.append(this.title.draw());this.title.pack({top:0,left:0});var aL=this.legend.draw({},this);var al={top:0,left:0,bottom:0,right:0};if(this.legend.placement=="outsideGrid"){this.target.append(aL);switch(this.legend.location){case"n":al.top+=this.legend.getHeight();break;case"s":al.bottom+=this.legend.getHeight();break;case"ne":case"e":case"se":al.right+=this.legend.getWidth();break;case"nw":case"w":case"sw":al.left+=this.legend.getWidth();break;default:al.right+=this.legend.getWidth();break}aL=aL.detach()}var ar=this.axes;var aM;for(aH=0;aH<12;aH++){aM=U[aH];this.target.append(ar[aM].draw(this.baseCanvas._ctx,this));ar[aM].set()}if(ar.yaxis.show){al.left+=ar.yaxis.getWidth()}var aG=["y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis"];var az=[0,0,0,0,0,0,0,0];var aC=0;var aB;for(aB=0;aB<8;aB++){if(ar[aG[aB]].show){aC+=ar[aG[aB]].getWidth();az[aB]=aC}}al.right+=aC;if(ar.x2axis.show){al.top+=ar.x2axis.getHeight()}if(this.title.show){al.top+=this.title.getHeight()}if(ar.xaxis.show){al.bottom+=ar.xaxis.getHeight()}if(this.options.gridDimensions&&L.isPlainObject(this.options.gridDimensions)){var at=parseInt(this.options.gridDimensions.width,10)||0;var aI=parseInt(this.options.gridDimensions.height,10)||0;var an=(this._width-al.left-al.right-at)/2;var aK=(this._height-al.top-al.bottom-aI)/2;if(aK>=0&&an>=0){al.top+=aK;al.bottom+=aK;al.left+=an;al.right+=an}}var am=["top","bottom","left","right"];for(var aB in am){if(this._gridPadding[am[aB]]==null&&al[am[aB]]>0){this._gridPadding[am[aB]]=al[am[aB]]}else{if(this._gridPadding[am[aB]]==null){this._gridPadding[am[aB]]=this._defaultGridPadding[am[aB]]}}}var aA=this._gridPadding;if(this.legend.placement==="outsideGrid"){aA={top:this.title.getHeight(),left:0,right:0,bottom:0};if(this.legend.location==="s"){aA.left=this._gridPadding.left;aA.right=this._gridPadding.right}}ar.xaxis.pack({position:"absolute",bottom:this._gridPadding.bottom-ar.xaxis.getHeight(),left:0,width:this._width},{min:this._gridPadding.left,max:this._width-this._gridPadding.right});ar.yaxis.pack({position:"absolute",top:0,left:this._gridPadding.left-ar.yaxis.getWidth(),height:this._height},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top});ar.x2axis.pack({position:"absolute",top:this._gridPadding.top-ar.x2axis.getHeight(),left:0,width:this._width},{min:this._gridPadding.left,max:this._width-this._gridPadding.right});for(aH=8;aH>0;aH--){ar[aG[aH-1]].pack({position:"absolute",top:0,right:this._gridPadding.right-az[aH-1]},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top})}var au=(this._width-this._gridPadding.left-this._gridPadding.right)/2+this._gridPadding.left-ar.yMidAxis.getWidth()/2;ar.yMidAxis.pack({position:"absolute",top:0,left:au,zIndex:9,textAlign:"center"},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top});this.target.append(this.grid.createElement(this._gridPadding,this));this.grid.draw();var aq=this.series;var aJ=aq.length;for(aH=0,aE=aJ;aH<aE;aH++){aF=this.seriesStack[aH];this.target.append(aq[aF].shadowCanvas.createElement(this._gridPadding,"jqplot-series-shadowCanvas",null,this));aq[aF].shadowCanvas.setContext();aq[aF].shadowCanvas._elem.data("seriesIndex",aF)}for(aH=0,aE=aJ;aH<aE;aH++){aF=this.seriesStack[aH];this.target.append(aq[aF].canvas.createElement(this._gridPadding,"jqplot-series-canvas",null,this));aq[aF].canvas.setContext();aq[aF].canvas._elem.data("seriesIndex",aF)}this.target.append(this.eventCanvas.createElement(this._gridPadding,"jqplot-event-canvas",null,this));this.eventCanvas.setContext();this.eventCanvas._ctx.fillStyle="rgba(0,0,0,0)";this.eventCanvas._ctx.fillRect(0,0,this.eventCanvas._ctx.canvas.width,this.eventCanvas._ctx.canvas.height);this.bindCustomEvents();if(this.legend.preDraw){this.eventCanvas._elem.before(aL);this.legend.pack(aA);if(this.legend._elem){this.drawSeries({legendInfo:{location:this.legend.location,placement:this.legend.placement,width:this.legend.getWidth(),height:this.legend.getHeight(),xoffset:this.legend.xoffset,yoffset:this.legend.yoffset}})}else{this.drawSeries()}}else{this.drawSeries();if(aJ){L(aq[aJ-1].canvas._elem).after(aL)}this.legend.pack(aA)}for(var aH=0,aE=L.jqplot.eventListenerHooks.length;aH<aE;aH++){this.eventCanvas._elem.bind(L.jqplot.eventListenerHooks[aH][0],{plot:this},L.jqplot.eventListenerHooks[aH][1])}for(var aH=0,aE=this.eventListenerHooks.hooks.length;aH<aE;aH++){this.eventCanvas._elem.bind(this.eventListenerHooks.hooks[aH][0],{plot:this},this.eventListenerHooks.hooks[aH][1])}var ay=this.fillBetween;if(ay.fill&&ay.series1!==ay.series2&&ay.series1<aJ&&ay.series2<aJ&&aq[ay.series1]._type==="line"&&aq[ay.series2]._type==="line"){this.doFillBetweenLines()}for(var aH=0,aE=L.jqplot.postDrawHooks.length;aH<aE;aH++){L.jqplot.postDrawHooks[aH].call(this)}for(var aH=0,aE=this.postDrawHooks.hooks.length;aH<aE;aH++){this.postDrawHooks.hooks[aH].apply(this,this.postDrawHooks.args[aH])}if(this.target.is(":visible")){this._drawCount+=1}var av,aw,aD,ap;for(aH=0,aE=aJ;aH<aE;aH++){av=aq[aH];aw=av.renderer;aD=".jqplot-point-label.jqplot-series-"+aH;if(aw.animation&&aw.animation._supported&&aw.animation.show&&(this._drawCount<2||this.animateReplot)){ap=this.target.find(aD);ap.stop(true,true).hide();av.canvas._elem.stop(true,true).hide();av.shadowCanvas._elem.stop(true,true).hide();av.canvas._elem.jqplotEffect("blind",{mode:"show",direction:aw.animation.direction},aw.animation.speed);av.shadowCanvas._elem.jqplotEffect("blind",{mode:"show",direction:aw.animation.direction},aw.animation.speed);ap.fadeIn(aw.animation.speed*0.8)}}ap=null;this.target.trigger("jqplotPostDraw",[this])}};R.prototype.doFillBetweenLines=function(){var an=this.fillBetween;var ax=an.series1;var av=an.series2;var aw=(ax<av)?ax:av;var au=(av>ax)?av:ax;var ar=this.series[aw];var aq=this.series[au];if(aq.renderer.smooth){var ap=aq.renderer._smoothedData.slice(0).reverse()}else{var ap=aq.gridData.slice(0).reverse()}if(ar.renderer.smooth){var at=ar.renderer._smoothedData.concat(ap)}else{var at=ar.gridData.concat(ap)}var ao=(an.color!==null)?an.color:this.series[ax].fillColor;var ay=(an.baseSeries!==null)?an.baseSeries:aw;var am=this.series[ay].renderer.shapeRenderer;var al={fillStyle:ao,fill:true,closePath:true};am.draw(ar.shadowCanvas._ctx,at,al)};this.bindCustomEvents=function(){this.eventCanvas._elem.bind("click",{plot:this},this.onClick);this.eventCanvas._elem.bind("dblclick",{plot:this},this.onDblClick);this.eventCanvas._elem.bind("mousedown",{plot:this},this.onMouseDown);this.eventCanvas._elem.bind("mousemove",{plot:this},this.onMouseMove);this.eventCanvas._elem.bind("mouseenter",{plot:this},this.onMouseEnter);this.eventCanvas._elem.bind("mouseleave",{plot:this},this.onMouseLeave);if(this.captureRightClick){this.eventCanvas._elem.bind("mouseup",{plot:this},this.onRightClick);this.eventCanvas._elem.get(0).oncontextmenu=function(){return false}}else{this.eventCanvas._elem.bind("mouseup",{plot:this},this.onMouseUp)}};function ai(av){var au=av.data.plot;var ap=au.eventCanvas._elem.offset();var at={x:av.pageX-ap.left,y:av.pageY-ap.top};var aq={xaxis:null,yaxis:null,x2axis:null,y2axis:null,y3axis:null,y4axis:null,y5axis:null,y6axis:null,y7axis:null,y8axis:null,y9axis:null,yMidAxis:null};var ar=["xaxis","yaxis","x2axis","y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis","yMidAxis"];var al=au.axes;var am,ao;for(am=11;am>0;am--){ao=ar[am-1];if(al[ao].show){aq[ao]=al[ao].series_p2u(at[ao.charAt(0)])}}return{offsets:ap,gridPos:at,dataPos:aq}}function ak(al,am){var aq=am.series;var aW,aU,aT,aO,aP,aJ,aI,aw,au,az,aA,aK;var aS,aX,aQ,ar,aH,aM,aV;var an,aN;for(aT=am.seriesStack.length-1;aT>=0;aT--){aW=am.seriesStack[aT];aO=aq[aW];aV=aO._highlightThreshold;switch(aO.renderer.constructor){case L.jqplot.BarRenderer:aJ=al.x;aI=al.y;for(aU=0;aU<aO._barPoints.length;aU++){aH=aO._barPoints[aU];aQ=aO.gridData[aU];if(aJ>aH[0][0]&&aJ<aH[2][0]&&aI>aH[2][1]&&aI<aH[0][1]){return{seriesIndex:aO.index,pointIndex:aU,gridData:aQ,data:aO.data[aU],points:aO._barPoints[aU]}}}break;case L.jqplot.PyramidRenderer:aJ=al.x;aI=al.y;for(aU=0;aU<aO._barPoints.length;aU++){aH=aO._barPoints[aU];aQ=aO.gridData[aU];if(aJ>aH[0][0]+aV[0][0]&&aJ<aH[2][0]+aV[2][0]&&aI>aH[2][1]&&aI<aH[0][1]){return{seriesIndex:aO.index,pointIndex:aU,gridData:aQ,data:aO.data[aU],points:aO._barPoints[aU]}}}break;case L.jqplot.DonutRenderer:az=aO.startAngle/180*Math.PI;aJ=al.x-aO._center[0];aI=al.y-aO._center[1];aP=Math.sqrt(Math.pow(aJ,2)+Math.pow(aI,2));if(aJ>0&&-aI>=0){aw=2*Math.PI-Math.atan(-aI/aJ)}else{if(aJ>0&&-aI<0){aw=-Math.atan(-aI/aJ)}else{if(aJ<0){aw=Math.PI-Math.atan(-aI/aJ)}else{if(aJ==0&&-aI>0){aw=3*Math.PI/2}else{if(aJ==0&&-aI<0){aw=Math.PI/2}else{if(aJ==0&&aI==0){aw=0}}}}}}if(az){aw-=az;if(aw<0){aw+=2*Math.PI}else{if(aw>2*Math.PI){aw-=2*Math.PI}}}au=aO.sliceMargin/180*Math.PI;if(aP<aO._radius&&aP>aO._innerRadius){for(aU=0;aU<aO.gridData.length;aU++){aA=(aU>0)?aO.gridData[aU-1][1]+au:au;aK=aO.gridData[aU][1];if(aw>aA&&aw<aK){return{seriesIndex:aO.index,pointIndex:aU,gridData:[al.x,al.y],data:aO.data[aU]}}}}break;case L.jqplot.PieRenderer:az=aO.startAngle/180*Math.PI;aJ=al.x-aO._center[0];aI=al.y-aO._center[1];aP=Math.sqrt(Math.pow(aJ,2)+Math.pow(aI,2));if(aJ>0&&-aI>=0){aw=2*Math.PI-Math.atan(-aI/aJ)}else{if(aJ>0&&-aI<0){aw=-Math.atan(-aI/aJ)}else{if(aJ<0){aw=Math.PI-Math.atan(-aI/aJ)}else{if(aJ==0&&-aI>0){aw=3*Math.PI/2}else{if(aJ==0&&-aI<0){aw=Math.PI/2}else{if(aJ==0&&aI==0){aw=0}}}}}}if(az){aw-=az;if(aw<0){aw+=2*Math.PI}else{if(aw>2*Math.PI){aw-=2*Math.PI}}}au=aO.sliceMargin/180*Math.PI;if(aP<aO._radius){for(aU=0;aU<aO.gridData.length;aU++){aA=(aU>0)?aO.gridData[aU-1][1]+au:au;aK=aO.gridData[aU][1];if(aw>aA&&aw<aK){return{seriesIndex:aO.index,pointIndex:aU,gridData:[al.x,al.y],data:aO.data[aU]}}}}break;case L.jqplot.BubbleRenderer:aJ=al.x;aI=al.y;var aF=null;if(aO.show){for(var aU=0;aU<aO.gridData.length;aU++){aQ=aO.gridData[aU];aX=Math.sqrt((aJ-aQ[0])*(aJ-aQ[0])+(aI-aQ[1])*(aI-aQ[1]));if(aX<=aQ[2]&&(aX<=aS||aS==null)){aS=aX;aF={seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}if(aF!=null){return aF}}break;case L.jqplot.FunnelRenderer:aJ=al.x;aI=al.y;var aL=aO._vertices,ap=aL[0],ao=aL[aL.length-1],at,aE,ay;function aR(a0,a2,a1){var aZ=(a2[1]-a1[1])/(a2[0]-a1[0]);var aY=a2[1]-aZ*a2[0];var a3=a0+a2[1];return[(a3-aY)/aZ,a3]}at=aR(aI,ap[0],ao[3]);aE=aR(aI,ap[1],ao[2]);for(aU=0;aU<aL.length;aU++){ay=aL[aU];if(aI>=ay[0][1]&&aI<=ay[3][1]&&aJ>=at[0]&&aJ<=aE[0]){return{seriesIndex:aO.index,pointIndex:aU,gridData:null,data:aO.data[aU]}}}break;case L.jqplot.LineRenderer:aJ=al.x;aI=al.y;aP=aO.renderer;if(aO.show){if((aO.fill||(aO.renderer.bands.show&&aO.renderer.bands.fill))&&(!am.plugins.highlighter||!am.plugins.highlighter.show)){var ax=false;if(aJ>aO._boundingBox[0][0]&&aJ<aO._boundingBox[1][0]&&aI>aO._boundingBox[1][1]&&aI<aO._boundingBox[0][1]){var aD=aO._areaPoints.length;var aG;var aU=aD-1;for(var aG=0;aG<aD;aG++){var aC=[aO._areaPoints[aG][0],aO._areaPoints[aG][1]];var aB=[aO._areaPoints[aU][0],aO._areaPoints[aU][1]];if(aC[1]<aI&&aB[1]>=aI||aB[1]<aI&&aC[1]>=aI){if(aC[0]+(aI-aC[1])/(aB[1]-aC[1])*(aB[0]-aC[0])<aJ){ax=!ax}}aU=aG}}if(ax){return{seriesIndex:aW,pointIndex:null,gridData:aO.gridData,data:aO.data,points:aO._areaPoints}}break}else{aN=aO.markerRenderer.size/2+aO.neighborThreshold;an=(aN>0)?aN:0;for(var aU=0;aU<aO.gridData.length;aU++){aQ=aO.gridData[aU];if(aP.constructor==L.jqplot.OHLCRenderer){if(aP.candleStick){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._bodyWidth/2&&aJ<=aQ[0]+aP._bodyWidth/2&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{if(!aP.hlc){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][1])&&aI<=av(aO.data[aU][2])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}else{if(aQ[0]!=null&&aQ[1]!=null){aX=Math.sqrt((aJ-aQ[0])*(aJ-aQ[0])+(aI-aQ[1])*(aI-aQ[1]));if(aX<=an&&(aX<=aS||aS==null)){aS=aX;return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}}}break;default:aJ=al.x;aI=al.y;aP=aO.renderer;if(aO.show){aN=aO.markerRenderer.size/2+aO.neighborThreshold;an=(aN>0)?aN:0;for(var aU=0;aU<aO.gridData.length;aU++){aQ=aO.gridData[aU];if(aP.constructor==L.jqplot.OHLCRenderer){if(aP.candleStick){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._bodyWidth/2&&aJ<=aQ[0]+aP._bodyWidth/2&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{if(!aP.hlc){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][1])&&aI<=av(aO.data[aU][2])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}else{aX=Math.sqrt((aJ-aQ[0])*(aJ-aQ[0])+(aI-aQ[1])*(aI-aQ[1]));if(aX<=an&&(aX<=aS||aS==null)){aS=aX;return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}break}}return null}this.onClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onDblClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotDblClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseDown=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotMouseDown");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseUp=function(an){var am=ai(an);var al=L.Event("jqplotMouseUp");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,null,an.data.plot])};this.onRightClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);if(ap.captureRightClick){if(an.which==3){var al=L.Event("jqplotRightClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])}else{var al=L.Event("jqplotMouseUp");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])}}};this.onMouseMove=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotMouseMove");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseEnter=function(an){var am=ai(an);var ao=an.data.plot;var al=L.Event("jqplotMouseEnter");al.pageX=an.pageX;al.pageY=an.pageY;al.relatedTarget=an.relatedTarget;L(this).trigger(al,[am.gridPos,am.dataPos,null,ao])};this.onMouseLeave=function(an){var am=ai(an);var ao=an.data.plot;var al=L.Event("jqplotMouseLeave");al.pageX=an.pageX;al.pageY=an.pageY;al.relatedTarget=an.relatedTarget;L(this).trigger(al,[am.gridPos,am.dataPos,null,ao])};this.drawSeries=function(an,al){var ap,ao,am;al=(typeof(an)==="number"&&al==null)?an:al;an=(typeof(an)==="object")?an:{};if(al!=u){ao=this.series[al];am=ao.shadowCanvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.drawShadow(am,an,this);am=ao.canvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.draw(am,an,this);if(ao.renderer.constructor==L.jqplot.BezierCurveRenderer){if(al<this.series.length-1){this.drawSeries(al+1)}}}else{for(ap=0;ap<this.series.length;ap++){ao=this.series[ap];am=ao.shadowCanvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.drawShadow(am,an,this);am=ao.canvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.draw(am,an,this)}}an=al=ap=ao=am=null};this.moveSeriesToFront=function(am){am=parseInt(am,10);var ap=L.inArray(am,this.seriesStack);if(ap==-1){return}if(ap==this.seriesStack.length-1){this.previousSeriesStack=this.seriesStack.slice(0);return}var al=this.seriesStack[this.seriesStack.length-1];var ao=this.series[am].canvas._elem.detach();var an=this.series[am].shadowCanvas._elem.detach();this.series[al].shadowCanvas._elem.after(an);this.series[al].canvas._elem.after(ao);this.previousSeriesStack=this.seriesStack.slice(0);this.seriesStack.splice(ap,1);this.seriesStack.push(am)};this.moveSeriesToBack=function(am){am=parseInt(am,10);var ap=L.inArray(am,this.seriesStack);if(ap==0||ap==-1){return}var al=this.seriesStack[0];var ao=this.series[am].canvas._elem.detach();var an=this.series[am].shadowCanvas._elem.detach();this.series[al].shadowCanvas._elem.before(an);this.series[al].canvas._elem.before(ao);this.previousSeriesStack=this.seriesStack.slice(0);this.seriesStack.splice(ap,1);this.seriesStack.unshift(am)};this.restorePreviousSeriesOrder=function(){var ar,aq,ap,ao,an,al,am;if(this.seriesStack==this.previousSeriesStack){return}for(ar=1;ar<this.previousSeriesStack.length;ar++){al=this.previousSeriesStack[ar];am=this.previousSeriesStack[ar-1];ap=this.series[al].canvas._elem.detach();ao=this.series[al].shadowCanvas._elem.detach();this.series[am].shadowCanvas._elem.after(ao);this.series[am].canvas._elem.after(ap)}an=this.seriesStack.slice(0);this.seriesStack=this.previousSeriesStack.slice(0);this.previousSeriesStack=an};this.restoreOriginalSeriesOrder=function(){var ap,ao,al=[],an,am;for(ap=0;ap<this.series.length;ap++){al.push(ap)}if(this.seriesStack==al){return}this.previousSeriesStack=this.seriesStack.slice(0);this.seriesStack=al;for(ap=1;ap<this.seriesStack.length;ap++){an=this.series[ap].canvas._elem.detach();am=this.series[ap].shadowCanvas._elem.detach();this.series[ap-1].shadowCanvas._elem.after(am);this.series[ap-1].canvas._elem.after(an)}};this.activateTheme=function(al){this.themeEngine.activate(this,al)}}L.jqplot.computeHighlightColors=function(ai){var ak;if(L.isArray(ai)){ak=[];for(var am=0;am<ai.length;am++){var al=L.jqplot.getColorComponents(ai[am]);var ah=[al[0],al[1],al[2]];var an=ah[0]+ah[1]+ah[2];for(var aj=0;aj<3;aj++){ah[aj]=(an>660)?ah[aj]*0.85:0.73*ah[aj]+90;ah[aj]=parseInt(ah[aj],10);(ah[aj]>255)?255:ah[aj]}ah[3]=0.3+0.35*al[3];ak.push("rgba("+ah[0]+","+ah[1]+","+ah[2]+","+ah[3]+")")}}else{var al=L.jqplot.getColorComponents(ai);var ah=[al[0],al[1],al[2]];var an=ah[0]+ah[1]+ah[2];for(var aj=0;aj<3;aj++){ah[aj]=(an>660)?ah[aj]*0.85:0.73*ah[aj]+90;ah[aj]=parseInt(ah[aj],10);(ah[aj]>255)?255:ah[aj]}ah[3]=0.3+0.35*al[3];ak="rgba("+ah[0]+","+ah[1]+","+ah[2]+","+ah[3]+")"}return ak};L.jqplot.ColorGenerator=function(ai){ai=ai||L.jqplot.config.defaultColors;var ah=0;this.next=function(){if(ah<ai.length){return ai[ah++]}else{ah=0;return ai[ah++]}};this.previous=function(){if(ah>0){return ai[ah--]}else{ah=ai.length-1;return ai[ah]}};this.get=function(ak){var aj=ak-ai.length*Math.floor(ak/ai.length);return ai[aj]};this.setColors=function(aj){ai=aj};this.reset=function(){ah=0};this.getIndex=function(){return ah};this.setIndex=function(aj){ah=aj}};L.jqplot.hex2rgb=function(aj,ah){aj=aj.replace("#","");if(aj.length==3){aj=aj.charAt(0)+aj.charAt(0)+aj.charAt(1)+aj.charAt(1)+aj.charAt(2)+aj.charAt(2)}var ai;ai="rgba("+parseInt(aj.slice(0,2),16)+", "+parseInt(aj.slice(2,4),16)+", "+parseInt(aj.slice(4,6),16);if(ah){ai+=", "+ah}ai+=")";return ai};L.jqplot.rgb2hex=function(am){var aj=/rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *(?:, *[0-9.]*)?\)/;var ah=am.match(aj);var al="#";for(var ak=1;ak<4;ak++){var ai;if(ah[ak].search(/%/)!=-1){ai=parseInt(255*ah[ak]/100,10).toString(16);if(ai.length==1){ai="0"+ai}}else{ai=parseInt(ah[ak],10).toString(16);if(ai.length==1){ai="0"+ai}}al+=ai}return al};L.jqplot.normalize2rgb=function(ai,ah){if(ai.search(/^ *rgba?\(/)!=-1){return ai}else{if(ai.search(/^ *#?[0-9a-fA-F]?[0-9a-fA-F]/)!=-1){return L.jqplot.hex2rgb(ai,ah)}else{throw new Error("Invalid color spec")}}};L.jqplot.getColorComponents=function(am){am=L.jqplot.colorKeywordMap[am]||am;var ak=L.jqplot.normalize2rgb(am);var aj=/rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *,? *([0-9.]* *)?\)/;var ah=ak.match(aj);var ai=[];for(var al=1;al<4;al++){if(ah[al].search(/%/)!=-1){ai[al-1]=parseInt(255*ah[al]/100,10)}else{ai[al-1]=parseInt(ah[al],10)}}ai[3]=parseFloat(ah[4])?parseFloat(ah[4]):1;return ai};L.jqplot.colorKeywordMap={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",aqua:"rgb( 0, 255, 255)",aquamarine:"rgb(127, 255, 212)",azure:"rgb(240, 255, 255)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",black:"rgb( 0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb( 0, 0, 255)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",burlywood:"rgb(222, 184, 135)",cadetblue:"rgb( 95, 158, 160)",chartreuse:"rgb(127, 255, 0)",chocolate:"rgb(210, 105, 30)",coral:"rgb(255, 127, 80)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",crimson:"rgb(220, 20, 60)",cyan:"rgb( 0, 255, 255)",darkblue:"rgb( 0, 0, 139)",darkcyan:"rgb( 0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgray:"rgb(169, 169, 169)",darkgreen:"rgb( 0, 100, 0)",darkgrey:"rgb(169, 169, 169)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb( 85, 107, 47)",darkorange:"rgb(255, 140, 0)",darkorchid:"rgb(153, 50, 204)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkslateblue:"rgb( 72, 61, 139)",darkslategray:"rgb( 47, 79, 79)",darkslategrey:"rgb( 47, 79, 79)",darkturquoise:"rgb( 0, 206, 209)",darkviolet:"rgb(148, 0, 211)",deeppink:"rgb(255, 20, 147)",deepskyblue:"rgb( 0, 191, 255)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb( 30, 144, 255)",firebrick:"rgb(178, 34, 34)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb( 34, 139, 34)",fuchsia:"rgb(255, 0, 255)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",goldenrod:"rgb(218, 165, 32)",gray:"rgb(128, 128, 128)",grey:"rgb(128, 128, 128)",green:"rgb( 0, 128, 0)",greenyellow:"rgb(173, 255, 47)",honeydew:"rgb(240, 255, 240)",hotpink:"rgb(255, 105, 180)",indianred:"rgb(205, 92, 92)",indigo:"rgb( 75, 0, 130)",ivory:"rgb(255, 255, 240)",khaki:"rgb(240, 230, 140)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lightblue:"rgb(173, 216, 230)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgray:"rgb(211, 211, 211)",lightgreen:"rgb(144, 238, 144)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightsalmon:"rgb(255, 160, 122)",lightseagreen:"rgb( 32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightyellow:"rgb(255, 255, 224)",lime:"rgb( 0, 255, 0)",limegreen:"rgb( 50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",maroon:"rgb(128, 0, 0)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb( 0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumpurple:"rgb(147, 112, 219)",mediumseagreen:"rgb( 60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb( 0, 250, 154)",mediumturquoise:"rgb( 72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb( 25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navy:"rgb( 0, 0, 128)",oldlace:"rgb(253, 245, 230)",olive:"rgb(128, 128, 0)",olivedrab:"rgb(107, 142, 35)",orange:"rgb(255, 165, 0)",orangered:"rgb(255, 69, 0)",orchid:"rgb(218, 112, 214)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",paleturquoise:"rgb(175, 238, 238)",palevioletred:"rgb(219, 112, 147)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",plum:"rgb(221, 160, 221)",powderblue:"rgb(176, 224, 230)",purple:"rgb(128, 0, 128)",red:"rgb(255, 0, 0)",rosybrown:"rgb(188, 143, 143)",royalblue:"rgb( 65, 105, 225)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb( 46, 139, 87)",seashell:"rgb(255, 245, 238)",sienna:"rgb(160, 82, 45)",silver:"rgb(192, 192, 192)",skyblue:"rgb(135, 206, 235)",slateblue:"rgb(106, 90, 205)",slategray:"rgb(112, 128, 144)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",springgreen:"rgb( 0, 255, 127)",steelblue:"rgb( 70, 130, 180)",tan:"rgb(210, 180, 140)",teal:"rgb( 0, 128, 128)",thistle:"rgb(216, 191, 216)",tomato:"rgb(255, 99, 71)",turquoise:"rgb( 64, 224, 208)",violet:"rgb(238, 130, 238)",wheat:"rgb(245, 222, 179)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellowgreen:"rgb(154, 205, 50)"};L.jqplot.AxisLabelRenderer=function(ah){L.jqplot.ElemContainer.call(this);this.axis;this.show=true;this.label="";this.fontFamily=null;this.fontSize=null;this.textColor=null;this._elem;this.escapeHTML=false;L.extend(true,this,ah)};L.jqplot.AxisLabelRenderer.prototype=new L.jqplot.ElemContainer();L.jqplot.AxisLabelRenderer.prototype.constructor=L.jqplot.AxisLabelRenderer;L.jqplot.AxisLabelRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.AxisLabelRenderer.prototype.draw=function(ah,ai){if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=L('<div style="position:absolute;" class="jqplot-'+this.axis+'-label"></div>');if(Number(this.label)){this._elem.css("white-space","nowrap")}if(!this.escapeHTML){this._elem.html(this.label)}else{this._elem.text(this.label)}if(this.fontFamily){this._elem.css("font-family",this.fontFamily)}if(this.fontSize){this._elem.css("font-size",this.fontSize)}if(this.textColor){this._elem.css("color",this.textColor)}return this._elem};L.jqplot.AxisLabelRenderer.prototype.pack=function(){};L.jqplot.AxisTickRenderer=function(ah){L.jqplot.ElemContainer.call(this);this.mark="outside";this.axis;this.showMark=true;this.showGridline=true;this.isMinorTick=false;this.size=4;this.markSize=6;this.show=true;this.showLabel=true;this.label=null;this.value=null;this._styles={};this.formatter=L.jqplot.DefaultTickFormatter;this.prefix="";this.suffix="";this.formatString="";this.fontFamily;this.fontSize;this.textColor;this.escapeHTML=false;this._elem;this._breakTick=false;L.extend(true,this,ah)};L.jqplot.AxisTickRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.AxisTickRenderer.prototype=new L.jqplot.ElemContainer();L.jqplot.AxisTickRenderer.prototype.constructor=L.jqplot.AxisTickRenderer;L.jqplot.AxisTickRenderer.prototype.setTick=function(ah,aj,ai){this.value=ah;this.axis=aj;if(ai){this.isMinorTick=true}return this};L.jqplot.AxisTickRenderer.prototype.draw=function(){if(this.label===null){this.label=this.prefix+this.formatter(this.formatString,this.value)+this.suffix}var ai={position:"absolute"};if(Number(this.label)){ai.whitSpace="nowrap"}if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=L(document.createElement("div"));this._elem.addClass("jqplot-"+this.axis+"-tick");if(!this.escapeHTML){this._elem.html(this.label)}else{this._elem.text(this.label)}this._elem.css(ai);for(var ah in this._styles){this._elem.css(ah,this._styles[ah])}if(this.fontFamily){this._elem.css("font-family",this.fontFamily)}if(this.fontSize){this._elem.css("font-size",this.fontSize)}if(this.textColor){this._elem.css("color",this.textColor)}if(this._breakTick){this._elem.addClass("jqplot-breakTick")}return this._elem};L.jqplot.DefaultTickFormatter=function(ah,ai){if(typeof ai=="number"){if(!ah){ah=L.jqplot.config.defaultTickFormatString}return L.jqplot.sprintf(ah,ai)}else{return String(ai)}};L.jqplot.PercentTickFormatter=function(ah,ai){if(typeof ai=="number"){ai=100*ai;if(!ah){ah=L.jqplot.config.defaultTickFormatString}return L.jqplot.sprintf(ah,ai)}else{return String(ai)}};L.jqplot.AxisTickRenderer.prototype.pack=function(){};L.jqplot.CanvasGridRenderer=function(){this.shadowRenderer=new L.jqplot.ShadowRenderer()};L.jqplot.CanvasGridRenderer.prototype.init=function(ai){this._ctx;L.extend(true,this,ai);var ah={lineJoin:"miter",lineCap:"round",fill:false,isarc:false,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,lineWidth:this.shadowWidth,closePath:false,strokeStyle:this.shadowColor};this.renderer.shadowRenderer.init(ah)};L.jqplot.CanvasGridRenderer.prototype.createElement=function(ak){var aj;if(this._elem){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){aj=this._elem.get(0);window.G_vmlCanvasManager.uninitElement(aj);aj=null}this._elem.emptyForce();this._elem=null}aj=ak.canvasManager.getCanvas();var ah=this._plotDimensions.width;var ai=this._plotDimensions.height;aj.width=ah;aj.height=ai;this._elem=L(aj);this._elem.addClass("jqplot-grid-canvas");this._elem.css({position:"absolute",left:0,top:0});aj=ak.canvasManager.initCanvas(aj);this._top=this._offsets.top;this._bottom=ai-this._offsets.bottom;this._left=this._offsets.left;this._right=ah-this._offsets.right;this._width=this._right-this._left;this._height=this._bottom-this._top;aj=null;return this._elem};L.jqplot.CanvasGridRenderer.prototype.draw=function(){this._ctx=this._elem.get(0).getContext("2d");var at=this._ctx;var aw=this._axes;at.save();at.clearRect(0,0,this._plotDimensions.width,this._plotDimensions.height);at.fillStyle=this.backgroundColor||this.background;at.fillRect(this._left,this._top,this._width,this._height);at.save();at.lineJoin="miter";at.lineCap="butt";at.lineWidth=this.gridLineWidth;at.strokeStyle=this.gridLineColor;var aA,az,ap,aq;var am=["xaxis","yaxis","x2axis","y2axis"];for(var ay=4;ay>0;ay--){var aD=am[ay-1];var ah=aw[aD];var aB=ah._ticks;var ar=aB.length;if(ah.show){if(ah.drawBaseline){var aC={};if(ah.baselineWidth!==null){aC.lineWidth=ah.baselineWidth}if(ah.baselineColor!==null){aC.strokeStyle=ah.baselineColor}switch(aD){case"xaxis":ao(this._left,this._bottom,this._right,this._bottom,aC);break;case"yaxis":ao(this._left,this._bottom,this._left,this._top,aC);break;case"x2axis":ao(this._left,this._bottom,this._right,this._bottom,aC);break;case"y2axis":ao(this._right,this._bottom,this._right,this._top,aC);break}}for(var au=ar;au>0;au--){var an=aB[au-1];if(an.show){var ak=Math.round(ah.u2p(an.value))+0.5;switch(aD){case"xaxis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(ak,this._top,ak,this._bottom)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._bottom;az=this._bottom+ap;break;case"inside":aA=this._bottom-ap;az=this._bottom;break;case"cross":aA=this._bottom-ap;az=this._bottom+ap;break;default:aA=this._bottom;az=this._bottom+ap;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[ak,aA],[ak,az]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}ao(ak,aA,ak,az)}break;case"yaxis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(this._right,ak,this._left,ak)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._left-ap;az=this._left;break;case"inside":aA=this._left;az=this._left+ap;break;case"cross":aA=this._left-ap;az=this._left+ap;break;default:aA=this._left-ap;az=this._left;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[aA,ak],[az,ak]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}break;case"x2axis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(ak,this._bottom,ak,this._top)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._top-ap;az=this._top;break;case"inside":aA=this._top;az=this._top+ap;break;case"cross":aA=this._top-ap;az=this._top+ap;break;default:aA=this._top-ap;az=this._top;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[ak,aA],[ak,az]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}ao(ak,aA,ak,az)}break;case"y2axis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(this._left,ak,this._right,ak)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._right;az=this._right+ap;break;case"inside":aA=this._right-ap;az=this._right;break;case"cross":aA=this._right-ap;az=this._right+ap;break;default:aA=this._right;az=this._right+ap;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[aA,ak],[az,ak]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}break;default:break}}}an=null}ah=null;aB=null}am=["y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis","yMidAxis"];for(var ay=7;ay>0;ay--){var ah=aw[am[ay-1]];var aB=ah._ticks;if(ah.show){var ai=aB[ah.numberTicks-1];var al=aB[0];var aj=ah.getLeft();var av=[[aj,ai.getTop()+ai.getHeight()/2],[aj,al.getTop()+al.getHeight()/2+1]];if(this.shadow){this.renderer.shadowRenderer.draw(at,av,{lineCap:"butt",fill:false,closePath:false})}ao(av[0][0],av[0][1],av[1][0],av[1][1],{lineCap:"butt",strokeStyle:ah.borderColor,lineWidth:ah.borderWidth});for(var au=aB.length;au>0;au--){var an=aB[au-1];ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;if(an.showMark&&an.mark){switch(aq){case"outside":aA=aj;az=aj+ap;break;case"inside":aA=aj-ap;az=aj;break;case"cross":aA=aj-ap;az=aj+ap;break;default:aA=aj;az=aj+ap;break}av=[[aA,ak],[az,ak]];if(this.shadow){this.renderer.shadowRenderer.draw(at,av,{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}an=null}al=null}ah=null;aB=null}at.restore();function ao(aH,aG,aE,ax,aF){at.save();aF=aF||{};if(aF.lineWidth==null||aF.lineWidth!=0){L.extend(true,at,aF);at.beginPath();at.moveTo(aH,aG);at.lineTo(aE,ax);at.stroke();at.restore()}}if(this.shadow){var av=[[this._left,this._bottom],[this._right,this._bottom],[this._right,this._top]];this.renderer.shadowRenderer.draw(at,av)}if(this.borderWidth!=0&&this.drawBorder){ao(this._left,this._top,this._right,this._top,{lineCap:"round",strokeStyle:aw.x2axis.borderColor,lineWidth:aw.x2axis.borderWidth});ao(this._right,this._top,this._right,this._bottom,{lineCap:"round",strokeStyle:aw.y2axis.borderColor,lineWidth:aw.y2axis.borderWidth});ao(this._right,this._bottom,this._left,this._bottom,{lineCap:"round",strokeStyle:aw.xaxis.borderColor,lineWidth:aw.xaxis.borderWidth});ao(this._left,this._bottom,this._left,this._top,{lineCap:"round",strokeStyle:aw.yaxis.borderColor,lineWidth:aw.yaxis.borderWidth})}at.restore();at=null;aw=null};L.jqplot.DivTitleRenderer=function(){};L.jqplot.DivTitleRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.DivTitleRenderer.prototype.draw=function(){if(this._elem){this._elem.emptyForce();this._elem=null}var ak=this.renderer;var aj=document.createElement("div");this._elem=L(aj);this._elem.addClass("jqplot-title");if(!this.text){this.show=false;this._elem.height(0);this._elem.width(0)}else{if(this.text){var ah;if(this.color){ah=this.color}else{if(this.textColor){ah=this.textColor}}var ai={position:"absolute",top:"0px",left:"0px"};if(this._plotWidth){ai.width=this._plotWidth+"px"}if(this.fontSize){ai.fontSize=this.fontSize}if(typeof this.textAlign==="string"){ai.textAlign=this.textAlign}else{ai.textAlign="center"}if(ah){ai.color=ah}if(this.paddingBottom){ai.paddingBottom=this.paddingBottom}if(this.fontFamily){ai.fontFamily=this.fontFamily}this._elem.css(ai);if(this.escapeHtml){this._elem.text(this.text)}else{this._elem.html(this.text)}}}aj=null;return this._elem};L.jqplot.DivTitleRenderer.prototype.pack=function(){};var r=0.1;L.jqplot.LinePattern=function(aw,aq){var ap={dotted:[r,L.jqplot.config.dotGapLength],dashed:[L.jqplot.config.dashLength,L.jqplot.config.gapLength],solid:null};if(typeof aq==="string"){if(aq[0]==="."||aq[0]==="-"){var ax=aq;aq=[];for(var ao=0,al=ax.length;ao<al;ao++){if(ax[ao]==="."){aq.push(r)}else{if(ax[ao]==="-"){aq.push(L.jqplot.config.dashLength)}else{continue}}aq.push(L.jqplot.config.gapLength)}}else{aq=ap[aq]}}if(!(aq&&aq.length)){return aw}var ak=0;var ar=aq[0];var au=0;var at=0;var an=0;var ah=0;var av=function(ay,az){aw.moveTo(ay,az);au=ay;at=az;an=ay;ah=az};var aj=function(ay,aE){var aC=aw.lineWidth;var aA=ay-au;var az=aE-at;var aB=Math.sqrt(aA*aA+az*az);if((aB>0)&&(aC>0)){aA/=aB;az/=aB;while(true){var aD=aC*ar;if(aD<aB){au+=aD*aA;at+=aD*az;if((ak&1)==0){aw.lineTo(au,at)}else{aw.moveTo(au,at)}aB-=aD;ak++;if(ak>=aq.length){ak=0}ar=aq[ak]}else{au=ay;at=aE;if((ak&1)==0){aw.lineTo(au,at)}else{aw.moveTo(au,at)}ar-=aB/aC;break}}}};var ai=function(){aw.beginPath()};var am=function(){aj(an,ah)};return{moveTo:av,lineTo:aj,beginPath:ai,closePath:am}};L.jqplot.LineRenderer=function(){this.shapeRenderer=new L.jqplot.ShapeRenderer();this.shadowRenderer=new L.jqplot.ShadowRenderer()};L.jqplot.LineRenderer.prototype.init=function(ai,an){ai=ai||{};this._type="line";this.renderer.animation={show:false,direction:"left",speed:2500,_supported:true};this.renderer.smooth=false;this.renderer.tension=null;this.renderer.constrainSmoothing=true;this.renderer._smoothedData=[];this.renderer._smoothedPlotData=[];this.renderer._hiBandGridData=[];this.renderer._lowBandGridData=[];this.renderer._hiBandSmoothedData=[];this.renderer._lowBandSmoothedData=[];this.renderer.bandData=[];this.renderer.bands={show:false,hiData:[],lowData:[],color:this.color,showLines:false,fill:true,fillColor:null,_min:null,_max:null,interval:"3%"};var al={highlightMouseOver:ai.highlightMouseOver,highlightMouseDown:ai.highlightMouseDown,highlightColor:ai.highlightColor};delete (ai.highlightMouseOver);delete (ai.highlightMouseDown);delete (ai.highlightColor);L.extend(true,this.renderer,ai);this.renderer.options=ai;if(this.renderer.bandData.length>1&&(!ai.bands||ai.bands.show==null)){this.renderer.bands.show=true}else{if(ai.bands&&ai.bands.show==null&&ai.bands.interval!=null){this.renderer.bands.show=true}}if(this.fill){this.renderer.bands.show=false}if(this.renderer.bands.show){this.renderer.initBands.call(this,this.renderer.options,an)}if(this._stack){this.renderer.smooth=false}var am={lineJoin:this.lineJoin,lineCap:this.lineCap,fill:this.fill,isarc:false,strokeStyle:this.color,fillStyle:this.fillColor,lineWidth:this.lineWidth,linePattern:this.linePattern,closePath:this.fill};this.renderer.shapeRenderer.init(am);var aj=ai.shadowOffset;if(aj==null){if(this.lineWidth>2.5){aj=1.25*(1+(Math.atan((this.lineWidth/2.5))/0.785398163-1)*0.6)}else{aj=1.25*Math.atan((this.lineWidth/2.5))/0.785398163}}var ah={lineJoin:this.lineJoin,lineCap:this.lineCap,fill:this.fill,isarc:false,angle:this.shadowAngle,offset:aj,alpha:this.shadowAlpha,depth:this.shadowDepth,lineWidth:this.lineWidth,linePattern:this.linePattern,closePath:this.fill};this.renderer.shadowRenderer.init(ah);this._areaPoints=[];this._boundingBox=[[],[]];if(!this.isTrendline&&this.fill||this.renderer.bands.show){this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColor=null;if(al.highlightMouseDown&&al.highlightMouseOver==null){al.highlightMouseOver=false}L.extend(true,this,{highlightMouseOver:al.highlightMouseOver,highlightMouseDown:al.highlightMouseDown,highlightColor:al.highlightColor});if(!this.highlightColor){var ak=(this.renderer.bands.show)?this.renderer.bands.fillColor:this.fillColor;this.highlightColor=L.jqplot.computeHighlightColors(ak)}if(this.highlighter){this.highlighter.show=false}}if(!this.isTrendline&&an){an.plugins.lineRenderer={};an.postInitHooks.addOnce(z);an.postDrawHooks.addOnce(af);an.eventListenerHooks.addOnce("jqplotMouseMove",h);an.eventListenerHooks.addOnce("jqplotMouseDown",e);an.eventListenerHooks.addOnce("jqplotMouseUp",ad);an.eventListenerHooks.addOnce("jqplotClick",g);an.eventListenerHooks.addOnce("jqplotRightClick",s)}};L.jqplot.LineRenderer.prototype.initBands=function(ak,av){var al=ak.bandData||[];var an=this.renderer.bands;an.hiData=[];an.lowData=[];var aB=this.data;an._max=null;an._min=null;if(al.length==2){if(L.isArray(al[0][0])){var ao;var ah=0,ar=0;for(var aw=0,at=al[0].length;aw<at;aw++){ao=al[0][aw];if((ao[1]!=null&&ao[1]>an._max)||an._max==null){an._max=ao[1]}if((ao[1]!=null&&ao[1]<an._min)||an._min==null){an._min=ao[1]}}for(var aw=0,at=al[1].length;aw<at;aw++){ao=al[1][aw];if((ao[1]!=null&&ao[1]>an._max)||an._max==null){an._max=ao[1];ar=1}if((ao[1]!=null&&ao[1]<an._min)||an._min==null){an._min=ao[1];ah=1}}if(ar===ah){an.show=false}an.hiData=al[ar];an.lowData=al[ah]}else{if(al[0].length===aB.length&&al[1].length===aB.length){var aj=(al[0][0]>al[1][0])?0:1;var aC=(aj)?0:1;for(var aw=0,at=aB.length;aw<at;aw++){an.hiData.push([aB[aw][0],al[aj][aw]]);an.lowData.push([aB[aw][0],al[aC][aw]])}}else{an.show=false}}}else{if(al.length>2&&!L.isArray(al[0][0])){var aj=(al[0][0]>al[0][1])?0:1;var aC=(aj)?0:1;for(var aw=0,at=al.length;aw<at;aw++){an.hiData.push([aB[aw][0],al[aw][aj]]);an.lowData.push([aB[aw][0],al[aw][aC]])}}else{var aq=an.interval;var aA=null;var az=null;var ai=null;var au=null;if(L.isArray(aq)){aA=aq[0];az=aq[1]}else{aA=aq}if(isNaN(aA)){if(aA.charAt(aA.length-1)==="%"){ai="multiply";aA=parseFloat(aA)/100+1}}else{aA=parseFloat(aA);ai="add"}if(az!==null&&isNaN(az)){if(az.charAt(az.length-1)==="%"){au="multiply";az=parseFloat(az)/100+1}}else{if(az!==null){az=parseFloat(az);au="add"}}if(aA!==null){if(az===null){az=-aA;au=ai;if(au==="multiply"){az+=2}}if(aA<az){var ax=aA;aA=az;az=ax;ax=ai;ai=au;au=ax}for(var aw=0,at=aB.length;aw<at;aw++){switch(ai){case"add":an.hiData.push([aB[aw][0],aB[aw][1]+aA]);break;case"multiply":an.hiData.push([aB[aw][0],aB[aw][1]*aA]);break}switch(au){case"add":an.lowData.push([aB[aw][0],aB[aw][1]+az]);break;case"multiply":an.lowData.push([aB[aw][0],aB[aw][1]*az]);break}}}else{an.show=false}}}var am=an.hiData;var ap=an.lowData;for(var aw=0,at=am.length;aw<at;aw++){if((am[aw][1]!=null&&am[aw][1]>an._max)||an._max==null){an._max=am[aw][1]}}for(var aw=0,at=ap.length;aw<at;aw++){if((ap[aw][1]!=null&&ap[aw][1]<an._min)||an._min==null){an._min=ap[aw][1]}}if(an.fillColor===null){var ay=L.jqplot.getColorComponents(an.color);ay[3]=ay[3]*0.5;an.fillColor="rgba("+ay[0]+", "+ay[1]+", "+ay[2]+", "+ay[3]+")"}};function K(ai,ah){return(3.4182054+ah)*Math.pow(ai,-0.3534992)}function n(aj,ai){var ah=Math.sqrt(Math.pow((ai[0]-aj[0]),2)+Math.pow((ai[1]-aj[1]),2));return 5.7648*Math.log(ah)+7.4456}function A(ah){var ai=(Math.exp(2*ah)-1)/(Math.exp(2*ah)+1);return ai}function J(aJ){var at=this.renderer.smooth;var aD=this.canvas.getWidth();var an=this._xaxis.series_p2u;var aG=this._yaxis.series_p2u;var aF=null;var am=null;var az=aJ.length/aD;var aj=[];var ay=[];if(!isNaN(parseFloat(at))){aF=parseFloat(at)}else{aF=K(az,0.5)}var aw=[];var ak=[];for(var aE=0,aA=aJ.length;aE<aA;aE++){aw.push(aJ[aE][1]);ak.push(aJ[aE][0])}function av(aK,aL){if(aK-aL==0){return Math.pow(10,10)}else{return aK-aL}}var ax,ar,aq,ap;var ah=aJ.length-1;for(var al=1,aB=aJ.length;al<aB;al++){var ai=[];var au=[];for(var aC=0;aC<2;aC++){var aE=al-1+aC;if(aE==0||aE==ah){ai[aC]=Math.pow(10,10)}else{if(aw[aE+1]-aw[aE]==0||aw[aE]-aw[aE-1]==0){ai[aC]=0}else{if(((ak[aE+1]-ak[aE])/(aw[aE+1]-aw[aE])+(ak[aE]-ak[aE-1])/(aw[aE]-aw[aE-1]))==0){ai[aC]=0}else{if((aw[aE+1]-aw[aE])*(aw[aE]-aw[aE-1])<0){ai[aC]=0}else{ai[aC]=2/(av(ak[aE+1],ak[aE])/(aw[aE+1]-aw[aE])+av(ak[aE],ak[aE-1])/(aw[aE]-aw[aE-1]))}}}}}if(al==1){ai[0]=3/2*(aw[1]-aw[0])/av(ak[1],ak[0])-ai[1]/2}else{if(al==ah){ai[1]=3/2*(aw[ah]-aw[ah-1])/av(ak[ah],ak[ah-1])-ai[0]/2}}au[0]=-2*(ai[1]+2*ai[0])/av(ak[al],ak[al-1])+6*(aw[al]-aw[al-1])/Math.pow(av(ak[al],ak[al-1]),2);au[1]=2*(2*ai[1]+ai[0])/av(ak[al],ak[al-1])-6*(aw[al]-aw[al-1])/Math.pow(av(ak[al],ak[al-1]),2);ap=1/6*(au[1]-au[0])/av(ak[al],ak[al-1]);aq=1/2*(ak[al]*au[0]-ak[al-1]*au[1])/av(ak[al],ak[al-1]);ar=(aw[al]-aw[al-1]-aq*(Math.pow(ak[al],2)-Math.pow(ak[al-1],2))-ap*(Math.pow(ak[al],3)-Math.pow(ak[al-1],3)))/av(ak[al],ak[al-1]);ax=aw[al-1]-ar*ak[al-1]-aq*Math.pow(ak[al-1],2)-ap*Math.pow(ak[al-1],3);var aI=(ak[al]-ak[al-1])/aF;var aH,ao;for(var aC=0,aA=aF;aC<aA;aC++){aH=[];ao=ak[al-1]+aC*aI;aH.push(ao);aH.push(ax+ar*ao+aq*Math.pow(ao,2)+ap*Math.pow(ao,3));aj.push(aH);ay.push([an(aH[0]),aG(aH[1])])}}aj.push(aJ[aE]);ay.push([an(aJ[aE][0]),aG(aJ[aE][1])]);return[aj,ay]}function F(ap){var ao=this.renderer.smooth;var aU=this.renderer.tension;var ah=this.canvas.getWidth();var aH=this._xaxis.series_p2u;var aq=this._yaxis.series_p2u;var aI=null;var aJ=null;var aT=null;var aO=null;var aM=null;var at=null;var aR=null;var am=null;var aK,aL,aD,aC,aA,ay;var ak,ai,av,au;var aB,az,aN;var aw=[];var aj=[];var al=ap.length/ah;var aS,ax,aF,aG,aE;var ar=[];var an=[];if(!isNaN(parseFloat(ao))){aI=parseFloat(ao)}else{aI=K(al,0.5)}if(!isNaN(parseFloat(aU))){aU=parseFloat(aU)}for(var aQ=0,aP=ap.length-1;aQ<aP;aQ++){if(aU===null){at=Math.abs((ap[aQ+1][1]-ap[aQ][1])/(ap[aQ+1][0]-ap[aQ][0]));aS=0.3;ax=0.6;aF=(ax-aS)/2;aG=2.5;aE=-1.4;am=at/aG+aE;aO=aF*A(am)-aF*A(aE)+aS;if(aQ>0){aR=Math.abs((ap[aQ][1]-ap[aQ-1][1])/(ap[aQ][0]-ap[aQ-1][0]))}am=aR/aG+aE;aM=aF*A(am)-aF*A(aE)+aS;aT=(aO+aM)/2}else{aT=aU}for(aK=0;aK<aI;aK++){aL=aK/aI;aD=(1+2*aL)*Math.pow((1-aL),2);aC=aL*Math.pow((1-aL),2);aA=Math.pow(aL,2)*(3-2*aL);ay=Math.pow(aL,2)*(aL-1);if(ap[aQ-1]){ak=aT*(ap[aQ+1][0]-ap[aQ-1][0]);ai=aT*(ap[aQ+1][1]-ap[aQ-1][1])}else{ak=aT*(ap[aQ+1][0]-ap[aQ][0]);ai=aT*(ap[aQ+1][1]-ap[aQ][1])}if(ap[aQ+2]){av=aT*(ap[aQ+2][0]-ap[aQ][0]);au=aT*(ap[aQ+2][1]-ap[aQ][1])}else{av=aT*(ap[aQ+1][0]-ap[aQ][0]);au=aT*(ap[aQ+1][1]-ap[aQ][1])}aB=aD*ap[aQ][0]+aA*ap[aQ+1][0]+aC*ak+ay*av;az=aD*ap[aQ][1]+aA*ap[aQ+1][1]+aC*ai+ay*au;aN=[aB,az];ar.push(aN);an.push([aH(aB),aq(az)])}}ar.push(ap[aP]);an.push([aH(ap[aP][0]),aq(ap[aP][1])]);return[ar,an]}L.jqplot.LineRenderer.prototype.setGridData=function(ap){var al=this._xaxis.series_u2p;var ah=this._yaxis.series_u2p;var am=this._plotData;var aq=this._prevPlotData;this.gridData=[];this._prevGridData=[];this.renderer._smoothedData=[];this.renderer._smoothedPlotData=[];this.renderer._hiBandGridData=[];this.renderer._lowBandGridData=[];this.renderer._hiBandSmoothedData=[];this.renderer._lowBandSmoothedData=[];var ak=this.renderer.bands;var ai=false;for(var an=0,aj=am.length;an<aj;an++){if(am[an][0]!=null&&am[an][1]!=null){this.gridData.push([al.call(this._xaxis,am[an][0]),ah.call(this._yaxis,am[an][1])])}else{if(am[an][0]==null){ai=true;this.gridData.push([null,ah.call(this._yaxis,am[an][1])])}else{if(am[an][1]==null){ai=true;this.gridData.push([al.call(this._xaxis,am[an][0]),null])}}}if(aq[an]!=null&&aq[an][0]!=null&&aq[an][1]!=null){this._prevGridData.push([al.call(this._xaxis,aq[an][0]),ah.call(this._yaxis,aq[an][1])])}else{if(aq[an]!=null&&aq[an][0]==null){this._prevGridData.push([null,ah.call(this._yaxis,aq[an][1])])}else{if(aq[an]!=null&&aq[an][0]!=null&&aq[an][1]==null){this._prevGridData.push([al.call(this._xaxis,aq[an][0]),null])}}}}if(ai){this.renderer.smooth=false;if(this._type==="line"){ak.show=false}}if(this._type==="line"&&ak.show){for(var an=0,aj=ak.hiData.length;an<aj;an++){this.renderer._hiBandGridData.push([al.call(this._xaxis,ak.hiData[an][0]),ah.call(this._yaxis,ak.hiData[an][1])])}for(var an=0,aj=ak.lowData.length;an<aj;an++){this.renderer._lowBandGridData.push([al.call(this._xaxis,ak.lowData[an][0]),ah.call(this._yaxis,ak.lowData[an][1])])}}if(this._type==="line"&&this.renderer.smooth&&this.gridData.length>2){var ao;if(this.renderer.constrainSmoothing){ao=J.call(this,this.gridData);this.renderer._smoothedData=ao[0];this.renderer._smoothedPlotData=ao[1];if(ak.show){ao=J.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ao[0];ao=J.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ao[0]}ao=null}else{ao=F.call(this,this.gridData);this.renderer._smoothedData=ao[0];this.renderer._smoothedPlotData=ao[1];if(ak.show){ao=F.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ao[0];ao=F.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ao[0]}ao=null}}};L.jqplot.LineRenderer.prototype.makeGridData=function(ao,aq){var am=this._xaxis.series_u2p;var ah=this._yaxis.series_u2p;var ar=[];var aj=[];this.renderer._smoothedData=[];this.renderer._smoothedPlotData=[];this.renderer._hiBandGridData=[];this.renderer._lowBandGridData=[];this.renderer._hiBandSmoothedData=[];this.renderer._lowBandSmoothedData=[];var al=this.renderer.bands;var ai=false;for(var an=0;an<ao.length;an++){if(ao[an][0]!=null&&ao[an][1]!=null){ar.push([am.call(this._xaxis,ao[an][0]),ah.call(this._yaxis,ao[an][1])])}else{if(ao[an][0]==null){ai=true;ar.push([null,ah.call(this._yaxis,ao[an][1])])}else{if(ao[an][1]==null){ai=true;ar.push([am.call(this._xaxis,ao[an][0]),null])}}}}if(ai){this.renderer.smooth=false;if(this._type==="line"){al.show=false}}if(this._type==="line"&&al.show){for(var an=0,ak=al.hiData.length;an<ak;an++){this.renderer._hiBandGridData.push([am.call(this._xaxis,al.hiData[an][0]),ah.call(this._yaxis,al.hiData[an][1])])}for(var an=0,ak=al.lowData.length;an<ak;an++){this.renderer._lowBandGridData.push([am.call(this._xaxis,al.lowData[an][0]),ah.call(this._yaxis,al.lowData[an][1])])}}if(this._type==="line"&&this.renderer.smooth&&ar.length>2){var ap;if(this.renderer.constrainSmoothing){ap=J.call(this,ar);this.renderer._smoothedData=ap[0];this.renderer._smoothedPlotData=ap[1];if(al.show){ap=J.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ap[0];ap=J.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ap[0]}ap=null}else{ap=F.call(this,ar);this.renderer._smoothedData=ap[0];this.renderer._smoothedPlotData=ap[1];if(al.show){ap=F.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ap[0];ap=F.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ap[0]}ap=null}}return ar};L.jqplot.LineRenderer.prototype.draw=function(ax,aI,ai,aB){var aC;var aq=L.extend(true,{},ai);var ak=(aq.shadow!=u)?aq.shadow:this.shadow;var aJ=(aq.showLine!=u)?aq.showLine:this.showLine;var aA=(aq.fill!=u)?aq.fill:this.fill;var ah=(aq.fillAndStroke!=u)?aq.fillAndStroke:this.fillAndStroke;var ar,ay,av,aE;ax.save();if(aI.length){if(aJ){if(aA){if(this.fillToZero){var aF=this.negativeColor;if(!this.useNegativeColors){aF=aq.fillStyle}var ao=false;var ap=aq.fillStyle;if(ah){var aH=aI.slice(0)}if(this.index==0||!this._stack){var aw=[];var aL=(this.renderer.smooth)?this.renderer._smoothedPlotData:this._plotData;this._areaPoints=[];var aG=this._yaxis.series_u2p(this.fillToValue);var aj=this._xaxis.series_u2p(this.fillToValue);aq.closePath=true;if(this.fillAxis=="y"){aw.push([aI[0][0],aG]);this._areaPoints.push([aI[0][0],aG]);for(var aC=0;aC<aI.length-1;aC++){aw.push(aI[aC]);this._areaPoints.push(aI[aC]);if(aL[aC][1]*aL[aC+1][1]<=0){if(aL[aC][1]<0){ao=true;aq.fillStyle=aF}else{ao=false;aq.fillStyle=ap}var an=aI[aC][0]+(aI[aC+1][0]-aI[aC][0])*(aG-aI[aC][1])/(aI[aC+1][1]-aI[aC][1]);aw.push([an,aG]);this._areaPoints.push([an,aG]);if(ak){this.renderer.shadowRenderer.draw(ax,aw,aq)}this.renderer.shapeRenderer.draw(ax,aw,aq);aw=[[an,aG]]}}if(aL[aI.length-1][1]<0){ao=true;aq.fillStyle=aF}else{ao=false;aq.fillStyle=ap}aw.push(aI[aI.length-1]);this._areaPoints.push(aI[aI.length-1]);aw.push([aI[aI.length-1][0],aG]);this._areaPoints.push([aI[aI.length-1][0],aG])}if(ak){this.renderer.shadowRenderer.draw(ax,aw,aq)}this.renderer.shapeRenderer.draw(ax,aw,aq)}else{var au=this._prevGridData;for(var aC=au.length;aC>0;aC--){aI.push(au[aC-1])}if(ak){this.renderer.shadowRenderer.draw(ax,aI,aq)}this._areaPoints=aI;this.renderer.shapeRenderer.draw(ax,aI,aq)}}else{if(ah){var aH=aI.slice(0)}if(this.index==0||!this._stack){var al=ax.canvas.height;aI.unshift([aI[0][0],al]);var aD=aI.length;aI.push([aI[aD-1][0],al])}else{var au=this._prevGridData;for(var aC=au.length;aC>0;aC--){aI.push(au[aC-1])}}this._areaPoints=aI;if(ak){this.renderer.shadowRenderer.draw(ax,aI,aq)}this.renderer.shapeRenderer.draw(ax,aI,aq)}if(ah){var az=L.extend(true,{},aq,{fill:false,closePath:false});this.renderer.shapeRenderer.draw(ax,aH,az);if(this.markerRenderer.show){if(this.renderer.smooth){aH=this.gridData}for(aC=0;aC<aH.length;aC++){this.markerRenderer.draw(aH[aC][0],aH[aC][1],ax,aq.markerOptions)}}}}else{if(this.renderer.bands.show){var am;var aK=L.extend(true,{},aq);if(this.renderer.bands.showLines){am=(this.renderer.smooth)?this.renderer._hiBandSmoothedData:this.renderer._hiBandGridData;this.renderer.shapeRenderer.draw(ax,am,aq);am=(this.renderer.smooth)?this.renderer._lowBandSmoothedData:this.renderer._lowBandGridData;this.renderer.shapeRenderer.draw(ax,am,aK)}if(this.renderer.bands.fill){if(this.renderer.smooth){am=this.renderer._hiBandSmoothedData.concat(this.renderer._lowBandSmoothedData.reverse())}else{am=this.renderer._hiBandGridData.concat(this.renderer._lowBandGridData.reverse())}this._areaPoints=am;aK.closePath=true;aK.fill=true;aK.fillStyle=this.renderer.bands.fillColor;this.renderer.shapeRenderer.draw(ax,am,aK)}}if(ak){this.renderer.shadowRenderer.draw(ax,aI,aq)}this.renderer.shapeRenderer.draw(ax,aI,aq)}}var ar=av=ay=aE=null;for(aC=0;aC<this._areaPoints.length;aC++){var at=this._areaPoints[aC];if(ar>at[0]||ar==null){ar=at[0]}if(aE<at[1]||aE==null){aE=at[1]}if(av<at[0]||av==null){av=at[0]}if(ay>at[1]||ay==null){ay=at[1]}}if(this.type==="line"&&this.renderer.bands.show){aE=this._yaxis.series_u2p(this.renderer.bands._min);ay=this._yaxis.series_u2p(this.renderer.bands._max)}this._boundingBox=[[ar,aE],[av,ay]];if(this.markerRenderer.show&&!aA){if(this.renderer.smooth){aI=this.gridData}for(aC=0;aC<aI.length;aC++){if(aI[aC][0]!=null&&aI[aC][1]!=null){this.markerRenderer.draw(aI[aC][0],aI[aC][1],ax,aq.markerOptions)}}}}ax.restore()};L.jqplot.LineRenderer.prototype.drawShadow=function(ah,aj,ai){};function z(ak,aj,ah){for(var ai=0;ai<this.series.length;ai++){if(this.series[ai].renderer.constructor==L.jqplot.LineRenderer){if(this.series[ai].highlightMouseOver){this.series[ai].highlightMouseDown=false}}}}function af(){if(this.plugins.lineRenderer&&this.plugins.lineRenderer.highlightCanvas){this.plugins.lineRenderer.highlightCanvas.resetCanvas();this.plugins.lineRenderer.highlightCanvas=null}this.plugins.lineRenderer.highlightedSeriesIndex=null;this.plugins.lineRenderer.highlightCanvas=new L.jqplot.GenericCanvas();this.eventCanvas._elem.before(this.plugins.lineRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-lineRenderer-highlight-canvas",this._plotDimensions,this));this.plugins.lineRenderer.highlightCanvas.setContext();this.eventCanvas._elem.bind("mouseleave",{plot:this},function(ah){aa(ah.data.plot)})}function ac(an,am,ak,aj){var ai=an.series[am];var ah=an.plugins.lineRenderer.highlightCanvas;ah._ctx.clearRect(0,0,ah._ctx.canvas.width,ah._ctx.canvas.height);ai._highlightedPoint=ak;an.plugins.lineRenderer.highlightedSeriesIndex=am;var al={fillStyle:ai.highlightColor};if(ai.type==="line"&&ai.renderer.bands.show){al.fill=true;al.closePath=true}ai.renderer.shapeRenderer.draw(ah._ctx,aj,al);ah=null}function aa(aj){var ah=aj.plugins.lineRenderer.highlightCanvas;ah._ctx.clearRect(0,0,ah._ctx.canvas.width,ah._ctx.canvas.height);for(var ai=0;ai<aj.series.length;ai++){aj.series[ai]._highlightedPoint=null}aj.plugins.lineRenderer.highlightedSeriesIndex=null;aj.target.trigger("jqplotDataUnhighlight");ah=null}function h(al,ak,ao,an,am){if(an){var aj=[an.seriesIndex,an.pointIndex,an.data];var ai=jQuery.Event("jqplotDataMouseOver");ai.pageX=al.pageX;ai.pageY=al.pageY;am.target.trigger(ai,aj);if(am.series[aj[0]].highlightMouseOver&&!(aj[0]==am.plugins.lineRenderer.highlightedSeriesIndex)){var ah=jQuery.Event("jqplotDataHighlight");ah.which=al.which;ah.pageX=al.pageX;ah.pageY=al.pageY;am.target.trigger(ah,aj);ac(am,an.seriesIndex,an.pointIndex,an.points)}}else{if(an==null){aa(am)}}}function e(ak,aj,an,am,al){if(am){var ai=[am.seriesIndex,am.pointIndex,am.data];if(al.series[ai[0]].highlightMouseDown&&!(ai[0]==al.plugins.lineRenderer.highlightedSeriesIndex)){var ah=jQuery.Event("jqplotDataHighlight");ah.which=ak.which;ah.pageX=ak.pageX;ah.pageY=ak.pageY;al.target.trigger(ah,ai);ac(al,am.seriesIndex,am.pointIndex,am.points)}}else{if(am==null){aa(al)}}}function ad(aj,ai,am,al,ak){var ah=ak.plugins.lineRenderer.highlightedSeriesIndex;if(ah!=null&&ak.series[ah].highlightMouseDown){aa(ak)}}function g(ak,aj,an,am,al){if(am){var ai=[am.seriesIndex,am.pointIndex,am.data];var ah=jQuery.Event("jqplotDataClick");ah.which=ak.which;ah.pageX=ak.pageX;ah.pageY=ak.pageY;al.target.trigger(ah,ai)}}function s(al,ak,ao,an,am){if(an){var aj=[an.seriesIndex,an.pointIndex,an.data];var ah=am.plugins.lineRenderer.highlightedSeriesIndex;if(ah!=null&&am.series[ah].highlightMouseDown){aa(am)}var ai=jQuery.Event("jqplotDataRightClick");ai.which=al.which;ai.pageX=al.pageX;ai.pageY=al.pageY;am.target.trigger(ai,aj)}}L.jqplot.LinearAxisRenderer=function(){};L.jqplot.LinearAxisRenderer.prototype.init=function(ah){this.breakPoints=null;this.breakTickLabel="≈";this.drawBaseline=true;this.baselineWidth=null;this.baselineColor=null;this.forceTickAt0=false;this.forceTickAt100=false;this.tickInset=0;this.minorTicks=0;this.alignTicks=false;this._autoFormatString="";this._overrideFormatString=false;this._scalefact=1;L.extend(true,this,ah);if(this.breakPoints){if(!L.isArray(this.breakPoints)){this.breakPoints=null}else{if(this.breakPoints.length<2||this.breakPoints[1]<=this.breakPoints[0]){this.breakPoints=null}}}if(this.numberTicks!=null&&this.numberTicks<2){this.numberTicks=2}this.resetDataBounds()};L.jqplot.LinearAxisRenderer.prototype.draw=function(ah,ao){if(this.show){this.renderer.createTicks.call(this,ao);var an=0;var ai;if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=L(document.createElement("div"));this._elem.addClass("jqplot-axis jqplot-"+this.name);this._elem.css("position","absolute");if(this.name=="xaxis"||this.name=="x2axis"){this._elem.width(this._plotDimensions.width)}else{this._elem.height(this._plotDimensions.height)}this.labelOptions.axis=this.name;this._label=new this.labelRenderer(this.labelOptions);if(this._label.show){var am=this._label.draw(ah,ao);am.appendTo(this._elem);am=null}var al=this._ticks;var ak;for(var aj=0;aj<al.length;aj++){ak=al[aj];if(ak.show&&ak.showLabel&&(!ak.isMinorTick||this.showMinorTicks)){this._elem.append(ak.draw(ah,ao))}}ak=null;al=null}return this._elem};L.jqplot.LinearAxisRenderer.prototype.reset=function(){this.min=this._options.min;this.max=this._options.max;this.tickInterval=this._options.tickInterval;this.numberTicks=this._options.numberTicks;this._autoFormatString="";if(this._overrideFormatString&&this.tickOptions&&this.tickOptions.formatString){this.tickOptions.formatString=""}};L.jqplot.LinearAxisRenderer.prototype.set=function(){var ao=0;var aj;var ai=0;var an=0;var ah=(this._label==null)?false:this._label.show;if(this.show){var am=this._ticks;var al;for(var ak=0;ak<am.length;ak++){al=am[ak];if(!al._breakTick&&al.show&&al.showLabel&&(!al.isMinorTick||this.showMinorTicks)){if(this.name=="xaxis"||this.name=="x2axis"){aj=al._elem.outerHeight(true)}else{aj=al._elem.outerWidth(true)}if(aj>ao){ao=aj}}}al=null;am=null;if(ah){ai=this._label._elem.outerWidth(true);an=this._label._elem.outerHeight(true)}if(this.name=="xaxis"){ao=ao+an;this._elem.css({height:ao+"px",left:"0px",bottom:"0px"})}else{if(this.name=="x2axis"){ao=ao+an;this._elem.css({height:ao+"px",left:"0px",top:"0px"})}else{if(this.name=="yaxis"){ao=ao+ai;this._elem.css({width:ao+"px",left:"0px",top:"0px"});if(ah&&this._label.constructor==L.jqplot.AxisLabelRenderer){this._label._elem.css("width",ai+"px")}}else{ao=ao+ai;this._elem.css({width:ao+"px",right:"0px",top:"0px"});if(ah&&this._label.constructor==L.jqplot.AxisLabelRenderer){this._label._elem.css("width",ai+"px")}}}}}};L.jqplot.LinearAxisRenderer.prototype.createTicks=function(aj){var aT=this._ticks;var aK=this.ticks;var az=this.name;var aB=this._dataBounds;var ah=(this.name.charAt(0)==="x")?this._plotDimensions.width:this._plotDimensions.height;var an;var a6,aI;var ap,ao;var a4,a0;var aH=this.min;var a5=this.max;var aW=this.numberTicks;var ba=this.tickInterval;var am=30;this._scalefact=(Math.max(ah,am+1)-am)/300;if(aK.length){for(a0=0;a0<aK.length;a0++){var aO=aK[a0];var aU=new this.tickRenderer(this.tickOptions);if(L.isArray(aO)){aU.value=aO[0];if(this.breakPoints){if(aO[0]==this.breakPoints[0]){aU.label=this.breakTickLabel;aU._breakTick=true;aU.showGridline=false;aU.showMark=false}else{if(aO[0]>this.breakPoints[0]&&aO[0]<=this.breakPoints[1]){aU.show=false;aU.showGridline=false;aU.label=aO[1]}else{aU.label=aO[1]}}}else{aU.label=aO[1]}aU.setTick(aO[0],this.name);this._ticks.push(aU)}else{if(L.isPlainObject(aO)){L.extend(true,aU,aO);aU.axis=this.name;this._ticks.push(aU)}else{aU.value=aO;if(this.breakPoints){if(aO==this.breakPoints[0]){aU.label=this.breakTickLabel;aU._breakTick=true;aU.showGridline=false;aU.showMark=false}else{if(aO>this.breakPoints[0]&&aO<=this.breakPoints[1]){aU.show=false;aU.showGridline=false}}}aU.setTick(aO,this.name);this._ticks.push(aU)}}}this.numberTicks=aK.length;this.min=this._ticks[0].value;this.max=this._ticks[this.numberTicks-1].value;this.tickInterval=(this.max-this.min)/(this.numberTicks-1)}else{if(az=="xaxis"||az=="x2axis"){ah=this._plotDimensions.width}else{ah=this._plotDimensions.height}var ax=this.numberTicks;if(this.alignTicks){if(this.name==="x2axis"&&aj.axes.xaxis.show){ax=aj.axes.xaxis.numberTicks}else{if(this.name.charAt(0)==="y"&&this.name!=="yaxis"&&this.name!=="yMidAxis"&&aj.axes.yaxis.show){ax=aj.axes.yaxis.numberTicks}}}a6=((this.min!=null)?this.min:aB.min);aI=((this.max!=null)?this.max:aB.max);var av=aI-a6;var aS,ay;var at;if(this.tickOptions==null||!this.tickOptions.formatString){this._overrideFormatString=true}if(this.min==null||this.max==null&&this.tickInterval==null&&!this.autoscale){if(this.forceTickAt0){if(a6>0){a6=0}if(aI<0){aI=0}}if(this.forceTickAt100){if(a6>100){a6=100}if(aI<100){aI=100}}var aE=false,a1=false;if(this.min!=null){aE=true}else{if(this.max!=null){a1=true}}var aP=L.jqplot.LinearTickGenerator(a6,aI,this._scalefact,ax,aE,a1);var aw=(this.min!=null)?a6:a6+av*(this.padMin-1);var aQ=(this.max!=null)?aI:aI-av*(this.padMax-1);if(a6<aw||aI>aQ){aw=(this.min!=null)?a6:a6-av*(this.padMin-1);aQ=(this.max!=null)?aI:aI+av*(this.padMax-1);aP=L.jqplot.LinearTickGenerator(aw,aQ,this._scalefact,ax,aE,a1)}this.min=aP[0];this.max=aP[1];this.numberTicks=aP[2];this._autoFormatString=aP[3];this.tickInterval=aP[4]}else{if(a6==aI){var ai=0.05;if(a6>0){ai=Math.max(Math.log(a6)/Math.LN10,0.05)}a6-=ai;aI+=ai}if(this.autoscale&&this.min==null&&this.max==null){var ak,al,ar;var aC=false;var aN=false;var aA={min:null,max:null,average:null,stddev:null};for(var a0=0;a0<this._series.length;a0++){var aV=this._series[a0];var aD=(aV.fillAxis=="x")?aV._xaxis.name:aV._yaxis.name;if(this.name==aD){var aR=aV._plotValues[aV.fillAxis];var aG=aR[0];var a2=aR[0];for(var aZ=1;aZ<aR.length;aZ++){if(aR[aZ]<aG){aG=aR[aZ]}else{if(aR[aZ]>a2){a2=aR[aZ]}}}var au=(a2-aG)/a2;if(aV.renderer.constructor==L.jqplot.BarRenderer){if(aG>=0&&(aV.fillToZero||au>0.1)){aC=true}else{aC=false;if(aV.fill&&aV.fillToZero&&aG<0&&a2>0){aN=true}else{aN=false}}}else{if(aV.fill){if(aG>=0&&(aV.fillToZero||au>0.1)){aC=true}else{if(aG<0&&a2>0&&aV.fillToZero){aC=false;aN=true}else{aC=false;aN=false}}}else{if(aG<0){aC=false}}}}}if(aC){this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing);this.min=0;aH=0;al=aI/(this.numberTicks-1);at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)));if(al/at==parseInt(al/at,10)){al+=at}this.tickInterval=Math.ceil(al/at)*at;this.max=this.tickInterval*(this.numberTicks-1)}else{if(aN){this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing);var aJ=Math.ceil(Math.abs(a6)/av*(this.numberTicks-1));var a9=this.numberTicks-1-aJ;al=Math.max(Math.abs(a6/aJ),Math.abs(aI/a9));at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)));this.tickInterval=Math.ceil(al/at)*at;this.max=this.tickInterval*a9;this.min=-this.tickInterval*aJ}else{if(this.numberTicks==null){if(this.tickInterval){this.numberTicks=3+Math.ceil(av/this.tickInterval)}else{this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing)}}if(this.tickInterval==null){al=av/(this.numberTicks-1);if(al<1){at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)))}else{at=1}this.tickInterval=Math.ceil(al*at*this.pad)/at}else{at=1/this.tickInterval}ak=this.tickInterval*(this.numberTicks-1);ar=(ak-av)/2;if(this.min==null){this.min=Math.floor(at*(a6-ar))/at}if(this.max==null){this.max=this.min+ak}}}var aF=L.jqplot.getSignificantFigures(this.tickInterval);var aM;if(aF.digitsLeft>=aF.significantDigits){aM="%d"}else{var at=Math.max(0,5-aF.digitsLeft);at=Math.min(at,aF.digitsRight);aM="%."+at+"f"}this._autoFormatString=aM}else{aS=(this.min!=null)?this.min:a6-av*(this.padMin-1);ay=(this.max!=null)?this.max:aI+av*(this.padMax-1);av=ay-aS;if(this.numberTicks==null){if(this.tickInterval!=null){this.numberTicks=Math.ceil((ay-aS)/this.tickInterval)+1}else{if(ah>100){this.numberTicks=parseInt(3+(ah-100)/75,10)}else{this.numberTicks=2}}}if(this.tickInterval==null){this.tickInterval=av/(this.numberTicks-1)}if(this.max==null){ay=aS+this.tickInterval*(this.numberTicks-1)}if(this.min==null){aS=ay-this.tickInterval*(this.numberTicks-1)}var aF=L.jqplot.getSignificantFigures(this.tickInterval);var aM;if(aF.digitsLeft>=aF.significantDigits){aM="%d"}else{var at=Math.max(0,5-aF.digitsLeft);at=Math.min(at,aF.digitsRight);aM="%."+at+"f"}this._autoFormatString=aM;this.min=aS;this.max=ay}if(this.renderer.constructor==L.jqplot.LinearAxisRenderer&&this._autoFormatString==""){av=this.max-this.min;var a7=new this.tickRenderer(this.tickOptions);var aL=a7.formatString||L.jqplot.config.defaultTickFormatString;var aL=aL.match(L.jqplot.sprintf.regex)[0];var a3=0;if(aL){if(aL.search(/[fFeEgGpP]/)>-1){var aY=aL.match(/\%\.(\d{0,})?[eEfFgGpP]/);if(aY){a3=parseInt(aY[1],10)}else{a3=6}}else{if(aL.search(/[di]/)>-1){a3=0}}var aq=Math.pow(10,-a3);if(this.tickInterval<aq){if(aW==null&&ba==null){this.tickInterval=aq;if(a5==null&&aH==null){this.min=Math.floor(this._dataBounds.min/aq)*aq;if(this.min==this._dataBounds.min){this.min=this._dataBounds.min-this.tickInterval}this.max=Math.ceil(this._dataBounds.max/aq)*aq;if(this.max==this._dataBounds.max){this.max=this._dataBounds.max+this.tickInterval}var aX=(this.max-this.min)/this.tickInterval;aX=aX.toFixed(11);aX=Math.ceil(aX);this.numberTicks=aX+1}else{if(a5==null){var aX=(this._dataBounds.max-this.min)/this.tickInterval;aX=aX.toFixed(11);this.numberTicks=Math.ceil(aX)+2;this.max=this.min+this.tickInterval*(this.numberTicks-1)}else{if(aH==null){var aX=(this.max-this._dataBounds.min)/this.tickInterval;aX=aX.toFixed(11);this.numberTicks=Math.ceil(aX)+2;this.min=this.max-this.tickInterval*(this.numberTicks-1)}else{this.numberTicks=Math.ceil((a5-aH)/this.tickInterval)+1;this.min=Math.floor(aH*Math.pow(10,a3))/Math.pow(10,a3);this.max=Math.ceil(a5*Math.pow(10,a3))/Math.pow(10,a3);this.numberTicks=Math.ceil((this.max-this.min)/this.tickInterval)+1}}}}}}}}if(this._overrideFormatString&&this._autoFormatString!=""){this.tickOptions=this.tickOptions||{};this.tickOptions.formatString=this._autoFormatString}var aU,a8;for(var a0=0;a0<this.numberTicks;a0++){a4=this.min+a0*this.tickInterval;aU=new this.tickRenderer(this.tickOptions);aU.setTick(a4,this.name);this._ticks.push(aU);if(a0<this.numberTicks-1){for(var aZ=0;aZ<this.minorTicks;aZ++){a4+=this.tickInterval/(this.minorTicks+1);a8=L.extend(true,{},this.tickOptions,{name:this.name,value:a4,label:"",isMinorTick:true});aU=new this.tickRenderer(a8);this._ticks.push(aU)}}aU=null}}if(this.tickInset){this.min=this.min-this.tickInset*this.tickInterval;this.max=this.max+this.tickInset*this.tickInterval}aT=null};L.jqplot.LinearAxisRenderer.prototype.resetTickValues=function(aj){if(L.isArray(aj)&&aj.length==this._ticks.length){var ai;for(var ah=0;ah<aj.length;ah++){ai=this._ticks[ah];ai.value=aj[ah];ai.label=ai.formatter(ai.formatString,aj[ah]);ai.label=ai.prefix+ai.label;ai._elem.html(ai.label)}ai=null;this.min=L.jqplot.arrayMin(aj);this.max=L.jqplot.arrayMax(aj);this.pack()}};L.jqplot.LinearAxisRenderer.prototype.pack=function(aj,ai){aj=aj||{};ai=ai||this._offsets;var ay=this._ticks;var au=this.max;var at=this.min;var ao=ai.max;var am=ai.min;var aq=(this._label==null)?false:this._label.show;for(var ar in aj){this._elem.css(ar,aj[ar])}this._offsets=ai;var ak=ao-am;var al=au-at;if(this.breakPoints){al=al-this.breakPoints[1]+this.breakPoints[0];this.p2u=function(aA){return(aA-am)*al/ak+at};this.u2p=function(aA){if(aA>this.breakPoints[0]&&aA<this.breakPoints[1]){aA=this.breakPoints[0]}if(aA<=this.breakPoints[0]){return(aA-at)*ak/al+am}else{return(aA-this.breakPoints[1]+this.breakPoints[0]-at)*ak/al+am}};if(this.name.charAt(0)=="x"){this.series_u2p=function(aA){if(aA>this.breakPoints[0]&&aA<this.breakPoints[1]){aA=this.breakPoints[0]}if(aA<=this.breakPoints[0]){return(aA-at)*ak/al}else{return(aA-this.breakPoints[1]+this.breakPoints[0]-at)*ak/al}};this.series_p2u=function(aA){return aA*al/ak+at}}else{this.series_u2p=function(aA){if(aA>this.breakPoints[0]&&aA<this.breakPoints[1]){aA=this.breakPoints[0]}if(aA>=this.breakPoints[1]){return(aA-au)*ak/al}else{return(aA+this.breakPoints[1]-this.breakPoints[0]-au)*ak/al}};this.series_p2u=function(aA){return aA*al/ak+au}}}else{this.p2u=function(aA){return(aA-am)*al/ak+at};this.u2p=function(aA){return(aA-at)*ak/al+am};if(this.name=="xaxis"||this.name=="x2axis"){this.series_u2p=function(aA){return(aA-at)*ak/al};this.series_p2u=function(aA){return aA*al/ak+at}}else{this.series_u2p=function(aA){return(aA-au)*ak/al};this.series_p2u=function(aA){return aA*al/ak+au}}}if(this.show){if(this.name=="xaxis"||this.name=="x2axis"){for(var av=0;av<ay.length;av++){var ap=ay[av];if(ap.show&&ap.showLabel){var ah;if(ap.constructor==L.jqplot.CanvasAxisTickRenderer&&ap.angle){var ax=(this.name=="xaxis")?1:-1;switch(ap.labelPosition){case"auto":if(ax*ap.angle<0){ah=-ap.getWidth()+ap._textRenderer.height*Math.sin(-ap._textRenderer.angle)/2}else{ah=-ap._textRenderer.height*Math.sin(ap._textRenderer.angle)/2}break;case"end":ah=-ap.getWidth()+ap._textRenderer.height*Math.sin(-ap._textRenderer.angle)/2;break;case"start":ah=-ap._textRenderer.height*Math.sin(ap._textRenderer.angle)/2;break;case"middle":ah=-ap.getWidth()/2+ap._textRenderer.height*Math.sin(-ap._textRenderer.angle)/2;break;default:ah=-ap.getWidth()/2+ap._textRenderer.height*Math.sin(-ap._textRenderer.angle)/2;break}}else{ah=-ap.getWidth()/2}var az=this.u2p(ap.value)+ah+"px";ap._elem.css("left",az);ap.pack()}}if(aq){var an=this._label._elem.outerWidth(true);this._label._elem.css("left",am+ak/2-an/2+"px");if(this.name=="xaxis"){this._label._elem.css("bottom","0px")}else{this._label._elem.css("top","0px")}this._label.pack()}}else{for(var av=0;av<ay.length;av++){var ap=ay[av];if(ap.show&&ap.showLabel){var ah;if(ap.constructor==L.jqplot.CanvasAxisTickRenderer&&ap.angle){var ax=(this.name=="yaxis")?1:-1;switch(ap.labelPosition){case"auto":case"end":if(ax*ap.angle<0){ah=-ap._textRenderer.height*Math.cos(-ap._textRenderer.angle)/2}else{ah=-ap.getHeight()+ap._textRenderer.height*Math.cos(ap._textRenderer.angle)/2}break;case"start":if(ap.angle>0){ah=-ap._textRenderer.height*Math.cos(-ap._textRenderer.angle)/2}else{ah=-ap.getHeight()+ap._textRenderer.height*Math.cos(ap._textRenderer.angle)/2}break;case"middle":ah=-ap.getHeight()/2;break;default:ah=-ap.getHeight()/2;break}}else{ah=-ap.getHeight()/2}var az=this.u2p(ap.value)+ah+"px";ap._elem.css("top",az);ap.pack()}}if(aq){var aw=this._label._elem.outerHeight(true);this._label._elem.css("top",ao-ak/2-aw/2+"px");if(this.name=="yaxis"){this._label._elem.css("left","0px")}else{this._label._elem.css("right","0px")}this._label.pack()}}}ay=null};function i(ai){var ah;ai=Math.abs(ai);if(ai>=10){ah="%d"}else{if(ai>1){if(ai===parseInt(ai,10)){ah="%d"}else{ah="%.1f"}}else{var aj=-Math.floor(Math.log(ai)/Math.LN10);ah="%."+aj+"f"}}return ah}var b=[0.1,0.2,0.3,0.4,0.5,0.8,1,2,3,4,5];var c=function(ai){var ah=b.indexOf(ai);if(ah>0){return b[ah-1]}else{return b[b.length-1]/100}};var k=function(ai){var ah=b.indexOf(ai);if(ah<b.length-1){return b[ah+1]}else{return b[0]*100}};function d(al,au,at){var aq=Math.floor(at/2);var ai=Math.ceil(at*1.5);var ak=Number.MAX_VALUE;var ah=(au-al);var ax;var ap;var ar;var ay=L.jqplot.getSignificantFigures;var aw;var an;var ao;var av;for(var am=0,aj=ai-aq+1;am<aj;am++){ao=aq+am;ax=ah/(ao-1);ap=ay(ax);ax=Math.abs(at-ao)+ap.digitsRight;if(ax<ak){ak=ax;ar=ao;av=ap.digitsRight}else{if(ax===ak){if(ap.digitsRight<av){ar=ao;av=ap.digitsRight}}}}aw=Math.max(av,Math.max(ay(al).digitsRight,ay(au).digitsRight));if(aw===0){an="%d"}else{an="%."+aw+"f"}ax=ah/(ar-1);return[al,au,ar,an,ax]}function W(ai,al){al=al||7;var ak=ai/(al-1);var aj=Math.pow(10,Math.floor(Math.log(ak)/Math.LN10));var am=ak/aj;var ah;if(aj<1){if(am>5){ah=10*aj}else{if(am>2){ah=5*aj}else{if(am>1){ah=2*aj}else{ah=aj}}}}else{if(am>5){ah=10*aj}else{if(am>4){ah=5*aj}else{if(am>3){ah=4*aj}else{if(am>2){ah=3*aj}else{if(am>1){ah=2*aj}else{ah=aj}}}}}}return ah}function Q(ai,ah){ah=ah||1;var ak=Math.floor(Math.log(ai)/Math.LN10);var am=Math.pow(10,ak);var al=ai/am;var aj;al=al/ah;if(al<=0.38){aj=0.1}else{if(al<=1.6){aj=0.2}else{if(al<=4){aj=0.5}else{if(al<=8){aj=1}else{if(al<=16){aj=2}else{aj=5}}}}}return aj*am}function x(aj,ai){var al=Math.floor(Math.log(aj)/Math.LN10);var an=Math.pow(10,al);var am=aj/an;var ah;var ak;am=am/ai;if(am<=0.38){ak=0.1}else{if(am<=1.6){ak=0.2}else{if(am<=4){ak=0.5}else{if(am<=8){ak=1}else{if(am<=16){ak=2}else{ak=5}}}}}ah=ak*an;return[ah,ak,an]}L.jqplot.LinearTickGenerator=function(an,aq,aj,ak,ao,ar){ao=(ao===null)?false:ao;ar=(ar===null||ao)?false:ar;if(an===aq){aq=(aq)?0:1}aj=aj||1;if(aq<an){var at=aq;aq=an;an=at}var ai=[];var aw=Q(aq-an,aj);var av=L.jqplot.getSignificantFigures;if(ak==null){if(!ao&&!ar){ai[0]=Math.floor(an/aw)*aw;ai[1]=Math.ceil(aq/aw)*aw;ai[2]=Math.round((ai[1]-ai[0])/aw+1);ai[3]=i(aw);ai[4]=aw}else{if(ao){ai[0]=an;ai[2]=Math.ceil((aq-an)/aw+1);ai[1]=an+(ai[2]-1)*aw;var au=av(an).digitsRight;var ap=av(aw).digitsRight;if(au<ap){ai[3]=i(aw)}else{ai[3]="%."+au+"f"}ai[4]=aw}else{if(ar){ai[1]=aq;ai[2]=Math.ceil((aq-an)/aw+1);ai[0]=aq-(ai[2]-1)*aw;var al=av(aq).digitsRight;var ap=av(aw).digitsRight;if(al<ap){ai[3]=i(aw)}else{ai[3]="%."+al+"f"}ai[4]=aw}}}}else{var am=[];am[0]=Math.floor(an/aw)*aw;am[1]=Math.ceil(aq/aw)*aw;am[2]=Math.round((am[1]-am[0])/aw+1);am[3]=i(aw);am[4]=aw;if(am[2]===ak){ai=am}else{var ah=W(am[1]-am[0],ak);ai[0]=am[0];ai[2]=ak;ai[4]=ah;ai[3]=i(ah);ai[1]=ai[0]+(ai[2]-1)*ai[4]}}return ai};L.jqplot.LinearTickGenerator.bestLinearInterval=Q;L.jqplot.LinearTickGenerator.bestInterval=W;L.jqplot.LinearTickGenerator.bestLinearComponents=x;L.jqplot.LinearTickGenerator.bestConstrainedInterval=d;L.jqplot.MarkerRenderer=function(ah){this.show=true;this.style="filledCircle";this.lineWidth=2;this.size=9;this.color="#666666";this.shadow=true;this.shadowAngle=45;this.shadowOffset=1;this.shadowDepth=3;this.shadowAlpha="0.07";this.shadowRenderer=new L.jqplot.ShadowRenderer();this.shapeRenderer=new L.jqplot.ShapeRenderer();L.extend(true,this,ah)};L.jqplot.MarkerRenderer.prototype.init=function(ah){L.extend(true,this,ah);var aj={angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,lineWidth:this.lineWidth,depth:this.shadowDepth,closePath:true};if(this.style.indexOf("filled")!=-1){aj.fill=true}if(this.style.indexOf("ircle")!=-1){aj.isarc=true;aj.closePath=false}this.shadowRenderer.init(aj);var ai={fill:false,isarc:false,strokeStyle:this.color,fillStyle:this.color,lineWidth:this.lineWidth,closePath:true};if(this.style.indexOf("filled")!=-1){ai.fill=true}if(this.style.indexOf("ircle")!=-1){ai.isarc=true;ai.closePath=false}this.shapeRenderer.init(ai)};L.jqplot.MarkerRenderer.prototype.drawDiamond=function(aj,ai,am,al,ao){var ah=1.2;var ap=this.size/2/ah;var an=this.size/2*ah;var ak=[[aj-ap,ai],[aj,ai+an],[aj+ap,ai],[aj,ai-an]];if(this.shadow){this.shadowRenderer.draw(am,ak)}this.shapeRenderer.draw(am,ak,ao)};L.jqplot.MarkerRenderer.prototype.drawPlus=function(ak,aj,an,am,aq){var ai=1;var ar=this.size/2*ai;var ao=this.size/2*ai;var ap=[[ak,aj-ao],[ak,aj+ao]];var al=[[ak+ar,aj],[ak-ar,aj]];var ah=L.extend(true,{},this.options,{closePath:false});if(this.shadow){this.shadowRenderer.draw(an,ap,{closePath:false});this.shadowRenderer.draw(an,al,{closePath:false})}this.shapeRenderer.draw(an,ap,ah);this.shapeRenderer.draw(an,al,ah)};L.jqplot.MarkerRenderer.prototype.drawX=function(ak,aj,an,am,aq){var ai=1;var ar=this.size/2*ai;var ao=this.size/2*ai;var ah=L.extend(true,{},this.options,{closePath:false});var ap=[[ak-ar,aj-ao],[ak+ar,aj+ao]];var al=[[ak-ar,aj+ao],[ak+ar,aj-ao]];if(this.shadow){this.shadowRenderer.draw(an,ap,{closePath:false});this.shadowRenderer.draw(an,al,{closePath:false})}this.shapeRenderer.draw(an,ap,ah);this.shapeRenderer.draw(an,al,ah)};L.jqplot.MarkerRenderer.prototype.drawDash=function(aj,ai,am,al,ao){var ah=1;var ap=this.size/2*ah;var an=this.size/2*ah;var ak=[[aj-ap,ai],[aj+ap,ai]];if(this.shadow){this.shadowRenderer.draw(am,ak)}this.shapeRenderer.draw(am,ak,ao)};L.jqplot.MarkerRenderer.prototype.drawLine=function(am,al,ah,ak,ai){var aj=[am,al];if(this.shadow){this.shadowRenderer.draw(ah,aj)}this.shapeRenderer.draw(ah,aj,ai)};L.jqplot.MarkerRenderer.prototype.drawSquare=function(aj,ai,am,al,ao){var ah=1;var ap=this.size/2/ah;var an=this.size/2*ah;var ak=[[aj-ap,ai-an],[aj-ap,ai+an],[aj+ap,ai+an],[aj+ap,ai-an]];if(this.shadow){this.shadowRenderer.draw(am,ak)}this.shapeRenderer.draw(am,ak,ao)};L.jqplot.MarkerRenderer.prototype.drawCircle=function(ai,ao,ak,an,al){var ah=this.size/2;var aj=2*Math.PI;var am=[ai,ao,ah,0,aj,true];if(this.shadow){this.shadowRenderer.draw(ak,am)}this.shapeRenderer.draw(ak,am,al)};L.jqplot.MarkerRenderer.prototype.draw=function(ah,ak,ai,aj){aj=aj||{};if(aj.show==null||aj.show!=false){if(aj.color&&!aj.fillStyle){aj.fillStyle=aj.color}if(aj.color&&!aj.strokeStyle){aj.strokeStyle=aj.color}switch(this.style){case"diamond":this.drawDiamond(ah,ak,ai,false,aj);break;case"filledDiamond":this.drawDiamond(ah,ak,ai,true,aj);break;case"circle":this.drawCircle(ah,ak,ai,false,aj);break;case"filledCircle":this.drawCircle(ah,ak,ai,true,aj);break;case"square":this.drawSquare(ah,ak,ai,false,aj);break;case"filledSquare":this.drawSquare(ah,ak,ai,true,aj);break;case"x":this.drawX(ah,ak,ai,true,aj);break;case"plus":this.drawPlus(ah,ak,ai,true,aj);break;case"dash":this.drawDash(ah,ak,ai,true,aj);break;case"line":this.drawLine(ah,ak,ai,false,aj);break;default:this.drawDiamond(ah,ak,ai,false,aj);break}}};L.jqplot.ShadowRenderer=function(ah){this.angle=45;this.offset=1;this.alpha=0.07;this.lineWidth=1.5;this.lineJoin="miter";this.lineCap="round";this.closePath=false;this.fill=false;this.depth=3;this.strokeStyle="rgba(0,0,0,0.1)";this.isarc=false;L.extend(true,this,ah)};L.jqplot.ShadowRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.ShadowRenderer.prototype.draw=function(av,at,ax){av.save();var ah=(ax!=null)?ax:{};var au=(ah.fill!=null)?ah.fill:this.fill;var ap=(ah.fillRect!=null)?ah.fillRect:this.fillRect;var ao=(ah.closePath!=null)?ah.closePath:this.closePath;var al=(ah.offset!=null)?ah.offset:this.offset;var aj=(ah.alpha!=null)?ah.alpha:this.alpha;var an=(ah.depth!=null)?ah.depth:this.depth;var aw=(ah.isarc!=null)?ah.isarc:this.isarc;var aq=(ah.linePattern!=null)?ah.linePattern:this.linePattern;av.lineWidth=(ah.lineWidth!=null)?ah.lineWidth:this.lineWidth;av.lineJoin=(ah.lineJoin!=null)?ah.lineJoin:this.lineJoin;av.lineCap=(ah.lineCap!=null)?ah.lineCap:this.lineCap;av.strokeStyle=ah.strokeStyle||this.strokeStyle||"rgba(0,0,0,"+aj+")";av.fillStyle=ah.fillStyle||this.fillStyle||"rgba(0,0,0,"+aj+")";for(var ak=0;ak<an;ak++){var ar=L.jqplot.LinePattern(av,aq);av.translate(Math.cos(this.angle*Math.PI/180)*al,Math.sin(this.angle*Math.PI/180)*al);ar.beginPath();if(aw){av.arc(at[0],at[1],at[2],at[3],at[4],true)}else{if(ap){if(ap){av.fillRect(at[0],at[1],at[2],at[3])}}else{if(at&&at.length){var ai=true;for(var am=0;am<at.length;am++){if(at[am][0]!=null&&at[am][1]!=null){if(ai){ar.moveTo(at[am][0],at[am][1]);ai=false}else{ar.lineTo(at[am][0],at[am][1])}}else{ai=true}}}}}if(ao){ar.closePath()}if(au){av.fill()}else{av.stroke()}}av.restore()};L.jqplot.ShapeRenderer=function(ah){this.lineWidth=1.5;this.linePattern="solid";this.lineJoin="miter";this.lineCap="round";this.closePath=false;this.fill=false;this.isarc=false;this.fillRect=false;this.strokeRect=false;this.clearRect=false;this.strokeStyle="#999999";this.fillStyle="#999999";L.extend(true,this,ah)};L.jqplot.ShapeRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.ShapeRenderer.prototype.draw=function(at,aq,av){at.save();var ah=(av!=null)?av:{};var ar=(ah.fill!=null)?ah.fill:this.fill;var am=(ah.closePath!=null)?ah.closePath:this.closePath;var an=(ah.fillRect!=null)?ah.fillRect:this.fillRect;var ak=(ah.strokeRect!=null)?ah.strokeRect:this.strokeRect;var ai=(ah.clearRect!=null)?ah.clearRect:this.clearRect;var au=(ah.isarc!=null)?ah.isarc:this.isarc;var ao=(ah.linePattern!=null)?ah.linePattern:this.linePattern;var ap=L.jqplot.LinePattern(at,ao);at.lineWidth=ah.lineWidth||this.lineWidth;at.lineJoin=ah.lineJoin||this.lineJoin;at.lineCap=ah.lineCap||this.lineCap;at.strokeStyle=(ah.strokeStyle||ah.color)||this.strokeStyle;at.fillStyle=ah.fillStyle||this.fillStyle;at.beginPath();if(au){at.arc(aq[0],aq[1],aq[2],aq[3],aq[4],true);if(am){at.closePath()}if(ar){at.fill()}else{at.stroke()}at.restore();return}else{if(ai){at.clearRect(aq[0],aq[1],aq[2],aq[3]);at.restore();return}else{if(an||ak){if(an){at.fillRect(aq[0],aq[1],aq[2],aq[3])}if(ak){at.strokeRect(aq[0],aq[1],aq[2],aq[3]);at.restore();return}}else{if(aq&&aq.length){var aj=true;for(var al=0;al<aq.length;al++){if(aq[al][0]!=null&&aq[al][1]!=null){if(aj){ap.moveTo(aq[al][0],aq[al][1]);aj=false}else{ap.lineTo(aq[al][0],aq[al][1])}}else{aj=true}}if(am){ap.closePath()}if(ar){at.fill()}else{at.stroke()}}}}}at.restore()};L.jqplot.TableLegendRenderer=function(){};L.jqplot.TableLegendRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.TableLegendRenderer.prototype.addrow=function(aq,ak,ah,ao){var al=(ah)?this.rowSpacing+"px":"0px";var ap;var aj;var ai;var an;var am;ai=document.createElement("tr");ap=L(ai);ap.addClass("jqplot-table-legend");ai=null;if(ao){ap.prependTo(this._elem)}else{ap.appendTo(this._elem)}if(this.showSwatches){aj=L(document.createElement("td"));aj.addClass("jqplot-table-legend jqplot-table-legend-swatch");aj.css({textAlign:"center",paddingTop:al});an=L(document.createElement("div"));an.addClass("jqplot-table-legend-swatch-outline");am=L(document.createElement("div"));am.addClass("jqplot-table-legend-swatch");am.css({backgroundColor:ak,borderColor:ak});ap.append(aj.append(an.append(am)))}if(this.showLabels){aj=L(document.createElement("td"));aj.addClass("jqplot-table-legend jqplot-table-legend-label");aj.css("paddingTop",al);ap.append(aj);if(this.escapeHtml){aj.text(aq)}else{aj.html(aq)}}aj=null;an=null;am=null;ap=null;ai=null};L.jqplot.TableLegendRenderer.prototype.draw=function(){if(this._elem){this._elem.emptyForce();this._elem=null}if(this.show){var am=this._series;var ai=document.createElement("table");this._elem=L(ai);this._elem.addClass("jqplot-table-legend");var ar={position:"absolute"};if(this.background){ar.background=this.background}if(this.border){ar.border=this.border}if(this.fontSize){ar.fontSize=this.fontSize}if(this.fontFamily){ar.fontFamily=this.fontFamily}if(this.textColor){ar.textColor=this.textColor}if(this.marginTop!=null){ar.marginTop=this.marginTop}if(this.marginBottom!=null){ar.marginBottom=this.marginBottom}if(this.marginLeft!=null){ar.marginLeft=this.marginLeft}if(this.marginRight!=null){ar.marginRight=this.marginRight}var ah=false,ao=false,aq;for(var an=0;an<am.length;an++){aq=am[an];if(aq._stack||aq.renderer.constructor==L.jqplot.BezierCurveRenderer){ao=true}if(aq.show&&aq.showLabel){var al=this.labels[an]||aq.label.toString();if(al){var aj=aq.color;if(ao&&an<am.length-1){ah=true}else{if(ao&&an==am.length-1){ah=false}}this.renderer.addrow.call(this,al,aj,ah,ao);ah=true}for(var ak=0;ak<L.jqplot.addLegendRowHooks.length;ak++){var ap=L.jqplot.addLegendRowHooks[ak].call(this,aq);if(ap){this.renderer.addrow.call(this,ap.label,ap.color,ah);ah=true}}al=null}}}return this._elem};L.jqplot.TableLegendRenderer.prototype.pack=function(aj){if(this.show){if(this.placement=="insideGrid"){switch(this.location){case"nw":var ai=aj.left;var ah=aj.top;this._elem.css("left",ai);this._elem.css("top",ah);break;case"n":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;var ah=aj.top;this._elem.css("left",ai);this._elem.css("top",ah);break;case"ne":var ai=aj.right;var ah=aj.top;this._elem.css({right:ai,top:ah});break;case"e":var ai=aj.right;var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({right:ai,top:ah});break;case"se":var ai=aj.right;var ah=aj.bottom;this._elem.css({right:ai,bottom:ah});break;case"s":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;var ah=aj.bottom;this._elem.css({left:ai,bottom:ah});break;case"sw":var ai=aj.left;var ah=aj.bottom;this._elem.css({left:ai,bottom:ah});break;case"w":var ai=aj.left;var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({left:ai,top:ah});break;default:var ai=aj.right;var ah=aj.bottom;this._elem.css({right:ai,bottom:ah});break}}else{if(this.placement=="outside"){switch(this.location){case"nw":var ai=this._plotDimensions.width-aj.left;var ah=aj.top;this._elem.css("right",ai);this._elem.css("top",ah);break;case"n":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;var ah=this._plotDimensions.height-aj.top;this._elem.css("left",ai);this._elem.css("bottom",ah);break;case"ne":var ai=this._plotDimensions.width-aj.right;var ah=aj.top;this._elem.css({left:ai,top:ah});break;case"e":var ai=this._plotDimensions.width-aj.right;var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({left:ai,top:ah});break;case"se":var ai=this._plotDimensions.width-aj.right;var ah=aj.bottom;this._elem.css({left:ai,bottom:ah});break;case"s":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;var ah=this._plotDimensions.height-aj.bottom;this._elem.css({left:ai,top:ah});break;case"sw":var ai=this._plotDimensions.width-aj.left;var ah=aj.bottom;this._elem.css({right:ai,bottom:ah});break;case"w":var ai=this._plotDimensions.width-aj.left;var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({right:ai,top:ah});break;default:var ai=aj.right;var ah=aj.bottom;this._elem.css({right:ai,bottom:ah});break}}else{switch(this.location){case"nw":this._elem.css({left:0,top:aj.top});break;case"n":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;this._elem.css({left:ai,top:aj.top});break;case"ne":this._elem.css({right:0,top:aj.top});break;case"e":var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({right:aj.right,top:ah});break;case"se":this._elem.css({right:aj.right,bottom:aj.bottom});break;case"s":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;this._elem.css({left:ai,bottom:aj.bottom});break;case"sw":this._elem.css({left:aj.left,bottom:aj.bottom});break;case"w":var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({left:aj.left,top:ah});break;default:this._elem.css({right:aj.right,bottom:aj.bottom});break}}}}};L.jqplot.ThemeEngine=function(){this.themes={};this.activeTheme=null};L.jqplot.ThemeEngine.prototype.init=function(){var ak=new L.jqplot.Theme({_name:"Default"});var an,ai,am;for(an in ak.target){if(an=="textColor"){ak.target[an]=this.target.css("color")}else{ak.target[an]=this.target.css(an)}}if(this.title.show&&this.title._elem){for(an in ak.title){if(an=="textColor"){ak.title[an]=this.title._elem.css("color")}else{ak.title[an]=this.title._elem.css(an)}}}for(an in ak.grid){ak.grid[an]=this.grid[an]}if(ak.grid.backgroundColor==null&&this.grid.background!=null){ak.grid.backgroundColor=this.grid.background}if(this.legend.show&&this.legend._elem){for(an in ak.legend){if(an=="textColor"){ak.legend[an]=this.legend._elem.css("color")}else{ak.legend[an]=this.legend._elem.css(an)}}}var aj;for(ai=0;ai<this.series.length;ai++){aj=this.series[ai];if(aj.renderer.constructor==L.jqplot.LineRenderer){ak.series.push(new p())}else{if(aj.renderer.constructor==L.jqplot.BarRenderer){ak.series.push(new T())}else{if(aj.renderer.constructor==L.jqplot.PieRenderer){ak.series.push(new f())}else{if(aj.renderer.constructor==L.jqplot.DonutRenderer){ak.series.push(new G())}else{if(aj.renderer.constructor==L.jqplot.FunnelRenderer){ak.series.push(new Z())}else{if(aj.renderer.constructor==L.jqplot.MeterGaugeRenderer){ak.series.push(new D())}else{ak.series.push({})}}}}}}for(an in ak.series[ai]){ak.series[ai][an]=aj[an]}}var ah,al;for(an in this.axes){al=this.axes[an];ah=ak.axes[an]=new P();ah.borderColor=al.borderColor;ah.borderWidth=al.borderWidth;if(al._ticks&&al._ticks[0]){for(am in ah.ticks){if(al._ticks[0].hasOwnProperty(am)){ah.ticks[am]=al._ticks[0][am]}else{if(al._ticks[0]._elem){ah.ticks[am]=al._ticks[0]._elem.css(am)}}}}if(al._label&&al._label.show){for(am in ah.label){if(al._label[am]){ah.label[am]=al._label[am]}else{if(al._label._elem){if(am=="textColor"){ah.label[am]=al._label._elem.css("color")}else{ah.label[am]=al._label._elem.css(am)}}}}}}this.themeEngine._add(ak);this.themeEngine.activeTheme=this.themeEngine.themes[ak._name]};L.jqplot.ThemeEngine.prototype.get=function(ah){if(!ah){return this.activeTheme}else{return this.themes[ah]}};function O(ai,ah){return ai-ah}L.jqplot.ThemeEngine.prototype.getThemeNames=function(){var ah=[];for(var ai in this.themes){ah.push(ai)}return ah.sort(O)};L.jqplot.ThemeEngine.prototype.getThemes=function(){var ai=[];var ah=[];for(var ak in this.themes){ai.push(ak)}ai.sort(O);for(var aj=0;aj<ai.length;aj++){ah.push(this.themes[ai[aj]])}return ah};L.jqplot.ThemeEngine.prototype.activate=function(av,aB){var ah=false;if(!aB&&this.activeTheme&&this.activeTheme._name){aB=this.activeTheme._name}if(!this.themes.hasOwnProperty(aB)){throw new Error("No theme of that name")}else{var am=this.themes[aB];this.activeTheme=am;var aA,at=false,ar=false;var ai=["xaxis","x2axis","yaxis","y2axis"];for(aw=0;aw<ai.length;aw++){var an=ai[aw];if(am.axesStyles.borderColor!=null){av.axes[an].borderColor=am.axesStyles.borderColor}if(am.axesStyles.borderWidth!=null){av.axes[an].borderWidth=am.axesStyles.borderWidth}}for(var az in av.axes){var ak=av.axes[az];if(ak.show){var aq=am.axes[az]||{};var ao=am.axesStyles;var al=L.jqplot.extend(true,{},aq,ao);aA=(am.axesStyles.borderColor!=null)?am.axesStyles.borderColor:al.borderColor;if(al.borderColor!=null){ak.borderColor=al.borderColor;ah=true}aA=(am.axesStyles.borderWidth!=null)?am.axesStyles.borderWidth:al.borderWidth;if(al.borderWidth!=null){ak.borderWidth=al.borderWidth;ah=true}if(ak._ticks&&ak._ticks[0]){for(var aj in al.ticks){aA=al.ticks[aj];if(aA!=null){ak.tickOptions[aj]=aA;ak._ticks=[];ah=true}}}if(ak._label&&ak._label.show){for(var aj in al.label){aA=al.label[aj];if(aA!=null){ak.labelOptions[aj]=aA;ah=true}}}}}for(var au in am.grid){if(am.grid[au]!=null){av.grid[au]=am.grid[au]}}if(!ah){av.grid.draw()}if(av.legend.show){for(au in am.legend){if(am.legend[au]!=null){av.legend[au]=am.legend[au]}}}if(av.title.show){for(au in am.title){if(am.title[au]!=null){av.title[au]=am.title[au]}}}var aw;for(aw=0;aw<am.series.length;aw++){var ap={};var ay=false;for(au in am.series[aw]){aA=(am.seriesStyles[au]!=null)?am.seriesStyles[au]:am.series[aw][au];if(aA!=null){ap[au]=aA;if(au=="color"){av.series[aw].renderer.shapeRenderer.fillStyle=aA;av.series[aw].renderer.shapeRenderer.strokeStyle=aA;av.series[aw][au]=aA}else{if((au=="lineWidth")||(au=="linePattern")){av.series[aw].renderer.shapeRenderer[au]=aA;av.series[aw][au]=aA}else{if(au=="markerOptions"){V(av.series[aw].markerOptions,aA);V(av.series[aw].markerRenderer,aA)}else{av.series[aw][au]=aA}}}ah=true}}}if(ah){av.target.empty();av.draw()}for(au in am.target){if(am.target[au]!=null){av.target.css(au,am.target[au])}}}};L.jqplot.ThemeEngine.prototype._add=function(ai,ah){if(ah){ai._name=ah}if(!ai._name){ai._name=Date.parse(new Date())}if(!this.themes.hasOwnProperty(ai._name)){this.themes[ai._name]=ai}else{throw new Error("jqplot.ThemeEngine Error: Theme already in use")}};L.jqplot.ThemeEngine.prototype.remove=function(ah){if(ah=="Default"){return false}return delete this.themes[ah]};L.jqplot.ThemeEngine.prototype.newTheme=function(ah,aj){if(typeof(ah)=="object"){aj=aj||ah;ah=null}if(aj&&aj._name){ah=aj._name}else{ah=ah||Date.parse(new Date())}var ai=this.copy(this.themes.Default._name,ah);L.jqplot.extend(ai,aj);return ai};function B(aj){if(aj==null||typeof(aj)!="object"){return aj}var ah=new aj.constructor();for(var ai in aj){ah[ai]=B(aj[ai])}return ah}L.jqplot.clone=B;function V(aj,ai){if(ai==null||typeof(ai)!="object"){return}for(var ah in ai){if(ah=="highlightColors"){aj[ah]=B(ai[ah])}if(ai[ah]!=null&&typeof(ai[ah])=="object"){if(!aj.hasOwnProperty(ah)){aj[ah]={}}V(aj[ah],ai[ah])}else{aj[ah]=ai[ah]}}}L.jqplot.merge=V;L.jqplot.extend=function(){var am=arguments[0]||{},ak=1,al=arguments.length,ah=false,aj;if(typeof am==="boolean"){ah=am;am=arguments[1]||{};ak=2}if(typeof am!=="object"&&!toString.call(am)==="[object Function]"){am={}}for(;ak<al;ak++){if((aj=arguments[ak])!=null){for(var ai in aj){var an=am[ai],ao=aj[ai];if(am===ao){continue}if(ah&&ao&&typeof ao==="object"&&!ao.nodeType){am[ai]=L.jqplot.extend(ah,an||(ao.length!=null?[]:{}),ao)}else{if(ao!==u){am[ai]=ao}}}}}return am};L.jqplot.ThemeEngine.prototype.rename=function(ai,ah){if(ai=="Default"||ah=="Default"){throw new Error("jqplot.ThemeEngine Error: Cannot rename from/to Default")}if(this.themes.hasOwnProperty(ah)){throw new Error("jqplot.ThemeEngine Error: New name already in use.")}else{if(this.themes.hasOwnProperty(ai)){var aj=this.copy(ai,ah);this.remove(ai);return aj}}throw new Error("jqplot.ThemeEngine Error: Old name or new name invalid")};L.jqplot.ThemeEngine.prototype.copy=function(ah,aj,al){if(aj=="Default"){throw new Error("jqplot.ThemeEngine Error: Cannot copy over Default theme")}if(!this.themes.hasOwnProperty(ah)){var ai="jqplot.ThemeEngine Error: Source name invalid";throw new Error(ai)}if(this.themes.hasOwnProperty(aj)){var ai="jqplot.ThemeEngine Error: Target name invalid";throw new Error(ai)}else{var ak=B(this.themes[ah]);ak._name=aj;L.jqplot.extend(true,ak,al);this._add(ak);return ak}};L.jqplot.Theme=function(ah,ai){if(typeof(ah)=="object"){ai=ai||ah;ah=null}ah=ah||Date.parse(new Date());this._name=ah;this.target={backgroundColor:null};this.legend={textColor:null,fontFamily:null,fontSize:null,border:null,background:null};this.title={textColor:null,fontFamily:null,fontSize:null,textAlign:null};this.seriesStyles={};this.series=[];this.grid={drawGridlines:null,gridLineColor:null,gridLineWidth:null,backgroundColor:null,borderColor:null,borderWidth:null,shadow:null};this.axesStyles={label:{},ticks:{}};this.axes={};if(typeof(ai)=="string"){this._name=ai}else{if(typeof(ai)=="object"){L.jqplot.extend(true,this,ai)}}};var P=function(){this.borderColor=null;this.borderWidth=null;this.ticks=new o();this.label=new t()};var o=function(){this.show=null;this.showGridline=null;this.showLabel=null;this.showMark=null;this.size=null;this.textColor=null;this.whiteSpace=null;this.fontSize=null;this.fontFamily=null};var t=function(){this.textColor=null;this.whiteSpace=null;this.fontSize=null;this.fontFamily=null;this.fontWeight=null};var p=function(){this.color=null;this.lineWidth=null;this.linePattern=null;this.shadow=null;this.fillColor=null;this.showMarker=null;this.markerOptions=new I()};var I=function(){this.show=null;this.style=null;this.lineWidth=null;this.size=null;this.color=null;this.shadow=null};var T=function(){this.color=null;this.seriesColors=null;this.lineWidth=null;this.shadow=null;this.barPadding=null;this.barMargin=null;this.barWidth=null;this.highlightColors=null};var f=function(){this.seriesColors=null;this.padding=null;this.sliceMargin=null;this.fill=null;this.shadow=null;this.startAngle=null;this.lineWidth=null;this.highlightColors=null};var G=function(){this.seriesColors=null;this.padding=null;this.sliceMargin=null;this.fill=null;this.shadow=null;this.startAngle=null;this.lineWidth=null;this.innerDiameter=null;this.thickness=null;this.ringMargin=null;this.highlightColors=null};var Z=function(){this.color=null;this.lineWidth=null;this.shadow=null;this.padding=null;this.sectionMargin=null;this.seriesColors=null;this.highlightColors=null};var D=function(){this.padding=null;this.backgroundColor=null;this.ringColor=null;this.tickColor=null;this.ringWidth=null;this.intervalColors=null;this.intervalInnerRadius=null;this.intervalOuterRadius=null;this.hubRadius=null;this.needleThickness=null;this.needlePad=null};L.fn.jqplotChildText=function(){return L(this).contents().filter(function(){return this.nodeType==3}).text()};L.fn.jqplotGetComputedFontStyle=function(){var ak=window.getComputedStyle?window.getComputedStyle(this[0],""):this[0].currentStyle;var ai=ak["font-style"]?["font-style","font-weight","font-size","font-family"]:["fontStyle","fontWeight","fontSize","fontFamily"];var al=[];for(var aj=0;aj<ai.length;++aj){var ah=String(ak[ai[aj]]);if(ah&&ah!="normal"){al.push(ah)}}return al.join(" ")};L.fn.jqplotToImageCanvas=function(aj){aj=aj||{};var av=(aj.x_offset==null)?0:aj.x_offset;var ax=(aj.y_offset==null)?0:aj.y_offset;var al=(aj.backgroundColor==null)?"rgb(255,255,255)":aj.backgroundColor;if(L(this).width()==0||L(this).height()==0){return null}if(L.jqplot.use_excanvas){return null}var an=document.createElement("canvas");var aA=L(this).outerHeight(true);var at=L(this).outerWidth(true);var am=L(this).offset();var ao=am.left;var aq=am.top;var au=0,ar=0;var ay=["jqplot-table-legend","jqplot-xaxis-tick","jqplot-x2axis-tick","jqplot-yaxis-tick","jqplot-y2axis-tick","jqplot-y3axis-tick","jqplot-y4axis-tick","jqplot-y5axis-tick","jqplot-y6axis-tick","jqplot-y7axis-tick","jqplot-y8axis-tick","jqplot-y9axis-tick","jqplot-xaxis-label","jqplot-x2axis-label","jqplot-yaxis-label","jqplot-y2axis-label","jqplot-y3axis-label","jqplot-y4axis-label","jqplot-y5axis-label","jqplot-y6axis-label","jqplot-y7axis-label","jqplot-y8axis-label","jqplot-y9axis-label"];var ap,ah,ai,aB;for(var az=0;az<ay.length;az++){L(this).find("."+ay[az]).each(function(){ap=L(this).offset().top-aq;ah=L(this).offset().left-ao;aB=ah+L(this).outerWidth(true)+au;ai=ap+L(this).outerHeight(true)+ar;if(ah<-au){at=at-au-ah;au=-ah}if(ap<-ar){aA=aA-ar-ap;ar=-ap}if(aB>at){at=aB}if(ai>aA){aA=ai}})}an.width=at+Number(av);an.height=aA+Number(ax);var ak=an.getContext("2d");ak.save();ak.fillStyle=al;ak.fillRect(0,0,an.width,an.height);ak.restore();ak.translate(au,ar);ak.textAlign="left";ak.textBaseline="top";function aC(aE){var aF=parseInt(L(aE).css("line-height"),10);if(isNaN(aF)){aF=parseInt(L(aE).css("font-size"),10)*1.2}return aF}function aD(aF,aE,aS,aG,aO,aH){var aQ=aC(aF);var aK=L(aF).innerWidth();var aL=L(aF).innerHeight();var aN=aS.split(/\s+/);var aR=aN.length;var aP="";var aM=[];var aU=aO;var aT=aG;for(var aJ=0;aJ<aR;aJ++){aP+=aN[aJ];if(aE.measureText(aP).width>aK){aM.push(aJ);aP="";aJ--}}if(aM.length===0){if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aS,aT,aO)}else{aP=aN.slice(0,aM[0]).join(" ");if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aP,aT,aU);aU+=aQ;for(var aJ=1,aI=aM.length;aJ<aI;aJ++){aP=aN.slice(aM[aJ-1],aM[aJ]).join(" ");if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aP,aT,aU);aU+=aQ}aP=aN.slice(aM[aJ-1],aN.length).join(" ");if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aP,aT,aU)}}function aw(aG,aJ,aE){var aN=aG.tagName.toLowerCase();var aF=L(aG).position();var aK=window.getComputedStyle?window.getComputedStyle(aG,""):aG.currentStyle;var aI=aJ+aF.left+parseInt(aK.marginLeft,10)+parseInt(aK.borderLeftWidth,10)+parseInt(aK.paddingLeft,10);var aL=aE+aF.top+parseInt(aK.marginTop,10)+parseInt(aK.borderTopWidth,10)+parseInt(aK.paddingTop,10);var aM=an.width;if((aN=="div"||aN=="span")&&!L(aG).hasClass("jqplot-highlighter-tooltip")){L(aG).children().each(function(){aw(this,aI,aL)});var aO=L(aG).jqplotChildText();if(aO){ak.font=L(aG).jqplotGetComputedFontStyle();ak.fillStyle=L(aG).css("color");aD(aG,ak,aO,aI,aL,aM)}}else{if(aN==="table"&&L(aG).hasClass("jqplot-table-legend")){ak.strokeStyle=L(aG).css("border-top-color");ak.fillStyle=L(aG).css("background-color");ak.fillRect(aI,aL,L(aG).innerWidth(),L(aG).innerHeight());if(parseInt(L(aG).css("border-top-width"),10)>0){ak.strokeRect(aI,aL,L(aG).innerWidth(),L(aG).innerHeight())}L(aG).find("div.jqplot-table-legend-swatch-outline").each(function(){var aU=L(this);ak.strokeStyle=aU.css("border-top-color");var aQ=aI+aU.position().left;var aR=aL+aU.position().top;ak.strokeRect(aQ,aR,aU.innerWidth(),aU.innerHeight());aQ+=parseInt(aU.css("padding-left"),10);aR+=parseInt(aU.css("padding-top"),10);var aT=aU.innerHeight()-2*parseInt(aU.css("padding-top"),10);var aP=aU.innerWidth()-2*parseInt(aU.css("padding-left"),10);var aS=aU.children("div.jqplot-table-legend-swatch");ak.fillStyle=aS.css("background-color");ak.fillRect(aQ,aR,aP,aT)});L(aG).find("td.jqplot-table-legend-label").each(function(){var aR=L(this);var aP=aI+aR.position().left;var aQ=aL+aR.position().top+parseInt(aR.css("padding-top"),10);ak.font=aR.jqplotGetComputedFontStyle();ak.fillStyle=aR.css("color");aD(aR,ak,aR.text(),aP,aQ,aM)});var aH=null}else{if(aN=="canvas"){ak.drawImage(aG,aI,aL)}}}}L(this).children().each(function(){aw(this,av,ax)});return an};L.fn.jqplotToImageStr=function(ai){var ah=L(this).jqplotToImageCanvas(ai);if(ah){return ah.toDataURL("image/png")}else{return null}};L.fn.jqplotToImageElem=function(ah){var ai=document.createElement("img");var aj=L(this).jqplotToImageStr(ah);ai.src=aj;return ai};L.fn.jqplotToImageElemStr=function(ah){var ai="<img src="+L(this).jqplotToImageStr(ah)+" />";return ai};L.fn.jqplotSaveImage=function(){var ah=L(this).jqplotToImageStr({});if(ah){window.location.href=ah.replace("image/png","image/octet-stream")}};L.fn.jqplotViewImage=function(){var ai=L(this).jqplotToImageElemStr({});var aj=L(this).jqplotToImageStr({});if(ai){var ah=window.open("");ah.document.open("image/png");ah.document.write(ai);ah.document.close();ah=null}};var ag=function(){this.syntax=ag.config.syntax;this._type="jsDate";this.proxy=new Date();this.options={};this.locale=ag.regional.getLocale();this.formatString="";this.defaultCentury=ag.config.defaultCentury;switch(arguments.length){case 0:break;case 1:if(l(arguments[0])=="[object Object]"&&arguments[0]._type!="jsDate"){var aj=this.options=arguments[0];this.syntax=aj.syntax||this.syntax;this.defaultCentury=aj.defaultCentury||this.defaultCentury;this.proxy=ag.createDate(aj.date)}else{this.proxy=ag.createDate(arguments[0])}break;default:var ah=[];for(var ai=0;ai<arguments.length;ai++){ah.push(arguments[ai])}this.proxy=new Date();this.proxy.setFullYear.apply(this.proxy,ah.slice(0,3));if(ah.slice(3).length){this.proxy.setHours.apply(this.proxy,ah.slice(3))}break}};ag.config={defaultLocale:"en",syntax:"perl",defaultCentury:1900};ag.prototype.add=function(aj,ai){var ah=E[ai]||E.day;if(typeof ah=="number"){this.proxy.setTime(this.proxy.getTime()+(ah*aj))}else{ah.add(this,aj)}return this};ag.prototype.clone=function(){return new ag(this.proxy.getTime())};ag.prototype.getUtcOffset=function(){return this.proxy.getTimezoneOffset()*60000};ag.prototype.diff=function(ai,al,ah){ai=new ag(ai);if(ai===null){return null}var aj=E[al]||E.day;if(typeof aj=="number"){var ak=(this.proxy.getTime()-ai.proxy.getTime())/aj}else{var ak=aj.diff(this.proxy,ai.proxy)}return(ah?ak:Math[ak>0?"floor":"ceil"](ak))};ag.prototype.getAbbrDayName=function(){return ag.regional[this.locale]["dayNamesShort"][this.proxy.getDay()]};ag.prototype.getAbbrMonthName=function(){return ag.regional[this.locale]["monthNamesShort"][this.proxy.getMonth()]};ag.prototype.getAMPM=function(){return this.proxy.getHours()>=12?"PM":"AM"};ag.prototype.getAmPm=function(){return this.proxy.getHours()>=12?"pm":"am"};ag.prototype.getCentury=function(){return parseInt(this.proxy.getFullYear()/100,10)};ag.prototype.getDate=function(){return this.proxy.getDate()};ag.prototype.getDay=function(){return this.proxy.getDay()};ag.prototype.getDayOfWeek=function(){var ah=this.proxy.getDay();return ah===0?7:ah};ag.prototype.getDayOfYear=function(){var ai=this.proxy;var ah=ai-new Date(""+ai.getFullYear()+"/1/1 GMT");ah+=ai.getTimezoneOffset()*60000;ai=null;return parseInt(ah/60000/60/24,10)+1};ag.prototype.getDayName=function(){return ag.regional[this.locale]["dayNames"][this.proxy.getDay()]};ag.prototype.getFullWeekOfYear=function(){var ak=this.proxy;var ah=this.getDayOfYear();var aj=6-ak.getDay();var ai=parseInt((ah+aj)/7,10);return ai};ag.prototype.getFullYear=function(){return this.proxy.getFullYear()};ag.prototype.getGmtOffset=function(){var ah=this.proxy.getTimezoneOffset()/60;var ai=ah<0?"+":"-";ah=Math.abs(ah);return ai+N(Math.floor(ah),2)+":"+N((ah%1)*60,2)};ag.prototype.getHours=function(){return this.proxy.getHours()};ag.prototype.getHours12=function(){var ah=this.proxy.getHours();return ah>12?ah-12:(ah==0?12:ah)};ag.prototype.getIsoWeek=function(){var ak=this.proxy;var aj=this.getWeekOfYear();var ah=(new Date(""+ak.getFullYear()+"/1/1")).getDay();var ai=aj+(ah>4||ah<=1?0:1);if(ai==53&&(new Date(""+ak.getFullYear()+"/12/31")).getDay()<4){ai=1}else{if(ai===0){ak=new ag(new Date(""+(ak.getFullYear()-1)+"/12/31"));ai=ak.getIsoWeek()}}ak=null;return ai};ag.prototype.getMilliseconds=function(){return this.proxy.getMilliseconds()};ag.prototype.getMinutes=function(){return this.proxy.getMinutes()};ag.prototype.getMonth=function(){return this.proxy.getMonth()};ag.prototype.getMonthName=function(){return ag.regional[this.locale]["monthNames"][this.proxy.getMonth()]};ag.prototype.getMonthNumber=function(){return this.proxy.getMonth()+1};ag.prototype.getSeconds=function(){return this.proxy.getSeconds()};ag.prototype.getShortYear=function(){return this.proxy.getYear()%100};ag.prototype.getTime=function(){return this.proxy.getTime()};ag.prototype.getTimezoneAbbr=function(){return this.proxy.toString().replace(/^.*\(([^)]+)\)$/,"$1")};ag.prototype.getTimezoneName=function(){var ah=/(?:\((.+)\)$| ([A-Z]{3}) )/.exec(this.toString());return ah[1]||ah[2]||"GMT"+this.getGmtOffset()};ag.prototype.getTimezoneOffset=function(){return this.proxy.getTimezoneOffset()};ag.prototype.getWeekOfYear=function(){var ah=this.getDayOfYear();var aj=7-this.getDayOfWeek();var ai=parseInt((ah+aj)/7,10);return ai};ag.prototype.getUnix=function(){return Math.round(this.proxy.getTime()/1000,0)};ag.prototype.getYear=function(){return this.proxy.getYear()};ag.prototype.next=function(ah){ah=ah||"day";return this.clone().add(1,ah)};ag.prototype.set=function(){switch(arguments.length){case 0:this.proxy=new Date();break;case 1:if(l(arguments[0])=="[object Object]"&&arguments[0]._type!="jsDate"){var aj=this.options=arguments[0];this.syntax=aj.syntax||this.syntax;this.defaultCentury=aj.defaultCentury||this.defaultCentury;this.proxy=ag.createDate(aj.date)}else{this.proxy=ag.createDate(arguments[0])}break;default:var ah=[];for(var ai=0;ai<arguments.length;ai++){ah.push(arguments[ai])}this.proxy=new Date();this.proxy.setFullYear.apply(this.proxy,ah.slice(0,3));if(ah.slice(3).length){this.proxy.setHours.apply(this.proxy,ah.slice(3))}break}return this};ag.prototype.setDate=function(ah){this.proxy.setDate(ah);return this};ag.prototype.setFullYear=function(){this.proxy.setFullYear.apply(this.proxy,arguments);return this};ag.prototype.setHours=function(){this.proxy.setHours.apply(this.proxy,arguments);return this};ag.prototype.setMilliseconds=function(ah){this.proxy.setMilliseconds(ah);return this};ag.prototype.setMinutes=function(){this.proxy.setMinutes.apply(this.proxy,arguments);return this};ag.prototype.setMonth=function(){this.proxy.setMonth.apply(this.proxy,arguments);return this};ag.prototype.setSeconds=function(){this.proxy.setSeconds.apply(this.proxy,arguments);return this};ag.prototype.setTime=function(ah){this.proxy.setTime(ah);return this};ag.prototype.setYear=function(){this.proxy.setYear.apply(this.proxy,arguments);return this};ag.prototype.strftime=function(ah){ah=ah||this.formatString||ag.regional[this.locale]["formatString"];return ag.strftime(this,ah,this.syntax)};ag.prototype.toString=function(){return this.proxy.toString()};ag.prototype.toYmdInt=function(){return(this.proxy.getFullYear()*10000)+(this.getMonthNumber()*100)+this.proxy.getDate()};ag.regional={en:{monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],formatString:"%Y-%m-%d %H:%M:%S"},fr:{monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthNamesShort:["Jan","Fév","Mar","Avr","Mai","Jun","Jul","Aoû","Sep","Oct","Nov","Déc"],dayNames:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],dayNamesShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],formatString:"%Y-%m-%d %H:%M:%S"},de:{monthNames:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthNamesShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],dayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],dayNamesShort:["So","Mo","Di","Mi","Do","Fr","Sa"],formatString:"%Y-%m-%d %H:%M:%S"},es:{monthNames:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthNamesShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],dayNames:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],dayNamesShort:["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],formatString:"%Y-%m-%d %H:%M:%S"},ru:{monthNames:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthNamesShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],dayNames:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],dayNamesShort:["вск","пнд","втр","срд","чтв","птн","сбт"],formatString:"%Y-%m-%d %H:%M:%S"},ar:{monthNames:["كانون الثاني","شباط","آذار","نيسان","آذار","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],monthNamesShort:["1","2","3","4","5","6","7","8","9","10","11","12"],dayNames:["السبت","الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة"],dayNamesShort:["سبت","أحد","اثنين","ثلاثاء","أربعاء","خميس","جمعة"],formatString:"%Y-%m-%d %H:%M:%S"},pt:{monthNames:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthNamesShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],dayNames:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"],dayNamesShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],formatString:"%Y-%m-%d %H:%M:%S"},"pt-BR":{monthNames:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthNamesShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],dayNames:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"],dayNamesShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],formatString:"%Y-%m-%d %H:%M:%S"},pl:{monthNames:["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"],monthNamesShort:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Paź","Lis","Gru"],dayNames:["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"],dayNamesShort:["Ni","Pn","Wt","Śr","Cz","Pt","Sb"],formatString:"%Y-%m-%d %H:%M:%S"},nl:{monthNames:["Januari","Februari","Maart","April","Mei","Juni","July","Augustus","September","Oktober","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],dayNames:","["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],dayNamesShort:["Zo","Ma","Di","Wo","Do","Vr","Za"],formatString:"%Y-%m-%d %H:%M:%S"},sv:{monthNames:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],monthNamesShort:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],dayNames:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],dayNamesShort:["sön","mån","tis","ons","tor","fre","lör"],formatString:"%Y-%m-%d %H:%M:%S"}};ag.regional["en-US"]=ag.regional["en-GB"]=ag.regional.en;ag.regional.getLocale=function(){var ah=ag.config.defaultLocale;if(document&&document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){ah=document.getElementsByTagName("html")[0].lang;if(!ag.regional.hasOwnProperty(ah)){ah=ag.config.defaultLocale}}return ah};var C=24*60*60*1000;var N=function(ah,ak){ah=String(ah);var ai=ak-ah.length;var aj=String(Math.pow(10,ai)).slice(1);return aj.concat(ah)};var E={millisecond:1,second:1000,minute:60*1000,hour:60*60*1000,day:C,week:7*C,month:{add:function(aj,ah){E.year.add(aj,Math[ah>0?"floor":"ceil"](ah/12));var ai=aj.getMonth()+(ah%12);if(ai==12){ai=0;aj.setYear(aj.getFullYear()+1)}else{if(ai==-1){ai=11;aj.setYear(aj.getFullYear()-1)}}aj.setMonth(ai)},diff:function(al,aj){var ah=al.getFullYear()-aj.getFullYear();var ai=al.getMonth()-aj.getMonth()+(ah*12);var ak=al.getDate()-aj.getDate();return ai+(ak/30)}},year:{add:function(ai,ah){ai.setYear(ai.getFullYear()+Math[ah>0?"floor":"ceil"](ah))},diff:function(ai,ah){return E.month.diff(ai,ah)/12}}};for(var Y in E){if(Y.substring(Y.length-1)!="s"){E[Y+"s"]=E[Y]}}var H=function(al,ak,ai){if(ag.formats[ai]["shortcuts"][ak]){return ag.strftime(al,ag.formats[ai]["shortcuts"][ak],ai)}else{var ah=(ag.formats[ai]["codes"][ak]||"").split(".");var aj=al["get"+ah[0]]?al["get"+ah[0]]():"";if(ah[1]){aj=N(aj,ah[1])}return aj}};ag.strftime=function(an,ak,aj,ao){var ai="perl";var am=ag.regional.getLocale();if(aj&&ag.formats.hasOwnProperty(aj)){ai=aj}else{if(aj&&ag.regional.hasOwnProperty(aj)){am=aj}}if(ao&&ag.formats.hasOwnProperty(ao)){ai=ao}else{if(ao&&ag.regional.hasOwnProperty(ao)){am=ao}}if(l(an)!="[object Object]"||an._type!="jsDate"){an=new ag(an);an.locale=am}if(!ak){ak=an.formatString||ag.regional[am]["formatString"]}var ah=ak||"%Y-%m-%d",ap="",al;while(ah.length>0){if(al=ah.match(ag.formats[ai].codes.matcher)){ap+=ah.slice(0,al.index);ap+=(al[1]||"")+H(an,al[2],ai);ah=ah.slice(al.index+al[0].length)}else{ap+=ah;ah=""}}return ap};ag.formats={ISO:"%Y-%m-%dT%H:%M:%S.%N%G",SQL:"%Y-%m-%d %H:%M:%S"};ag.formats.perl={codes:{matcher:/()%(#?(%|[a-z]))/i,Y:"FullYear",y:"ShortYear.2",m:"MonthNumber.2","#m":"MonthNumber",B:"MonthName",b:"AbbrMonthName",d:"Date.2","#d":"Date",e:"Date",A:"DayName",a:"AbbrDayName",w:"Day",H:"Hours.2","#H":"Hours",I:"Hours12.2","#I":"Hours12",p:"AMPM",M:"Minutes.2","#M":"Minutes",S:"Seconds.2","#S":"Seconds",s:"Unix",N:"Milliseconds.3","#N":"Milliseconds",O:"TimezoneOffset",Z:"TimezoneName",G:"GmtOffset"},shortcuts:{F:"%Y-%m-%d",T:"%H:%M:%S",X:"%H:%M:%S",x:"%m/%d/%y",D:"%m/%d/%y","#c":"%a %b %e %H:%M:%S %Y",v:"%e-%b-%Y",R:"%H:%M",r:"%I:%M:%S %p",t:"\t",n:"\n","%":"%"}};ag.formats.php={codes:{matcher:/()%((%|[a-z]))/i,a:"AbbrDayName",A:"DayName",d:"Date.2",e:"Date",j:"DayOfYear.3",u:"DayOfWeek",w:"Day",U:"FullWeekOfYear.2",V:"IsoWeek.2",W:"WeekOfYear.2",b:"AbbrMonthName",B:"MonthName",m:"MonthNumber.2",h:"AbbrMonthName",C:"Century.2",y:"ShortYear.2",Y:"FullYear",H:"Hours.2",I:"Hours12.2",l:"Hours12",p:"AMPM",P:"AmPm",M:"Minutes.2",S:"Seconds.2",s:"Unix",O:"TimezoneOffset",z:"GmtOffset",Z:"TimezoneAbbr"},shortcuts:{D:"%m/%d/%y",F:"%Y-%m-%d",T:"%H:%M:%S",X:"%H:%M:%S",x:"%m/%d/%y",R:"%H:%M",r:"%I:%M:%S %p",t:"\t",n:"\n","%":"%"}};ag.createDate=function(aj){if(aj==null){return new Date()}if(aj instanceof Date){return aj}if(typeof aj=="number"){return new Date(aj)}var ao=String(aj).replace(/^\s*(.+)\s*$/g,"$1");ao=ao.replace(/^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,4})/,"$1/$2/$3");ao=ao.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{4})/i,"$1 $2 $3");var an=ao.match(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i);if(an&&an.length>3){var at=parseFloat(an[3]);var am=ag.config.defaultCentury+at;am=String(am);ao=ao.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i,an[1]+" "+an[2]+" "+am)}an=ao.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})[^0-9]/);function ar(ax,aw){var aC=parseFloat(aw[1]);var aB=parseFloat(aw[2]);var aA=parseFloat(aw[3]);var az=ag.config.defaultCentury;var av,au,aD,ay;if(aC>31){au=aA;aD=aB;av=az+aC}else{au=aB;aD=aC;av=az+aA}ay=aD+"/"+au+"/"+av;return ax.replace(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})/,ay)}if(an&&an.length>3){ao=ar(ao,an)}var an=ao.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})$/);if(an&&an.length>3){ao=ar(ao,an)}var al=0;var ai=ag.matchers.length;var aq,ah,ap=ao,ak;while(al<ai){ah=Date.parse(ap);if(!isNaN(ah)){return new Date(ah)}aq=ag.matchers[al];if(typeof aq=="function"){ak=aq.call(ag,ap);if(ak instanceof Date){return ak}}else{ap=ao.replace(aq[0],aq[1])}al++}return NaN};ag.daysInMonth=function(ah,ai){if(ai==2){return new Date(ah,1,29).getDate()==29?29:28}return[u,31,u,31,30,31,30,31,31,30,31,30,31][ai]};ag.matchers=[[/(3[01]|[0-2]\d)\s*\.\s*(1[0-2]|0\d)\s*\.\s*([1-9]\d{3})/,"$2/$1/$3"],[/([1-9]\d{3})\s*-\s*(1[0-2]|0\d)\s*-\s*(3[01]|[0-2]\d)/,"$2/$3/$1"],function(ak){var ai=ak.match(/^(?:(.+)\s+)?([012]?\d)(?:\s*\:\s*(\d\d))?(?:\s*\:\s*(\d\d(\.\d*)?))?\s*(am|pm)?\s*$/i);if(ai){if(ai[1]){var aj=this.createDate(ai[1]);if(isNaN(aj)){return}}else{var aj=new Date();aj.setMilliseconds(0)}var ah=parseFloat(ai[2]);if(ai[6]){ah=ai[6].toLowerCase()=="am"?(ah==12?0:ah):(ah==12?12:ah+12)}aj.setHours(ah,parseInt(ai[3]||0,10),parseInt(ai[4]||0,10),((parseFloat(ai[5]||0))||0)*1000);return aj}else{return ak}},function(ak){var ai=ak.match(/^(?:(.+))[T|\s+]([012]\d)(?:\:(\d\d))(?:\:(\d\d))(?:\.\d+)([\+\-]\d\d\:\d\d)$/i);if(ai){if(ai[1]){var aj=this.createDate(ai[1]);if(isNaN(aj)){return}}else{var aj=new Date();aj.setMilliseconds(0)}var ah=parseFloat(ai[2]);aj.setHours(ah,parseInt(ai[3],10),parseInt(ai[4],10),parseFloat(ai[5])*1000);return aj}else{return ak}},function(al){var aj=al.match(/^([0-3]?\d)\s*[-\/.\s]{1}\s*([a-zA-Z]{3,9})\s*[-\/.\s]{1}\s*([0-3]?\d)$/);if(aj){var ak=new Date();var am=ag.config.defaultCentury;var ao=parseFloat(aj[1]);var an=parseFloat(aj[3]);var ai,ah,ap;if(ao>31){ah=an;ai=am+ao}else{ah=ao;ai=am+an}var ap=ab(aj[2],ag.regional[ag.regional.getLocale()]["monthNamesShort"]);if(ap==-1){ap=ab(aj[2],ag.regional[ag.regional.getLocale()]["monthNames"])}ak.setFullYear(ai,ap,ah);ak.setHours(0,0,0,0);return ak}else{return al}}];function ab(aj,ak){if(ak.indexOf){return ak.indexOf(aj)}for(var ah=0,ai=ak.length;ah<ai;ah++){if(ak[ah]===aj){return ah}}return -1}function l(ah){if(ah===null){return"[object Null]"}return Object.prototype.toString.call(ah)}L.jsDate=ag;L.jqplot.sprintf=function(){function an(au,ap,aq,at){var ar=(au.length>=ap)?"":Array(1+ap-au.length>>>0).join(aq);return at?au+ar:ar+au}function ak(ar){var aq=new String(ar);for(var ap=10;ap>0;ap--){if(aq==(aq=aq.replace(/^(\d+)(\d{3})/,"$1"+L.jqplot.sprintf.thousandsSeparator+"$2"))){break}}return aq}function aj(av,au,ax,ar,at,aq){var aw=ar-av.length;if(aw>0){var ap=" ";if(aq){ap=" "}if(ax||!at){av=an(av,ar,ap,ax)}else{av=av.slice(0,au.length)+an("",aw,"0",true)+av.slice(au.length)}}return av}function ao(ay,aq,aw,ar,ap,av,ax,au){var at=ay>>>0;aw=aw&&at&&{"2":"0b","8":"0","16":"0x"}[aq]||"";ay=aw+an(at.toString(aq),av||0,"0",false);return aj(ay,aw,ar,ap,ax,au)}function ah(au,av,ar,ap,at,aq){if(ap!=null){au=au.slice(0,ap)}return aj(au,"",av,ar,at,aq)}var ai=arguments,al=0,am=ai[al++];return am.replace(L.jqplot.sprintf.regex,function(aM,ax,ay,aB,aO,aJ,av){if(aM=="%%"){return"%"}var aD=false,az="",aA=false,aL=false,aw=false,au=false;for(var aI=0;ay&&aI<ay.length;aI++){switch(ay.charAt(aI)){case" ":az=" ";break;case"+":az="+";break;case"-":aD=true;break;case"0":aA=true;break;case"#":aL=true;break;case"&":aw=true;break;case"'":au=true;break}}if(!aB){aB=0}else{if(aB=="*"){aB=+ai[al++]}else{if(aB.charAt(0)=="*"){aB=+ai[aB.slice(1,-1)]}else{aB=+aB}}}if(aB<0){aB=-aB;aD=true}if(!isFinite(aB)){throw new Error("$.jqplot.sprintf: (minimum-)width must be finite")}if(!aJ){aJ="fFeE".indexOf(av)>-1?6:(av=="d")?0:void (0)}else{if(aJ=="*"){aJ=+ai[al++]}else{if(aJ.charAt(0)=="*"){aJ=+ai[aJ.slice(1,-1)]}else{aJ=+aJ}}}var aF=ax?ai[ax.slice(0,-1)]:ai[al++];switch(av){case"s":if(aF==null){return""}return ah(String(aF),aD,aB,aJ,aA,aw);case"c":return ah(String.fromCharCode(+aF),aD,aB,aJ,aA,aw);case"b":return ao(aF,2,aL,aD,aB,aJ,aA,aw);case"o":return ao(aF,8,aL,aD,aB,aJ,aA,aw);case"x":return ao(aF,16,aL,aD,aB,aJ,aA,aw);case"X":return ao(aF,16,aL,aD,aB,aJ,aA,aw).toUpperCase();case"u":return ao(aF,10,aL,aD,aB,aJ,aA,aw);case"i":var ar=parseInt(+aF,10);if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aK=au?ak(String(Math.abs(ar))):String(Math.abs(ar));aF=aH+an(aK,aJ,"0",false);return aj(aF,aH,aD,aB,aA,aw);case"d":var ar=Math.round(+aF);if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aK=au?ak(String(Math.abs(ar))):String(Math.abs(ar));aF=aH+an(aK,aJ,"0",false);return aj(aF,aH,aD,aB,aA,aw);case"e":case"E":case"f":case"F":case"g":case"G":var ar=+aF;if(isNaN(ar)){return""}var aH=ar<0?"-":az;var at=["toExponential","toFixed","toPrecision"]["efg".indexOf(av.toLowerCase())];var aN=["toString","toUpperCase"]["eEfFgG".indexOf(av)%2];var aK=Math.abs(ar)[at](aJ);var aE=aK.toString().split(".");aE[0]=au?ak(aE[0]):aE[0];aK=aE.join(L.jqplot.sprintf.decimalMark);aF=aH+aK;var aC=aj(aF,aH,aD,aB,aA,aw)[aN]();return aC;case"p":case"P":var ar=+aF;if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aE=String(Number(Math.abs(ar)).toExponential()).split(/e|E/);var aq=(aE[0].indexOf(".")!=-1)?aE[0].length-1:String(ar).length;var aG=(aE[1]<0)?-aE[1]-1:0;if(Math.abs(ar)<1){if(aq+aG<=aJ){aF=aH+Math.abs(ar).toPrecision(aq)}else{if(aq<=aJ-1){aF=aH+Math.abs(ar).toExponential(aq-1)}else{aF=aH+Math.abs(ar).toExponential(aJ-1)}}}else{var ap=(aq<=aJ)?aq:aJ;aF=aH+Math.abs(ar).toPrecision(ap)}var aN=["toString","toUpperCase"]["pP".indexOf(av)%2];return aj(aF,aH,aD,aB,aA,aw)[aN]();case"n":return"";default:return aM}})};L.jqplot.sprintf.thousandsSeparator=",";L.jqplot.sprintf.decimalMark=".";L.jqplot.sprintf.regex=/%%|%(\d+\$)?([-+#0&\' ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([nAscboxXuidfegpEGP])/g;L.jqplot.getSignificantFigures=function(al){var an=String(Number(Math.abs(al)).toExponential()).split(/e|E/);var am=(an[0].indexOf(".")!=-1)?an[0].length-1:an[0].length;var ai=(an[1]<0)?-an[1]-1:0;var ah=parseInt(an[1],10);var aj=(ah+1>0)?ah+1:0;var ak=(am<=aj)?0:am-ah-1;return{significantDigits:am,digitsLeft:aj,digitsRight:ak,zeros:ai,exponent:ah}};L.jqplot.getPrecision=function(ah){return L.jqplot.getSignificantFigures(ah).digitsRight};var X=L.uiBackCompat!==false;L.jqplot.effects={effect:{}};var m="jqplot.storage.";L.extend(L.jqplot.effects,{version:"1.9pre",save:function(ai,aj){for(var ah=0;ah<aj.length;ah++){if(aj[ah]!==null){ai.data(m+aj[ah],ai[0].style[aj[ah]])}}},restore:function(ai,aj){for(var ah=0;ah<aj.length;ah++){if(aj[ah]!==null){ai.css(aj[ah],ai.data(m+aj[ah]))}}},setMode:function(ah,ai){if(ai==="toggle"){ai=ah.is(":hidden")?"show":"hide"}return ai},createWrapper:function(ai){if(ai.parent().is(".ui-effects-wrapper")){return ai.parent()}var aj={width:ai.outerWidth(true),height:ai.outerHeight(true),"float":ai.css("float")},al=L("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),ah={width:ai.width(),height:ai.height()},ak=document.activeElement;ai.wrap(al);if(ai[0]===ak||L.contains(ai[0],ak)){L(ak).focus()}al=ai.parent();if(ai.css("position")==="static"){al.css({position:"relative"});ai.css({position:"relative"})}else{L.extend(aj,{position:ai.css("position"),zIndex:ai.css("z-index")});L.each(["top","left","bottom","right"],function(am,an){aj[an]=ai.css(an);if(isNaN(parseInt(aj[an],10))){aj[an]="auto"}});ai.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}ai.css(ah);return al.css(aj).show()},removeWrapper:function(ah){var ai=document.activeElement;if(ah.parent().is(".ui-effects-wrapper")){ah.parent().replaceWith(ah);if(ah[0]===ai||L.contains(ah[0],ai)){L(ai).focus()}}return ah}});function j(ai,ah,aj,ak){if(L.isPlainObject(ai)){return ai}ai={effect:ai};if(ah===u){ah={}}if(L.isFunction(ah)){ak=ah;aj=null;ah={}}if(L.type(ah)==="number"||L.fx.speeds[ah]){ak=aj;aj=ah;ah={}}if(L.isFunction(aj)){ak=aj;aj=null}if(ah){L.extend(ai,ah)}aj=aj||ah.duration;ai.duration=L.fx.off?0:typeof aj==="number"?aj:aj in L.fx.speeds?L.fx.speeds[aj]:L.fx.speeds._default;ai.complete=ak||ah.complete;return ai}function ae(ah){if(!ah||typeof ah==="number"||L.fx.speeds[ah]){return true}if(typeof ah==="string"&&!L.jqplot.effects.effect[ah]){if(X&&L.jqplot.effects[ah]){return false}return true}return false}L.fn.extend({jqplotEffect:function(ap,aq,ai,ao){var an=j.apply(this,arguments),ak=an.mode,al=an.queue,am=L.jqplot.effects.effect[an.effect],ah=!am&&X&&L.jqplot.effects[an.effect];if(L.fx.off||!(am||ah)){if(ak){return this[ak](an.duration,an.complete)}else{return this.each(function(){if(an.complete){an.complete.call(this)}})}}function aj(au){var av=L(this),at=an.complete,aw=an.mode;function ar(){if(L.isFunction(at)){at.call(av[0])}if(L.isFunction(au)){au()}}if(av.is(":hidden")?aw==="hide":aw==="show"){ar()}else{am.call(av[0],an,ar)}}if(am){return al===false?this.each(aj):this.queue(al||"fx",aj)}else{return ah.call(this,{options:an,duration:an.duration,callback:an.complete,mode:an.mode})}}});var a=/up|down|vertical/,v=/up|left|vertical|horizontal/;L.jqplot.effects.effect.blind=function(aj,ao){var ak=L(this),ar=["position","top","bottom","left","right","height","width"],ap=L.jqplot.effects.setMode(ak,aj.mode||"hide"),au=aj.direction||"up",am=a.test(au),al=am?"height":"width",aq=am?"top":"left",aw=v.test(au),an={},av=ap==="show",ai,ah,at;if(ak.parent().is(".ui-effects-wrapper")){L.jqplot.effects.save(ak.parent(),ar)}else{L.jqplot.effects.save(ak,ar)}ak.show();at=parseInt(ak.css("top"),10);ai=L.jqplot.effects.createWrapper(ak).css({overflow:"hidden"});ah=am?ai[al]()+at:ai[al]();an[al]=av?String(ah):"0";if(!aw){ak.css(am?"bottom":"right",0).css(am?"top":"left","").css({position:"absolute"});an[aq]=av?"0":String(ah)}if(av){ai.css(al,0);if(!aw){ai.css(aq,ah)}}ai.animate(an,{duration:aj.duration,easing:aj.easing,queue:false,complete:function(){if(ap==="hide"){ak.hide()}L.jqplot.effects.restore(ak,ar);L.jqplot.effects.removeWrapper(ak);ao()}})}})(jQuery);
|
1 |
+
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
2 |
+
jsDate | (c) 2010-2013 Chris Leonello
|
3 |
*/(function(L){var u;L.fn.emptyForce=function(){for(var ah=0,ai;(ai=L(this)[ah])!=null;ah++){if(ai.nodeType===1){L.cleanData(ai.getElementsByTagName("*"))}if(L.jqplot.use_excanvas){ai.outerHTML=""}else{while(ai.firstChild){ai.removeChild(ai.firstChild)}}ai=null}return L(this)};L.fn.removeChildForce=function(ah){while(ah.firstChild){this.removeChildForce(ah.firstChild);ah.removeChild(ah.firstChild)}};L.fn.jqplot=function(){var ah=[];var aj=[];for(var ak=0,ai=arguments.length;ak<ai;ak++){if(L.isArray(arguments[ak])){ah.push(arguments[ak])}else{if(L.isPlainObject(arguments[ak])){aj.push(arguments[ak])}}}return this.each(function(an){var at,ar,aq=L(this),am=ah.length,al=aj.length,ap,ao;if(an<am){ap=ah[an]}else{ap=am?ah[am-1]:null}if(an<al){ao=aj[an]}else{ao=al?aj[al-1]:null}at=aq.attr("id");if(at===u){at="jqplot_target_"+L.jqplot.targetCounter++;aq.attr("id",at)}ar=L.jqplot(at,ap,ao);aq.data("jqplot",ar)})};L.jqplot=function(an,ak,ai){var aj=null,ah=null;if(arguments.length===3){aj=ak;ah=ai}else{if(arguments.length===2){if(L.isArray(ak)){aj=ak}else{if(L.isPlainObject(ak)){ah=ak}}}}if(aj===null&&ah!==null&&ah.data){aj=ah.data}var am=new R();L("#"+an).removeClass("jqplot-error");if(L.jqplot.config.catchErrors){try{am.init(an,aj,ah);am.draw();am.themeEngine.init.call(am);return am}catch(al){var ao=L.jqplot.config.errorMessage||al.message;L("#"+an).append('<div class="jqplot-error-message">'+ao+"</div>");L("#"+an).addClass("jqplot-error");document.getElementById(an).style.background=L.jqplot.config.errorBackground;document.getElementById(an).style.border=L.jqplot.config.errorBorder;document.getElementById(an).style.fontFamily=L.jqplot.config.errorFontFamily;document.getElementById(an).style.fontSize=L.jqplot.config.errorFontSize;document.getElementById(an).style.fontStyle=L.jqplot.config.errorFontStyle;document.getElementById(an).style.fontWeight=L.jqplot.config.errorFontWeight}}else{am.init(an,aj,ah);am.draw();am.themeEngine.init.call(am);return am}};L.jqplot.version="1.0.8";L.jqplot.revision="1250";L.jqplot.targetCounter=1;L.jqplot.CanvasManager=function(){if(typeof L.jqplot.CanvasManager.canvases=="undefined"){L.jqplot.CanvasManager.canvases=[];L.jqplot.CanvasManager.free=[]}var ah=[];this.getCanvas=function(){var ak;var aj=true;if(!L.jqplot.use_excanvas){for(var al=0,ai=L.jqplot.CanvasManager.canvases.length;al<ai;al++){if(L.jqplot.CanvasManager.free[al]===true){aj=false;ak=L.jqplot.CanvasManager.canvases[al];L.jqplot.CanvasManager.free[al]=false;ah.push(al);break}}}if(aj){ak=document.createElement("canvas");ah.push(L.jqplot.CanvasManager.canvases.length);L.jqplot.CanvasManager.canvases.push(ak);L.jqplot.CanvasManager.free.push(false)}return ak};this.initCanvas=function(ai){if(L.jqplot.use_excanvas){return window.G_vmlCanvasManager.initElement(ai)}return ai};this.freeAllCanvases=function(){for(var aj=0,ai=ah.length;aj<ai;aj++){this.freeCanvas(ah[aj])}ah=[]};this.freeCanvas=function(ai){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(L.jqplot.CanvasManager.canvases[ai]);L.jqplot.CanvasManager.canvases[ai]=null}else{var aj=L.jqplot.CanvasManager.canvases[ai];aj.getContext("2d").clearRect(0,0,aj.width,aj.height);L(aj).unbind().removeAttr("class").removeAttr("style");L(aj).css({left:"",top:"",position:""});aj.width=0;aj.height=0;L.jqplot.CanvasManager.free[ai]=true}}};L.jqplot.log=function(){if(window.console){window.console.log.apply(window.console,arguments)}};L.jqplot.config={addDomReference:false,enablePlugins:false,defaultHeight:300,defaultWidth:400,UTCAdjust:false,timezoneOffset:new Date(new Date().getTimezoneOffset()*60000),errorMessage:"",errorBackground:"",errorBorder:"",errorFontFamily:"",errorFontSize:"",errorFontStyle:"",errorFontWeight:"",catchErrors:false,defaultTickFormatString:"%.1f",defaultColors:["#4bb2c5","#EAA228","#c5b47f","#579575","#839557","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc","#c747a3","#cddf54","#FBD178","#26B4E3","#bd70c7"],defaultNegativeColors:["#498991","#C08840","#9F9274","#546D61","#646C4A","#6F6621","#6E3F5F","#4F64B0","#A89050","#C45923","#187399","#945381","#959E5C","#C7AF7B","#478396","#907294"],dashLength:4,gapLength:4,dotGapLength:2.5,srcLocation:"jqplot/src/",pluginLocation:"jqplot/src/plugins/"};L.jqplot.arrayMax=function(ah){return Math.max.apply(Math,ah)};L.jqplot.arrayMin=function(ah){return Math.min.apply(Math,ah)};L.jqplot.enablePlugins=L.jqplot.config.enablePlugins;L.jqplot.support_canvas=function(){if(typeof L.jqplot.support_canvas.result=="undefined"){L.jqplot.support_canvas.result=!!document.createElement("canvas").getContext}return L.jqplot.support_canvas.result};L.jqplot.support_canvas_text=function(){if(typeof L.jqplot.support_canvas_text.result=="undefined"){if(window.G_vmlCanvasManager!==u&&window.G_vmlCanvasManager._version>887){L.jqplot.support_canvas_text.result=true}else{L.jqplot.support_canvas_text.result=!!(document.createElement("canvas").getContext&&typeof document.createElement("canvas").getContext("2d").fillText=="function")}}return L.jqplot.support_canvas_text.result};L.jqplot.use_excanvas=((!L.support.boxModel||!L.support.objectAll||!$support.leadingWhitespace)&&!L.jqplot.support_canvas())?true:false;L.jqplot.preInitHooks=[];L.jqplot.postInitHooks=[];L.jqplot.preParseOptionsHooks=[];L.jqplot.postParseOptionsHooks=[];L.jqplot.preDrawHooks=[];L.jqplot.postDrawHooks=[];L.jqplot.preDrawSeriesHooks=[];L.jqplot.postDrawSeriesHooks=[];L.jqplot.preDrawLegendHooks=[];L.jqplot.addLegendRowHooks=[];L.jqplot.preSeriesInitHooks=[];L.jqplot.postSeriesInitHooks=[];L.jqplot.preParseSeriesOptionsHooks=[];L.jqplot.postParseSeriesOptionsHooks=[];L.jqplot.eventListenerHooks=[];L.jqplot.preDrawSeriesShadowHooks=[];L.jqplot.postDrawSeriesShadowHooks=[];L.jqplot.ElemContainer=function(){this._elem;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null}};L.jqplot.ElemContainer.prototype.createElement=function(ak,am,ai,aj,an){this._offsets=am;var ah=ai||"jqplot";var al=document.createElement(ak);this._elem=L(al);this._elem.addClass(ah);this._elem.css(aj);this._elem.attr(an);al=null;return this._elem};L.jqplot.ElemContainer.prototype.getWidth=function(){if(this._elem){return this._elem.outerWidth(true)}else{return null}};L.jqplot.ElemContainer.prototype.getHeight=function(){if(this._elem){return this._elem.outerHeight(true)}else{return null}};L.jqplot.ElemContainer.prototype.getPosition=function(){if(this._elem){return this._elem.position()}else{return{top:null,left:null,bottom:null,right:null}}};L.jqplot.ElemContainer.prototype.getTop=function(){return this.getPosition().top};L.jqplot.ElemContainer.prototype.getLeft=function(){return this.getPosition().left};L.jqplot.ElemContainer.prototype.getBottom=function(){return this._elem.css("bottom")};L.jqplot.ElemContainer.prototype.getRight=function(){return this._elem.css("right")};function w(ah){L.jqplot.ElemContainer.call(this);this.name=ah;this._series=[];this.show=false;this.tickRenderer=L.jqplot.AxisTickRenderer;this.tickOptions={};this.labelRenderer=L.jqplot.AxisLabelRenderer;this.labelOptions={};this.label=null;this.showLabel=true;this.min=null;this.max=null;this.autoscale=false;this.pad=1.2;this.padMax=null;this.padMin=null;this.ticks=[];this.numberTicks;this.tickInterval;this.renderer=L.jqplot.LinearAxisRenderer;this.rendererOptions={};this.showTicks=true;this.showTickMarks=true;this.showMinorTicks=true;this.drawMajorGridlines=true;this.drawMinorGridlines=false;this.drawMajorTickMarks=true;this.drawMinorTickMarks=true;this.useSeriesColor=false;this.borderWidth=null;this.borderColor=null;this.scaleToHiddenSeries=false;this._dataBounds={min:null,max:null};this._intervalStats=[];this._offsets={min:null,max:null};this._ticks=[];this._label=null;this.syncTicks=null;this.tickSpacing=75;this._min=null;this._max=null;this._tickInterval=null;this._numberTicks=null;this.__ticks=null;this._options={}}w.prototype=new L.jqplot.ElemContainer();w.prototype.constructor=w;w.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.tickOptions.axis=this.name;if(this.tickOptions.showMark==null){this.tickOptions.showMark=this.showTicks}if(this.tickOptions.showMark==null){this.tickOptions.showMark=this.showTickMarks}if(this.tickOptions.showLabel==null){this.tickOptions.showLabel=this.showTicks}if(this.label==null||this.label==""){this.showLabel=false}else{this.labelOptions.label=this.label}if(this.showLabel==false){this.labelOptions.show=false}if(this.pad==0){this.pad=1}if(this.padMax==0){this.padMax=1}if(this.padMin==0){this.padMin=1}if(this.padMax==null){this.padMax=(this.pad-1)/2+1}if(this.padMin==null){this.padMin=(this.pad-1)/2+1}this.pad=this.padMax+this.padMin-1;if(this.min!=null||this.max!=null){this.autoscale=false}if(this.syncTicks==null&&this.name.indexOf("y")>-1){this.syncTicks=true}else{if(this.syncTicks==null){this.syncTicks=false}}this.renderer.init.call(this,this.rendererOptions)};w.prototype.draw=function(ah,ai){if(this.__ticks){this.__ticks=null}return this.renderer.draw.call(this,ah,ai)};w.prototype.set=function(){this.renderer.set.call(this)};w.prototype.pack=function(ai,ah){if(this.show){this.renderer.pack.call(this,ai,ah)}if(this._min==null){this._min=this.min;this._max=this.max;this._tickInterval=this.tickInterval;this._numberTicks=this.numberTicks;this.__ticks=this._ticks}};w.prototype.reset=function(){this.renderer.reset.call(this)};w.prototype.resetScale=function(ah){L.extend(true,this,{min:null,max:null,numberTicks:null,tickInterval:null,_ticks:[],ticks:[]},ah);this.resetDataBounds()};w.prototype.resetDataBounds=function(){var ao=this._dataBounds;ao.min=null;ao.max=null;var ai,ap,am;var aj=(this.show)?true:false;for(var al=0;al<this._series.length;al++){ap=this._series[al];if(ap.show||this.scaleToHiddenSeries){am=ap._plotData;if(ap._type==="line"&&ap.renderer.bands.show&&this.name.charAt(0)!=="x"){am=[[0,ap.renderer.bands._min],[1,ap.renderer.bands._max]]}var ah=1,an=1;if(ap._type!=null&&ap._type=="ohlc"){ah=3;an=2}for(var ak=0,ai=am.length;ak<ai;ak++){if(this.name=="xaxis"||this.name=="x2axis"){if((am[ak][0]!=null&&am[ak][0]<ao.min)||ao.min==null){ao.min=am[ak][0]}if((am[ak][0]!=null&&am[ak][0]>ao.max)||ao.max==null){ao.max=am[ak][0]}}else{if((am[ak][ah]!=null&&am[ak][ah]<ao.min)||ao.min==null){ao.min=am[ak][ah]}if((am[ak][an]!=null&&am[ak][an]>ao.max)||ao.max==null){ao.max=am[ak][an]}}}if(aj&&ap.renderer.constructor!==L.jqplot.BarRenderer){aj=false}else{if(aj&&this._options.hasOwnProperty("forceTickAt0")&&this._options.forceTickAt0==false){aj=false}else{if(aj&&ap.renderer.constructor===L.jqplot.BarRenderer){if(ap.barDirection=="vertical"&&this.name!="xaxis"&&this.name!="x2axis"){if(this._options.pad!=null||this._options.padMin!=null){aj=false}}else{if(ap.barDirection=="horizontal"&&(this.name=="xaxis"||this.name=="x2axis")){if(this._options.pad!=null||this._options.padMin!=null){aj=false}}}}}}}}if(aj&&this.renderer.constructor===L.jqplot.LinearAxisRenderer&&ao.min>=0){this.padMin=1;this.forceTickAt0=true}};function q(ah){L.jqplot.ElemContainer.call(this);this.show=false;this.location="ne";this.labels=[];this.showLabels=true;this.showSwatches=true;this.placement="insideGrid";this.xoffset=0;this.yoffset=0;this.border;this.background;this.textColor;this.fontFamily;this.fontSize;this.rowSpacing="0.5em";this.renderer=L.jqplot.TableLegendRenderer;this.rendererOptions={};this.preDraw=false;this.marginTop=null;this.marginRight=null;this.marginBottom=null;this.marginLeft=null;this.escapeHtml=false;this._series=[];L.extend(true,this,ah)}q.prototype=new L.jqplot.ElemContainer();q.prototype.constructor=q;q.prototype.setOptions=function(ah){L.extend(true,this,ah);if(this.placement=="inside"){this.placement="insideGrid"}if(this.xoffset>0){if(this.placement=="insideGrid"){switch(this.location){case"nw":case"w":case"sw":if(this.marginLeft==null){this.marginLeft=this.xoffset+"px"}this.marginRight="0px";break;case"ne":case"e":case"se":default:if(this.marginRight==null){this.marginRight=this.xoffset+"px"}this.marginLeft="0px";break}}else{if(this.placement=="outside"){switch(this.location){case"nw":case"w":case"sw":if(this.marginRight==null){this.marginRight=this.xoffset+"px"}this.marginLeft="0px";break;case"ne":case"e":case"se":default:if(this.marginLeft==null){this.marginLeft=this.xoffset+"px"}this.marginRight="0px";break}}}this.xoffset=0}if(this.yoffset>0){if(this.placement=="outside"){switch(this.location){case"sw":case"s":case"se":if(this.marginTop==null){this.marginTop=this.yoffset+"px"}this.marginBottom="0px";break;case"ne":case"n":case"nw":default:if(this.marginBottom==null){this.marginBottom=this.yoffset+"px"}this.marginTop="0px";break}}else{if(this.placement=="insideGrid"){switch(this.location){case"sw":case"s":case"se":if(this.marginBottom==null){this.marginBottom=this.yoffset+"px"}this.marginTop="0px";break;case"ne":case"n":case"nw":default:if(this.marginTop==null){this.marginTop=this.yoffset+"px"}this.marginBottom="0px";break}}}this.yoffset=0}};q.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions)};q.prototype.draw=function(ai,aj){for(var ah=0;ah<L.jqplot.preDrawLegendHooks.length;ah++){L.jqplot.preDrawLegendHooks[ah].call(this,ai)}return this.renderer.draw.call(this,ai,aj)};q.prototype.pack=function(ah){this.renderer.pack.call(this,ah)};function y(ah){L.jqplot.ElemContainer.call(this);this.text=ah;this.show=true;this.fontFamily;this.fontSize;this.textAlign;this.textColor;this.renderer=L.jqplot.DivTitleRenderer;this.rendererOptions={};this.escapeHtml=false}y.prototype=new L.jqplot.ElemContainer();y.prototype.constructor=y;y.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions)};y.prototype.draw=function(ah){return this.renderer.draw.call(this,ah)};y.prototype.pack=function(){this.renderer.pack.call(this)};function S(ah){ah=ah||{};L.jqplot.ElemContainer.call(this);this.show=true;this.xaxis="xaxis";this._xaxis;this.yaxis="yaxis";this._yaxis;this.gridBorderWidth=2;this.renderer=L.jqplot.LineRenderer;this.rendererOptions={};this.data=[];this.gridData=[];this.label="";this.showLabel=true;this.color;this.negativeColor;this.lineWidth=2.5;this.lineJoin="round";this.lineCap="round";this.linePattern="solid";this.shadow=true;this.shadowAngle=45;this.shadowOffset=1.25;this.shadowDepth=3;this.shadowAlpha="0.1";this.breakOnNull=false;this.markerRenderer=L.jqplot.MarkerRenderer;this.markerOptions={};this.showLine=true;this.showMarker=true;this.index;this.fill=false;this.fillColor;this.fillAlpha;this.fillAndStroke=false;this.disableStack=false;this._stack=false;this.neighborThreshold=4;this.fillToZero=false;this.fillToValue=0;this.fillAxis="y";this.useNegativeColors=true;this._stackData=[];this._plotData=[];this._plotValues={x:[],y:[]};this._intervals={x:{},y:{}};this._prevPlotData=[];this._prevGridData=[];this._stackAxis="y";this._primaryAxis="_xaxis";this.canvas=new L.jqplot.GenericCanvas();this.shadowCanvas=new L.jqplot.GenericCanvas();this.plugins={};this._sumy=0;this._sumx=0;this._type=""}S.prototype=new L.jqplot.ElemContainer();S.prototype.constructor=S;S.prototype.init=function(ak,ao,am){this.index=ak;this.gridBorderWidth=ao;var an=this.data;var aj=[],al,ah;for(al=0,ah=an.length;al<ah;al++){if(!this.breakOnNull){if(an[al]==null||an[al][0]==null||an[al][1]==null){continue}else{aj.push(an[al])}}else{aj.push(an[al])}}this.data=aj;if(!this.color){this.color=am.colorGenerator.get(this.index)}if(!this.negativeColor){this.negativeColor=am.negativeColorGenerator.get(this.index)}if(!this.fillColor){this.fillColor=this.color}if(this.fillAlpha){var ai=L.jqplot.normalize2rgb(this.fillColor);var ai=L.jqplot.getColorComponents(ai);this.fillColor="rgba("+ai[0]+","+ai[1]+","+ai[2]+","+this.fillAlpha+")"}if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions,am);this.markerRenderer=new this.markerRenderer();if(!this.markerOptions.color){this.markerOptions.color=this.color}if(this.markerOptions.show==null){this.markerOptions.show=this.showMarker}this.showMarker=this.markerOptions.show;this.markerRenderer.init(this.markerOptions)};S.prototype.draw=function(an,ak,am){var ai=(ak==u)?{}:ak;an=(an==u)?this.canvas._ctx:an;var ah,al,aj;for(ah=0;ah<L.jqplot.preDrawSeriesHooks.length;ah++){L.jqplot.preDrawSeriesHooks[ah].call(this,an,ai)}if(this.show){this.renderer.setGridData.call(this,am);if(!ai.preventJqPlotSeriesDrawTrigger){L(an.canvas).trigger("jqplotSeriesDraw",[this.data,this.gridData])}al=[];if(ai.data){al=ai.data}else{if(!this._stack){al=this.data}else{al=this._plotData}}aj=ai.gridData||this.renderer.makeGridData.call(this,al,am);if(this._type==="line"&&this.renderer.smooth&&this.renderer._smoothedData.length){aj=this.renderer._smoothedData}this.renderer.draw.call(this,an,aj,ai,am)}for(ah=0;ah<L.jqplot.postDrawSeriesHooks.length;ah++){L.jqplot.postDrawSeriesHooks[ah].call(this,an,ai,am)}an=ak=am=ah=al=aj=null};S.prototype.drawShadow=function(an,ak,am){var ai=(ak==u)?{}:ak;an=(an==u)?this.shadowCanvas._ctx:an;var ah,al,aj;for(ah=0;ah<L.jqplot.preDrawSeriesShadowHooks.length;ah++){L.jqplot.preDrawSeriesShadowHooks[ah].call(this,an,ai)}if(this.shadow){this.renderer.setGridData.call(this,am);al=[];if(ai.data){al=ai.data}else{if(!this._stack){al=this.data}else{al=this._plotData}}aj=ai.gridData||this.renderer.makeGridData.call(this,al,am);this.renderer.drawShadow.call(this,an,aj,ai,am)}for(ah=0;ah<L.jqplot.postDrawSeriesShadowHooks.length;ah++){L.jqplot.postDrawSeriesShadowHooks[ah].call(this,an,ai)}an=ak=am=ah=al=aj=null};S.prototype.toggleDisplay=function(ai,ak){var ah,aj;if(ai.data.series){ah=ai.data.series}else{ah=this}if(ai.data.speed){aj=ai.data.speed}if(aj){if(ah.canvas._elem.is(":hidden")||!ah.show){ah.show=true;ah.canvas._elem.removeClass("jqplot-series-hidden");if(ah.shadowCanvas._elem){ah.shadowCanvas._elem.fadeIn(aj)}ah.canvas._elem.fadeIn(aj,ak);ah.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-"+ah.index).fadeIn(aj)}else{ah.show=false;ah.canvas._elem.addClass("jqplot-series-hidden");if(ah.shadowCanvas._elem){ah.shadowCanvas._elem.fadeOut(aj)}ah.canvas._elem.fadeOut(aj,ak);ah.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-"+ah.index).fadeOut(aj)}}else{if(ah.canvas._elem.is(":hidden")||!ah.show){ah.show=true;ah.canvas._elem.removeClass("jqplot-series-hidden");if(ah.shadowCanvas._elem){ah.shadowCanvas._elem.show()}ah.canvas._elem.show(0,ak);ah.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-"+ah.index).show()}else{ah.show=false;ah.canvas._elem.addClass("jqplot-series-hidden");if(ah.shadowCanvas._elem){ah.shadowCanvas._elem.hide()}ah.canvas._elem.hide(0,ak);ah.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-"+ah.index).hide()}}};function M(){L.jqplot.ElemContainer.call(this);this.drawGridlines=true;this.gridLineColor="#cccccc";this.gridLineWidth=1;this.background="#fffdf6";this.borderColor="#999999";this.borderWidth=2;this.drawBorder=true;this.shadow=true;this.shadowAngle=45;this.shadowOffset=1.5;this.shadowWidth=3;this.shadowDepth=3;this.shadowColor=null;this.shadowAlpha="0.07";this._left;this._top;this._right;this._bottom;this._width;this._height;this._axes=[];this.renderer=L.jqplot.CanvasGridRenderer;this.rendererOptions={};this._offsets={top:null,bottom:null,left:null,right:null}}M.prototype=new L.jqplot.ElemContainer();M.prototype.constructor=M;M.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions)};M.prototype.createElement=function(ah,ai){this._offsets=ah;return this.renderer.createElement.call(this,ai)};M.prototype.draw=function(){this.renderer.draw.call(this)};L.jqplot.GenericCanvas=function(){L.jqplot.ElemContainer.call(this);this._ctx};L.jqplot.GenericCanvas.prototype=new L.jqplot.ElemContainer();L.jqplot.GenericCanvas.prototype.constructor=L.jqplot.GenericCanvas;L.jqplot.GenericCanvas.prototype.createElement=function(al,aj,ai,am){this._offsets=al;var ah="jqplot";if(aj!=u){ah=aj}var ak;ak=am.canvasManager.getCanvas();if(ai!=null){this._plotDimensions=ai}ak.width=this._plotDimensions.width-this._offsets.left-this._offsets.right;ak.height=this._plotDimensions.height-this._offsets.top-this._offsets.bottom;this._elem=L(ak);this._elem.css({position:"absolute",left:this._offsets.left,top:this._offsets.top});this._elem.addClass(ah);ak=am.canvasManager.initCanvas(ak);ak=null;return this._elem};L.jqplot.GenericCanvas.prototype.setContext=function(){this._ctx=this._elem.get(0).getContext("2d");return this._ctx};L.jqplot.GenericCanvas.prototype.resetCanvas=function(){if(this._elem){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}this._elem.emptyForce()}this._ctx=null};L.jqplot.HooksManager=function(){this.hooks=[];this.args=[]};L.jqplot.HooksManager.prototype.addOnce=function(ak,ai){ai=ai||[];var al=false;for(var aj=0,ah=this.hooks.length;aj<ah;aj++){if(this.hooks[aj]==ak){al=true}}if(!al){this.hooks.push(ak);this.args.push(ai)}};L.jqplot.HooksManager.prototype.add=function(ai,ah){ah=ah||[];this.hooks.push(ai);this.args.push(ah)};L.jqplot.EventListenerManager=function(){this.hooks=[]};L.jqplot.EventListenerManager.prototype.addOnce=function(al,ak){var am=false,aj,ai;for(var ai=0,ah=this.hooks.length;ai<ah;ai++){aj=this.hooks[ai];if(aj[0]==al&&aj[1]==ak){am=true}}if(!am){this.hooks.push([al,ak])}};L.jqplot.EventListenerManager.prototype.add=function(ai,ah){this.hooks.push([ai,ah])};var U=["yMidAxis","xaxis","yaxis","x2axis","y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis"];function R(){this.animate=false;this.animateReplot=false;this.axes={xaxis:new w("xaxis"),yaxis:new w("yaxis"),x2axis:new w("x2axis"),y2axis:new w("y2axis"),y3axis:new w("y3axis"),y4axis:new w("y4axis"),y5axis:new w("y5axis"),y6axis:new w("y6axis"),y7axis:new w("y7axis"),y8axis:new w("y8axis"),y9axis:new w("y9axis"),yMidAxis:new w("yMidAxis")};this.baseCanvas=new L.jqplot.GenericCanvas();this.captureRightClick=false;this.data=[];this.dataRenderer;this.dataRendererOptions;this.defaults={axesDefaults:{},axes:{xaxis:{},yaxis:{},x2axis:{},y2axis:{},y3axis:{},y4axis:{},y5axis:{},y6axis:{},y7axis:{},y8axis:{},y9axis:{},yMidAxis:{}},seriesDefaults:{},series:[]};this.defaultAxisStart=1;this.drawIfHidden=false;this.eventCanvas=new L.jqplot.GenericCanvas();this.fillBetween={series1:null,series2:null,color:null,baseSeries:0,fill:true};this.fontFamily;this.fontSize;this.grid=new M();this.legend=new q();this.noDataIndicator={show:false,indicator:"Loading Data...",axes:{xaxis:{min:0,max:10,tickInterval:2,show:true},yaxis:{min:0,max:12,tickInterval:3,show:true}}};this.negativeSeriesColors=L.jqplot.config.defaultNegativeColors;this.options={};this.previousSeriesStack=[];this.plugins={};this.series=[];this.seriesStack=[];this.seriesColors=L.jqplot.config.defaultColors;this.sortData=true;this.stackSeries=false;this.syncXTicks=true;this.syncYTicks=true;this.target=null;this.targetId=null;this.textColor;this.title=new y();this._drawCount=0;this._sumy=0;this._sumx=0;this._stackData=[];this._plotData=[];this._width=null;this._height=null;this._plotDimensions={height:null,width:null};this._gridPadding={top:null,right:null,bottom:null,left:null};this._defaultGridPadding={top:10,right:10,bottom:23,left:10};this._addDomReference=L.jqplot.config.addDomReference;this.preInitHooks=new L.jqplot.HooksManager();this.postInitHooks=new L.jqplot.HooksManager();this.preParseOptionsHooks=new L.jqplot.HooksManager();this.postParseOptionsHooks=new L.jqplot.HooksManager();this.preDrawHooks=new L.jqplot.HooksManager();this.postDrawHooks=new L.jqplot.HooksManager();this.preDrawSeriesHooks=new L.jqplot.HooksManager();this.postDrawSeriesHooks=new L.jqplot.HooksManager();this.preDrawLegendHooks=new L.jqplot.HooksManager();this.addLegendRowHooks=new L.jqplot.HooksManager();this.preSeriesInitHooks=new L.jqplot.HooksManager();this.postSeriesInitHooks=new L.jqplot.HooksManager();this.preParseSeriesOptionsHooks=new L.jqplot.HooksManager();this.postParseSeriesOptionsHooks=new L.jqplot.HooksManager();this.eventListenerHooks=new L.jqplot.EventListenerManager();this.preDrawSeriesShadowHooks=new L.jqplot.HooksManager();this.postDrawSeriesShadowHooks=new L.jqplot.HooksManager();this.colorGenerator=new L.jqplot.ColorGenerator();this.negativeColorGenerator=new L.jqplot.ColorGenerator();this.canvasManager=new L.jqplot.CanvasManager();this.themeEngine=new L.jqplot.ThemeEngine();var aj=0;this.init=function(av,ar,ay){ay=ay||{};for(var at=0;at<L.jqplot.preInitHooks.length;at++){L.jqplot.preInitHooks[at].call(this,av,ar,ay)}for(var at=0;at<this.preInitHooks.hooks.length;at++){this.preInitHooks.hooks[at].call(this,av,ar,ay)}this.targetId="#"+av;this.target=L("#"+av);if(this._addDomReference){this.target.data("jqplot",this)}this.target.removeClass("jqplot-error");if(!this.target.get(0)){throw new Error("No plot target specified")}if(this.target.css("position")=="static"){this.target.css("position","relative")}if(!this.target.hasClass("jqplot-target")){this.target.addClass("jqplot-target")}if(!this.target.height()){var au;if(ay&&ay.height){au=parseInt(ay.height,10)}else{if(this.target.attr("data-height")){au=parseInt(this.target.attr("data-height"),10)}else{au=parseInt(L.jqplot.config.defaultHeight,10)}}this._height=au;this.target.css("height",au+"px")}else{this._height=au=this.target.height()}if(!this.target.width()){var aw;if(ay&&ay.width){aw=parseInt(ay.width,10)}else{if(this.target.attr("data-width")){aw=parseInt(this.target.attr("data-width"),10)}else{aw=parseInt(L.jqplot.config.defaultWidth,10)}}this._width=aw;this.target.css("width",aw+"px")}else{this._width=aw=this.target.width()}for(var at=0,ap=U.length;at<ap;at++){this.axes[U[at]]=new w(U[at])}this._plotDimensions.height=this._height;this._plotDimensions.width=this._width;this.grid._plotDimensions=this._plotDimensions;this.title._plotDimensions=this._plotDimensions;this.baseCanvas._plotDimensions=this._plotDimensions;this.eventCanvas._plotDimensions=this._plotDimensions;this.legend._plotDimensions=this._plotDimensions;if(this._height<=0||this._width<=0||!this._height||!this._width){throw new Error("Canvas dimension not set")}if(ay.dataRenderer&&L.isFunction(ay.dataRenderer)){if(ay.dataRendererOptions){this.dataRendererOptions=ay.dataRendererOptions}this.dataRenderer=ay.dataRenderer;ar=this.dataRenderer(ar,this,this.dataRendererOptions)}if(ay.noDataIndicator&&L.isPlainObject(ay.noDataIndicator)){L.extend(true,this.noDataIndicator,ay.noDataIndicator)}if(ar==null||L.isArray(ar)==false||ar.length==0||L.isArray(ar[0])==false||ar[0].length==0){if(this.noDataIndicator.show==false){throw new Error("No data specified")}else{for(var al in this.noDataIndicator.axes){for(var an in this.noDataIndicator.axes[al]){this.axes[al][an]=this.noDataIndicator.axes[al][an]}}this.postDrawHooks.add(function(){var aD=this.eventCanvas.getHeight();var aA=this.eventCanvas.getWidth();var az=L('<div class="jqplot-noData-container" style="position:absolute;"></div>');this.target.append(az);az.height(aD);az.width(aA);az.css("top",this.eventCanvas._offsets.top);az.css("left",this.eventCanvas._offsets.left);var aC=L('<div class="jqplot-noData-contents" style="text-align:center; position:relative; margin-left:auto; margin-right:auto;"></div>');az.append(aC);aC.html(this.noDataIndicator.indicator);var aB=aC.height();var ax=aC.width();aC.height(aB);aC.width(ax);aC.css("top",(aD-aB)/2+"px")})}}this.data=L.extend(true,[],ar);this.parseOptions(ay);if(this.textColor){this.target.css("color",this.textColor)}if(this.fontFamily){this.target.css("font-family",this.fontFamily)}if(this.fontSize){this.target.css("font-size",this.fontSize)}this.title.init();this.legend.init();this._sumy=0;this._sumx=0;this.computePlotData();for(var at=0;at<this.series.length;at++){this.seriesStack.push(at);this.previousSeriesStack.push(at);this.series[at].shadowCanvas._plotDimensions=this._plotDimensions;this.series[at].canvas._plotDimensions=this._plotDimensions;for(var aq=0;aq<L.jqplot.preSeriesInitHooks.length;aq++){L.jqplot.preSeriesInitHooks[aq].call(this.series[at],av,this.data,this.options.seriesDefaults,this.options.series[at],this)}for(var aq=0;aq<this.preSeriesInitHooks.hooks.length;aq++){this.preSeriesInitHooks.hooks[aq].call(this.series[at],av,this.data,this.options.seriesDefaults,this.options.series[at],this)}this.series[at]._plotDimensions=this._plotDimensions;this.series[at].init(at,this.grid.borderWidth,this);for(var aq=0;aq<L.jqplot.postSeriesInitHooks.length;aq++){L.jqplot.postSeriesInitHooks[aq].call(this.series[at],av,this.data,this.options.seriesDefaults,this.options.series[at],this)}for(var aq=0;aq<this.postSeriesInitHooks.hooks.length;aq++){this.postSeriesInitHooks.hooks[aq].call(this.series[at],av,this.data,this.options.seriesDefaults,this.options.series[at],this)}this._sumy+=this.series[at]._sumy;this._sumx+=this.series[at]._sumx}var am,ao;for(var at=0,ap=U.length;at<ap;at++){am=U[at];ao=this.axes[am];ao._plotDimensions=this._plotDimensions;ao.init();if(this.axes[am].borderColor==null){if(am.charAt(0)!=="x"&&ao.useSeriesColor===true&&ao.show){ao.borderColor=ao._series[0].color}else{ao.borderColor=this.grid.borderColor}}}if(this.sortData){ah(this.series)}this.grid.init();this.grid._axes=this.axes;this.legend._series=this.series;for(var at=0;at<L.jqplot.postInitHooks.length;at++){L.jqplot.postInitHooks[at].call(this,av,this.data,ay)}for(var at=0;at<this.postInitHooks.hooks.length;at++){this.postInitHooks.hooks[at].call(this,av,this.data,ay)}};this.resetAxesScale=function(aq,am){var ao=am||{};var ap=aq||this.axes;if(ap===true){ap=this.axes}if(L.isArray(ap)){for(var an=0;an<ap.length;an++){this.axes[ap[an]].resetScale(ao[ap[an]])}}else{if(typeof(ap)==="object"){for(var al in ap){this.axes[al].resetScale(ao[al])}}}};this.reInitialize=function(au,al){var ay=L.extend(true,{},this.options,al);var aw=this.targetId.substr(1);var ar=(au==null)?this.data:au;for(var av=0;av<L.jqplot.preInitHooks.length;av++){L.jqplot.preInitHooks[av].call(this,aw,ar,ay)}for(var av=0;av<this.preInitHooks.hooks.length;av++){this.preInitHooks.hooks[av].call(this,aw,ar,ay)}this._height=this.target.height();this._width=this.target.width();if(this._height<=0||this._width<=0||!this._height||!this._width){throw new Error("Target dimension not set")}this._plotDimensions.height=this._height;this._plotDimensions.width=this._width;this.grid._plotDimensions=this._plotDimensions;this.title._plotDimensions=this._plotDimensions;this.baseCanvas._plotDimensions=this._plotDimensions;this.eventCanvas._plotDimensions=this._plotDimensions;this.legend._plotDimensions=this._plotDimensions;var am,ax,at,ao;for(var av=0,aq=U.length;av<aq;av++){am=U[av];ao=this.axes[am];ax=ao._ticks;for(var at=0,ap=ax.length;at<ap;at++){var an=ax[at]._elem;if(an){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(an.get(0))}an.emptyForce();an=null;ax._elem=null}}ax=null;delete ao.ticks;delete ao._ticks;this.axes[am]=new w(am);this.axes[am]._plotWidth=this._width;this.axes[am]._plotHeight=this._height}if(au){if(ay.dataRenderer&&L.isFunction(ay.dataRenderer)){if(ay.dataRendererOptions){this.dataRendererOptions=ay.dataRendererOptions}this.dataRenderer=ay.dataRenderer;au=this.dataRenderer(au,this,this.dataRendererOptions)}this.data=L.extend(true,[],au)}if(al){this.parseOptions(ay)}this.title._plotWidth=this._width;if(this.textColor){this.target.css("color",this.textColor)}if(this.fontFamily){this.target.css("font-family",this.fontFamily)}if(this.fontSize){this.target.css("font-size",this.fontSize)}this.title.init();this.legend.init();this._sumy=0;this._sumx=0;this.seriesStack=[];this.previousSeriesStack=[];this.computePlotData();for(var av=0,aq=this.series.length;av<aq;av++){this.seriesStack.push(av);this.previousSeriesStack.push(av);this.series[av].shadowCanvas._plotDimensions=this._plotDimensions;this.series[av].canvas._plotDimensions=this._plotDimensions;for(var at=0;at<L.jqplot.preSeriesInitHooks.length;at++){L.jqplot.preSeriesInitHooks[at].call(this.series[av],aw,this.data,this.options.seriesDefaults,this.options.series[av],this)}for(var at=0;at<this.preSeriesInitHooks.hooks.length;at++){this.preSeriesInitHooks.hooks[at].call(this.series[av],aw,this.data,this.options.seriesDefaults,this.options.series[av],this)}this.series[av]._plotDimensions=this._plotDimensions;this.series[av].init(av,this.grid.borderWidth,this);for(var at=0;at<L.jqplot.postSeriesInitHooks.length;at++){L.jqplot.postSeriesInitHooks[at].call(this.series[av],aw,this.data,this.options.seriesDefaults,this.options.series[av],this)}for(var at=0;at<this.postSeriesInitHooks.hooks.length;at++){this.postSeriesInitHooks.hooks[at].call(this.series[av],aw,this.data,this.options.seriesDefaults,this.options.series[av],this)}this._sumy+=this.series[av]._sumy;this._sumx+=this.series[av]._sumx}for(var av=0,aq=U.length;av<aq;av++){am=U[av];ao=this.axes[am];ao._plotDimensions=this._plotDimensions;ao.init();if(ao.borderColor==null){if(am.charAt(0)!=="x"&&ao.useSeriesColor===true&&ao.show){ao.borderColor=ao._series[0].color}else{ao.borderColor=this.grid.borderColor}}}if(this.sortData){ah(this.series)}this.grid.init();this.grid._axes=this.axes;this.legend._series=this.series;for(var av=0,aq=L.jqplot.postInitHooks.length;av<aq;av++){L.jqplot.postInitHooks[av].call(this,aw,this.data,ay)}for(var av=0,aq=this.postInitHooks.hooks.length;av<aq;av++){this.postInitHooks.hooks[av].call(this,aw,this.data,ay)}};this.quickInit=function(){this._height=this.target.height();this._width=this.target.width();if(this._height<=0||this._width<=0||!this._height||!this._width){throw new Error("Target dimension not set")}this._plotDimensions.height=this._height;this._plotDimensions.width=this._width;this.grid._plotDimensions=this._plotDimensions;this.title._plotDimensions=this._plotDimensions;this.baseCanvas._plotDimensions=this._plotDimensions;this.eventCanvas._plotDimensions=this._plotDimensions;this.legend._plotDimensions=this._plotDimensions;for(var aq in this.axes){this.axes[aq]._plotWidth=this._width;this.axes[aq]._plotHeight=this._height}this.title._plotWidth=this._width;if(this.textColor){this.target.css("color",this.textColor)}if(this.fontFamily){this.target.css("font-family",this.fontFamily)}if(this.fontSize){this.target.css("font-size",this.fontSize)}this._sumy=0;this._sumx=0;this.computePlotData();for(var ao=0;ao<this.series.length;ao++){if(this.series[ao]._type==="line"&&this.series[ao].renderer.bands.show){this.series[ao].renderer.initBands.call(this.series[ao],this.series[ao].renderer.options,this)}this.series[ao]._plotDimensions=this._plotDimensions;this.series[ao].canvas._plotDimensions=this._plotDimensions;this._sumy+=this.series[ao]._sumy;this._sumx+=this.series[ao]._sumx}var am;for(var al=0;al<12;al++){am=U[al];var an=this.axes[am]._ticks;for(var ao=0;ao<an.length;ao++){var ap=an[ao]._elem;if(ap){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(ap.get(0))}ap.emptyForce();ap=null;an._elem=null}}an=null;this.axes[am]._plotDimensions=this._plotDimensions;this.axes[am]._ticks=[]}if(this.sortData){ah(this.series)}this.grid._axes=this.axes;this.legend._series=this.series};function ah(ap){var au,av,aw,al,at;for(var aq=0;aq<ap.length;aq++){var am;var ar=[ap[aq].data,ap[aq]._stackData,ap[aq]._plotData,ap[aq]._prevPlotData];for(var an=0;an<4;an++){am=true;au=ar[an];if(ap[aq]._stackAxis=="x"){for(var ao=0;ao<au.length;ao++){if(typeof(au[ao][1])!="number"){am=false;break}}if(am){au.sort(function(ay,ax){return ay[1]-ax[1]})}}else{for(var ao=0;ao<au.length;ao++){if(typeof(au[ao][0])!="number"){am=false;break}}if(am){au.sort(function(ay,ax){return ay[0]-ax[0]})}}}}}this.computePlotData=function(){this._plotData=[];this._stackData=[];var at,au,ao;for(au=0,ao=this.series.length;au<ao;au++){at=this.series[au];this._plotData.push([]);this._stackData.push([]);var am=at.data;this._plotData[au]=L.extend(true,[],am);this._stackData[au]=L.extend(true,[],am);at._plotData=this._plotData[au];at._stackData=this._stackData[au];var ax={x:[],y:[]};if(this.stackSeries&&!at.disableStack){at._stack=true;var av=(at._stackAxis==="x")?0:1;for(var ap=0,al=am.length;ap<al;ap++){var aw=am[ap][av];if(aw==null){aw=0}this._plotData[au][ap][av]=aw;this._stackData[au][ap][av]=aw;if(au>0){for(var aq=au;aq--;){var an=this._plotData[aq][ap][av];if(aw*an>=0){this._plotData[au][ap][av]+=an;this._stackData[au][ap][av]+=an;break}}}}}else{for(var ar=0;ar<at.data.length;ar++){ax.x.push(at.data[ar][0]);ax.y.push(at.data[ar][1])}this._stackData.push(at.data);this.series[au]._stackData=at.data;this._plotData.push(at.data);at._plotData=at.data;at._plotValues=ax}if(au>0){at._prevPlotData=this.series[au-1]._plotData}at._sumy=0;at._sumx=0;for(ar=at.data.length-1;ar>-1;ar--){at._sumy+=at.data[ar][1];at._sumx+=at.data[ar][0]}}};this.populatePlotData=function(au,av){this._plotData=[];this._stackData=[];au._stackData=[];au._plotData=[];var ay={x:[],y:[]};if(this.stackSeries&&!au.disableStack){au._stack=true;var ax=(au._stackAxis==="x")?0:1;var az=L.extend(true,[],au.data);var aA=L.extend(true,[],au.data);var an,am,ao,aw,al;for(var ar=0;ar<av;ar++){var ap=this.series[ar].data;for(var aq=0;aq<ap.length;aq++){ao=ap[aq];an=(ao[0]!=null)?ao[0]:0;am=(ao[1]!=null)?ao[1]:0;az[aq][0]+=an;az[aq][1]+=am;aw=(ax)?am:an;if(au.data[aq][ax]*aw>=0){aA[aq][ax]+=aw}}}for(var at=0;at<aA.length;at++){ay.x.push(aA[at][0]);ay.y.push(aA[at][1])}this._plotData.push(aA);this._stackData.push(az);au._stackData=az;au._plotData=aA;au._plotValues=ay}else{for(var at=0;at<au.data.length;at++){ay.x.push(au.data[at][0]);ay.y.push(au.data[at][1])}this._stackData.push(au.data);this.series[av]._stackData=au.data;this._plotData.push(au.data);au._plotData=au.data;au._plotValues=ay}if(av>0){au._prevPlotData=this.series[av-1]._plotData}au._sumy=0;au._sumx=0;for(at=au.data.length-1;at>-1;at--){au._sumy+=au.data[at][1];au._sumx+=au.data[at][0]}};this.getNextSeriesColor=(function(am){var al=0;var an=am.seriesColors;return function(){if(al<an.length){return an[al++]}else{al=0;return an[al++]}}})(this);this.parseOptions=function(ay){for(var at=0;at<this.preParseOptionsHooks.hooks.length;at++){this.preParseOptionsHooks.hooks[at].call(this,ay)}for(var at=0;at<L.jqplot.preParseOptionsHooks.length;at++){L.jqplot.preParseOptionsHooks[at].call(this,ay)}this.options=L.extend(true,{},this.defaults,ay);var am=this.options;this.animate=am.animate;this.animateReplot=am.animateReplot;this.stackSeries=am.stackSeries;if(L.isPlainObject(am.fillBetween)){var ax=["series1","series2","color","baseSeries","fill"],au;for(var at=0,aq=ax.length;at<aq;at++){au=ax[at];if(am.fillBetween[au]!=null){this.fillBetween[au]=am.fillBetween[au]}}}if(am.seriesColors){this.seriesColors=am.seriesColors}if(am.negativeSeriesColors){this.negativeSeriesColors=am.negativeSeriesColors}if(am.captureRightClick){this.captureRightClick=am.captureRightClick}this.defaultAxisStart=(ay&&ay.defaultAxisStart!=null)?ay.defaultAxisStart:this.defaultAxisStart;this.colorGenerator.setColors(this.seriesColors);this.negativeColorGenerator.setColors(this.negativeSeriesColors);L.extend(true,this._gridPadding,am.gridPadding);this.sortData=(am.sortData!=null)?am.sortData:this.sortData;for(var at=0;at<12;at++){var an=U[at];var ap=this.axes[an];ap._options=L.extend(true,{},am.axesDefaults,am.axes[an]);L.extend(true,ap,am.axesDefaults,am.axes[an]);ap._plotWidth=this._width;ap._plotHeight=this._height}var aw=function(aD,aB,aE){var aA=[];var aC,az;aB=aB||"vertical";if(!L.isArray(aD[0])){for(aC=0,az=aD.length;aC<az;aC++){if(aB=="vertical"){aA.push([aE+aC,aD[aC]])}else{aA.push([aD[aC],aE+aC])}}}else{L.extend(true,aA,aD)}return aA};var av=0;this.series=[];for(var at=0;at<this.data.length;at++){var al=L.extend(true,{index:at},{seriesColors:this.seriesColors,negativeSeriesColors:this.negativeSeriesColors},this.options.seriesDefaults,this.options.series[at],{rendererOptions:{animation:{show:this.animate}}});var ax=new S(al);for(var ar=0;ar<L.jqplot.preParseSeriesOptionsHooks.length;ar++){L.jqplot.preParseSeriesOptionsHooks[ar].call(ax,this.options.seriesDefaults,this.options.series[at])}for(var ar=0;ar<this.preParseSeriesOptionsHooks.hooks.length;ar++){this.preParseSeriesOptionsHooks.hooks[ar].call(ax,this.options.seriesDefaults,this.options.series[at])}L.extend(true,ax,al);var ao="vertical";if(ax.renderer===L.jqplot.BarRenderer&&ax.rendererOptions&&ax.rendererOptions.barDirection=="horizontal"){ao="horizontal";ax._stackAxis="x";ax._primaryAxis="_yaxis"}ax.data=aw(this.data[at],ao,this.defaultAxisStart);switch(ax.xaxis){case"xaxis":ax._xaxis=this.axes.xaxis;break;case"x2axis":ax._xaxis=this.axes.x2axis;break;default:break}ax._yaxis=this.axes[ax.yaxis];ax._xaxis._series.push(ax);ax._yaxis._series.push(ax);if(ax.show){ax._xaxis.show=true;ax._yaxis.show=true}else{if(ax._xaxis.scaleToHiddenSeries){ax._xaxis.show=true}if(ax._yaxis.scaleToHiddenSeries){ax._yaxis.show=true}}if(!ax.label){ax.label="Series "+(at+1).toString()}this.series.push(ax);for(var ar=0;ar<L.jqplot.postParseSeriesOptionsHooks.length;ar++){L.jqplot.postParseSeriesOptionsHooks[ar].call(this.series[at],this.options.seriesDefaults,this.options.series[at])}for(var ar=0;ar<this.postParseSeriesOptionsHooks.hooks.length;ar++){this.postParseSeriesOptionsHooks.hooks[ar].call(this.series[at],this.options.seriesDefaults,this.options.series[at])}}L.extend(true,this.grid,this.options.grid);for(var at=0,aq=U.length;at<aq;at++){var an=U[at];var ap=this.axes[an];if(ap.borderWidth==null){ap.borderWidth=this.grid.borderWidth}}if(typeof this.options.title=="string"){this.title.text=this.options.title}else{if(typeof this.options.title=="object"){L.extend(true,this.title,this.options.title)}}this.title._plotWidth=this._width;this.legend.setOptions(this.options.legend);for(var at=0;at<L.jqplot.postParseOptionsHooks.length;at++){L.jqplot.postParseOptionsHooks[at].call(this,ay)}for(var at=0;at<this.postParseOptionsHooks.hooks.length;at++){this.postParseOptionsHooks.hooks[at].call(this,ay)}};this.destroy=function(){this.canvasManager.freeAllCanvases();if(this.eventCanvas&&this.eventCanvas._elem){this.eventCanvas._elem.unbind()}this.target.empty();this.target[0].innerHTML=""};this.replot=function(am){var an=am||{};var ap=an.data||null;var al=(an.clear===false)?false:true;var ao=an.resetAxes||false;delete an.data;delete an.clear;delete an.resetAxes;this.target.trigger("jqplotPreReplot");if(al){this.destroy()}if(ap||!L.isEmptyObject(an)){this.reInitialize(ap,an)}else{this.quickInit()}if(ao){this.resetAxesScale(ao,an.axes)}this.draw();this.target.trigger("jqplotPostReplot")};this.redraw=function(al){al=(al!=null)?al:true;this.target.trigger("jqplotPreRedraw");if(al){this.canvasManager.freeAllCanvases();this.eventCanvas._elem.unbind();this.target.empty()}for(var an in this.axes){this.axes[an]._ticks=[]}this.computePlotData();this._sumy=0;this._sumx=0;for(var am=0,ao=this.series.length;am<ao;am++){this._sumy+=this.series[am]._sumy;this._sumx+=this.series[am]._sumx}this.draw();this.target.trigger("jqplotPostRedraw")};this.draw=function(){if(this.drawIfHidden||this.target.is(":visible")){this.target.trigger("jqplotPreDraw");var aH,aF,aE,ao;for(aH=0,aE=L.jqplot.preDrawHooks.length;aH<aE;aH++){L.jqplot.preDrawHooks[aH].call(this)}for(aH=0,aE=this.preDrawHooks.hooks.length;aH<aE;aH++){this.preDrawHooks.hooks[aH].apply(this,this.preDrawSeriesHooks.args[aH])}this.target.append(this.baseCanvas.createElement({left:0,right:0,top:0,bottom:0},"jqplot-base-canvas",null,this));this.baseCanvas.setContext();this.target.append(this.title.draw());this.title.pack({top:0,left:0});var aL=this.legend.draw({},this);var al={top:0,left:0,bottom:0,right:0};if(this.legend.placement=="outsideGrid"){this.target.append(aL);switch(this.legend.location){case"n":al.top+=this.legend.getHeight();break;case"s":al.bottom+=this.legend.getHeight();break;case"ne":case"e":case"se":al.right+=this.legend.getWidth();break;case"nw":case"w":case"sw":al.left+=this.legend.getWidth();break;default:al.right+=this.legend.getWidth();break}aL=aL.detach()}var ar=this.axes;var aM;for(aH=0;aH<12;aH++){aM=U[aH];this.target.append(ar[aM].draw(this.baseCanvas._ctx,this));ar[aM].set()}if(ar.yaxis.show){al.left+=ar.yaxis.getWidth()}var aG=["y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis"];var az=[0,0,0,0,0,0,0,0];var aC=0;var aB;for(aB=0;aB<8;aB++){if(ar[aG[aB]].show){aC+=ar[aG[aB]].getWidth();az[aB]=aC}}al.right+=aC;if(ar.x2axis.show){al.top+=ar.x2axis.getHeight()}if(this.title.show){al.top+=this.title.getHeight()}if(ar.xaxis.show){al.bottom+=ar.xaxis.getHeight()}if(this.options.gridDimensions&&L.isPlainObject(this.options.gridDimensions)){var at=parseInt(this.options.gridDimensions.width,10)||0;var aI=parseInt(this.options.gridDimensions.height,10)||0;var an=(this._width-al.left-al.right-at)/2;var aK=(this._height-al.top-al.bottom-aI)/2;if(aK>=0&&an>=0){al.top+=aK;al.bottom+=aK;al.left+=an;al.right+=an}}var am=["top","bottom","left","right"];for(var aB in am){if(this._gridPadding[am[aB]]==null&&al[am[aB]]>0){this._gridPadding[am[aB]]=al[am[aB]]}else{if(this._gridPadding[am[aB]]==null){this._gridPadding[am[aB]]=this._defaultGridPadding[am[aB]]}}}var aA=this._gridPadding;if(this.legend.placement==="outsideGrid"){aA={top:this.title.getHeight(),left:0,right:0,bottom:0};if(this.legend.location==="s"){aA.left=this._gridPadding.left;aA.right=this._gridPadding.right}}ar.xaxis.pack({position:"absolute",bottom:this._gridPadding.bottom-ar.xaxis.getHeight(),left:0,width:this._width},{min:this._gridPadding.left,max:this._width-this._gridPadding.right});ar.yaxis.pack({position:"absolute",top:0,left:this._gridPadding.left-ar.yaxis.getWidth(),height:this._height},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top});ar.x2axis.pack({position:"absolute",top:this._gridPadding.top-ar.x2axis.getHeight(),left:0,width:this._width},{min:this._gridPadding.left,max:this._width-this._gridPadding.right});for(aH=8;aH>0;aH--){ar[aG[aH-1]].pack({position:"absolute",top:0,right:this._gridPadding.right-az[aH-1]},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top})}var au=(this._width-this._gridPadding.left-this._gridPadding.right)/2+this._gridPadding.left-ar.yMidAxis.getWidth()/2;ar.yMidAxis.pack({position:"absolute",top:0,left:au,zIndex:9,textAlign:"center"},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top});this.target.append(this.grid.createElement(this._gridPadding,this));this.grid.draw();var aq=this.series;var aJ=aq.length;for(aH=0,aE=aJ;aH<aE;aH++){aF=this.seriesStack[aH];this.target.append(aq[aF].shadowCanvas.createElement(this._gridPadding,"jqplot-series-shadowCanvas",null,this));aq[aF].shadowCanvas.setContext();aq[aF].shadowCanvas._elem.data("seriesIndex",aF)}for(aH=0,aE=aJ;aH<aE;aH++){aF=this.seriesStack[aH];this.target.append(aq[aF].canvas.createElement(this._gridPadding,"jqplot-series-canvas",null,this));aq[aF].canvas.setContext();aq[aF].canvas._elem.data("seriesIndex",aF)}this.target.append(this.eventCanvas.createElement(this._gridPadding,"jqplot-event-canvas",null,this));this.eventCanvas.setContext();this.eventCanvas._ctx.fillStyle="rgba(0,0,0,0)";this.eventCanvas._ctx.fillRect(0,0,this.eventCanvas._ctx.canvas.width,this.eventCanvas._ctx.canvas.height);this.bindCustomEvents();if(this.legend.preDraw){this.eventCanvas._elem.before(aL);this.legend.pack(aA);if(this.legend._elem){this.drawSeries({legendInfo:{location:this.legend.location,placement:this.legend.placement,width:this.legend.getWidth(),height:this.legend.getHeight(),xoffset:this.legend.xoffset,yoffset:this.legend.yoffset}})}else{this.drawSeries()}}else{this.drawSeries();if(aJ){L(aq[aJ-1].canvas._elem).after(aL)}this.legend.pack(aA)}for(var aH=0,aE=L.jqplot.eventListenerHooks.length;aH<aE;aH++){this.eventCanvas._elem.bind(L.jqplot.eventListenerHooks[aH][0],{plot:this},L.jqplot.eventListenerHooks[aH][1])}for(var aH=0,aE=this.eventListenerHooks.hooks.length;aH<aE;aH++){this.eventCanvas._elem.bind(this.eventListenerHooks.hooks[aH][0],{plot:this},this.eventListenerHooks.hooks[aH][1])}var ay=this.fillBetween;if(ay.fill&&ay.series1!==ay.series2&&ay.series1<aJ&&ay.series2<aJ&&aq[ay.series1]._type==="line"&&aq[ay.series2]._type==="line"){this.doFillBetweenLines()}for(var aH=0,aE=L.jqplot.postDrawHooks.length;aH<aE;aH++){L.jqplot.postDrawHooks[aH].call(this)}for(var aH=0,aE=this.postDrawHooks.hooks.length;aH<aE;aH++){this.postDrawHooks.hooks[aH].apply(this,this.postDrawHooks.args[aH])}if(this.target.is(":visible")){this._drawCount+=1}var av,aw,aD,ap;for(aH=0,aE=aJ;aH<aE;aH++){av=aq[aH];aw=av.renderer;aD=".jqplot-point-label.jqplot-series-"+aH;if(aw.animation&&aw.animation._supported&&aw.animation.show&&(this._drawCount<2||this.animateReplot)){ap=this.target.find(aD);ap.stop(true,true).hide();av.canvas._elem.stop(true,true).hide();av.shadowCanvas._elem.stop(true,true).hide();av.canvas._elem.jqplotEffect("blind",{mode:"show",direction:aw.animation.direction},aw.animation.speed);av.shadowCanvas._elem.jqplotEffect("blind",{mode:"show",direction:aw.animation.direction},aw.animation.speed);ap.fadeIn(aw.animation.speed*0.8)}}ap=null;this.target.trigger("jqplotPostDraw",[this])}};R.prototype.doFillBetweenLines=function(){var an=this.fillBetween;var ax=an.series1;var av=an.series2;var aw=(ax<av)?ax:av;var au=(av>ax)?av:ax;var ar=this.series[aw];var aq=this.series[au];if(aq.renderer.smooth){var ap=aq.renderer._smoothedData.slice(0).reverse()}else{var ap=aq.gridData.slice(0).reverse()}if(ar.renderer.smooth){var at=ar.renderer._smoothedData.concat(ap)}else{var at=ar.gridData.concat(ap)}var ao=(an.color!==null)?an.color:this.series[ax].fillColor;var ay=(an.baseSeries!==null)?an.baseSeries:aw;var am=this.series[ay].renderer.shapeRenderer;var al={fillStyle:ao,fill:true,closePath:true};am.draw(ar.shadowCanvas._ctx,at,al)};this.bindCustomEvents=function(){this.eventCanvas._elem.bind("click",{plot:this},this.onClick);this.eventCanvas._elem.bind("dblclick",{plot:this},this.onDblClick);this.eventCanvas._elem.bind("mousedown",{plot:this},this.onMouseDown);this.eventCanvas._elem.bind("mousemove",{plot:this},this.onMouseMove);this.eventCanvas._elem.bind("mouseenter",{plot:this},this.onMouseEnter);this.eventCanvas._elem.bind("mouseleave",{plot:this},this.onMouseLeave);if(this.captureRightClick){this.eventCanvas._elem.bind("mouseup",{plot:this},this.onRightClick);this.eventCanvas._elem.get(0).oncontextmenu=function(){return false}}else{this.eventCanvas._elem.bind("mouseup",{plot:this},this.onMouseUp)}};function ai(av){var au=av.data.plot;var ap=au.eventCanvas._elem.offset();var at={x:av.pageX-ap.left,y:av.pageY-ap.top};var aq={xaxis:null,yaxis:null,x2axis:null,y2axis:null,y3axis:null,y4axis:null,y5axis:null,y6axis:null,y7axis:null,y8axis:null,y9axis:null,yMidAxis:null};var ar=["xaxis","yaxis","x2axis","y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis","yMidAxis"];var al=au.axes;var am,ao;for(am=11;am>0;am--){ao=ar[am-1];if(al[ao].show){aq[ao]=al[ao].series_p2u(at[ao.charAt(0)])}}return{offsets:ap,gridPos:at,dataPos:aq}}function ak(al,am){var aq=am.series;var aW,aU,aT,aO,aP,aJ,aI,aw,au,az,aA,aK;var aS,aX,aQ,ar,aH,aM,aV;var an,aN;for(aT=am.seriesStack.length-1;aT>=0;aT--){aW=am.seriesStack[aT];aO=aq[aW];aV=aO._highlightThreshold;switch(aO.renderer.constructor){case L.jqplot.BarRenderer:aJ=al.x;aI=al.y;for(aU=0;aU<aO._barPoints.length;aU++){aH=aO._barPoints[aU];aQ=aO.gridData[aU];if(aJ>aH[0][0]&&aJ<aH[2][0]&&aI>aH[2][1]&&aI<aH[0][1]){return{seriesIndex:aO.index,pointIndex:aU,gridData:aQ,data:aO.data[aU],points:aO._barPoints[aU]}}}break;case L.jqplot.PyramidRenderer:aJ=al.x;aI=al.y;for(aU=0;aU<aO._barPoints.length;aU++){aH=aO._barPoints[aU];aQ=aO.gridData[aU];if(aJ>aH[0][0]+aV[0][0]&&aJ<aH[2][0]+aV[2][0]&&aI>aH[2][1]&&aI<aH[0][1]){return{seriesIndex:aO.index,pointIndex:aU,gridData:aQ,data:aO.data[aU],points:aO._barPoints[aU]}}}break;case L.jqplot.DonutRenderer:az=aO.startAngle/180*Math.PI;aJ=al.x-aO._center[0];aI=al.y-aO._center[1];aP=Math.sqrt(Math.pow(aJ,2)+Math.pow(aI,2));if(aJ>0&&-aI>=0){aw=2*Math.PI-Math.atan(-aI/aJ)}else{if(aJ>0&&-aI<0){aw=-Math.atan(-aI/aJ)}else{if(aJ<0){aw=Math.PI-Math.atan(-aI/aJ)}else{if(aJ==0&&-aI>0){aw=3*Math.PI/2}else{if(aJ==0&&-aI<0){aw=Math.PI/2}else{if(aJ==0&&aI==0){aw=0}}}}}}if(az){aw-=az;if(aw<0){aw+=2*Math.PI}else{if(aw>2*Math.PI){aw-=2*Math.PI}}}au=aO.sliceMargin/180*Math.PI;if(aP<aO._radius&&aP>aO._innerRadius){for(aU=0;aU<aO.gridData.length;aU++){aA=(aU>0)?aO.gridData[aU-1][1]+au:au;aK=aO.gridData[aU][1];if(aw>aA&&aw<aK){return{seriesIndex:aO.index,pointIndex:aU,gridData:[al.x,al.y],data:aO.data[aU]}}}}break;case L.jqplot.PieRenderer:az=aO.startAngle/180*Math.PI;aJ=al.x-aO._center[0];aI=al.y-aO._center[1];aP=Math.sqrt(Math.pow(aJ,2)+Math.pow(aI,2));if(aJ>0&&-aI>=0){aw=2*Math.PI-Math.atan(-aI/aJ)}else{if(aJ>0&&-aI<0){aw=-Math.atan(-aI/aJ)}else{if(aJ<0){aw=Math.PI-Math.atan(-aI/aJ)}else{if(aJ==0&&-aI>0){aw=3*Math.PI/2}else{if(aJ==0&&-aI<0){aw=Math.PI/2}else{if(aJ==0&&aI==0){aw=0}}}}}}if(az){aw-=az;if(aw<0){aw+=2*Math.PI}else{if(aw>2*Math.PI){aw-=2*Math.PI}}}au=aO.sliceMargin/180*Math.PI;if(aP<aO._radius){for(aU=0;aU<aO.gridData.length;aU++){aA=(aU>0)?aO.gridData[aU-1][1]+au:au;aK=aO.gridData[aU][1];if(aw>aA&&aw<aK){return{seriesIndex:aO.index,pointIndex:aU,gridData:[al.x,al.y],data:aO.data[aU]}}}}break;case L.jqplot.BubbleRenderer:aJ=al.x;aI=al.y;var aF=null;if(aO.show){for(var aU=0;aU<aO.gridData.length;aU++){aQ=aO.gridData[aU];aX=Math.sqrt((aJ-aQ[0])*(aJ-aQ[0])+(aI-aQ[1])*(aI-aQ[1]));if(aX<=aQ[2]&&(aX<=aS||aS==null)){aS=aX;aF={seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}if(aF!=null){return aF}}break;case L.jqplot.FunnelRenderer:aJ=al.x;aI=al.y;var aL=aO._vertices,ap=aL[0],ao=aL[aL.length-1],at,aE,ay;function aR(a0,a2,a1){var aZ=(a2[1]-a1[1])/(a2[0]-a1[0]);var aY=a2[1]-aZ*a2[0];var a3=a0+a2[1];return[(a3-aY)/aZ,a3]}at=aR(aI,ap[0],ao[3]);aE=aR(aI,ap[1],ao[2]);for(aU=0;aU<aL.length;aU++){ay=aL[aU];if(aI>=ay[0][1]&&aI<=ay[3][1]&&aJ>=at[0]&&aJ<=aE[0]){return{seriesIndex:aO.index,pointIndex:aU,gridData:null,data:aO.data[aU]}}}break;case L.jqplot.LineRenderer:aJ=al.x;aI=al.y;aP=aO.renderer;if(aO.show){if((aO.fill||(aO.renderer.bands.show&&aO.renderer.bands.fill))&&(!am.plugins.highlighter||!am.plugins.highlighter.show)){var ax=false;if(aJ>aO._boundingBox[0][0]&&aJ<aO._boundingBox[1][0]&&aI>aO._boundingBox[1][1]&&aI<aO._boundingBox[0][1]){var aD=aO._areaPoints.length;var aG;var aU=aD-1;for(var aG=0;aG<aD;aG++){var aC=[aO._areaPoints[aG][0],aO._areaPoints[aG][1]];var aB=[aO._areaPoints[aU][0],aO._areaPoints[aU][1]];if(aC[1]<aI&&aB[1]>=aI||aB[1]<aI&&aC[1]>=aI){if(aC[0]+(aI-aC[1])/(aB[1]-aC[1])*(aB[0]-aC[0])<aJ){ax=!ax}}aU=aG}}if(ax){return{seriesIndex:aW,pointIndex:null,gridData:aO.gridData,data:aO.data,points:aO._areaPoints}}break}else{aN=aO.markerRenderer.size/2+aO.neighborThreshold;an=(aN>0)?aN:0;for(var aU=0;aU<aO.gridData.length;aU++){aQ=aO.gridData[aU];if(aP.constructor==L.jqplot.OHLCRenderer){if(aP.candleStick){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._bodyWidth/2&&aJ<=aQ[0]+aP._bodyWidth/2&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{if(!aP.hlc){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][1])&&aI<=av(aO.data[aU][2])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}else{if(aQ[0]!=null&&aQ[1]!=null){aX=Math.sqrt((aJ-aQ[0])*(aJ-aQ[0])+(aI-aQ[1])*(aI-aQ[1]));if(aX<=an&&(aX<=aS||aS==null)){aS=aX;return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}}}break;default:aJ=al.x;aI=al.y;aP=aO.renderer;if(aO.show){aN=aO.markerRenderer.size/2+aO.neighborThreshold;an=(aN>0)?aN:0;for(var aU=0;aU<aO.gridData.length;aU++){aQ=aO.gridData[aU];if(aP.constructor==L.jqplot.OHLCRenderer){if(aP.candleStick){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._bodyWidth/2&&aJ<=aQ[0]+aP._bodyWidth/2&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{if(!aP.hlc){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][1])&&aI<=av(aO.data[aU][2])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}else{aX=Math.sqrt((aJ-aQ[0])*(aJ-aQ[0])+(aI-aQ[1])*(aI-aQ[1]));if(aX<=an&&(aX<=aS||aS==null)){aS=aX;return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}break}}return null}this.onClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onDblClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotDblClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseDown=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotMouseDown");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseUp=function(an){var am=ai(an);var al=L.Event("jqplotMouseUp");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,null,an.data.plot])};this.onRightClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);if(ap.captureRightClick){if(an.which==3){var al=L.Event("jqplotRightClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])}else{var al=L.Event("jqplotMouseUp");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])}}};this.onMouseMove=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotMouseMove");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseEnter=function(an){var am=ai(an);var ao=an.data.plot;var al=L.Event("jqplotMouseEnter");al.pageX=an.pageX;al.pageY=an.pageY;al.relatedTarget=an.relatedTarget;L(this).trigger(al,[am.gridPos,am.dataPos,null,ao])};this.onMouseLeave=function(an){var am=ai(an);var ao=an.data.plot;var al=L.Event("jqplotMouseLeave");al.pageX=an.pageX;al.pageY=an.pageY;al.relatedTarget=an.relatedTarget;L(this).trigger(al,[am.gridPos,am.dataPos,null,ao])};this.drawSeries=function(an,al){var ap,ao,am;al=(typeof(an)==="number"&&al==null)?an:al;an=(typeof(an)==="object")?an:{};if(al!=u){ao=this.series[al];am=ao.shadowCanvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.drawShadow(am,an,this);am=ao.canvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.draw(am,an,this);if(ao.renderer.constructor==L.jqplot.BezierCurveRenderer){if(al<this.series.length-1){this.drawSeries(al+1)}}}else{for(ap=0;ap<this.series.length;ap++){ao=this.series[ap];am=ao.shadowCanvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.drawShadow(am,an,this);am=ao.canvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.draw(am,an,this)}}an=al=ap=ao=am=null};this.moveSeriesToFront=function(am){am=parseInt(am,10);var ap=L.inArray(am,this.seriesStack);if(ap==-1){return}if(ap==this.seriesStack.length-1){this.previousSeriesStack=this.seriesStack.slice(0);return}var al=this.seriesStack[this.seriesStack.length-1];var ao=this.series[am].canvas._elem.detach();var an=this.series[am].shadowCanvas._elem.detach();this.series[al].shadowCanvas._elem.after(an);this.series[al].canvas._elem.after(ao);this.previousSeriesStack=this.seriesStack.slice(0);this.seriesStack.splice(ap,1);this.seriesStack.push(am)};this.moveSeriesToBack=function(am){am=parseInt(am,10);var ap=L.inArray(am,this.seriesStack);if(ap==0||ap==-1){return}var al=this.seriesStack[0];var ao=this.series[am].canvas._elem.detach();var an=this.series[am].shadowCanvas._elem.detach();this.series[al].shadowCanvas._elem.before(an);this.series[al].canvas._elem.before(ao);this.previousSeriesStack=this.seriesStack.slice(0);this.seriesStack.splice(ap,1);this.seriesStack.unshift(am)};this.restorePreviousSeriesOrder=function(){var ar,aq,ap,ao,an,al,am;if(this.seriesStack==this.previousSeriesStack){return}for(ar=1;ar<this.previousSeriesStack.length;ar++){al=this.previousSeriesStack[ar];am=this.previousSeriesStack[ar-1];ap=this.series[al].canvas._elem.detach();ao=this.series[al].shadowCanvas._elem.detach();this.series[am].shadowCanvas._elem.after(ao);this.series[am].canvas._elem.after(ap)}an=this.seriesStack.slice(0);this.seriesStack=this.previousSeriesStack.slice(0);this.previousSeriesStack=an};this.restoreOriginalSeriesOrder=function(){var ap,ao,al=[],an,am;for(ap=0;ap<this.series.length;ap++){al.push(ap)}if(this.seriesStack==al){return}this.previousSeriesStack=this.seriesStack.slice(0);this.seriesStack=al;for(ap=1;ap<this.seriesStack.length;ap++){an=this.series[ap].canvas._elem.detach();am=this.series[ap].shadowCanvas._elem.detach();this.series[ap-1].shadowCanvas._elem.after(am);this.series[ap-1].canvas._elem.after(an)}};this.activateTheme=function(al){this.themeEngine.activate(this,al)}}L.jqplot.computeHighlightColors=function(ai){var ak;if(L.isArray(ai)){ak=[];for(var am=0;am<ai.length;am++){var al=L.jqplot.getColorComponents(ai[am]);var ah=[al[0],al[1],al[2]];var an=ah[0]+ah[1]+ah[2];for(var aj=0;aj<3;aj++){ah[aj]=(an>660)?ah[aj]*0.85:0.73*ah[aj]+90;ah[aj]=parseInt(ah[aj],10);(ah[aj]>255)?255:ah[aj]}ah[3]=0.3+0.35*al[3];ak.push("rgba("+ah[0]+","+ah[1]+","+ah[2]+","+ah[3]+")")}}else{var al=L.jqplot.getColorComponents(ai);var ah=[al[0],al[1],al[2]];var an=ah[0]+ah[1]+ah[2];for(var aj=0;aj<3;aj++){ah[aj]=(an>660)?ah[aj]*0.85:0.73*ah[aj]+90;ah[aj]=parseInt(ah[aj],10);(ah[aj]>255)?255:ah[aj]}ah[3]=0.3+0.35*al[3];ak="rgba("+ah[0]+","+ah[1]+","+ah[2]+","+ah[3]+")"}return ak};L.jqplot.ColorGenerator=function(ai){ai=ai||L.jqplot.config.defaultColors;var ah=0;this.next=function(){if(ah<ai.length){return ai[ah++]}else{ah=0;return ai[ah++]}};this.previous=function(){if(ah>0){return ai[ah--]}else{ah=ai.length-1;return ai[ah]}};this.get=function(ak){var aj=ak-ai.length*Math.floor(ak/ai.length);return ai[aj]};this.setColors=function(aj){ai=aj};this.reset=function(){ah=0};this.getIndex=function(){return ah};this.setIndex=function(aj){ah=aj}};L.jqplot.hex2rgb=function(aj,ah){aj=aj.replace("#","");if(aj.length==3){aj=aj.charAt(0)+aj.charAt(0)+aj.charAt(1)+aj.charAt(1)+aj.charAt(2)+aj.charAt(2)}var ai;ai="rgba("+parseInt(aj.slice(0,2),16)+", "+parseInt(aj.slice(2,4),16)+", "+parseInt(aj.slice(4,6),16);if(ah){ai+=", "+ah}ai+=")";return ai};L.jqplot.rgb2hex=function(am){var aj=/rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *(?:, *[0-9.]*)?\)/;var ah=am.match(aj);var al="#";for(var ak=1;ak<4;ak++){var ai;if(ah[ak].search(/%/)!=-1){ai=parseInt(255*ah[ak]/100,10).toString(16);if(ai.length==1){ai="0"+ai}}else{ai=parseInt(ah[ak],10).toString(16);if(ai.length==1){ai="0"+ai}}al+=ai}return al};L.jqplot.normalize2rgb=function(ai,ah){if(ai.search(/^ *rgba?\(/)!=-1){return ai}else{if(ai.search(/^ *#?[0-9a-fA-F]?[0-9a-fA-F]/)!=-1){return L.jqplot.hex2rgb(ai,ah)}else{throw new Error("Invalid color spec")}}};L.jqplot.getColorComponents=function(am){am=L.jqplot.colorKeywordMap[am]||am;var ak=L.jqplot.normalize2rgb(am);var aj=/rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *,? *([0-9.]* *)?\)/;var ah=ak.match(aj);var ai=[];for(var al=1;al<4;al++){if(ah[al].search(/%/)!=-1){ai[al-1]=parseInt(255*ah[al]/100,10)}else{ai[al-1]=parseInt(ah[al],10)}}ai[3]=parseFloat(ah[4])?parseFloat(ah[4]):1;return ai};L.jqplot.colorKeywordMap={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",aqua:"rgb( 0, 255, 255)",aquamarine:"rgb(127, 255, 212)",azure:"rgb(240, 255, 255)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",black:"rgb( 0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb( 0, 0, 255)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",burlywood:"rgb(222, 184, 135)",cadetblue:"rgb( 95, 158, 160)",chartreuse:"rgb(127, 255, 0)",chocolate:"rgb(210, 105, 30)",coral:"rgb(255, 127, 80)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",crimson:"rgb(220, 20, 60)",cyan:"rgb( 0, 255, 255)",darkblue:"rgb( 0, 0, 139)",darkcyan:"rgb( 0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgray:"rgb(169, 169, 169)",darkgreen:"rgb( 0, 100, 0)",darkgrey:"rgb(169, 169, 169)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb( 85, 107, 47)",darkorange:"rgb(255, 140, 0)",darkorchid:"rgb(153, 50, 204)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkslateblue:"rgb( 72, 61, 139)",darkslategray:"rgb( 47, 79, 79)",darkslategrey:"rgb( 47, 79, 79)",darkturquoise:"rgb( 0, 206, 209)",darkviolet:"rgb(148, 0, 211)",deeppink:"rgb(255, 20, 147)",deepskyblue:"rgb( 0, 191, 255)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb( 30, 144, 255)",firebrick:"rgb(178, 34, 34)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb( 34, 139, 34)",fuchsia:"rgb(255, 0, 255)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",goldenrod:"rgb(218, 165, 32)",gray:"rgb(128, 128, 128)",grey:"rgb(128, 128, 128)",green:"rgb( 0, 128, 0)",greenyellow:"rgb(173, 255, 47)",honeydew:"rgb(240, 255, 240)",hotpink:"rgb(255, 105, 180)",indianred:"rgb(205, 92, 92)",indigo:"rgb( 75, 0, 130)",ivory:"rgb(255, 255, 240)",khaki:"rgb(240, 230, 140)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lightblue:"rgb(173, 216, 230)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgray:"rgb(211, 211, 211)",lightgreen:"rgb(144, 238, 144)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightsalmon:"rgb(255, 160, 122)",lightseagreen:"rgb( 32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightyellow:"rgb(255, 255, 224)",lime:"rgb( 0, 255, 0)",limegreen:"rgb( 50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",maroon:"rgb(128, 0, 0)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb( 0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumpurple:"rgb(147, 112, 219)",mediumseagreen:"rgb( 60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb( 0, 250, 154)",mediumturquoise:"rgb( 72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb( 25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navy:"rgb( 0, 0, 128)",oldlace:"rgb(253, 245, 230)",olive:"rgb(128, 128, 0)",olivedrab:"rgb(107, 142, 35)",orange:"rgb(255, 165, 0)",orangered:"rgb(255, 69, 0)",orchid:"rgb(218, 112, 214)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",paleturquoise:"rgb(175, 238, 238)",palevioletred:"rgb(219, 112, 147)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",plum:"rgb(221, 160, 221)",powderblue:"rgb(176, 224, 230)",purple:"rgb(128, 0, 128)",red:"rgb(255, 0, 0)",rosybrown:"rgb(188, 143, 143)",royalblue:"rgb( 65, 105, 225)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb( 46, 139, 87)",seashell:"rgb(255, 245, 238)",sienna:"rgb(160, 82, 45)",silver:"rgb(192, 192, 192)",skyblue:"rgb(135, 206, 235)",slateblue:"rgb(106, 90, 205)",slategray:"rgb(112, 128, 144)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",springgreen:"rgb( 0, 255, 127)",steelblue:"rgb( 70, 130, 180)",tan:"rgb(210, 180, 140)",teal:"rgb( 0, 128, 128)",thistle:"rgb(216, 191, 216)",tomato:"rgb(255, 99, 71)",turquoise:"rgb( 64, 224, 208)",violet:"rgb(238, 130, 238)",wheat:"rgb(245, 222, 179)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellowgreen:"rgb(154, 205, 50)"};L.jqplot.AxisLabelRenderer=function(ah){L.jqplot.ElemContainer.call(this);this.axis;this.show=true;this.label="";this.fontFamily=null;this.fontSize=null;this.textColor=null;this._elem;this.escapeHTML=false;L.extend(true,this,ah)};L.jqplot.AxisLabelRenderer.prototype=new L.jqplot.ElemContainer();L.jqplot.AxisLabelRenderer.prototype.constructor=L.jqplot.AxisLabelRenderer;L.jqplot.AxisLabelRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.AxisLabelRenderer.prototype.draw=function(ah,ai){if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=L('<div style="position:absolute;" class="jqplot-'+this.axis+'-label"></div>');if(Number(this.label)){this._elem.css("white-space","nowrap")}if(!this.escapeHTML){this._elem.html(this.label)}else{this._elem.text(this.label)}if(this.fontFamily){this._elem.css("font-family",this.fontFamily)}if(this.fontSize){this._elem.css("font-size",this.fontSize)}if(this.textColor){this._elem.css("color",this.textColor)}return this._elem};L.jqplot.AxisLabelRenderer.prototype.pack=function(){};L.jqplot.AxisTickRenderer=function(ah){L.jqplot.ElemContainer.call(this);this.mark="outside";this.axis;this.showMark=true;this.showGridline=true;this.isMinorTick=false;this.size=4;this.markSize=6;this.show=true;this.showLabel=true;this.label=null;this.value=null;this._styles={};this.formatter=L.jqplot.DefaultTickFormatter;this.prefix="";this.suffix="";this.formatString="";this.fontFamily;this.fontSize;this.textColor;this.escapeHTML=false;this._elem;this._breakTick=false;L.extend(true,this,ah)};L.jqplot.AxisTickRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.AxisTickRenderer.prototype=new L.jqplot.ElemContainer();L.jqplot.AxisTickRenderer.prototype.constructor=L.jqplot.AxisTickRenderer;L.jqplot.AxisTickRenderer.prototype.setTick=function(ah,aj,ai){this.value=ah;this.axis=aj;if(ai){this.isMinorTick=true}return this};L.jqplot.AxisTickRenderer.prototype.draw=function(){if(this.label===null){this.label=this.prefix+this.formatter(this.formatString,this.value)+this.suffix}var ai={position:"absolute"};if(Number(this.label)){ai.whitSpace="nowrap"}if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=L(document.createElement("div"));this._elem.addClass("jqplot-"+this.axis+"-tick");if(!this.escapeHTML){this._elem.html(this.label)}else{this._elem.text(this.label)}this._elem.css(ai);for(var ah in this._styles){this._elem.css(ah,this._styles[ah])}if(this.fontFamily){this._elem.css("font-family",this.fontFamily)}if(this.fontSize){this._elem.css("font-size",this.fontSize)}if(this.textColor){this._elem.css("color",this.textColor)}if(this._breakTick){this._elem.addClass("jqplot-breakTick")}return this._elem};L.jqplot.DefaultTickFormatter=function(ah,ai){if(typeof ai=="number"){if(!ah){ah=L.jqplot.config.defaultTickFormatString}return L.jqplot.sprintf(ah,ai)}else{return String(ai)}};L.jqplot.PercentTickFormatter=function(ah,ai){if(typeof ai=="number"){ai=100*ai;if(!ah){ah=L.jqplot.config.defaultTickFormatString}return L.jqplot.sprintf(ah,ai)}else{return String(ai)}};L.jqplot.AxisTickRenderer.prototype.pack=function(){};L.jqplot.CanvasGridRenderer=function(){this.shadowRenderer=new L.jqplot.ShadowRenderer()};L.jqplot.CanvasGridRenderer.prototype.init=function(ai){this._ctx;L.extend(true,this,ai);var ah={lineJoin:"miter",lineCap:"round",fill:false,isarc:false,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,lineWidth:this.shadowWidth,closePath:false,strokeStyle:this.shadowColor};this.renderer.shadowRenderer.init(ah)};L.jqplot.CanvasGridRenderer.prototype.createElement=function(ak){var aj;if(this._elem){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){aj=this._elem.get(0);window.G_vmlCanvasManager.uninitElement(aj);aj=null}this._elem.emptyForce();this._elem=null}aj=ak.canvasManager.getCanvas();var ah=this._plotDimensions.width;var ai=this._plotDimensions.height;aj.width=ah;aj.height=ai;this._elem=L(aj);this._elem.addClass("jqplot-grid-canvas");this._elem.css({position:"absolute",left:0,top:0});aj=ak.canvasManager.initCanvas(aj);this._top=this._offsets.top;this._bottom=ai-this._offsets.bottom;this._left=this._offsets.left;this._right=ah-this._offsets.right;this._width=this._right-this._left;this._height=this._bottom-this._top;aj=null;return this._elem};L.jqplot.CanvasGridRenderer.prototype.draw=function(){this._ctx=this._elem.get(0).getContext("2d");var at=this._ctx;var aw=this._axes;at.save();at.clearRect(0,0,this._plotDimensions.width,this._plotDimensions.height);at.fillStyle=this.backgroundColor||this.background;at.fillRect(this._left,this._top,this._width,this._height);at.save();at.lineJoin="miter";at.lineCap="butt";at.lineWidth=this.gridLineWidth;at.strokeStyle=this.gridLineColor;var aA,az,ap,aq;var am=["xaxis","yaxis","x2axis","y2axis"];for(var ay=4;ay>0;ay--){var aD=am[ay-1];var ah=aw[aD];var aB=ah._ticks;var ar=aB.length;if(ah.show){if(ah.drawBaseline){var aC={};if(ah.baselineWidth!==null){aC.lineWidth=ah.baselineWidth}if(ah.baselineColor!==null){aC.strokeStyle=ah.baselineColor}switch(aD){case"xaxis":ao(this._left,this._bottom,this._right,this._bottom,aC);break;case"yaxis":ao(this._left,this._bottom,this._left,this._top,aC);break;case"x2axis":ao(this._left,this._bottom,this._right,this._bottom,aC);break;case"y2axis":ao(this._right,this._bottom,this._right,this._top,aC);break}}for(var au=ar;au>0;au--){var an=aB[au-1];if(an.show){var ak=Math.round(ah.u2p(an.value))+0.5;switch(aD){case"xaxis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(ak,this._top,ak,this._bottom)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._bottom;az=this._bottom+ap;break;case"inside":aA=this._bottom-ap;az=this._bottom;break;case"cross":aA=this._bottom-ap;az=this._bottom+ap;break;default:aA=this._bottom;az=this._bottom+ap;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[ak,aA],[ak,az]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}ao(ak,aA,ak,az)}break;case"yaxis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(this._right,ak,this._left,ak)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._left-ap;az=this._left;break;case"inside":aA=this._left;az=this._left+ap;break;case"cross":aA=this._left-ap;az=this._left+ap;break;default:aA=this._left-ap;az=this._left;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[aA,ak],[az,ak]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}break;case"x2axis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(ak,this._bottom,ak,this._top)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._top-ap;az=this._top;break;case"inside":aA=this._top;az=this._top+ap;break;case"cross":aA=this._top-ap;az=this._top+ap;break;default:aA=this._top-ap;az=this._top;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[ak,aA],[ak,az]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}ao(ak,aA,ak,az)}break;case"y2axis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(this._left,ak,this._right,ak)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._right;az=this._right+ap;break;case"inside":aA=this._right-ap;az=this._right;break;case"cross":aA=this._right-ap;az=this._right+ap;break;default:aA=this._right;az=this._right+ap;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[aA,ak],[az,ak]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}break;default:break}}}an=null}ah=null;aB=null}am=["y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis","yMidAxis"];for(var ay=7;ay>0;ay--){var ah=aw[am[ay-1]];var aB=ah._ticks;if(ah.show){var ai=aB[ah.numberTicks-1];var al=aB[0];var aj=ah.getLeft();var av=[[aj,ai.getTop()+ai.getHeight()/2],[aj,al.getTop()+al.getHeight()/2+1]];if(this.shadow){this.renderer.shadowRenderer.draw(at,av,{lineCap:"butt",fill:false,closePath:false})}ao(av[0][0],av[0][1],av[1][0],av[1][1],{lineCap:"butt",strokeStyle:ah.borderColor,lineWidth:ah.borderWidth});for(var au=aB.length;au>0;au--){var an=aB[au-1];ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;if(an.showMark&&an.mark){switch(aq){case"outside":aA=aj;az=aj+ap;break;case"inside":aA=aj-ap;az=aj;break;case"cross":aA=aj-ap;az=aj+ap;break;default:aA=aj;az=aj+ap;break}av=[[aA,ak],[az,ak]];if(this.shadow){this.renderer.shadowRenderer.draw(at,av,{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}an=null}al=null}ah=null;aB=null}at.restore();function ao(aH,aG,aE,ax,aF){at.save();aF=aF||{};if(aF.lineWidth==null||aF.lineWidth!=0){L.extend(true,at,aF);at.beginPath();at.moveTo(aH,aG);at.lineTo(aE,ax);at.stroke();at.restore()}}if(this.shadow){var av=[[this._left,this._bottom],[this._right,this._bottom],[this._right,this._top]];this.renderer.shadowRenderer.draw(at,av)}if(this.borderWidth!=0&&this.drawBorder){ao(this._left,this._top,this._right,this._top,{lineCap:"round",strokeStyle:aw.x2axis.borderColor,lineWidth:aw.x2axis.borderWidth});ao(this._right,this._top,this._right,this._bottom,{lineCap:"round",strokeStyle:aw.y2axis.borderColor,lineWidth:aw.y2axis.borderWidth});ao(this._right,this._bottom,this._left,this._bottom,{lineCap:"round",strokeStyle:aw.xaxis.borderColor,lineWidth:aw.xaxis.borderWidth});ao(this._left,this._bottom,this._left,this._top,{lineCap:"round",strokeStyle:aw.yaxis.borderColor,lineWidth:aw.yaxis.borderWidth})}at.restore();at=null;aw=null};L.jqplot.DivTitleRenderer=function(){};L.jqplot.DivTitleRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.DivTitleRenderer.prototype.draw=function(){if(this._elem){this._elem.emptyForce();this._elem=null}var ak=this.renderer;var aj=document.createElement("div");this._elem=L(aj);this._elem.addClass("jqplot-title");if(!this.text){this.show=false;this._elem.height(0);this._elem.width(0)}else{if(this.text){var ah;if(this.color){ah=this.color}else{if(this.textColor){ah=this.textColor}}var ai={position:"absolute",top:"0px",left:"0px"};if(this._plotWidth){ai.width=this._plotWidth+"px"}if(this.fontSize){ai.fontSize=this.fontSize}if(typeof this.textAlign==="string"){ai.textAlign=this.textAlign}else{ai.textAlign="center"}if(ah){ai.color=ah}if(this.paddingBottom){ai.paddingBottom=this.paddingBottom}if(this.fontFamily){ai.fontFamily=this.fontFamily}this._elem.css(ai);if(this.escapeHtml){this._elem.text(this.text)}else{this._elem.html(this.text)}}}aj=null;return this._elem};L.jqplot.DivTitleRenderer.prototype.pack=function(){};var r=0.1;L.jqplot.LinePattern=function(aw,aq){var ap={dotted:[r,L.jqplot.config.dotGapLength],dashed:[L.jqplot.config.dashLength,L.jqplot.config.gapLength],solid:null};if(typeof aq==="string"){if(aq[0]==="."||aq[0]==="-"){var ax=aq;aq=[];for(var ao=0,al=ax.length;ao<al;ao++){if(ax[ao]==="."){aq.push(r)}else{if(ax[ao]==="-"){aq.push(L.jqplot.config.dashLength)}else{continue}}aq.push(L.jqplot.config.gapLength)}}else{aq=ap[aq]}}if(!(aq&&aq.length)){return aw}var ak=0;var ar=aq[0];var au=0;var at=0;var an=0;var ah=0;var av=function(ay,az){aw.moveTo(ay,az);au=ay;at=az;an=ay;ah=az};var aj=function(ay,aE){var aC=aw.lineWidth;var aA=ay-au;var az=aE-at;var aB=Math.sqrt(aA*aA+az*az);if((aB>0)&&(aC>0)){aA/=aB;az/=aB;while(true){var aD=aC*ar;if(aD<aB){au+=aD*aA;at+=aD*az;if((ak&1)==0){aw.lineTo(au,at)}else{aw.moveTo(au,at)}aB-=aD;ak++;if(ak>=aq.length){ak=0}ar=aq[ak]}else{au=ay;at=aE;if((ak&1)==0){aw.lineTo(au,at)}else{aw.moveTo(au,at)}ar-=aB/aC;break}}}};var ai=function(){aw.beginPath()};var am=function(){aj(an,ah)};return{moveTo:av,lineTo:aj,beginPath:ai,closePath:am}};L.jqplot.LineRenderer=function(){this.shapeRenderer=new L.jqplot.ShapeRenderer();this.shadowRenderer=new L.jqplot.ShadowRenderer()};L.jqplot.LineRenderer.prototype.init=function(ai,an){ai=ai||{};this._type="line";this.renderer.animation={show:false,direction:"left",speed:2500,_supported:true};this.renderer.smooth=false;this.renderer.tension=null;this.renderer.constrainSmoothing=true;this.renderer._smoothedData=[];this.renderer._smoothedPlotData=[];this.renderer._hiBandGridData=[];this.renderer._lowBandGridData=[];this.renderer._hiBandSmoothedData=[];this.renderer._lowBandSmoothedData=[];this.renderer.bandData=[];this.renderer.bands={show:false,hiData:[],lowData:[],color:this.color,showLines:false,fill:true,fillColor:null,_min:null,_max:null,interval:"3%"};var al={highlightMouseOver:ai.highlightMouseOver,highlightMouseDown:ai.highlightMouseDown,highlightColor:ai.highlightColor};delete (ai.highlightMouseOver);delete (ai.highlightMouseDown);delete (ai.highlightColor);L.extend(true,this.renderer,ai);this.renderer.options=ai;if(this.renderer.bandData.length>1&&(!ai.bands||ai.bands.show==null)){this.renderer.bands.show=true}else{if(ai.bands&&ai.bands.show==null&&ai.bands.interval!=null){this.renderer.bands.show=true}}if(this.fill){this.renderer.bands.show=false}if(this.renderer.bands.show){this.renderer.initBands.call(this,this.renderer.options,an)}if(this._stack){this.renderer.smooth=false}var am={lineJoin:this.lineJoin,lineCap:this.lineCap,fill:this.fill,isarc:false,strokeStyle:this.color,fillStyle:this.fillColor,lineWidth:this.lineWidth,linePattern:this.linePattern,closePath:this.fill};this.renderer.shapeRenderer.init(am);var aj=ai.shadowOffset;if(aj==null){if(this.lineWidth>2.5){aj=1.25*(1+(Math.atan((this.lineWidth/2.5))/0.785398163-1)*0.6)}else{aj=1.25*Math.atan((this.lineWidth/2.5))/0.785398163}}var ah={lineJoin:this.lineJoin,lineCap:this.lineCap,fill:this.fill,isarc:false,angle:this.shadowAngle,offset:aj,alpha:this.shadowAlpha,depth:this.shadowDepth,lineWidth:this.lineWidth,linePattern:this.linePattern,closePath:this.fill};this.renderer.shadowRenderer.init(ah);this._areaPoints=[];this._boundingBox=[[],[]];if(!this.isTrendline&&this.fill||this.renderer.bands.show){this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColor=null;if(al.highlightMouseDown&&al.highlightMouseOver==null){al.highlightMouseOver=false}L.extend(true,this,{highlightMouseOver:al.highlightMouseOver,highlightMouseDown:al.highlightMouseDown,highlightColor:al.highlightColor});if(!this.highlightColor){var ak=(this.renderer.bands.show)?this.renderer.bands.fillColor:this.fillColor;this.highlightColor=L.jqplot.computeHighlightColors(ak)}if(this.highlighter){this.highlighter.show=false}}if(!this.isTrendline&&an){an.plugins.lineRenderer={};an.postInitHooks.addOnce(z);an.postDrawHooks.addOnce(af);an.eventListenerHooks.addOnce("jqplotMouseMove",h);an.eventListenerHooks.addOnce("jqplotMouseDown",e);an.eventListenerHooks.addOnce("jqplotMouseUp",ad);an.eventListenerHooks.addOnce("jqplotClick",g);an.eventListenerHooks.addOnce("jqplotRightClick",s)}};L.jqplot.LineRenderer.prototype.initBands=function(ak,av){var al=ak.bandData||[];var an=this.renderer.bands;an.hiData=[];an.lowData=[];var aB=this.data;an._max=null;an._min=null;if(al.length==2){if(L.isArray(al[0][0])){var ao;var ah=0,ar=0;for(var aw=0,at=al[0].length;aw<at;aw++){ao=al[0][aw];if((ao[1]!=null&&ao[1]>an._max)||an._max==null){an._max=ao[1]}if((ao[1]!=null&&ao[1]<an._min)||an._min==null){an._min=ao[1]}}for(var aw=0,at=al[1].length;aw<at;aw++){ao=al[1][aw];if((ao[1]!=null&&ao[1]>an._max)||an._max==null){an._max=ao[1];ar=1}if((ao[1]!=null&&ao[1]<an._min)||an._min==null){an._min=ao[1];ah=1}}if(ar===ah){an.show=false}an.hiData=al[ar];an.lowData=al[ah]}else{if(al[0].length===aB.length&&al[1].length===aB.length){var aj=(al[0][0]>al[1][0])?0:1;var aC=(aj)?0:1;for(var aw=0,at=aB.length;aw<at;aw++){an.hiData.push([aB[aw][0],al[aj][aw]]);an.lowData.push([aB[aw][0],al[aC][aw]])}}else{an.show=false}}}else{if(al.length>2&&!L.isArray(al[0][0])){var aj=(al[0][0]>al[0][1])?0:1;var aC=(aj)?0:1;for(var aw=0,at=al.length;aw<at;aw++){an.hiData.push([aB[aw][0],al[aw][aj]]);an.lowData.push([aB[aw][0],al[aw][aC]])}}else{var aq=an.interval;var aA=null;var az=null;var ai=null;var au=null;if(L.isArray(aq)){aA=aq[0];az=aq[1]}else{aA=aq}if(isNaN(aA)){if(aA.charAt(aA.length-1)==="%"){ai="multiply";aA=parseFloat(aA)/100+1}}else{aA=parseFloat(aA);ai="add"}if(az!==null&&isNaN(az)){if(az.charAt(az.length-1)==="%"){au="multiply";az=parseFloat(az)/100+1}}else{if(az!==null){az=parseFloat(az);au="add"}}if(aA!==null){if(az===null){az=-aA;au=ai;if(au==="multiply"){az+=2}}if(aA<az){var ax=aA;aA=az;az=ax;ax=ai;ai=au;au=ax}for(var aw=0,at=aB.length;aw<at;aw++){switch(ai){case"add":an.hiData.push([aB[aw][0],aB[aw][1]+aA]);break;case"multiply":an.hiData.push([aB[aw][0],aB[aw][1]*aA]);break}switch(au){case"add":an.lowData.push([aB[aw][0],aB[aw][1]+az]);break;case"multiply":an.lowData.push([aB[aw][0],aB[aw][1]*az]);break}}}else{an.show=false}}}var am=an.hiData;var ap=an.lowData;for(var aw=0,at=am.length;aw<at;aw++){if((am[aw][1]!=null&&am[aw][1]>an._max)||an._max==null){an._max=am[aw][1]}}for(var aw=0,at=ap.length;aw<at;aw++){if((ap[aw][1]!=null&&ap[aw][1]<an._min)||an._min==null){an._min=ap[aw][1]}}if(an.fillColor===null){var ay=L.jqplot.getColorComponents(an.color);ay[3]=ay[3]*0.5;an.fillColor="rgba("+ay[0]+", "+ay[1]+", "+ay[2]+", "+ay[3]+")"}};function K(ai,ah){return(3.4182054+ah)*Math.pow(ai,-0.3534992)}function n(aj,ai){var ah=Math.sqrt(Math.pow((ai[0]-aj[0]),2)+Math.pow((ai[1]-aj[1]),2));return 5.7648*Math.log(ah)+7.4456}function A(ah){var ai=(Math.exp(2*ah)-1)/(Math.exp(2*ah)+1);return ai}function J(aJ){var at=this.renderer.smooth;var aD=this.canvas.getWidth();var an=this._xaxis.series_p2u;var aG=this._yaxis.series_p2u;var aF=null;var am=null;var az=aJ.length/aD;var aj=[];var ay=[];if(!isNaN(parseFloat(at))){aF=parseFloat(at)}else{aF=K(az,0.5)}var aw=[];var ak=[];for(var aE=0,aA=aJ.length;aE<aA;aE++){aw.push(aJ[aE][1]);ak.push(aJ[aE][0])}function av(aK,aL){if(aK-aL==0){return Math.pow(10,10)}else{return aK-aL}}var ax,ar,aq,ap;var ah=aJ.length-1;for(var al=1,aB=aJ.length;al<aB;al++){var ai=[];var au=[];for(var aC=0;aC<2;aC++){var aE=al-1+aC;if(aE==0||aE==ah){ai[aC]=Math.pow(10,10)}else{if(aw[aE+1]-aw[aE]==0||aw[aE]-aw[aE-1]==0){ai[aC]=0}else{if(((ak[aE+1]-ak[aE])/(aw[aE+1]-aw[aE])+(ak[aE]-ak[aE-1])/(aw[aE]-aw[aE-1]))==0){ai[aC]=0}else{if((aw[aE+1]-aw[aE])*(aw[aE]-aw[aE-1])<0){ai[aC]=0}else{ai[aC]=2/(av(ak[aE+1],ak[aE])/(aw[aE+1]-aw[aE])+av(ak[aE],ak[aE-1])/(aw[aE]-aw[aE-1]))}}}}}if(al==1){ai[0]=3/2*(aw[1]-aw[0])/av(ak[1],ak[0])-ai[1]/2}else{if(al==ah){ai[1]=3/2*(aw[ah]-aw[ah-1])/av(ak[ah],ak[ah-1])-ai[0]/2}}au[0]=-2*(ai[1]+2*ai[0])/av(ak[al],ak[al-1])+6*(aw[al]-aw[al-1])/Math.pow(av(ak[al],ak[al-1]),2);au[1]=2*(2*ai[1]+ai[0])/av(ak[al],ak[al-1])-6*(aw[al]-aw[al-1])/Math.pow(av(ak[al],ak[al-1]),2);ap=1/6*(au[1]-au[0])/av(ak[al],ak[al-1]);aq=1/2*(ak[al]*au[0]-ak[al-1]*au[1])/av(ak[al],ak[al-1]);ar=(aw[al]-aw[al-1]-aq*(Math.pow(ak[al],2)-Math.pow(ak[al-1],2))-ap*(Math.pow(ak[al],3)-Math.pow(ak[al-1],3)))/av(ak[al],ak[al-1]);ax=aw[al-1]-ar*ak[al-1]-aq*Math.pow(ak[al-1],2)-ap*Math.pow(ak[al-1],3);var aI=(ak[al]-ak[al-1])/aF;var aH,ao;for(var aC=0,aA=aF;aC<aA;aC++){aH=[];ao=ak[al-1]+aC*aI;aH.push(ao);aH.push(ax+ar*ao+aq*Math.pow(ao,2)+ap*Math.pow(ao,3));aj.push(aH);ay.push([an(aH[0]),aG(aH[1])])}}aj.push(aJ[aE]);ay.push([an(aJ[aE][0]),aG(aJ[aE][1])]);return[aj,ay]}function F(ap){var ao=this.renderer.smooth;var aU=this.renderer.tension;var ah=this.canvas.getWidth();var aH=this._xaxis.series_p2u;var aq=this._yaxis.series_p2u;var aI=null;var aJ=null;var aT=null;var aO=null;var aM=null;var at=null;var aR=null;var am=null;var aK,aL,aD,aC,aA,ay;var ak,ai,av,au;var aB,az,aN;var aw=[];var aj=[];var al=ap.length/ah;var aS,ax,aF,aG,aE;var ar=[];var an=[];if(!isNaN(parseFloat(ao))){aI=parseFloat(ao)}else{aI=K(al,0.5)}if(!isNaN(parseFloat(aU))){aU=parseFloat(aU)}for(var aQ=0,aP=ap.length-1;aQ<aP;aQ++){if(aU===null){at=Math.abs((ap[aQ+1][1]-ap[aQ][1])/(ap[aQ+1][0]-ap[aQ][0]));aS=0.3;ax=0.6;aF=(ax-aS)/2;aG=2.5;aE=-1.4;am=at/aG+aE;aO=aF*A(am)-aF*A(aE)+aS;if(aQ>0){aR=Math.abs((ap[aQ][1]-ap[aQ-1][1])/(ap[aQ][0]-ap[aQ-1][0]))}am=aR/aG+aE;aM=aF*A(am)-aF*A(aE)+aS;aT=(aO+aM)/2}else{aT=aU}for(aK=0;aK<aI;aK++){aL=aK/aI;aD=(1+2*aL)*Math.pow((1-aL),2);aC=aL*Math.pow((1-aL),2);aA=Math.pow(aL,2)*(3-2*aL);ay=Math.pow(aL,2)*(aL-1);if(ap[aQ-1]){ak=aT*(ap[aQ+1][0]-ap[aQ-1][0]);ai=aT*(ap[aQ+1][1]-ap[aQ-1][1])}else{ak=aT*(ap[aQ+1][0]-ap[aQ][0]);ai=aT*(ap[aQ+1][1]-ap[aQ][1])}if(ap[aQ+2]){av=aT*(ap[aQ+2][0]-ap[aQ][0]);au=aT*(ap[aQ+2][1]-ap[aQ][1])}else{av=aT*(ap[aQ+1][0]-ap[aQ][0]);au=aT*(ap[aQ+1][1]-ap[aQ][1])}aB=aD*ap[aQ][0]+aA*ap[aQ+1][0]+aC*ak+ay*av;az=aD*ap[aQ][1]+aA*ap[aQ+1][1]+aC*ai+ay*au;aN=[aB,az];ar.push(aN);an.push([aH(aB),aq(az)])}}ar.push(ap[aP]);an.push([aH(ap[aP][0]),aq(ap[aP][1])]);return[ar,an]}L.jqplot.LineRenderer.prototype.setGridData=function(ap){var al=this._xaxis.series_u2p;var ah=this._yaxis.series_u2p;var am=this._plotData;var aq=this._prevPlotData;this.gridData=[];this._prevGridData=[];this.renderer._smoothedData=[];this.renderer._smoothedPlotData=[];this.renderer._hiBandGridData=[];this.renderer._lowBandGridData=[];this.renderer._hiBandSmoothedData=[];this.renderer._lowBandSmoothedData=[];var ak=this.renderer.bands;var ai=false;for(var an=0,aj=am.length;an<aj;an++){if(am[an][0]!=null&&am[an][1]!=null){this.gridData.push([al.call(this._xaxis,am[an][0]),ah.call(this._yaxis,am[an][1])])}else{if(am[an][0]==null){ai=true;this.gridData.push([null,ah.call(this._yaxis,am[an][1])])}else{if(am[an][1]==null){ai=true;this.gridData.push([al.call(this._xaxis,am[an][0]),null])}}}if(aq[an]!=null&&aq[an][0]!=null&&aq[an][1]!=null){this._prevGridData.push([al.call(this._xaxis,aq[an][0]),ah.call(this._yaxis,aq[an][1])])}else{if(aq[an]!=null&&aq[an][0]==null){this._prevGridData.push([null,ah.call(this._yaxis,aq[an][1])])}else{if(aq[an]!=null&&aq[an][0]!=null&&aq[an][1]==null){this._prevGridData.push([al.call(this._xaxis,aq[an][0]),null])}}}}if(ai){this.renderer.smooth=false;if(this._type==="line"){ak.show=false}}if(this._type==="line"&&ak.show){for(var an=0,aj=ak.hiData.length;an<aj;an++){this.renderer._hiBandGridData.push([al.call(this._xaxis,ak.hiData[an][0]),ah.call(this._yaxis,ak.hiData[an][1])])}for(var an=0,aj=ak.lowData.length;an<aj;an++){this.renderer._lowBandGridData.push([al.call(this._xaxis,ak.lowData[an][0]),ah.call(this._yaxis,ak.lowData[an][1])])}}if(this._type==="line"&&this.renderer.smooth&&this.gridData.length>2){var ao;if(this.renderer.constrainSmoothing){ao=J.call(this,this.gridData);this.renderer._smoothedData=ao[0];this.renderer._smoothedPlotData=ao[1];if(ak.show){ao=J.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ao[0];ao=J.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ao[0]}ao=null}else{ao=F.call(this,this.gridData);this.renderer._smoothedData=ao[0];this.renderer._smoothedPlotData=ao[1];if(ak.show){ao=F.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ao[0];ao=F.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ao[0]}ao=null}}};L.jqplot.LineRenderer.prototype.makeGridData=function(ao,aq){var am=this._xaxis.series_u2p;var ah=this._yaxis.series_u2p;var ar=[];var aj=[];this.renderer._smoothedData=[];this.renderer._smoothedPlotData=[];this.renderer._hiBandGridData=[];this.renderer._lowBandGridData=[];this.renderer._hiBandSmoothedData=[];this.renderer._lowBandSmoothedData=[];var al=this.renderer.bands;var ai=false;for(var an=0;an<ao.length;an++){if(ao[an][0]!=null&&ao[an][1]!=null){ar.push([am.call(this._xaxis,ao[an][0]),ah.call(this._yaxis,ao[an][1])])}else{if(ao[an][0]==null){ai=true;ar.push([null,ah.call(this._yaxis,ao[an][1])])}else{if(ao[an][1]==null){ai=true;ar.push([am.call(this._xaxis,ao[an][0]),null])}}}}if(ai){this.renderer.smooth=false;if(this._type==="line"){al.show=false}}if(this._type==="line"&&al.show){for(var an=0,ak=al.hiData.length;an<ak;an++){this.renderer._hiBandGridData.push([am.call(this._xaxis,al.hiData[an][0]),ah.call(this._yaxis,al.hiData[an][1])])}for(var an=0,ak=al.lowData.length;an<ak;an++){this.renderer._lowBandGridData.push([am.call(this._xaxis,al.lowData[an][0]),ah.call(this._yaxis,al.lowData[an][1])])}}if(this._type==="line"&&this.renderer.smooth&&ar.length>2){var ap;if(this.renderer.constrainSmoothing){ap=J.call(this,ar);this.renderer._smoothedData=ap[0];this.renderer._smoothedPlotData=ap[1];if(al.show){ap=J.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ap[0];ap=J.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ap[0]}ap=null}else{ap=F.call(this,ar);this.renderer._smoothedData=ap[0];this.renderer._smoothedPlotData=ap[1];if(al.show){ap=F.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ap[0];ap=F.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ap[0]}ap=null}}return ar};L.jqplot.LineRenderer.prototype.draw=function(ax,aI,ai,aB){var aC;var aq=L.extend(true,{},ai);var ak=(aq.shadow!=u)?aq.shadow:this.shadow;var aJ=(aq.showLine!=u)?aq.showLine:this.showLine;var aA=(aq.fill!=u)?aq.fill:this.fill;var ah=(aq.fillAndStroke!=u)?aq.fillAndStroke:this.fillAndStroke;var ar,ay,av,aE;ax.save();if(aI.length){if(aJ){if(aA){if(this.fillToZero){var aF=this.negativeColor;if(!this.useNegativeColors){aF=aq.fillStyle}var ao=false;var ap=aq.fillStyle;if(ah){var aH=aI.slice(0)}if(this.index==0||!this._stack){var aw=[];var aL=(this.renderer.smooth)?this.renderer._smoothedPlotData:this._plotData;this._areaPoints=[];var aG=this._yaxis.series_u2p(this.fillToValue);var aj=this._xaxis.series_u2p(this.fillToValue);aq.closePath=true;if(this.fillAxis=="y"){aw.push([aI[0][0],aG]);this._areaPoints.push([aI[0][0],aG]);for(var aC=0;aC<aI.length-1;aC++){aw.push(aI[aC]);this._areaPoints.push(aI[aC]);if(aL[aC][1]*aL[aC+1][1]<=0){if(aL[aC][1]<0){ao=true;aq.fillStyle=aF}else{ao=false;aq.fillStyle=ap}var an=aI[aC][0]+(aI[aC+1][0]-aI[aC][0])*(aG-aI[aC][1])/(aI[aC+1][1]-aI[aC][1]);aw.push([an,aG]);this._areaPoints.push([an,aG]);if(ak){this.renderer.shadowRenderer.draw(ax,aw,aq)}this.renderer.shapeRenderer.draw(ax,aw,aq);aw=[[an,aG]]}}if(aL[aI.length-1][1]<0){ao=true;aq.fillStyle=aF}else{ao=false;aq.fillStyle=ap}aw.push(aI[aI.length-1]);this._areaPoints.push(aI[aI.length-1]);aw.push([aI[aI.length-1][0],aG]);this._areaPoints.push([aI[aI.length-1][0],aG])}if(ak){this.renderer.shadowRenderer.draw(ax,aw,aq)}this.renderer.shapeRenderer.draw(ax,aw,aq)}else{var au=this._prevGridData;for(var aC=au.length;aC>0;aC--){aI.push(au[aC-1])}if(ak){this.renderer.shadowRenderer.draw(ax,aI,aq)}this._areaPoints=aI;this.renderer.shapeRenderer.draw(ax,aI,aq)}}else{if(ah){var aH=aI.slice(0)}if(this.index==0||!this._stack){var al=ax.canvas.height;aI.unshift([aI[0][0],al]);var aD=aI.length;aI.push([aI[aD-1][0],al])}else{var au=this._prevGridData;for(var aC=au.length;aC>0;aC--){aI.push(au[aC-1])}}this._areaPoints=aI;if(ak){this.renderer.shadowRenderer.draw(ax,aI,aq)}this.renderer.shapeRenderer.draw(ax,aI,aq)}if(ah){var az=L.extend(true,{},aq,{fill:false,closePath:false});this.renderer.shapeRenderer.draw(ax,aH,az);if(this.markerRenderer.show){if(this.renderer.smooth){aH=this.gridData}for(aC=0;aC<aH.length;aC++){this.markerRenderer.draw(aH[aC][0],aH[aC][1],ax,aq.markerOptions)}}}}else{if(this.renderer.bands.show){var am;var aK=L.extend(true,{},aq);if(this.renderer.bands.showLines){am=(this.renderer.smooth)?this.renderer._hiBandSmoothedData:this.renderer._hiBandGridData;this.renderer.shapeRenderer.draw(ax,am,aq);am=(this.renderer.smooth)?this.renderer._lowBandSmoothedData:this.renderer._lowBandGridData;this.renderer.shapeRenderer.draw(ax,am,aK)}if(this.renderer.bands.fill){if(this.renderer.smooth){am=this.renderer._hiBandSmoothedData.concat(this.renderer._lowBandSmoothedData.reverse())}else{am=this.renderer._hiBandGridData.concat(this.renderer._lowBandGridData.reverse())}this._areaPoints=am;aK.closePath=true;aK.fill=true;aK.fillStyle=this.renderer.bands.fillColor;this.renderer.shapeRenderer.draw(ax,am,aK)}}if(ak){this.renderer.shadowRenderer.draw(ax,aI,aq)}this.renderer.shapeRenderer.draw(ax,aI,aq)}}var ar=av=ay=aE=null;for(aC=0;aC<this._areaPoints.length;aC++){var at=this._areaPoints[aC];if(ar>at[0]||ar==null){ar=at[0]}if(aE<at[1]||aE==null){aE=at[1]}if(av<at[0]||av==null){av=at[0]}if(ay>at[1]||ay==null){ay=at[1]}}if(this.type==="line"&&this.renderer.bands.show){aE=this._yaxis.series_u2p(this.renderer.bands._min);ay=this._yaxis.series_u2p(this.renderer.bands._max)}this._boundingBox=[[ar,aE],[av,ay]];if(this.markerRenderer.show&&!aA){if(this.renderer.smooth){aI=this.gridData}for(aC=0;aC<aI.length;aC++){if(aI[aC][0]!=null&&aI[aC][1]!=null){this.markerRenderer.draw(aI[aC][0],aI[aC][1],ax,aq.markerOptions)}}}}ax.restore()};L.jqplot.LineRenderer.prototype.drawShadow=function(ah,aj,ai){};function z(ak,aj,ah){for(var ai=0;ai<this.series.length;ai++){if(this.series[ai].renderer.constructor==L.jqplot.LineRenderer){if(this.series[ai].highlightMouseOver){this.series[ai].highlightMouseDown=false}}}}function af(){if(this.plugins.lineRenderer&&this.plugins.lineRenderer.highlightCanvas){this.plugins.lineRenderer.highlightCanvas.resetCanvas();this.plugins.lineRenderer.highlightCanvas=null}this.plugins.lineRenderer.highlightedSeriesIndex=null;this.plugins.lineRenderer.highlightCanvas=new L.jqplot.GenericCanvas();this.eventCanvas._elem.before(this.plugins.lineRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-lineRenderer-highlight-canvas",this._plotDimensions,this));this.plugins.lineRenderer.highlightCanvas.setContext();this.eventCanvas._elem.bind("mouseleave",{plot:this},function(ah){aa(ah.data.plot)})}function ac(an,am,ak,aj){var ai=an.series[am];var ah=an.plugins.lineRenderer.highlightCanvas;ah._ctx.clearRect(0,0,ah._ctx.canvas.width,ah._ctx.canvas.height);ai._highlightedPoint=ak;an.plugins.lineRenderer.highlightedSeriesIndex=am;var al={fillStyle:ai.highlightColor};if(ai.type==="line"&&ai.renderer.bands.show){al.fill=true;al.closePath=true}ai.renderer.shapeRenderer.draw(ah._ctx,aj,al);ah=null}function aa(aj){var ah=aj.plugins.lineRenderer.highlightCanvas;ah._ctx.clearRect(0,0,ah._ctx.canvas.width,ah._ctx.canvas.height);for(var ai=0;ai<aj.series.length;ai++){aj.series[ai]._highlightedPoint=null}aj.plugins.lineRenderer.highlightedSeriesIndex=null;aj.target.trigger("jqplotDataUnhighlight");ah=null}function h(al,ak,ao,an,am){if(an){var aj=[an.seriesIndex,an.pointIndex,an.data];var ai=jQuery.Event("jqplotDataMouseOver");ai.pageX=al.pageX;ai.pageY=al.pageY;am.target.trigger(ai,aj);if(am.series[aj[0]].highlightMouseOver&&!(aj[0]==am.plugins.lineRenderer.highlightedSeriesIndex)){var ah=jQuery.Event("jqplotDataHighlight");ah.which=al.which;ah.pageX=al.pageX;ah.pageY=al.pageY;am.target.trigger(ah,aj);ac(am,an.seriesIndex,an.pointIndex,an.points)}}else{if(an==null){aa(am)}}}function e(ak,aj,an,am,al){if(am){var ai=[am.seriesIndex,am.pointIndex,am.data];if(al.series[ai[0]].highlightMouseDown&&!(ai[0]==al.plugins.lineRenderer.highlightedSeriesIndex)){var ah=jQuery.Event("jqplotDataHighlight");ah.which=ak.which;ah.pageX=ak.pageX;ah.pageY=ak.pageY;al.target.trigger(ah,ai);ac(al,am.seriesIndex,am.pointIndex,am.points)}}else{if(am==null){aa(al)}}}function ad(aj,ai,am,al,ak){var ah=ak.plugins.lineRenderer.highlightedSeriesIndex;if(ah!=null&&ak.series[ah].highlightMouseDown){aa(ak)}}function g(ak,aj,an,am,al){if(am){var ai=[am.seriesIndex,am.pointIndex,am.data];var ah=jQuery.Event("jqplotDataClick");ah.which=ak.which;ah.pageX=ak.pageX;ah.pageY=ak.pageY;al.target.trigger(ah,ai)}}function s(al,ak,ao,an,am){if(an){var aj=[an.seriesIndex,an.pointIndex,an.data];var ah=am.plugins.lineRenderer.highlightedSeriesIndex;if(ah!=null&&am.series[ah].highlightMouseDown){aa(am)}var ai=jQuery.Event("jqplotDataRightClick");ai.which=al.which;ai.pageX=al.pageX;ai.pageY=al.pageY;am.target.trigger(ai,aj)}}L.jqplot.LinearAxisRenderer=function(){};L.jqplot.LinearAxisRenderer.prototype.init=function(ah){this.breakPoints=null;this.breakTickLabel="≈";this.drawBaseline=true;this.baselineWidth=null;this.baselineColor=null;this.forceTickAt0=false;this.forceTickAt100=false;this.tickInset=0;this.minorTicks=0;this.alignTicks=false;this._autoFormatString="";this._overrideFormatString=false;this._scalefact=1;L.extend(true,this,ah);if(this.breakPoints){if(!L.isArray(this.breakPoints)){this.breakPoints=null}else{if(this.breakPoints.length<2||this.breakPoints[1]<=this.breakPoints[0]){this.breakPoints=null}}}if(this.numberTicks!=null&&this.numberTicks<2){this.numberTicks=2}this.resetDataBounds()};L.jqplot.LinearAxisRenderer.prototype.draw=function(ah,ao){if(this.show){this.renderer.createTicks.call(this,ao);var an=0;var ai;if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=L(document.createElement("div"));this._elem.addClass("jqplot-axis jqplot-"+this.name);this._elem.css("position","absolute");if(this.name=="xaxis"||this.name=="x2axis"){this._elem.width(this._plotDimensions.width)}else{this._elem.height(this._plotDimensions.height)}this.labelOptions.axis=this.name;this._label=new this.labelRenderer(this.labelOptions);if(this._label.show){var am=this._label.draw(ah,ao);am.appendTo(this._elem);am=null}var al=this._ticks;var ak;for(var aj=0;aj<al.length;aj++){ak=al[aj];if(ak.show&&ak.showLabel&&(!ak.isMinorTick||this.showMinorTicks)){this._elem.append(ak.draw(ah,ao))}}ak=null;al=null}return this._elem};L.jqplot.LinearAxisRenderer.prototype.reset=function(){this.min=this._options.min;this.max=this._options.max;this.tickInterval=this._options.tickInterval;this.numberTicks=this._options.numberTicks;this._autoFormatString="";if(this._overrideFormatString&&this.tickOptions&&this.tickOptions.formatString){this.tickOptions.formatString=""}};L.jqplot.LinearAxisRenderer.prototype.set=function(){var ao=0;var aj;var ai=0;var an=0;var ah=(this._label==null)?false:this._label.show;if(this.show){var am=this._ticks;var al;for(var ak=0;ak<am.length;ak++){al=am[ak];if(!al._breakTick&&al.show&&al.showLabel&&(!al.isMinorTick||this.showMinorTicks)){if(this.name=="xaxis"||this.name=="x2axis"){aj=al._elem.outerHeight(true)}else{aj=al._elem.outerWidth(true)}if(aj>ao){ao=aj}}}al=null;am=null;if(ah){ai=this._label._elem.outerWidth(true);an=this._label._elem.outerHeight(true)}if(this.name=="xaxis"){ao=ao+an;this._elem.css({height:ao+"px",left:"0px",bottom:"0px"})}else{if(this.name=="x2axis"){ao=ao+an;this._elem.css({height:ao+"px",left:"0px",top:"0px"})}else{if(this.name=="yaxis"){ao=ao+ai;this._elem.css({width:ao+"px",left:"0px",top:"0px"});if(ah&&this._label.constructor==L.jqplot.AxisLabelRenderer){this._label._elem.css("width",ai+"px")}}else{ao=ao+ai;this._elem.css({width:ao+"px",right:"0px",top:"0px"});if(ah&&this._label.constructor==L.jqplot.AxisLabelRenderer){this._label._elem.css("width",ai+"px")}}}}}};L.jqplot.LinearAxisRenderer.prototype.createTicks=function(aj){var aT=this._ticks;var aK=this.ticks;var az=this.name;var aB=this._dataBounds;var ah=(this.name.charAt(0)==="x")?this._plotDimensions.width:this._plotDimensions.height;var an;var a6,aI;var ap,ao;var a4,a0;var aH=this.min;var a5=this.max;var aW=this.numberTicks;var ba=this.tickInterval;var am=30;this._scalefact=(Math.max(ah,am+1)-am)/300;if(aK.length){for(a0=0;a0<aK.length;a0++){var aO=aK[a0];var aU=new this.tickRenderer(this.tickOptions);if(L.isArray(aO)){aU.value=aO[0];if(this.breakPoints){if(aO[0]==this.breakPoints[0]){aU.label=this.breakTickLabel;aU._breakTick=true;aU.showGridline=false;aU.showMark=false}else{if(aO[0]>this.breakPoints[0]&&aO[0]<=this.breakPoints[1]){aU.show=false;aU.showGridline=false;aU.label=aO[1]}else{aU.label=aO[1]}}}else{aU.label=aO[1]}aU.setTick(aO[0],this.name);this._ticks.push(aU)}else{if(L.isPlainObject(aO)){L.extend(true,aU,aO);aU.axis=this.name;this._ticks.push(aU)}else{aU.value=aO;if(this.breakPoints){if(aO==this.breakPoints[0]){aU.label=this.breakTickLabel;aU._breakTick=true;aU.showGridline=false;aU.showMark=false}else{if(aO>this.breakPoints[0]&&aO<=this.breakPoints[1]){aU.show=false;aU.showGridline=false}}}aU.setTick(aO,this.name);this._ticks.push(aU)}}}this.numberTicks=aK.length;this.min=this._ticks[0].value;this.max=this._ticks[this.numberTicks-1].value;this.tickInterval=(this.max-this.min)/(this.numberTicks-1)}else{if(az=="xaxis"||az=="x2axis"){ah=this._plotDimensions.width}else{ah=this._plotDimensions.height}var ax=this.numberTicks;if(this.alignTicks){if(this.name==="x2axis"&&aj.axes.xaxis.show){ax=aj.axes.xaxis.numberTicks}else{if(this.name.charAt(0)==="y"&&this.name!=="yaxis"&&this.name!=="yMidAxis"&&aj.axes.yaxis.show){ax=aj.axes.yaxis.numberTicks}}}a6=((this.min!=null)?this.min:aB.min);aI=((this.max!=null)?this.max:aB.max);var av=aI-a6;var aS,ay;var at;if(this.tickOptions==null||!this.tickOptions.formatString){this._overrideFormatString=true}if(this.min==null||this.max==null&&this.tickInterval==null&&!this.autoscale){if(this.forceTickAt0){if(a6>0){a6=0}if(aI<0){aI=0}}if(this.forceTickAt100){if(a6>100){a6=100}if(aI<100){aI=100}}var aE=false,a1=false;if(this.min!=null){aE=true}else{if(this.max!=null){a1=true}}var aP=L.jqplot.LinearTickGenerator(a6,aI,this._scalefact,ax,aE,a1);var aw=(this.min!=null)?a6:a6+av*(this.padMin-1);var aQ=(this.max!=null)?aI:aI-av*(this.padMax-1);if(a6<aw||aI>aQ){aw=(this.min!=null)?a6:a6-av*(this.padMin-1);aQ=(this.max!=null)?aI:aI+av*(this.padMax-1);aP=L.jqplot.LinearTickGenerator(aw,aQ,this._scalefact,ax,aE,a1)}this.min=aP[0];this.max=aP[1];this.numberTicks=aP[2];this._autoFormatString=aP[3];this.tickInterval=aP[4]}else{if(a6==aI){var ai=0.05;if(a6>0){ai=Math.max(Math.log(a6)/Math.LN10,0.05)}a6-=ai;aI+=ai}if(this.autoscale&&this.min==null&&this.max==null){var ak,al,ar;var aC=false;var aN=false;var aA={min:null,max:null,average:null,stddev:null};for(var a0=0;a0<this._series.length;a0++){var aV=this._series[a0];var aD=(aV.fillAxis=="x")?aV._xaxis.name:aV._yaxis.name;if(this.name==aD){var aR=aV._plotValues[aV.fillAxis];var aG=aR[0];var a2=aR[0];for(var aZ=1;aZ<aR.length;aZ++){if(aR[aZ]<aG){aG=aR[aZ]}else{if(aR[aZ]>a2){a2=aR[aZ]}}}var au=(a2-aG)/a2;if(aV.renderer.constructor==L.jqplot.BarRenderer){if(aG>=0&&(aV.fillToZero||au>0.1)){aC=true}else{aC=false;if(aV.fill&&aV.fillToZero&&aG<0&&a2>0){aN=true}else{aN=false}}}else{if(aV.fill){if(aG>=0&&(aV.fillToZero||au>0.1)){aC=true}else{if(aG<0&&a2>0&&aV.fillToZero){aC=false;aN=true}else{aC=false;aN=false}}}else{if(aG<0){aC=false}}}}}if(aC){this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing);this.min=0;aH=0;al=aI/(this.numberTicks-1);at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)));if(al/at==parseInt(al/at,10)){al+=at}this.tickInterval=Math.ceil(al/at)*at;this.max=this.tickInterval*(this.numberTicks-1)}else{if(aN){this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing);var aJ=Math.ceil(Math.abs(a6)/av*(this.numberTicks-1));var a9=this.numberTicks-1-aJ;al=Math.max(Math.abs(a6/aJ),Math.abs(aI/a9));at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)));this.tickInterval=Math.ceil(al/at)*at;this.max=this.tickInterval*a9;this.min=-this.tickInterval*aJ}else{if(this.numberTicks==null){if(this.tickInterval){this.numberTicks=3+Math.ceil(av/this.tickInterval)}else{this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing)}}if(this.tickInterval==null){al=av/(this.numberTicks-1);if(al<1){at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)))}else{at=1}this.tickInterval=Math.ceil(al*at*this.pad)/at}else{at=1/this.tickInterval}ak=this.tickInterval*(this.numberTicks-1);ar=(ak-av)/2;if(this.min==null){this.min=Math.floor(at*(a6-ar))/at}if(this.max==null){this.max=this.min+ak}}}var aF=L.jqplot.getSignificantFigures(this.tickInterval);var aM;if(aF.digitsLeft>=aF.significantDigits){aM="%d"}else{var at=Math.max(0,5-aF.digitsLeft);at=Math.min(at,aF.digitsRight);aM="%."+at+"f"}this._autoFormatString=aM}else{aS=(this.min!=null)?this.min:a6-av*(this.padMin-1);ay=(this.max!=null)?this.max:aI+av*(this.padMax-1);av=ay-aS;if(this.numberTicks==null){if(this.tickInterval!=null){this.numberTicks=Math.ceil((ay-aS)/this.tickInterval)+1}else{if(ah>100){this.numberTicks=parseInt(3+(ah-100)/75,10)}else{this.numberTicks=2}}}if(this.tickInterval==null){this.tickInterval=av/(this.numberTicks-1)}if(this.max==null){ay=aS+this.tickInterval*(this.numberTicks-1)}if(this.min==null){aS=ay-this.tickInterval*(this.numberTicks-1)}var aF=L.jqplot.getSignificantFigures(this.tickInterval);var aM;if(aF.digitsLeft>=aF.significantDigits){aM="%d"}else{var at=Math.max(0,5-aF.digitsLeft);at=Math.min(at,aF.digitsRight);aM="%."+at+"f"}this._autoFormatString=aM;this.min=aS;this.max=ay}if(this.renderer.constructor==L.jqplot.LinearAxisRenderer&&this._autoFormatString==""){av=this.max-this.min;var a7=new this.tickRenderer(this.tickOptions);var aL=a7.formatString||L.jqplot.config.defaultTickFormatString;var aL=aL.match(L.jqplot.sprintf.regex)[0];var a3=0;if(aL){if(aL.search(/[fFeEgGpP]/)>-1){var aY=aL.match(/\%\.(\d{0,})?[eEfFgGpP]/);if(aY){a3=parseInt(aY[1],10)}else{a3=6}}else{if(aL.search(/[di]/)>-1){a3=0}}var aq=Math.pow(10,-a3);if(this.tickInterval<aq){if(aW==null&&ba==null){this.tickInterval=aq;if(a5==null&&aH==null){this.min=Math.floor(this._dataBounds.min/aq)*aq;if(this.min==this._dataBounds.min){this.min=this._dataBounds.min-this.tickInterval}this.max=Math.ceil(this._dataBounds.max/aq)*aq;if(this.max==this._dataBounds.max){this.max=this._dataBounds.max+this.tickInterval}var aX=(this.max-this.min)/this.tickInterval;aX=aX.toFixed(11);aX=Math.ceil(aX);this.numberTicks=aX+1}else{if(a5==null){var aX=(this._dataBounds.max-this.min)/this.tickInterval;aX=aX.toFixed(11);this.numberTicks=Math.ceil(aX)+2;this.max=this.min+this.tickInterval*(this.numberTicks-1)}else{if(aH==null){var aX=(this.max-this._dataBounds.min)/this.tickInterval;aX=aX.toFixed(11);this.numberTicks=Math.ceil(aX)+2;this.min=this.max-this.tickInterval*(this.numberTicks-1)}else{this.numberTicks=Math.ceil((a5-aH)/this.tickInterval)+1;this.min=Math.floor(aH*Math.pow(10,a3))/Math.pow(10,a3);this.max=Math.ceil(a5*Math.pow(10,a3))/Math.pow(10,a3);this.numberTicks=Math.ceil((this.max-this.min)/this.tickInterval)+1}}}}}}}}if(this._overrideFormatString&&this._autoFormatString!=""){this.tickOptions=this.tickOptions||{};this.tickOptions.formatString=this._autoFormatString}var aU,a8;for(var a0=0;a0<this.numberTicks;a0++){a4=this.min+a0*this.tickInterval;aU=new this.tickRenderer(this.tickOptions);aU.setTick(a4,this.name);this._ticks.push(aU);if(a0<this.numberTicks-1){for(var aZ=0;aZ<this.minorTicks;aZ++){a4+=this.tickInterval/(this.minorTicks+1);a8=L.extend(true,{},this.tickOptions,{name:this.name,value:a4,label:"",isMinorTick:true});aU=new this.tickRenderer(a8);this._ticks.push(aU)}}aU=null}}if(this.tickInset){this.min=this.min-this.tickInset*this.tickInterval;this.max=this.max+this.tickInset*this.tickInterval}aT=null};L.jqplot.LinearAxisRenderer.prototype.resetTickValues=function(aj){if(L.isArray(aj)&&aj.length==this._ticks.length){var ai;for(var ah=0;ah<aj.length;ah++){ai=this._ticks[ah];ai.value=aj[ah];ai.label=ai.formatter(ai.formatString,aj[ah]);ai.label=ai.prefix+ai.label;ai._elem.html(ai.label)}ai=null;this.min=L.jqplot.arrayMin(aj);this.max=L.jqplot.arrayMax(aj);this.pack()}};L.jqplot.LinearAxisRenderer.prototype.pack=function(aj,ai){aj=aj||{};ai=ai||this._offsets;var ay=this._ticks;var au=this.max;var at=this.min;var ao=ai.max;var am=ai.min;var aq=(this._label==null)?false:this._label.show;for(var ar in aj){this._elem.css(ar,aj[ar])}this._offsets=ai;var ak=ao-am;var al=au-at;if(this.breakPoints){al=al-this.breakPoints[1]+this.breakPoints[0];this.p2u=function(aA){return(aA-am)*al/ak+at};this.u2p=function(aA){if(aA>this.breakPoints[0]&&aA<this.breakPoints[1]){aA=this.breakPoints[0]}if(aA<=this.breakPoints[0]){return(aA-at)*ak/al+am}else{return(aA-this.breakPoints[1]+this.breakPoints[0]-at)*ak/al+am}};if(this.name.charAt(0)=="x"){this.series_u2p=function(aA){if(aA>this.breakPoints[0]&&aA<this.breakPoints[1]){aA=this.breakPoints[0]}if(aA<=this.breakPoints[0]){return(aA-at)*ak/al}else{return(aA-this.breakPoints[1]+this.breakPoints[0]-at)*ak/al}};this.series_p2u=function(aA){return aA*al/ak+at}}else{this.series_u2p=function(aA){if(aA>this.breakPoints[0]&&aA<this.breakPoints[1]){aA=this.breakPoints[0]}if(aA>=this.breakPoints[1]){return(aA-au)*ak/al}else{return(aA+this.breakPoints[1]-this.breakPoints[0]-au)*ak/al}};this.series_p2u=function(aA){return aA*al/ak+au}}}else{this.p2u=function(aA){return(aA-am)*al/ak+at};this.u2p=function(aA){return(aA-at)*ak/al+am};if(this.name=="xaxis"||this.name=="x2axis"){this.series_u2p=function(aA){return(aA-at)*ak/al};this.series_p2u=function(aA){return aA*al/ak+at}}else{this.series_u2p=function(aA){return(aA-au)*ak/al};this.series_p2u=function(aA){return aA*al/ak+au}}}if(this.show){if(this.name=="xaxis"||this.name=="x2axis"){for(var av=0;av<ay.length;av++){var ap=ay[av];if(ap.show&&ap.showLabel){var ah;if(ap.constructor==L.jqplot.CanvasAxisTickRenderer&&ap.angle){var ax=(this.name=="xaxis")?1:-1;switch(ap.labelPosition){case"auto":if(ax*ap.angle<0){ah=-ap.getWidth()+ap._textRenderer.height*Math.sin(-ap._textRenderer.angle)/2}else{ah=-ap._textRenderer.height*Math.sin(ap._textRenderer.angle)/2}break;case"end":ah=-ap.getWidth()+ap._textRenderer.height*Math.sin(-ap._textRenderer.angle)/2;break;case"start":ah=-ap._textRenderer.height*Math.sin(ap._textRenderer.angle)/2;break;case"middle":ah=-ap.getWidth()/2+ap._textRenderer.height*Math.sin(-ap._textRenderer.angle)/2;break;default:ah=-ap.getWidth()/2+ap._textRenderer.height*Math.sin(-ap._textRenderer.angle)/2;break}}else{ah=-ap.getWidth()/2}var az=this.u2p(ap.value)+ah+"px";ap._elem.css("left",az);ap.pack()}}if(aq){var an=this._label._elem.outerWidth(true);this._label._elem.css("left",am+ak/2-an/2+"px");if(this.name=="xaxis"){this._label._elem.css("bottom","0px")}else{this._label._elem.css("top","0px")}this._label.pack()}}else{for(var av=0;av<ay.length;av++){var ap=ay[av];if(ap.show&&ap.showLabel){var ah;if(ap.constructor==L.jqplot.CanvasAxisTickRenderer&&ap.angle){var ax=(this.name=="yaxis")?1:-1;switch(ap.labelPosition){case"auto":case"end":if(ax*ap.angle<0){ah=-ap._textRenderer.height*Math.cos(-ap._textRenderer.angle)/2}else{ah=-ap.getHeight()+ap._textRenderer.height*Math.cos(ap._textRenderer.angle)/2}break;case"start":if(ap.angle>0){ah=-ap._textRenderer.height*Math.cos(-ap._textRenderer.angle)/2}else{ah=-ap.getHeight()+ap._textRenderer.height*Math.cos(ap._textRenderer.angle)/2}break;case"middle":ah=-ap.getHeight()/2;break;default:ah=-ap.getHeight()/2;break}}else{ah=-ap.getHeight()/2}var az=this.u2p(ap.value)+ah+"px";ap._elem.css("top",az);ap.pack()}}if(aq){var aw=this._label._elem.outerHeight(true);this._label._elem.css("top",ao-ak/2-aw/2+"px");if(this.name=="yaxis"){this._label._elem.css("left","0px")}else{this._label._elem.css("right","0px")}this._label.pack()}}}ay=null};function i(ai){var ah;ai=Math.abs(ai);if(ai>=10){ah="%d"}else{if(ai>1){if(ai===parseInt(ai,10)){ah="%d"}else{ah="%.1f"}}else{var aj=-Math.floor(Math.log(ai)/Math.LN10);ah="%."+aj+"f"}}return ah}var b=[0.1,0.2,0.3,0.4,0.5,0.8,1,2,3,4,5];var c=function(ai){var ah=b.indexOf(ai);if(ah>0){return b[ah-1]}else{return b[b.length-1]/100}};var k=function(ai){var ah=b.indexOf(ai);if(ah<b.length-1){return b[ah+1]}else{return b[0]*100}};function d(al,au,at){var aq=Math.floor(at/2);var ai=Math.ceil(at*1.5);var ak=Number.MAX_VALUE;var ah=(au-al);var ax;var ap;var ar;var ay=L.jqplot.getSignificantFigures;var aw;var an;var ao;var av;for(var am=0,aj=ai-aq+1;am<aj;am++){ao=aq+am;ax=ah/(ao-1);ap=ay(ax);ax=Math.abs(at-ao)+ap.digitsRight;if(ax<ak){ak=ax;ar=ao;av=ap.digitsRight}else{if(ax===ak){if(ap.digitsRight<av){ar=ao;av=ap.digitsRight}}}}aw=Math.max(av,Math.max(ay(al).digitsRight,ay(au).digitsRight));if(aw===0){an="%d"}else{an="%."+aw+"f"}ax=ah/(ar-1);return[al,au,ar,an,ax]}function W(ai,al){al=al||7;var ak=ai/(al-1);var aj=Math.pow(10,Math.floor(Math.log(ak)/Math.LN10));var am=ak/aj;var ah;if(aj<1){if(am>5){ah=10*aj}else{if(am>2){ah=5*aj}else{if(am>1){ah=2*aj}else{ah=aj}}}}else{if(am>5){ah=10*aj}else{if(am>4){ah=5*aj}else{if(am>3){ah=4*aj}else{if(am>2){ah=3*aj}else{if(am>1){ah=2*aj}else{ah=aj}}}}}}return ah}function Q(ai,ah){ah=ah||1;var ak=Math.floor(Math.log(ai)/Math.LN10);var am=Math.pow(10,ak);var al=ai/am;var aj;al=al/ah;if(al<=0.38){aj=0.1}else{if(al<=1.6){aj=0.2}else{if(al<=4){aj=0.5}else{if(al<=8){aj=1}else{if(al<=16){aj=2}else{aj=5}}}}}return aj*am}function x(aj,ai){var al=Math.floor(Math.log(aj)/Math.LN10);var an=Math.pow(10,al);var am=aj/an;var ah;var ak;am=am/ai;if(am<=0.38){ak=0.1}else{if(am<=1.6){ak=0.2}else{if(am<=4){ak=0.5}else{if(am<=8){ak=1}else{if(am<=16){ak=2}else{ak=5}}}}}ah=ak*an;return[ah,ak,an]}L.jqplot.LinearTickGenerator=function(an,aq,aj,ak,ao,ar){ao=(ao===null)?false:ao;ar=(ar===null||ao)?false:ar;if(an===aq){aq=(aq)?0:1}aj=aj||1;if(aq<an){var at=aq;aq=an;an=at}var ai=[];var aw=Q(aq-an,aj);var av=L.jqplot.getSignificantFigures;if(ak==null){if(!ao&&!ar){ai[0]=Math.floor(an/aw)*aw;ai[1]=Math.ceil(aq/aw)*aw;ai[2]=Math.round((ai[1]-ai[0])/aw+1);ai[3]=i(aw);ai[4]=aw}else{if(ao){ai[0]=an;ai[2]=Math.ceil((aq-an)/aw+1);ai[1]=an+(ai[2]-1)*aw;var au=av(an).digitsRight;var ap=av(aw).digitsRight;if(au<ap){ai[3]=i(aw)}else{ai[3]="%."+au+"f"}ai[4]=aw}else{if(ar){ai[1]=aq;ai[2]=Math.ceil((aq-an)/aw+1);ai[0]=aq-(ai[2]-1)*aw;var al=av(aq).digitsRight;var ap=av(aw).digitsRight;if(al<ap){ai[3]=i(aw)}else{ai[3]="%."+al+"f"}ai[4]=aw}}}}else{var am=[];am[0]=Math.floor(an/aw)*aw;am[1]=Math.ceil(aq/aw)*aw;am[2]=Math.round((am[1]-am[0])/aw+1);am[3]=i(aw);am[4]=aw;if(am[2]===ak){ai=am}else{var ah=W(am[1]-am[0],ak);ai[0]=am[0];ai[2]=ak;ai[4]=ah;ai[3]=i(ah);ai[1]=ai[0]+(ai[2]-1)*ai[4]}}return ai};L.jqplot.LinearTickGenerator.bestLinearInterval=Q;L.jqplot.LinearTickGenerator.bestInterval=W;L.jqplot.LinearTickGenerator.bestLinearComponents=x;L.jqplot.LinearTickGenerator.bestConstrainedInterval=d;L.jqplot.MarkerRenderer=function(ah){this.show=true;this.style="filledCircle";this.lineWidth=2;this.size=9;this.color="#666666";this.shadow=true;this.shadowAngle=45;this.shadowOffset=1;this.shadowDepth=3;this.shadowAlpha="0.07";this.shadowRenderer=new L.jqplot.ShadowRenderer();this.shapeRenderer=new L.jqplot.ShapeRenderer();L.extend(true,this,ah)};L.jqplot.MarkerRenderer.prototype.init=function(ah){L.extend(true,this,ah);var aj={angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,lineWidth:this.lineWidth,depth:this.shadowDepth,closePath:true};if(this.style.indexOf("filled")!=-1){aj.fill=true}if(this.style.indexOf("ircle")!=-1){aj.isarc=true;aj.closePath=false}this.shadowRenderer.init(aj);var ai={fill:false,isarc:false,strokeStyle:this.color,fillStyle:this.color,lineWidth:this.lineWidth,closePath:true};if(this.style.indexOf("filled")!=-1){ai.fill=true}if(this.style.indexOf("ircle")!=-1){ai.isarc=true;ai.closePath=false}this.shapeRenderer.init(ai)};L.jqplot.MarkerRenderer.prototype.drawDiamond=function(aj,ai,am,al,ao){var ah=1.2;var ap=this.size/2/ah;var an=this.size/2*ah;var ak=[[aj-ap,ai],[aj,ai+an],[aj+ap,ai],[aj,ai-an]];if(this.shadow){this.shadowRenderer.draw(am,ak)}this.shapeRenderer.draw(am,ak,ao)};L.jqplot.MarkerRenderer.prototype.drawPlus=function(ak,aj,an,am,aq){var ai=1;var ar=this.size/2*ai;var ao=this.size/2*ai;var ap=[[ak,aj-ao],[ak,aj+ao]];var al=[[ak+ar,aj],[ak-ar,aj]];var ah=L.extend(true,{},this.options,{closePath:false});if(this.shadow){this.shadowRenderer.draw(an,ap,{closePath:false});this.shadowRenderer.draw(an,al,{closePath:false})}this.shapeRenderer.draw(an,ap,ah);this.shapeRenderer.draw(an,al,ah)};L.jqplot.MarkerRenderer.prototype.drawX=function(ak,aj,an,am,aq){var ai=1;var ar=this.size/2*ai;var ao=this.size/2*ai;var ah=L.extend(true,{},this.options,{closePath:false});var ap=[[ak-ar,aj-ao],[ak+ar,aj+ao]];var al=[[ak-ar,aj+ao],[ak+ar,aj-ao]];if(this.shadow){this.shadowRenderer.draw(an,ap,{closePath:false});this.shadowRenderer.draw(an,al,{closePath:false})}this.shapeRenderer.draw(an,ap,ah);this.shapeRenderer.draw(an,al,ah)};L.jqplot.MarkerRenderer.prototype.drawDash=function(aj,ai,am,al,ao){var ah=1;var ap=this.size/2*ah;var an=this.size/2*ah;var ak=[[aj-ap,ai],[aj+ap,ai]];if(this.shadow){this.shadowRenderer.draw(am,ak)}this.shapeRenderer.draw(am,ak,ao)};L.jqplot.MarkerRenderer.prototype.drawLine=function(am,al,ah,ak,ai){var aj=[am,al];if(this.shadow){this.shadowRenderer.draw(ah,aj)}this.shapeRenderer.draw(ah,aj,ai)};L.jqplot.MarkerRenderer.prototype.drawSquare=function(aj,ai,am,al,ao){var ah=1;var ap=this.size/2/ah;var an=this.size/2*ah;var ak=[[aj-ap,ai-an],[aj-ap,ai+an],[aj+ap,ai+an],[aj+ap,ai-an]];if(this.shadow){this.shadowRenderer.draw(am,ak)}this.shapeRenderer.draw(am,ak,ao)};L.jqplot.MarkerRenderer.prototype.drawCircle=function(ai,ao,ak,an,al){var ah=this.size/2;var aj=2*Math.PI;var am=[ai,ao,ah,0,aj,true];if(this.shadow){this.shadowRenderer.draw(ak,am)}this.shapeRenderer.draw(ak,am,al)};L.jqplot.MarkerRenderer.prototype.draw=function(ah,ak,ai,aj){aj=aj||{};if(aj.show==null||aj.show!=false){if(aj.color&&!aj.fillStyle){aj.fillStyle=aj.color}if(aj.color&&!aj.strokeStyle){aj.strokeStyle=aj.color}switch(this.style){case"diamond":this.drawDiamond(ah,ak,ai,false,aj);break;case"filledDiamond":this.drawDiamond(ah,ak,ai,true,aj);break;case"circle":this.drawCircle(ah,ak,ai,false,aj);break;case"filledCircle":this.drawCircle(ah,ak,ai,true,aj);break;case"square":this.drawSquare(ah,ak,ai,false,aj);break;case"filledSquare":this.drawSquare(ah,ak,ai,true,aj);break;case"x":this.drawX(ah,ak,ai,true,aj);break;case"plus":this.drawPlus(ah,ak,ai,true,aj);break;case"dash":this.drawDash(ah,ak,ai,true,aj);break;case"line":this.drawLine(ah,ak,ai,false,aj);break;default:this.drawDiamond(ah,ak,ai,false,aj);break}}};L.jqplot.ShadowRenderer=function(ah){this.angle=45;this.offset=1;this.alpha=0.07;this.lineWidth=1.5;this.lineJoin="miter";this.lineCap="round";this.closePath=false;this.fill=false;this.depth=3;this.strokeStyle="rgba(0,0,0,0.1)";this.isarc=false;L.extend(true,this,ah)};L.jqplot.ShadowRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.ShadowRenderer.prototype.draw=function(av,at,ax){av.save();var ah=(ax!=null)?ax:{};var au=(ah.fill!=null)?ah.fill:this.fill;var ap=(ah.fillRect!=null)?ah.fillRect:this.fillRect;var ao=(ah.closePath!=null)?ah.closePath:this.closePath;var al=(ah.offset!=null)?ah.offset:this.offset;var aj=(ah.alpha!=null)?ah.alpha:this.alpha;var an=(ah.depth!=null)?ah.depth:this.depth;var aw=(ah.isarc!=null)?ah.isarc:this.isarc;var aq=(ah.linePattern!=null)?ah.linePattern:this.linePattern;av.lineWidth=(ah.lineWidth!=null)?ah.lineWidth:this.lineWidth;av.lineJoin=(ah.lineJoin!=null)?ah.lineJoin:this.lineJoin;av.lineCap=(ah.lineCap!=null)?ah.lineCap:this.lineCap;av.strokeStyle=ah.strokeStyle||this.strokeStyle||"rgba(0,0,0,"+aj+")";av.fillStyle=ah.fillStyle||this.fillStyle||"rgba(0,0,0,"+aj+")";for(var ak=0;ak<an;ak++){var ar=L.jqplot.LinePattern(av,aq);av.translate(Math.cos(this.angle*Math.PI/180)*al,Math.sin(this.angle*Math.PI/180)*al);ar.beginPath();if(aw){av.arc(at[0],at[1],at[2],at[3],at[4],true)}else{if(ap){if(ap){av.fillRect(at[0],at[1],at[2],at[3])}}else{if(at&&at.length){var ai=true;for(var am=0;am<at.length;am++){if(at[am][0]!=null&&at[am][1]!=null){if(ai){ar.moveTo(at[am][0],at[am][1]);ai=false}else{ar.lineTo(at[am][0],at[am][1])}}else{ai=true}}}}}if(ao){ar.closePath()}if(au){av.fill()}else{av.stroke()}}av.restore()};L.jqplot.ShapeRenderer=function(ah){this.lineWidth=1.5;this.linePattern="solid";this.lineJoin="miter";this.lineCap="round";this.closePath=false;this.fill=false;this.isarc=false;this.fillRect=false;this.strokeRect=false;this.clearRect=false;this.strokeStyle="#999999";this.fillStyle="#999999";L.extend(true,this,ah)};L.jqplot.ShapeRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.ShapeRenderer.prototype.draw=function(at,aq,av){at.save();var ah=(av!=null)?av:{};var ar=(ah.fill!=null)?ah.fill:this.fill;var am=(ah.closePath!=null)?ah.closePath:this.closePath;var an=(ah.fillRect!=null)?ah.fillRect:this.fillRect;var ak=(ah.strokeRect!=null)?ah.strokeRect:this.strokeRect;var ai=(ah.clearRect!=null)?ah.clearRect:this.clearRect;var au=(ah.isarc!=null)?ah.isarc:this.isarc;var ao=(ah.linePattern!=null)?ah.linePattern:this.linePattern;var ap=L.jqplot.LinePattern(at,ao);at.lineWidth=ah.lineWidth||this.lineWidth;at.lineJoin=ah.lineJoin||this.lineJoin;at.lineCap=ah.lineCap||this.lineCap;at.strokeStyle=(ah.strokeStyle||ah.color)||this.strokeStyle;at.fillStyle=ah.fillStyle||this.fillStyle;at.beginPath();if(au){at.arc(aq[0],aq[1],aq[2],aq[3],aq[4],true);if(am){at.closePath()}if(ar){at.fill()}else{at.stroke()}at.restore();return}else{if(ai){at.clearRect(aq[0],aq[1],aq[2],aq[3]);at.restore();return}else{if(an||ak){if(an){at.fillRect(aq[0],aq[1],aq[2],aq[3])}if(ak){at.strokeRect(aq[0],aq[1],aq[2],aq[3]);at.restore();return}}else{if(aq&&aq.length){var aj=true;for(var al=0;al<aq.length;al++){if(aq[al][0]!=null&&aq[al][1]!=null){if(aj){ap.moveTo(aq[al][0],aq[al][1]);aj=false}else{ap.lineTo(aq[al][0],aq[al][1])}}else{aj=true}}if(am){ap.closePath()}if(ar){at.fill()}else{at.stroke()}}}}}at.restore()};L.jqplot.TableLegendRenderer=function(){};L.jqplot.TableLegendRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.TableLegendRenderer.prototype.addrow=function(aq,ak,ah,ao){var al=(ah)?this.rowSpacing+"px":"0px";var ap;var aj;var ai;var an;var am;ai=document.createElement("tr");ap=L(ai);ap.addClass("jqplot-table-legend");ai=null;if(ao){ap.prependTo(this._elem)}else{ap.appendTo(this._elem)}if(this.showSwatches){aj=L(document.createElement("td"));aj.addClass("jqplot-table-legend jqplot-table-legend-swatch");aj.css({textAlign:"center",paddingTop:al});an=L(document.createElement("div"));an.addClass("jqplot-table-legend-swatch-outline");am=L(document.createElement("div"));am.addClass("jqplot-table-legend-swatch");am.css({backgroundColor:ak,borderColor:ak});ap.append(aj.append(an.append(am)))}if(this.showLabels){aj=L(document.createElement("td"));aj.addClass("jqplot-table-legend jqplot-table-legend-label");aj.css("paddingTop",al);ap.append(aj);if(this.escapeHtml){aj.text(aq)}else{aj.html(aq)}}aj=null;an=null;am=null;ap=null;ai=null};L.jqplot.TableLegendRenderer.prototype.draw=function(){if(this._elem){this._elem.emptyForce();this._elem=null}if(this.show){var am=this._series;var ai=document.createElement("table");this._elem=L(ai);this._elem.addClass("jqplot-table-legend");var ar={position:"absolute"};if(this.background){ar.background=this.background}if(this.border){ar.border=this.border}if(this.fontSize){ar.fontSize=this.fontSize}if(this.fontFamily){ar.fontFamily=this.fontFamily}if(this.textColor){ar.textColor=this.textColor}if(this.marginTop!=null){ar.marginTop=this.marginTop}if(this.marginBottom!=null){ar.marginBottom=this.marginBottom}if(this.marginLeft!=null){ar.marginLeft=this.marginLeft}if(this.marginRight!=null){ar.marginRight=this.marginRight}var ah=false,ao=false,aq;for(var an=0;an<am.length;an++){aq=am[an];if(aq._stack||aq.renderer.constructor==L.jqplot.BezierCurveRenderer){ao=true}if(aq.show&&aq.showLabel){var al=this.labels[an]||aq.label.toString();if(al){var aj=aq.color;if(ao&&an<am.length-1){ah=true}else{if(ao&&an==am.length-1){ah=false}}this.renderer.addrow.call(this,al,aj,ah,ao);ah=true}for(var ak=0;ak<L.jqplot.addLegendRowHooks.length;ak++){var ap=L.jqplot.addLegendRowHooks[ak].call(this,aq);if(ap){this.renderer.addrow.call(this,ap.label,ap.color,ah);ah=true}}al=null}}}return this._elem};L.jqplot.TableLegendRenderer.prototype.pack=function(aj){if(this.show){if(this.placement=="insideGrid"){switch(this.location){case"nw":var ai=aj.left;var ah=aj.top;this._elem.css("left",ai);this._elem.css("top",ah);break;case"n":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;var ah=aj.top;this._elem.css("left",ai);this._elem.css("top",ah);break;case"ne":var ai=aj.right;var ah=aj.top;this._elem.css({right:ai,top:ah});break;case"e":var ai=aj.right;var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({right:ai,top:ah});break;case"se":var ai=aj.right;var ah=aj.bottom;this._elem.css({right:ai,bottom:ah});break;case"s":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;var ah=aj.bottom;this._elem.css({left:ai,bottom:ah});break;case"sw":var ai=aj.left;var ah=aj.bottom;this._elem.css({left:ai,bottom:ah});break;case"w":var ai=aj.left;var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({left:ai,top:ah});break;default:var ai=aj.right;var ah=aj.bottom;this._elem.css({right:ai,bottom:ah});break}}else{if(this.placement=="outside"){switch(this.location){case"nw":var ai=this._plotDimensions.width-aj.left;var ah=aj.top;this._elem.css("right",ai);this._elem.css("top",ah);break;case"n":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;var ah=this._plotDimensions.height-aj.top;this._elem.css("left",ai);this._elem.css("bottom",ah);break;case"ne":var ai=this._plotDimensions.width-aj.right;var ah=aj.top;this._elem.css({left:ai,top:ah});break;case"e":var ai=this._plotDimensions.width-aj.right;var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({left:ai,top:ah});break;case"se":var ai=this._plotDimensions.width-aj.right;var ah=aj.bottom;this._elem.css({left:ai,bottom:ah});break;case"s":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;var ah=this._plotDimensions.height-aj.bottom;this._elem.css({left:ai,top:ah});break;case"sw":var ai=this._plotDimensions.width-aj.left;var ah=aj.bottom;this._elem.css({right:ai,bottom:ah});break;case"w":var ai=this._plotDimensions.width-aj.left;var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({right:ai,top:ah});break;default:var ai=aj.right;var ah=aj.bottom;this._elem.css({right:ai,bottom:ah});break}}else{switch(this.location){case"nw":this._elem.css({left:0,top:aj.top});break;case"n":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;this._elem.css({left:ai,top:aj.top});break;case"ne":this._elem.css({right:0,top:aj.top});break;case"e":var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({right:aj.right,top:ah});break;case"se":this._elem.css({right:aj.right,bottom:aj.bottom});break;case"s":var ai=(aj.left+(this._plotDimensions.width-aj.right))/2-this.getWidth()/2;this._elem.css({left:ai,bottom:aj.bottom});break;case"sw":this._elem.css({left:aj.left,bottom:aj.bottom});break;case"w":var ah=(aj.top+(this._plotDimensions.height-aj.bottom))/2-this.getHeight()/2;this._elem.css({left:aj.left,top:ah});break;default:this._elem.css({right:aj.right,bottom:aj.bottom});break}}}}};L.jqplot.ThemeEngine=function(){this.themes={};this.activeTheme=null};L.jqplot.ThemeEngine.prototype.init=function(){var ak=new L.jqplot.Theme({_name:"Default"});var an,ai,am;for(an in ak.target){if(an=="textColor"){ak.target[an]=this.target.css("color")}else{ak.target[an]=this.target.css(an)}}if(this.title.show&&this.title._elem){for(an in ak.title){if(an=="textColor"){ak.title[an]=this.title._elem.css("color")}else{ak.title[an]=this.title._elem.css(an)}}}for(an in ak.grid){ak.grid[an]=this.grid[an]}if(ak.grid.backgroundColor==null&&this.grid.background!=null){ak.grid.backgroundColor=this.grid.background}if(this.legend.show&&this.legend._elem){for(an in ak.legend){if(an=="textColor"){ak.legend[an]=this.legend._elem.css("color")}else{ak.legend[an]=this.legend._elem.css(an)}}}var aj;for(ai=0;ai<this.series.length;ai++){aj=this.series[ai];if(aj.renderer.constructor==L.jqplot.LineRenderer){ak.series.push(new p())}else{if(aj.renderer.constructor==L.jqplot.BarRenderer){ak.series.push(new T())}else{if(aj.renderer.constructor==L.jqplot.PieRenderer){ak.series.push(new f())}else{if(aj.renderer.constructor==L.jqplot.DonutRenderer){ak.series.push(new G())}else{if(aj.renderer.constructor==L.jqplot.FunnelRenderer){ak.series.push(new Z())}else{if(aj.renderer.constructor==L.jqplot.MeterGaugeRenderer){ak.series.push(new D())}else{ak.series.push({})}}}}}}for(an in ak.series[ai]){ak.series[ai][an]=aj[an]}}var ah,al;for(an in this.axes){al=this.axes[an];ah=ak.axes[an]=new P();ah.borderColor=al.borderColor;ah.borderWidth=al.borderWidth;if(al._ticks&&al._ticks[0]){for(am in ah.ticks){if(al._ticks[0].hasOwnProperty(am)){ah.ticks[am]=al._ticks[0][am]}else{if(al._ticks[0]._elem){ah.ticks[am]=al._ticks[0]._elem.css(am)}}}}if(al._label&&al._label.show){for(am in ah.label){if(al._label[am]){ah.label[am]=al._label[am]}else{if(al._label._elem){if(am=="textColor"){ah.label[am]=al._label._elem.css("color")}else{ah.label[am]=al._label._elem.css(am)}}}}}}this.themeEngine._add(ak);this.themeEngine.activeTheme=this.themeEngine.themes[ak._name]};L.jqplot.ThemeEngine.prototype.get=function(ah){if(!ah){return this.activeTheme}else{return this.themes[ah]}};function O(ai,ah){return ai-ah}L.jqplot.ThemeEngine.prototype.getThemeNames=function(){var ah=[];for(var ai in this.themes){ah.push(ai)}return ah.sort(O)};L.jqplot.ThemeEngine.prototype.getThemes=function(){var ai=[];var ah=[];for(var ak in this.themes){ai.push(ak)}ai.sort(O);for(var aj=0;aj<ai.length;aj++){ah.push(this.themes[ai[aj]])}return ah};L.jqplot.ThemeEngine.prototype.activate=function(av,aB){var ah=false;if(!aB&&this.activeTheme&&this.activeTheme._name){aB=this.activeTheme._name}if(!this.themes.hasOwnProperty(aB)){throw new Error("No theme of that name")}else{var am=this.themes[aB];this.activeTheme=am;var aA,at=false,ar=false;var ai=["xaxis","x2axis","yaxis","y2axis"];for(aw=0;aw<ai.length;aw++){var an=ai[aw];if(am.axesStyles.borderColor!=null){av.axes[an].borderColor=am.axesStyles.borderColor}if(am.axesStyles.borderWidth!=null){av.axes[an].borderWidth=am.axesStyles.borderWidth}}for(var az in av.axes){var ak=av.axes[az];if(ak.show){var aq=am.axes[az]||{};var ao=am.axesStyles;var al=L.jqplot.extend(true,{},aq,ao);aA=(am.axesStyles.borderColor!=null)?am.axesStyles.borderColor:al.borderColor;if(al.borderColor!=null){ak.borderColor=al.borderColor;ah=true}aA=(am.axesStyles.borderWidth!=null)?am.axesStyles.borderWidth:al.borderWidth;if(al.borderWidth!=null){ak.borderWidth=al.borderWidth;ah=true}if(ak._ticks&&ak._ticks[0]){for(var aj in al.ticks){aA=al.ticks[aj];if(aA!=null){ak.tickOptions[aj]=aA;ak._ticks=[];ah=true}}}if(ak._label&&ak._label.show){for(var aj in al.label){aA=al.label[aj];if(aA!=null){ak.labelOptions[aj]=aA;ah=true}}}}}for(var au in am.grid){if(am.grid[au]!=null){av.grid[au]=am.grid[au]}}if(!ah){av.grid.draw()}if(av.legend.show){for(au in am.legend){if(am.legend[au]!=null){av.legend[au]=am.legend[au]}}}if(av.title.show){for(au in am.title){if(am.title[au]!=null){av.title[au]=am.title[au]}}}var aw;for(aw=0;aw<am.series.length;aw++){var ap={};var ay=false;for(au in am.series[aw]){aA=(am.seriesStyles[au]!=null)?am.seriesStyles[au]:am.series[aw][au];if(aA!=null){ap[au]=aA;if(au=="color"){av.series[aw].renderer.shapeRenderer.fillStyle=aA;av.series[aw].renderer.shapeRenderer.strokeStyle=aA;av.series[aw][au]=aA}else{if((au=="lineWidth")||(au=="linePattern")){av.series[aw].renderer.shapeRenderer[au]=aA;av.series[aw][au]=aA}else{if(au=="markerOptions"){V(av.series[aw].markerOptions,aA);V(av.series[aw].markerRenderer,aA)}else{av.series[aw][au]=aA}}}ah=true}}}if(ah){av.target.empty();av.draw()}for(au in am.target){if(am.target[au]!=null){av.target.css(au,am.target[au])}}}};L.jqplot.ThemeEngine.prototype._add=function(ai,ah){if(ah){ai._name=ah}if(!ai._name){ai._name=Date.parse(new Date())}if(!this.themes.hasOwnProperty(ai._name)){this.themes[ai._name]=ai}else{throw new Error("jqplot.ThemeEngine Error: Theme already in use")}};L.jqplot.ThemeEngine.prototype.remove=function(ah){if(ah=="Default"){return false}return delete this.themes[ah]};L.jqplot.ThemeEngine.prototype.newTheme=function(ah,aj){if(typeof(ah)=="object"){aj=aj||ah;ah=null}if(aj&&aj._name){ah=aj._name}else{ah=ah||Date.parse(new Date())}var ai=this.copy(this.themes.Default._name,ah);L.jqplot.extend(ai,aj);return ai};function B(aj){if(aj==null||typeof(aj)!="object"){return aj}var ah=new aj.constructor();for(var ai in aj){ah[ai]=B(aj[ai])}return ah}L.jqplot.clone=B;function V(aj,ai){if(ai==null||typeof(ai)!="object"){return}for(var ah in ai){if(ah=="highlightColors"){aj[ah]=B(ai[ah])}if(ai[ah]!=null&&typeof(ai[ah])=="object"){if(!aj.hasOwnProperty(ah)){aj[ah]={}}V(aj[ah],ai[ah])}else{aj[ah]=ai[ah]}}}L.jqplot.merge=V;L.jqplot.extend=function(){var am=arguments[0]||{},ak=1,al=arguments.length,ah=false,aj;if(typeof am==="boolean"){ah=am;am=arguments[1]||{};ak=2}if(typeof am!=="object"&&!toString.call(am)==="[object Function]"){am={}}for(;ak<al;ak++){if((aj=arguments[ak])!=null){for(var ai in aj){var an=am[ai],ao=aj[ai];if(am===ao){continue}if(ah&&ao&&typeof ao==="object"&&!ao.nodeType){am[ai]=L.jqplot.extend(ah,an||(ao.length!=null?[]:{}),ao)}else{if(ao!==u){am[ai]=ao}}}}}return am};L.jqplot.ThemeEngine.prototype.rename=function(ai,ah){if(ai=="Default"||ah=="Default"){throw new Error("jqplot.ThemeEngine Error: Cannot rename from/to Default")}if(this.themes.hasOwnProperty(ah)){throw new Error("jqplot.ThemeEngine Error: New name already in use.")}else{if(this.themes.hasOwnProperty(ai)){var aj=this.copy(ai,ah);this.remove(ai);return aj}}throw new Error("jqplot.ThemeEngine Error: Old name or new name invalid")};L.jqplot.ThemeEngine.prototype.copy=function(ah,aj,al){if(aj=="Default"){throw new Error("jqplot.ThemeEngine Error: Cannot copy over Default theme")}if(!this.themes.hasOwnProperty(ah)){var ai="jqplot.ThemeEngine Error: Source name invalid";throw new Error(ai)}if(this.themes.hasOwnProperty(aj)){var ai="jqplot.ThemeEngine Error: Target name invalid";throw new Error(ai)}else{var ak=B(this.themes[ah]);ak._name=aj;L.jqplot.extend(true,ak,al);this._add(ak);return ak}};L.jqplot.Theme=function(ah,ai){if(typeof(ah)=="object"){ai=ai||ah;ah=null}ah=ah||Date.parse(new Date());this._name=ah;this.target={backgroundColor:null};this.legend={textColor:null,fontFamily:null,fontSize:null,border:null,background:null};this.title={textColor:null,fontFamily:null,fontSize:null,textAlign:null};this.seriesStyles={};this.series=[];this.grid={drawGridlines:null,gridLineColor:null,gridLineWidth:null,backgroundColor:null,borderColor:null,borderWidth:null,shadow:null};this.axesStyles={label:{},ticks:{}};this.axes={};if(typeof(ai)=="string"){this._name=ai}else{if(typeof(ai)=="object"){L.jqplot.extend(true,this,ai)}}};var P=function(){this.borderColor=null;this.borderWidth=null;this.ticks=new o();this.label=new t()};var o=function(){this.show=null;this.showGridline=null;this.showLabel=null;this.showMark=null;this.size=null;this.textColor=null;this.whiteSpace=null;this.fontSize=null;this.fontFamily=null};var t=function(){this.textColor=null;this.whiteSpace=null;this.fontSize=null;this.fontFamily=null;this.fontWeight=null};var p=function(){this.color=null;this.lineWidth=null;this.linePattern=null;this.shadow=null;this.fillColor=null;this.showMarker=null;this.markerOptions=new I()};var I=function(){this.show=null;this.style=null;this.lineWidth=null;this.size=null;this.color=null;this.shadow=null};var T=function(){this.color=null;this.seriesColors=null;this.lineWidth=null;this.shadow=null;this.barPadding=null;this.barMargin=null;this.barWidth=null;this.highlightColors=null};var f=function(){this.seriesColors=null;this.padding=null;this.sliceMargin=null;this.fill=null;this.shadow=null;this.startAngle=null;this.lineWidth=null;this.highlightColors=null};var G=function(){this.seriesColors=null;this.padding=null;this.sliceMargin=null;this.fill=null;this.shadow=null;this.startAngle=null;this.lineWidth=null;this.innerDiameter=null;this.thickness=null;this.ringMargin=null;this.highlightColors=null};var Z=function(){this.color=null;this.lineWidth=null;this.shadow=null;this.padding=null;this.sectionMargin=null;this.seriesColors=null;this.highlightColors=null};var D=function(){this.padding=null;this.backgroundColor=null;this.ringColor=null;this.tickColor=null;this.ringWidth=null;this.intervalColors=null;this.intervalInnerRadius=null;this.intervalOuterRadius=null;this.hubRadius=null;this.needleThickness=null;this.needlePad=null};L.fn.jqplotChildText=function(){return L(this).contents().filter(function(){return this.nodeType==3}).text()};L.fn.jqplotGetComputedFontStyle=function(){var ak=window.getComputedStyle?window.getComputedStyle(this[0],""):this[0].currentStyle;var ai=ak["font-style"]?["font-style","font-weight","font-size","font-family"]:["fontStyle","fontWeight","fontSize","fontFamily"];var al=[];for(var aj=0;aj<ai.length;++aj){var ah=String(ak[ai[aj]]);if(ah&&ah!="normal"){al.push(ah)}}return al.join(" ")};L.fn.jqplotToImageCanvas=function(aj){aj=aj||{};var av=(aj.x_offset==null)?0:aj.x_offset;var ax=(aj.y_offset==null)?0:aj.y_offset;var al=(aj.backgroundColor==null)?"rgb(255,255,255)":aj.backgroundColor;if(L(this).width()==0||L(this).height()==0){return null}if(L.jqplot.use_excanvas){return null}var an=document.createElement("canvas");var aA=L(this).outerHeight(true);var at=L(this).outerWidth(true);var am=L(this).offset();var ao=am.left;var aq=am.top;var au=0,ar=0;var ay=["jqplot-table-legend","jqplot-xaxis-tick","jqplot-x2axis-tick","jqplot-yaxis-tick","jqplot-y2axis-tick","jqplot-y3axis-tick","jqplot-y4axis-tick","jqplot-y5axis-tick","jqplot-y6axis-tick","jqplot-y7axis-tick","jqplot-y8axis-tick","jqplot-y9axis-tick","jqplot-xaxis-label","jqplot-x2axis-label","jqplot-yaxis-label","jqplot-y2axis-label","jqplot-y3axis-label","jqplot-y4axis-label","jqplot-y5axis-label","jqplot-y6axis-label","jqplot-y7axis-label","jqplot-y8axis-label","jqplot-y9axis-label"];var ap,ah,ai,aB;for(var az=0;az<ay.length;az++){L(this).find("."+ay[az]).each(function(){ap=L(this).offset().top-aq;ah=L(this).offset().left-ao;aB=ah+L(this).outerWidth(true)+au;ai=ap+L(this).outerHeight(true)+ar;if(ah<-au){at=at-au-ah;au=-ah}if(ap<-ar){aA=aA-ar-ap;ar=-ap}if(aB>at){at=aB}if(ai>aA){aA=ai}})}an.width=at+Number(av);an.height=aA+Number(ax);var ak=an.getContext("2d");ak.save();ak.fillStyle=al;ak.fillRect(0,0,an.width,an.height);ak.restore();ak.translate(au,ar);ak.textAlign="left";ak.textBaseline="top";function aC(aE){var aF=parseInt(L(aE).css("line-height"),10);if(isNaN(aF)){aF=parseInt(L(aE).css("font-size"),10)*1.2}return aF}function aD(aF,aE,aS,aG,aO,aH){var aQ=aC(aF);var aK=L(aF).innerWidth();var aL=L(aF).innerHeight();var aN=aS.split(/\s+/);var aR=aN.length;var aP="";var aM=[];var aU=aO;var aT=aG;for(var aJ=0;aJ<aR;aJ++){aP+=aN[aJ];if(aE.measureText(aP).width>aK){aM.push(aJ);aP="";aJ--}}if(aM.length===0){if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aS,aT,aO)}else{aP=aN.slice(0,aM[0]).join(" ");if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aP,aT,aU);aU+=aQ;for(var aJ=1,aI=aM.length;aJ<aI;aJ++){aP=aN.slice(aM[aJ-1],aM[aJ]).join(" ");if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aP,aT,aU);aU+=aQ}aP=aN.slice(aM[aJ-1],aN.length).join(" ");if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aP,aT,aU)}}function aw(aG,aJ,aE){var aN=aG.tagName.toLowerCase();var aF=L(aG).position();var aK=window.getComputedStyle?window.getComputedStyle(aG,""):aG.currentStyle;var aI=aJ+aF.left+parseInt(aK.marginLeft,10)+parseInt(aK.borderLeftWidth,10)+parseInt(aK.paddingLeft,10);var aL=aE+aF.top+parseInt(aK.marginTop,10)+parseInt(aK.borderTopWidth,10)+parseInt(aK.paddingTop,10);var aM=an.width;if((aN=="div"||aN=="span")&&!L(aG).hasClass("jqplot-highlighter-tooltip")){L(aG).children().each(function(){aw(this,aI,aL)});var aO=L(aG).jqplotChildText();if(aO){ak.font=L(aG).jqplotGetComputedFontStyle();ak.fillStyle=L(aG).css("color");aD(aG,ak,aO,aI,aL,aM)}}else{if(aN==="table"&&L(aG).hasClass("jqplot-table-legend")){ak.strokeStyle=L(aG).css("border-top-color");ak.fillStyle=L(aG).css("background-color");ak.fillRect(aI,aL,L(aG).innerWidth(),L(aG).innerHeight());if(parseInt(L(aG).css("border-top-width"),10)>0){ak.strokeRect(aI,aL,L(aG).innerWidth(),L(aG).innerHeight())}L(aG).find("div.jqplot-table-legend-swatch-outline").each(function(){var aU=L(this);ak.strokeStyle=aU.css("border-top-color");var aQ=aI+aU.position().left;var aR=aL+aU.position().top;ak.strokeRect(aQ,aR,aU.innerWidth(),aU.innerHeight());aQ+=parseInt(aU.css("padding-left"),10);aR+=parseInt(aU.css("padding-top"),10);var aT=aU.innerHeight()-2*parseInt(aU.css("padding-top"),10);var aP=aU.innerWidth()-2*parseInt(aU.css("padding-left"),10);var aS=aU.children("div.jqplot-table-legend-swatch");ak.fillStyle=aS.css("background-color");ak.fillRect(aQ,aR,aP,aT)});L(aG).find("td.jqplot-table-legend-label").each(function(){var aR=L(this);var aP=aI+aR.position().left;var aQ=aL+aR.position().top+parseInt(aR.css("padding-top"),10);ak.font=aR.jqplotGetComputedFontStyle();ak.fillStyle=aR.css("color");aD(aR,ak,aR.text(),aP,aQ,aM)});var aH=null}else{if(aN=="canvas"){ak.drawImage(aG,aI,aL)}}}}L(this).children().each(function(){aw(this,av,ax)});return an};L.fn.jqplotToImageStr=function(ai){var ah=L(this).jqplotToImageCanvas(ai);if(ah){return ah.toDataURL("image/png")}else{return null}};L.fn.jqplotToImageElem=function(ah){var ai=document.createElement("img");var aj=L(this).jqplotToImageStr(ah);ai.src=aj;return ai};L.fn.jqplotToImageElemStr=function(ah){var ai="<img src="+L(this).jqplotToImageStr(ah)+" />";return ai};L.fn.jqplotSaveImage=function(){var ah=L(this).jqplotToImageStr({});if(ah){window.location.href=ah.replace("image/png","image/octet-stream")}};L.fn.jqplotViewImage=function(){var ai=L(this).jqplotToImageElemStr({});var aj=L(this).jqplotToImageStr({});if(ai){var ah=window.open("");ah.document.open("image/png");ah.document.write(ai);ah.document.close();ah=null}};var ag=function(){this.syntax=ag.config.syntax;this._type="jsDate";this.proxy=new Date();this.options={};this.locale=ag.regional.getLocale();this.formatString="";this.defaultCentury=ag.config.defaultCentury;switch(arguments.length){case 0:break;case 1:if(l(arguments[0])=="[object Object]"&&arguments[0]._type!="jsDate"){var aj=this.options=arguments[0];this.syntax=aj.syntax||this.syntax;this.defaultCentury=aj.defaultCentury||this.defaultCentury;this.proxy=ag.createDate(aj.date)}else{this.proxy=ag.createDate(arguments[0])}break;default:var ah=[];for(var ai=0;ai<arguments.length;ai++){ah.push(arguments[ai])}this.proxy=new Date();this.proxy.setFullYear.apply(this.proxy,ah.slice(0,3));if(ah.slice(3).length){this.proxy.setHours.apply(this.proxy,ah.slice(3))}break}};ag.config={defaultLocale:"en",syntax:"perl",defaultCentury:1900};ag.prototype.add=function(aj,ai){var ah=E[ai]||E.day;if(typeof ah=="number"){this.proxy.setTime(this.proxy.getTime()+(ah*aj))}else{ah.add(this,aj)}return this};ag.prototype.clone=function(){return new ag(this.proxy.getTime())};ag.prototype.getUtcOffset=function(){return this.proxy.getTimezoneOffset()*60000};ag.prototype.diff=function(ai,al,ah){ai=new ag(ai);if(ai===null){return null}var aj=E[al]||E.day;if(typeof aj=="number"){var ak=(this.proxy.getTime()-ai.proxy.getTime())/aj}else{var ak=aj.diff(this.proxy,ai.proxy)}return(ah?ak:Math[ak>0?"floor":"ceil"](ak))};ag.prototype.getAbbrDayName=function(){return ag.regional[this.locale]["dayNamesShort"][this.proxy.getDay()]};ag.prototype.getAbbrMonthName=function(){return ag.regional[this.locale]["monthNamesShort"][this.proxy.getMonth()]};ag.prototype.getAMPM=function(){return this.proxy.getHours()>=12?"PM":"AM"};ag.prototype.getAmPm=function(){return this.proxy.getHours()>=12?"pm":"am"};ag.prototype.getCentury=function(){return parseInt(this.proxy.getFullYear()/100,10)};ag.prototype.getDate=function(){return this.proxy.getDate()};ag.prototype.getDay=function(){return this.proxy.getDay()};ag.prototype.getDayOfWeek=function(){var ah=this.proxy.getDay();return ah===0?7:ah};ag.prototype.getDayOfYear=function(){var ai=this.proxy;var ah=ai-new Date(""+ai.getFullYear()+"/1/1 GMT");ah+=ai.getTimezoneOffset()*60000;ai=null;return parseInt(ah/60000/60/24,10)+1};ag.prototype.getDayName=function(){return ag.regional[this.locale]["dayNames"][this.proxy.getDay()]};ag.prototype.getFullWeekOfYear=function(){var ak=this.proxy;var ah=this.getDayOfYear();var aj=6-ak.getDay();var ai=parseInt((ah+aj)/7,10);return ai};ag.prototype.getFullYear=function(){return this.proxy.getFullYear()};ag.prototype.getGmtOffset=function(){var ah=this.proxy.getTimezoneOffset()/60;var ai=ah<0?"+":"-";ah=Math.abs(ah);return ai+N(Math.floor(ah),2)+":"+N((ah%1)*60,2)};ag.prototype.getHours=function(){return this.proxy.getHours()};ag.prototype.getHours12=function(){var ah=this.proxy.getHours();return ah>12?ah-12:(ah==0?12:ah)};ag.prototype.getIsoWeek=function(){var ak=this.proxy;var aj=this.getWeekOfYear();var ah=(new Date(""+ak.getFullYear()+"/1/1")).getDay();var ai=aj+(ah>4||ah<=1?0:1);if(ai==53&&(new Date(""+ak.getFullYear()+"/12/31")).getDay()<4){ai=1}else{if(ai===0){ak=new ag(new Date(""+(ak.getFullYear()-1)+"/12/31"));ai=ak.getIsoWeek()}}ak=null;return ai};ag.prototype.getMilliseconds=function(){return this.proxy.getMilliseconds()};ag.prototype.getMinutes=function(){return this.proxy.getMinutes()};ag.prototype.getMonth=function(){return this.proxy.getMonth()};ag.prototype.getMonthName=function(){return ag.regional[this.locale]["monthNames"][this.proxy.getMonth()]};ag.prototype.getMonthNumber=function(){return this.proxy.getMonth()+1};ag.prototype.getSeconds=function(){return this.proxy.getSeconds()};ag.prototype.getShortYear=function(){return this.proxy.getYear()%100};ag.prototype.getTime=function(){return this.proxy.getTime()};ag.prototype.getTimezoneAbbr=function(){return this.proxy.toString().replace(/^.*\(([^)]+)\)$/,"$1")};ag.prototype.getTimezoneName=function(){var ah=/(?:\((.+)\)$| ([A-Z]{3}) )/.exec(this.toString());return ah[1]||ah[2]||"GMT"+this.getGmtOffset()};ag.prototype.getTimezoneOffset=function(){return this.proxy.getTimezoneOffset()};ag.prototype.getWeekOfYear=function(){var ah=this.getDayOfYear();var aj=7-this.getDayOfWeek();var ai=parseInt((ah+aj)/7,10);return ai};ag.prototype.getUnix=function(){return Math.round(this.proxy.getTime()/1000,0)};ag.prototype.getYear=function(){return this.proxy.getYear()};ag.prototype.next=function(ah){ah=ah||"day";return this.clone().add(1,ah)};ag.prototype.set=function(){switch(arguments.length){case 0:this.proxy=new Date();break;case 1:if(l(arguments[0])=="[object Object]"&&arguments[0]._type!="jsDate"){var aj=this.options=arguments[0];this.syntax=aj.syntax||this.syntax;this.defaultCentury=aj.defaultCentury||this.defaultCentury;this.proxy=ag.createDate(aj.date)}else{this.proxy=ag.createDate(arguments[0])}break;default:var ah=[];for(var ai=0;ai<arguments.length;ai++){ah.push(arguments[ai])}this.proxy=new Date();this.proxy.setFullYear.apply(this.proxy,ah.slice(0,3));if(ah.slice(3).length){this.proxy.setHours.apply(this.proxy,ah.slice(3))}break}return this};ag.prototype.setDate=function(ah){this.proxy.setDate(ah);return this};ag.prototype.setFullYear=function(){this.proxy.setFullYear.apply(this.proxy,arguments);return this};ag.prototype.setHours=function(){this.proxy.setHours.apply(this.proxy,arguments);return this};ag.prototype.setMilliseconds=function(ah){this.proxy.setMilliseconds(ah);return this};ag.prototype.setMinutes=function(){this.proxy.setMinutes.apply(this.proxy,arguments);return this};ag.prototype.setMonth=function(){this.proxy.setMonth.apply(this.proxy,arguments);return this};ag.prototype.setSeconds=function(){this.proxy.setSeconds.apply(this.proxy,arguments);return this};ag.prototype.setTime=function(ah){this.proxy.setTime(ah);return this};ag.prototype.setYear=function(){this.proxy.setYear.apply(this.proxy,arguments);return this};ag.prototype.strftime=function(ah){ah=ah||this.formatString||ag.regional[this.locale]["formatString"];return ag.strftime(this,ah,this.syntax)};ag.prototype.toString=function(){return this.proxy.toString()};ag.prototype.toYmdInt=function(){return(this.proxy.getFullYear()*10000)+(this.getMonthNumber()*100)+this.proxy.getDate()};ag.regional={en:{monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],formatString:"%Y-%m-%d %H:%M:%S"},fr:{monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthNamesShort:["Jan","Fév","Mar","Avr","Mai","Jun","Jul","Aoû","Sep","Oct","Nov","Déc"],dayNames:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],dayNamesShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],formatString:"%Y-%m-%d %H:%M:%S"},de:{monthNames:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthNamesShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],dayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],dayNamesShort:["So","Mo","Di","Mi","Do","Fr","Sa"],formatString:"%Y-%m-%d %H:%M:%S"},es:{monthNames:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthNamesShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],dayNames:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],dayNamesShort:["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],formatString:"%Y-%m-%d %H:%M:%S"},ru:{monthNames:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthNamesShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],dayNames:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],dayNamesShort:["вск","пнд","втр","срд","чтв","птн","сбт"],formatString:"%Y-%m-%d %H:%M:%S"},ar:{monthNames:["كانون الثاني","شباط","آذار","نيسان","آذار","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],monthNamesShort:["1","2","3","4","5","6","7","8","9","10","11","12"],dayNames:["السبت","الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة"],dayNamesShort:["سبت","أحد","اثنين","ثلاثاء","أربعاء","خميس","جمعة"],formatString:"%Y-%m-%d %H:%M:%S"},pt:{monthNames:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthNamesShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],dayNames:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"],dayNamesShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],formatString:"%Y-%m-%d %H:%M:%S"},"pt-BR":{monthNames:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthNamesShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],dayNames:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"],dayNamesShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],formatString:"%Y-%m-%d %H:%M:%S"},pl:{monthNames:["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"],monthNamesShort:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Paź","Lis","Gru"],dayNames:["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"],dayNamesShort:["Ni","Pn","Wt","Śr","Cz","Pt","Sb"],formatString:"%Y-%m-%d %H:%M:%S"},nl:{monthNames:["Januari","Februari","Maart","April","Mei","Juni","July","Augustus","September","Oktober","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],dayNames:","["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],dayNamesShort:["Zo","Ma","Di","Wo","Do","Vr","Za"],formatString:"%Y-%m-%d %H:%M:%S"},sv:{monthNames:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],monthNamesShort:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],dayNames:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],dayNamesShort:["sön","mån","tis","ons","tor","fre","lör"],formatString:"%Y-%m-%d %H:%M:%S"}};ag.regional["en-US"]=ag.regional["en-GB"]=ag.regional.en;ag.regional.getLocale=function(){var ah=ag.config.defaultLocale;if(document&&document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){ah=document.getElementsByTagName("html")[0].lang;if(!ag.regional.hasOwnProperty(ah)){ah=ag.config.defaultLocale}}return ah};var C=24*60*60*1000;var N=function(ah,ak){ah=String(ah);var ai=ak-ah.length;var aj=String(Math.pow(10,ai)).slice(1);return aj.concat(ah)};var E={millisecond:1,second:1000,minute:60*1000,hour:60*60*1000,day:C,week:7*C,month:{add:function(aj,ah){E.year.add(aj,Math[ah>0?"floor":"ceil"](ah/12));var ai=aj.getMonth()+(ah%12);if(ai==12){ai=0;aj.setYear(aj.getFullYear()+1)}else{if(ai==-1){ai=11;aj.setYear(aj.getFullYear()-1)}}aj.setMonth(ai)},diff:function(al,aj){var ah=al.getFullYear()-aj.getFullYear();var ai=al.getMonth()-aj.getMonth()+(ah*12);var ak=al.getDate()-aj.getDate();return ai+(ak/30)}},year:{add:function(ai,ah){ai.setYear(ai.getFullYear()+Math[ah>0?"floor":"ceil"](ah))},diff:function(ai,ah){return E.month.diff(ai,ah)/12}}};for(var Y in E){if(Y.substring(Y.length-1)!="s"){E[Y+"s"]=E[Y]}}var H=function(al,ak,ai){if(ag.formats[ai]["shortcuts"][ak]){return ag.strftime(al,ag.formats[ai]["shortcuts"][ak],ai)}else{var ah=(ag.formats[ai]["codes"][ak]||"").split(".");var aj=al["get"+ah[0]]?al["get"+ah[0]]():"";if(ah[1]){aj=N(aj,ah[1])}return aj}};ag.strftime=function(an,ak,aj,ao){var ai="perl";var am=ag.regional.getLocale();if(aj&&ag.formats.hasOwnProperty(aj)){ai=aj}else{if(aj&&ag.regional.hasOwnProperty(aj)){am=aj}}if(ao&&ag.formats.hasOwnProperty(ao)){ai=ao}else{if(ao&&ag.regional.hasOwnProperty(ao)){am=ao}}if(l(an)!="[object Object]"||an._type!="jsDate"){an=new ag(an);an.locale=am}if(!ak){ak=an.formatString||ag.regional[am]["formatString"]}var ah=ak||"%Y-%m-%d",ap="",al;while(ah.length>0){if(al=ah.match(ag.formats[ai].codes.matcher)){ap+=ah.slice(0,al.index);ap+=(al[1]||"")+H(an,al[2],ai);ah=ah.slice(al.index+al[0].length)}else{ap+=ah;ah=""}}return ap};ag.formats={ISO:"%Y-%m-%dT%H:%M:%S.%N%G",SQL:"%Y-%m-%d %H:%M:%S"};ag.formats.perl={codes:{matcher:/()%(#?(%|[a-z]))/i,Y:"FullYear",y:"ShortYear.2",m:"MonthNumber.2","#m":"MonthNumber",B:"MonthName",b:"AbbrMonthName",d:"Date.2","#d":"Date",e:"Date",A:"DayName",a:"AbbrDayName",w:"Day",H:"Hours.2","#H":"Hours",I:"Hours12.2","#I":"Hours12",p:"AMPM",M:"Minutes.2","#M":"Minutes",S:"Seconds.2","#S":"Seconds",s:"Unix",N:"Milliseconds.3","#N":"Milliseconds",O:"TimezoneOffset",Z:"TimezoneName",G:"GmtOffset"},shortcuts:{F:"%Y-%m-%d",T:"%H:%M:%S",X:"%H:%M:%S",x:"%m/%d/%y",D:"%m/%d/%y","#c":"%a %b %e %H:%M:%S %Y",v:"%e-%b-%Y",R:"%H:%M",r:"%I:%M:%S %p",t:"\t",n:"\n","%":"%"}};ag.formats.php={codes:{matcher:/()%((%|[a-z]))/i,a:"AbbrDayName",A:"DayName",d:"Date.2",e:"Date",j:"DayOfYear.3",u:"DayOfWeek",w:"Day",U:"FullWeekOfYear.2",V:"IsoWeek.2",W:"WeekOfYear.2",b:"AbbrMonthName",B:"MonthName",m:"MonthNumber.2",h:"AbbrMonthName",C:"Century.2",y:"ShortYear.2",Y:"FullYear",H:"Hours.2",I:"Hours12.2",l:"Hours12",p:"AMPM",P:"AmPm",M:"Minutes.2",S:"Seconds.2",s:"Unix",O:"TimezoneOffset",z:"GmtOffset",Z:"TimezoneAbbr"},shortcuts:{D:"%m/%d/%y",F:"%Y-%m-%d",T:"%H:%M:%S",X:"%H:%M:%S",x:"%m/%d/%y",R:"%H:%M",r:"%I:%M:%S %p",t:"\t",n:"\n","%":"%"}};ag.createDate=function(aj){if(aj==null){return new Date()}if(aj instanceof Date){return aj}if(typeof aj=="number"){return new Date(aj)}var ao=String(aj).replace(/^\s*(.+)\s*$/g,"$1");ao=ao.replace(/^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,4})/,"$1/$2/$3");ao=ao.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{4})/i,"$1 $2 $3");var an=ao.match(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i);if(an&&an.length>3){var at=parseFloat(an[3]);var am=ag.config.defaultCentury+at;am=String(am);ao=ao.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i,an[1]+" "+an[2]+" "+am)}an=ao.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})[^0-9]/);function ar(ax,aw){var aC=parseFloat(aw[1]);var aB=parseFloat(aw[2]);var aA=parseFloat(aw[3]);var az=ag.config.defaultCentury;var av,au,aD,ay;if(aC>31){au=aA;aD=aB;av=az+aC}else{au=aB;aD=aC;av=az+aA}ay=aD+"/"+au+"/"+av;return ax.replace(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})/,ay)}if(an&&an.length>3){ao=ar(ao,an)}var an=ao.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})$/);if(an&&an.length>3){ao=ar(ao,an)}var al=0;var ai=ag.matchers.length;var aq,ah,ap=ao,ak;while(al<ai){ah=Date.parse(ap);if(!isNaN(ah)){return new Date(ah)}aq=ag.matchers[al];if(typeof aq=="function"){ak=aq.call(ag,ap);if(ak instanceof Date){return ak}}else{ap=ao.replace(aq[0],aq[1])}al++}return NaN};ag.daysInMonth=function(ah,ai){if(ai==2){return new Date(ah,1,29).getDate()==29?29:28}return[u,31,u,31,30,31,30,31,31,30,31,30,31][ai]};ag.matchers=[[/(3[01]|[0-2]\d)\s*\.\s*(1[0-2]|0\d)\s*\.\s*([1-9]\d{3})/,"$2/$1/$3"],[/([1-9]\d{3})\s*-\s*(1[0-2]|0\d)\s*-\s*(3[01]|[0-2]\d)/,"$2/$3/$1"],function(ak){var ai=ak.match(/^(?:(.+)\s+)?([012]?\d)(?:\s*\:\s*(\d\d))?(?:\s*\:\s*(\d\d(\.\d*)?))?\s*(am|pm)?\s*$/i);if(ai){if(ai[1]){var aj=this.createDate(ai[1]);if(isNaN(aj)){return}}else{var aj=new Date();aj.setMilliseconds(0)}var ah=parseFloat(ai[2]);if(ai[6]){ah=ai[6].toLowerCase()=="am"?(ah==12?0:ah):(ah==12?12:ah+12)}aj.setHours(ah,parseInt(ai[3]||0,10),parseInt(ai[4]||0,10),((parseFloat(ai[5]||0))||0)*1000);return aj}else{return ak}},function(ak){var ai=ak.match(/^(?:(.+))[T|\s+]([012]\d)(?:\:(\d\d))(?:\:(\d\d))(?:\.\d+)([\+\-]\d\d\:\d\d)$/i);if(ai){if(ai[1]){var aj=this.createDate(ai[1]);if(isNaN(aj)){return}}else{var aj=new Date();aj.setMilliseconds(0)}var ah=parseFloat(ai[2]);aj.setHours(ah,parseInt(ai[3],10),parseInt(ai[4],10),parseFloat(ai[5])*1000);return aj}else{return ak}},function(al){var aj=al.match(/^([0-3]?\d)\s*[-\/.\s]{1}\s*([a-zA-Z]{3,9})\s*[-\/.\s]{1}\s*([0-3]?\d)$/);if(aj){var ak=new Date();var am=ag.config.defaultCentury;var ao=parseFloat(aj[1]);var an=parseFloat(aj[3]);var ai,ah,ap;if(ao>31){ah=an;ai=am+ao}else{ah=ao;ai=am+an}var ap=ab(aj[2],ag.regional[ag.regional.getLocale()]["monthNamesShort"]);if(ap==-1){ap=ab(aj[2],ag.regional[ag.regional.getLocale()]["monthNames"])}ak.setFullYear(ai,ap,ah);ak.setHours(0,0,0,0);return ak}else{return al}}];function ab(aj,ak){if(ak.indexOf){return ak.indexOf(aj)}for(var ah=0,ai=ak.length;ah<ai;ah++){if(ak[ah]===aj){return ah}}return -1}function l(ah){if(ah===null){return"[object Null]"}return Object.prototype.toString.call(ah)}L.jsDate=ag;L.jqplot.sprintf=function(){function an(au,ap,aq,at){var ar=(au.length>=ap)?"":Array(1+ap-au.length>>>0).join(aq);return at?au+ar:ar+au}function ak(ar){var aq=new String(ar);for(var ap=10;ap>0;ap--){if(aq==(aq=aq.replace(/^(\d+)(\d{3})/,"$1"+L.jqplot.sprintf.thousandsSeparator+"$2"))){break}}return aq}function aj(av,au,ax,ar,at,aq){var aw=ar-av.length;if(aw>0){var ap=" ";if(aq){ap=" "}if(ax||!at){av=an(av,ar,ap,ax)}else{av=av.slice(0,au.length)+an("",aw,"0",true)+av.slice(au.length)}}return av}function ao(ay,aq,aw,ar,ap,av,ax,au){var at=ay>>>0;aw=aw&&at&&{"2":"0b","8":"0","16":"0x"}[aq]||"";ay=aw+an(at.toString(aq),av||0,"0",false);return aj(ay,aw,ar,ap,ax,au)}function ah(au,av,ar,ap,at,aq){if(ap!=null){au=au.slice(0,ap)}return aj(au,"",av,ar,at,aq)}var ai=arguments,al=0,am=ai[al++];return am.replace(L.jqplot.sprintf.regex,function(aM,ax,ay,aB,aO,aJ,av){if(aM=="%%"){return"%"}var aD=false,az="",aA=false,aL=false,aw=false,au=false;for(var aI=0;ay&&aI<ay.length;aI++){switch(ay.charAt(aI)){case" ":az=" ";break;case"+":az="+";break;case"-":aD=true;break;case"0":aA=true;break;case"#":aL=true;break;case"&":aw=true;break;case"'":au=true;break}}if(!aB){aB=0}else{if(aB=="*"){aB=+ai[al++]}else{if(aB.charAt(0)=="*"){aB=+ai[aB.slice(1,-1)]}else{aB=+aB}}}if(aB<0){aB=-aB;aD=true}if(!isFinite(aB)){throw new Error("$.jqplot.sprintf: (minimum-)width must be finite")}if(!aJ){aJ="fFeE".indexOf(av)>-1?6:(av=="d")?0:void (0)}else{if(aJ=="*"){aJ=+ai[al++]}else{if(aJ.charAt(0)=="*"){aJ=+ai[aJ.slice(1,-1)]}else{aJ=+aJ}}}var aF=ax?ai[ax.slice(0,-1)]:ai[al++];switch(av){case"s":if(aF==null){return""}return ah(String(aF),aD,aB,aJ,aA,aw);case"c":return ah(String.fromCharCode(+aF),aD,aB,aJ,aA,aw);case"b":return ao(aF,2,aL,aD,aB,aJ,aA,aw);case"o":return ao(aF,8,aL,aD,aB,aJ,aA,aw);case"x":return ao(aF,16,aL,aD,aB,aJ,aA,aw);case"X":return ao(aF,16,aL,aD,aB,aJ,aA,aw).toUpperCase();case"u":return ao(aF,10,aL,aD,aB,aJ,aA,aw);case"i":var ar=parseInt(+aF,10);if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aK=au?ak(String(Math.abs(ar))):String(Math.abs(ar));aF=aH+an(aK,aJ,"0",false);return aj(aF,aH,aD,aB,aA,aw);case"d":var ar=Math.round(+aF);if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aK=au?ak(String(Math.abs(ar))):String(Math.abs(ar));aF=aH+an(aK,aJ,"0",false);return aj(aF,aH,aD,aB,aA,aw);case"e":case"E":case"f":case"F":case"g":case"G":var ar=+aF;if(isNaN(ar)){return""}var aH=ar<0?"-":az;var at=["toExponential","toFixed","toPrecision"]["efg".indexOf(av.toLowerCase())];var aN=["toString","toUpperCase"]["eEfFgG".indexOf(av)%2];var aK=Math.abs(ar)[at](aJ);var aE=aK.toString().split(".");aE[0]=au?ak(aE[0]):aE[0];aK=aE.join(L.jqplot.sprintf.decimalMark);aF=aH+aK;var aC=aj(aF,aH,aD,aB,aA,aw)[aN]();return aC;case"p":case"P":var ar=+aF;if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aE=String(Number(Math.abs(ar)).toExponential()).split(/e|E/);var aq=(aE[0].indexOf(".")!=-1)?aE[0].length-1:String(ar).length;var aG=(aE[1]<0)?-aE[1]-1:0;if(Math.abs(ar)<1){if(aq+aG<=aJ){aF=aH+Math.abs(ar).toPrecision(aq)}else{if(aq<=aJ-1){aF=aH+Math.abs(ar).toExponential(aq-1)}else{aF=aH+Math.abs(ar).toExponential(aJ-1)}}}else{var ap=(aq<=aJ)?aq:aJ;aF=aH+Math.abs(ar).toPrecision(ap)}var aN=["toString","toUpperCase"]["pP".indexOf(av)%2];return aj(aF,aH,aD,aB,aA,aw)[aN]();case"n":return"";default:return aM}})};L.jqplot.sprintf.thousandsSeparator=",";L.jqplot.sprintf.decimalMark=".";L.jqplot.sprintf.regex=/%%|%(\d+\$)?([-+#0&\' ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([nAscboxXuidfegpEGP])/g;L.jqplot.getSignificantFigures=function(al){var an=String(Number(Math.abs(al)).toExponential()).split(/e|E/);var am=(an[0].indexOf(".")!=-1)?an[0].length-1:an[0].length;var ai=(an[1]<0)?-an[1]-1:0;var ah=parseInt(an[1],10);var aj=(ah+1>0)?ah+1:0;var ak=(am<=aj)?0:am-ah-1;return{significantDigits:am,digitsLeft:aj,digitsRight:ak,zeros:ai,exponent:ah}};L.jqplot.getPrecision=function(ah){return L.jqplot.getSignificantFigures(ah).digitsRight};var X=L.uiBackCompat!==false;L.jqplot.effects={effect:{}};var m="jqplot.storage.";L.extend(L.jqplot.effects,{version:"1.9pre",save:function(ai,aj){for(var ah=0;ah<aj.length;ah++){if(aj[ah]!==null){ai.data(m+aj[ah],ai[0].style[aj[ah]])}}},restore:function(ai,aj){for(var ah=0;ah<aj.length;ah++){if(aj[ah]!==null){ai.css(aj[ah],ai.data(m+aj[ah]))}}},setMode:function(ah,ai){if(ai==="toggle"){ai=ah.is(":hidden")?"show":"hide"}return ai},createWrapper:function(ai){if(ai.parent().is(".ui-effects-wrapper")){return ai.parent()}var aj={width:ai.outerWidth(true),height:ai.outerHeight(true),"float":ai.css("float")},al=L("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),ah={width:ai.width(),height:ai.height()},ak=document.activeElement;ai.wrap(al);if(ai[0]===ak||L.contains(ai[0],ak)){L(ak).focus()}al=ai.parent();if(ai.css("position")==="static"){al.css({position:"relative"});ai.css({position:"relative"})}else{L.extend(aj,{position:ai.css("position"),zIndex:ai.css("z-index")});L.each(["top","left","bottom","right"],function(am,an){aj[an]=ai.css(an);if(isNaN(parseInt(aj[an],10))){aj[an]="auto"}});ai.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}ai.css(ah);return al.css(aj).show()},removeWrapper:function(ah){var ai=document.activeElement;if(ah.parent().is(".ui-effects-wrapper")){ah.parent().replaceWith(ah);if(ah[0]===ai||L.contains(ah[0],ai)){L(ai).focus()}}return ah}});function j(ai,ah,aj,ak){if(L.isPlainObject(ai)){return ai}ai={effect:ai};if(ah===u){ah={}}if(L.isFunction(ah)){ak=ah;aj=null;ah={}}if(L.type(ah)==="number"||L.fx.speeds[ah]){ak=aj;aj=ah;ah={}}if(L.isFunction(aj)){ak=aj;aj=null}if(ah){L.extend(ai,ah)}aj=aj||ah.duration;ai.duration=L.fx.off?0:typeof aj==="number"?aj:aj in L.fx.speeds?L.fx.speeds[aj]:L.fx.speeds._default;ai.complete=ak||ah.complete;return ai}function ae(ah){if(!ah||typeof ah==="number"||L.fx.speeds[ah]){return true}if(typeof ah==="string"&&!L.jqplot.effects.effect[ah]){if(X&&L.jqplot.effects[ah]){return false}return true}return false}L.fn.extend({jqplotEffect:function(ap,aq,ai,ao){var an=j.apply(this,arguments),ak=an.mode,al=an.queue,am=L.jqplot.effects.effect[an.effect],ah=!am&&X&&L.jqplot.effects[an.effect];if(L.fx.off||!(am||ah)){if(ak){return this[ak](an.duration,an.complete)}else{return this.each(function(){if(an.complete){an.complete.call(this)}})}}function aj(au){var av=L(this),at=an.complete,aw=an.mode;function ar(){if(L.isFunction(at)){at.call(av[0])}if(L.isFunction(au)){au()}}if(av.is(":hidden")?aw==="hide":aw==="show"){ar()}else{am.call(av[0],an,ar)}}if(am){return al===false?this.each(aj):this.queue(al||"fx",aj)}else{return ah.call(this,{options:an,duration:an.duration,callback:an.complete,mode:an.mode})}}});var a=/up|down|vertical/,v=/up|left|vertical|horizontal/;L.jqplot.effects.effect.blind=function(aj,ao){var ak=L(this),ar=["position","top","bottom","left","right","height","width"],ap=L.jqplot.effects.setMode(ak,aj.mode||"hide"),au=aj.direction||"up",am=a.test(au),al=am?"height":"width",aq=am?"top":"left",aw=v.test(au),an={},av=ap==="show",ai,ah,at;if(ak.parent().is(".ui-effects-wrapper")){L.jqplot.effects.save(ak.parent(),ar)}else{L.jqplot.effects.save(ak,ar)}ak.show();at=parseInt(ak.css("top"),10);ai=L.jqplot.effects.createWrapper(ak).css({overflow:"hidden"});ah=am?ai[al]()+at:ai[al]();an[al]=av?String(ah):"0";if(!aw){ak.css(am?"bottom":"right",0).css(am?"top":"left","").css({position:"absolute"});an[aq]=av?"0":String(ah)}if(av){ai.css(al,0);if(!aw){ai.css(aq,ah)}}ai.animate(an,{duration:aj.duration,easing:aj.easing,queue:false,complete:function(){if(ap==="hide"){ak.hide()}L.jqplot.effects.restore(ak,ar);L.jqplot.effects.removeWrapper(ak);ao()}})}})(jQuery);
|
js/jqplot/plugins/jqplot.pieRenderer.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
2 |
-
jsDate | (c) 2010-2013 Chris Leonello
|
3 |
*/(function(e){e.jqplot.PieRenderer=function(){e.jqplot.LineRenderer.call(this)};e.jqplot.PieRenderer.prototype=new e.jqplot.LineRenderer();e.jqplot.PieRenderer.prototype.constructor=e.jqplot.PieRenderer;e.jqplot.PieRenderer.prototype.init=function(q,u){this.diameter=null;this.padding=20;this.sliceMargin=0;this.fill=true;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=5;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.dataLabels="percent";this.showDataLabels=false;this.dataLabelFormatString=null;this.dataLabelThreshold=3;this.dataLabelPositionFactor=0.52;this.dataLabelNudge=2;this.dataLabelCenterOn=true;this.startAngle=0;this.tickRenderer=e.jqplot.PieTickRenderer;this._drawData=true;this._type="pie";if(q.highlightMouseDown&&q.highlightMouseOver==null){q.highlightMouseOver=false}e.extend(true,this,q);if(this.sliceMargin<0){this.sliceMargin=0}this._diameter=null;this._radius=null;this._sliceAngles=[];this._highlightedPoint=null;if(this.highlightColors.length==0){for(var s=0;s<this.seriesColors.length;s++){var r=e.jqplot.getColorComponents(this.seriesColors[s]);var o=[r[0],r[1],r[2]];var t=o[0]+o[1]+o[2];for(var p=0;p<3;p++){o[p]=(t>570)?o[p]*0.8:o[p]+0.3*(255-o[p]);o[p]=parseInt(o[p],10)}this.highlightColors.push("rgb("+o[0]+","+o[1]+","+o[2]+")")}}this.highlightColorGenerator=new e.jqplot.ColorGenerator(this.highlightColors);u.postParseOptionsHooks.addOnce(m);u.postInitHooks.addOnce(g);u.eventListenerHooks.addOnce("jqplotMouseMove",b);u.eventListenerHooks.addOnce("jqplotMouseDown",a);u.eventListenerHooks.addOnce("jqplotMouseUp",l);u.eventListenerHooks.addOnce("jqplotClick",f);u.eventListenerHooks.addOnce("jqplotRightClick",n);u.postDrawHooks.addOnce(i)};e.jqplot.PieRenderer.prototype.setGridData=function(t){var p=[];var u=[];var o=this.startAngle/180*Math.PI;var s=0;this._drawData=false;for(var r=0;r<this.data.length;r++){if(this.data[r][1]!=0){this._drawData=true}p.push(this.data[r][1]);u.push([this.data[r][0]]);if(r>0){p[r]+=p[r-1]}s+=this.data[r][1]}var q=Math.PI*2/p[p.length-1];for(var r=0;r<p.length;r++){u[r][1]=p[r]*q;u[r][2]=this.data[r][1]/s}this.gridData=u};e.jqplot.PieRenderer.prototype.makeGridData=function(t,u){var p=[];var v=[];var s=0;var o=this.startAngle/180*Math.PI;this._drawData=false;for(var r=0;r<t.length;r++){if(this.data[r][1]!=0){this._drawData=true}p.push(t[r][1]);v.push([t[r][0]]);if(r>0){p[r]+=p[r-1]}s+=t[r][1]}var q=Math.PI*2/p[p.length-1];for(var r=0;r<p.length;r++){v[r][1]=p[r]*q;v[r][2]=t[r][1]/s}return v};function h(o){return Math.sin((o-(o-Math.PI)/8/Math.PI)/2)}function j(u,t,o,v,r){var w=0;var q=t-u;var s=Math.abs(q);var p=o;if(v==false){p+=r}if(p>0&&s>0.01&&s<6.282){w=parseFloat(p)/2/h(q)}return w}e.jqplot.PieRenderer.prototype.drawSlice=function(B,z,y,u,w){if(this._drawData){var p=this._radius;var A=this.fill;var x=this.lineWidth;var s=this.sliceMargin;if(this.fill==false){s+=this.lineWidth}B.save();B.translate(this._center[0],this._center[1]);var D=j(z,y,this.sliceMargin,this.fill,this.lineWidth);var o=D*Math.cos((z+y)/2);var C=D*Math.sin((z+y)/2);if((y-z)<=Math.PI){p-=D}else{p+=D}B.translate(o,C);if(w){for(var v=0,t=this.shadowDepth;v<t;v++){B.save();B.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI),this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));q(p)}for(var v=0,t=this.shadowDepth;v<t;v++){B.restore()}}else{q(p)}B.restore()}function q(r){if(y>6.282+this.startAngle){y=6.282+this.startAngle;if(z>y){z=6.281+this.startAngle}}if(z>=y){return}B.beginPath();B.fillStyle=u;B.strokeStyle=u;B.lineWidth=x;B.arc(0,0,r,z,y,false);B.lineTo(0,0);B.closePath();if(A){B.fill()}else{B.stroke()}}};e.jqplot.PieRenderer.prototype.draw=function(B,z,E,o){var W;var H=(E!=undefined)?E:{};var t=0;var s=0;var N=1;var L=new e.jqplot.ColorGenerator(this.seriesColors);if(E.legendInfo&&E.legendInfo.placement=="insideGrid"){var J=E.legendInfo;switch(J.location){case"nw":t=J.width+J.xoffset;break;case"w":t=J.width+J.xoffset;break;case"sw":t=J.width+J.xoffset;break;case"ne":t=J.width+J.xoffset;N=-1;break;case"e":t=J.width+J.xoffset;N=-1;break;case"se":t=J.width+J.xoffset;N=-1;break;case"n":s=J.height+J.yoffset;break;case"s":s=J.height+J.yoffset;N=-1;break;default:break}}var K=(H.shadow!=undefined)?H.shadow:this.shadow;var A=(H.fill!=undefined)?H.fill:this.fill;var C=B.canvas.width;var I=B.canvas.height;var Q=C-t-2*this.padding;var X=I-s-2*this.padding;var M=Math.min(Q,X);var Y=M;this._sliceAngles=[];var v=this.sliceMargin;if(this.fill==false){v+=this.lineWidth}var q;var G=0;var R,aa,Z,ab;var D=this.startAngle/180*Math.PI;for(var W=0,V=z.length;W<V;W++){aa=(W==0)?D:z[W-1][1]+D;Z=z[W][1]+D;this._sliceAngles.push([aa,Z]);q=j(aa,Z,this.sliceMargin,this.fill,this.lineWidth);if(Math.abs(Z-aa)>Math.PI){G=Math.max(q,G)}}if(this.diameter!=null&&this.diameter>0){this._diameter=this.diameter-2*G}else{this._diameter=Y-2*G}if(this._diameter<6){e.jqplot.log("Diameter of pie too small, not rendering.");return}var S=this._radius=this._diameter/2;this._center=[(C-N*t)/2+N*t+G*Math.cos(D),(I-N*s)/2+N*s+G*Math.sin(D)];if(this.shadow){for(var W=0,V=z.length;W<V;W++){ab="rgba(0,0,0,"+this.shadowAlpha+")";this.renderer.drawSlice.call(this,B,this._sliceAngles[W][0],this._sliceAngles[W][1],ab,true)}}for(var W=0;W<z.length;W++){this.renderer.drawSlice.call(this,B,this._sliceAngles[W][0],this._sliceAngles[W][1],L.next(),false);if(this.showDataLabels&&z[W][2]*100>=this.dataLabelThreshold){var F,U=(this._sliceAngles[W][0]+this._sliceAngles[W][1])/2,T;if(this.dataLabels=="label"){F=this.dataLabelFormatString||"%s";T=e.jqplot.sprintf(F,z[W][0])}else{if(this.dataLabels=="value"){F=this.dataLabelFormatString||"%d";T=e.jqplot.sprintf(F,this.data[W][1])}else{if(this.dataLabels=="percent"){F=this.dataLabelFormatString||"%d%%";T=e.jqplot.sprintf(F,z[W][2]*100)}else{if(this.dataLabels.constructor==Array){F=this.dataLabelFormatString||"%s";T=e.jqplot.sprintf(F,this.dataLabels[W])}}}}var p=(this._radius)*this.dataLabelPositionFactor+this.sliceMargin+this.dataLabelNudge;var P=this._center[0]+Math.cos(U)*p+this.canvas._offsets.left;var O=this._center[1]+Math.sin(U)*p+this.canvas._offsets.top;var u=e('<div class="jqplot-pie-series jqplot-data-label" style="position:absolute;">'+T+"</div>").insertBefore(o.eventCanvas._elem);if(this.dataLabelCenterOn){P-=u.width()/2;O-=u.height()/2}else{P-=u.width()*Math.sin(U/2);O-=u.height()/2}P=Math.round(P);O=Math.round(O);u.css({left:P,top:O})}}};e.jqplot.PieAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.PieAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.PieAxisRenderer.prototype.constructor=e.jqplot.PieAxisRenderer;e.jqplot.PieAxisRenderer.prototype.init=function(o){this.tickRenderer=e.jqplot.PieTickRenderer;e.extend(true,this,o);this._dataBounds={min:0,max:100};this.min=0;this.max=100;this.showTicks=false;this.ticks=[];this.showMark=false;this.show=false};e.jqplot.PieLegendRenderer=function(){e.jqplot.TableLegendRenderer.call(this)};e.jqplot.PieLegendRenderer.prototype=new e.jqplot.TableLegendRenderer();e.jqplot.PieLegendRenderer.prototype.constructor=e.jqplot.PieLegendRenderer;e.jqplot.PieLegendRenderer.prototype.init=function(o){this.numberRows=null;this.numberColumns=null;e.extend(true,this,o)};e.jqplot.PieLegendRenderer.prototype.draw=function(){var r=this;if(this.show){var B=this._series;this._elem=e(document.createElement("table"));this._elem.addClass("jqplot-table-legend");var E={position:"absolute"};if(this.background){E.background=this.background}if(this.border){E.border=this.border}if(this.fontSize){E.fontSize=this.fontSize}if(this.fontFamily){E.fontFamily=this.fontFamily}if(this.textColor){E.textColor=this.textColor}if(this.marginTop!=null){E.marginTop=this.marginTop}if(this.marginBottom!=null){E.marginBottom=this.marginBottom}if(this.marginLeft!=null){E.marginLeft=this.marginLeft}if(this.marginRight!=null){E.marginRight=this.marginRight}this._elem.css(E);var I=false,A=false,o,y;var C=B[0];var p=new e.jqplot.ColorGenerator(C.seriesColors);if(C.show){var J=C.data;if(this.numberRows){o=this.numberRows;if(!this.numberColumns){y=Math.ceil(J.length/o)}else{y=this.numberColumns}}else{if(this.numberColumns){y=this.numberColumns;o=Math.ceil(J.length/this.numberColumns)}else{o=J.length;y=1}}var H,G;var q,w,v;var x,z,F;var D=0;var u,t;for(H=0;H<o;H++){q=e(document.createElement("tr"));q.addClass("jqplot-table-legend");if(A){q.prependTo(this._elem)}else{q.appendTo(this._elem)}for(G=0;G<y;G++){if(D<J.length){x=this.labels[D]||J[D][0].toString();F=p.next();if(!A){if(H>0){I=true}else{I=false}}else{if(H==o-1){I=false}else{I=true}}z=(I)?this.rowSpacing:"0";w=e(document.createElement("td"));w.addClass("jqplot-table-legend jqplot-table-legend-swatch");w.css({textAlign:"center",paddingTop:z});u=e(document.createElement("div"));u.addClass("jqplot-table-legend-swatch-outline");t=e(document.createElement("div"));t.addClass("jqplot-table-legend-swatch");t.css({backgroundColor:F,borderColor:F});w.append(u.append(t));v=e(document.createElement("td"));v.addClass("jqplot-table-legend jqplot-table-legend-label");v.css("paddingTop",z);if(this.escapeHtml){v.text(x)}else{v.html(x)}if(A){v.prependTo(q);w.prependTo(q)}else{w.appendTo(q);v.appendTo(q)}I=true}D++}}}}return this._elem};e.jqplot.PieRenderer.prototype.handleMove=function(q,p,t,s,r){if(s){var o=[s.seriesIndex,s.pointIndex,s.data];r.target.trigger("jqplotDataMouseOver",o);if(r.series[o[0]].highlightMouseOver&&!(o[0]==r.plugins.pieRenderer.highlightedSeriesIndex&&o[1]==r.series[o[0]]._highlightedPoint)){r.target.trigger("jqplotDataHighlight",o);d(r,o[0],o[1])}}else{if(s==null){k(r)}}};function c(s,r,p){p=p||{};p.axesDefaults=p.axesDefaults||{};p.legend=p.legend||{};p.seriesDefaults=p.seriesDefaults||{};var o=false;if(p.seriesDefaults.renderer==e.jqplot.PieRenderer){o=true}else{if(p.series){for(var q=0;q<p.series.length;q++){if(p.series[q].renderer==e.jqplot.PieRenderer){o=true}}}}if(o){p.axesDefaults.renderer=e.jqplot.PieAxisRenderer;p.legend.renderer=e.jqplot.PieLegendRenderer;p.legend.preDraw=true;p.seriesDefaults.pointLabels={show:false}}}function g(r,q,o){for(var p=0;p<this.series.length;p++){if(this.series[p].renderer.constructor==e.jqplot.PieRenderer){if(this.series[p].highlightMouseOver){this.series[p].highlightMouseDown=false}}}}function m(o){for(var p=0;p<this.series.length;p++){this.series[p].seriesColors=this.seriesColors;this.series[p].colorGenerator=e.jqplot.colorGenerator}}function d(t,r,q){var p=t.series[r];var o=t.plugins.pieRenderer.highlightCanvas;o._ctx.clearRect(0,0,o._ctx.canvas.width,o._ctx.canvas.height);p._highlightedPoint=q;t.plugins.pieRenderer.highlightedSeriesIndex=r;p.renderer.drawSlice.call(p,o._ctx,p._sliceAngles[q][0],p._sliceAngles[q][1],p.highlightColorGenerator.get(q),false)}function k(q){var o=q.plugins.pieRenderer.highlightCanvas;o._ctx.clearRect(0,0,o._ctx.canvas.width,o._ctx.canvas.height);for(var p=0;p<q.series.length;p++){q.series[p]._highlightedPoint=null}q.plugins.pieRenderer.highlightedSeriesIndex=null;q.target.trigger("jqplotDataUnhighlight")}function b(s,r,v,u,t){if(u){var q=[u.seriesIndex,u.pointIndex,u.data];var p=jQuery.Event("jqplotDataMouseOver");p.pageX=s.pageX;p.pageY=s.pageY;t.target.trigger(p,q);if(t.series[q[0]].highlightMouseOver&&!(q[0]==t.plugins.pieRenderer.highlightedSeriesIndex&&q[1]==t.series[q[0]]._highlightedPoint)){var o=jQuery.Event("jqplotDataHighlight");o.which=s.which;o.pageX=s.pageX;o.pageY=s.pageY;t.target.trigger(o,q);d(t,q[0],q[1])}}else{if(u==null){k(t)}}}function a(r,q,u,t,s){if(t){var p=[t.seriesIndex,t.pointIndex,t.data];if(s.series[p[0]].highlightMouseDown&&!(p[0]==s.plugins.pieRenderer.highlightedSeriesIndex&&p[1]==s.series[p[0]]._highlightedPoint)){var o=jQuery.Event("jqplotDataHighlight");o.which=r.which;o.pageX=r.pageX;o.pageY=r.pageY;s.target.trigger(o,p);d(s,p[0],p[1])}}else{if(t==null){k(s)}}}function l(q,p,t,s,r){var o=r.plugins.pieRenderer.highlightedSeriesIndex;if(o!=null&&r.series[o].highlightMouseDown){k(r)}}function f(r,q,u,t,s){if(t){var p=[t.seriesIndex,t.pointIndex,t.data];var o=jQuery.Event("jqplotDataClick");o.which=r.which;o.pageX=r.pageX;o.pageY=r.pageY;s.target.trigger(o,p)}}function n(s,r,v,u,t){if(u){var q=[u.seriesIndex,u.pointIndex,u.data];var o=t.plugins.pieRenderer.highlightedSeriesIndex;if(o!=null&&t.series[o].highlightMouseDown){k(t)}var p=jQuery.Event("jqplotDataRightClick");p.which=s.which;p.pageX=s.pageX;p.pageY=s.pageY;t.target.trigger(p,q)}}function i(){if(this.plugins.pieRenderer&&this.plugins.pieRenderer.highlightCanvas){this.plugins.pieRenderer.highlightCanvas.resetCanvas();this.plugins.pieRenderer.highlightCanvas=null}this.plugins.pieRenderer={highlightedSeriesIndex:null};this.plugins.pieRenderer.highlightCanvas=new e.jqplot.GenericCanvas();var p=e(this.targetId+" .jqplot-data-label");if(p.length){e(p[0]).before(this.plugins.pieRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-pieRenderer-highlight-canvas",this._plotDimensions,this))}else{this.eventCanvas._elem.before(this.plugins.pieRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-pieRenderer-highlight-canvas",this._plotDimensions,this))}var o=this.plugins.pieRenderer.highlightCanvas.setContext();this.eventCanvas._elem.bind("mouseleave",{plot:this},function(q){k(q.data.plot)})}e.jqplot.preInitHooks.push(c);e.jqplot.PieTickRenderer=function(){e.jqplot.AxisTickRenderer.call(this)};e.jqplot.PieTickRenderer.prototype=new e.jqplot.AxisTickRenderer();e.jqplot.PieTickRenderer.prototype.constructor=e.jqplot.PieTickRenderer})(jQuery);
|
1 |
+
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
2 |
+
jsDate | (c) 2010-2013 Chris Leonello
|
3 |
*/(function(e){e.jqplot.PieRenderer=function(){e.jqplot.LineRenderer.call(this)};e.jqplot.PieRenderer.prototype=new e.jqplot.LineRenderer();e.jqplot.PieRenderer.prototype.constructor=e.jqplot.PieRenderer;e.jqplot.PieRenderer.prototype.init=function(q,u){this.diameter=null;this.padding=20;this.sliceMargin=0;this.fill=true;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=5;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.dataLabels="percent";this.showDataLabels=false;this.dataLabelFormatString=null;this.dataLabelThreshold=3;this.dataLabelPositionFactor=0.52;this.dataLabelNudge=2;this.dataLabelCenterOn=true;this.startAngle=0;this.tickRenderer=e.jqplot.PieTickRenderer;this._drawData=true;this._type="pie";if(q.highlightMouseDown&&q.highlightMouseOver==null){q.highlightMouseOver=false}e.extend(true,this,q);if(this.sliceMargin<0){this.sliceMargin=0}this._diameter=null;this._radius=null;this._sliceAngles=[];this._highlightedPoint=null;if(this.highlightColors.length==0){for(var s=0;s<this.seriesColors.length;s++){var r=e.jqplot.getColorComponents(this.seriesColors[s]);var o=[r[0],r[1],r[2]];var t=o[0]+o[1]+o[2];for(var p=0;p<3;p++){o[p]=(t>570)?o[p]*0.8:o[p]+0.3*(255-o[p]);o[p]=parseInt(o[p],10)}this.highlightColors.push("rgb("+o[0]+","+o[1]+","+o[2]+")")}}this.highlightColorGenerator=new e.jqplot.ColorGenerator(this.highlightColors);u.postParseOptionsHooks.addOnce(m);u.postInitHooks.addOnce(g);u.eventListenerHooks.addOnce("jqplotMouseMove",b);u.eventListenerHooks.addOnce("jqplotMouseDown",a);u.eventListenerHooks.addOnce("jqplotMouseUp",l);u.eventListenerHooks.addOnce("jqplotClick",f);u.eventListenerHooks.addOnce("jqplotRightClick",n);u.postDrawHooks.addOnce(i)};e.jqplot.PieRenderer.prototype.setGridData=function(t){var p=[];var u=[];var o=this.startAngle/180*Math.PI;var s=0;this._drawData=false;for(var r=0;r<this.data.length;r++){if(this.data[r][1]!=0){this._drawData=true}p.push(this.data[r][1]);u.push([this.data[r][0]]);if(r>0){p[r]+=p[r-1]}s+=this.data[r][1]}var q=Math.PI*2/p[p.length-1];for(var r=0;r<p.length;r++){u[r][1]=p[r]*q;u[r][2]=this.data[r][1]/s}this.gridData=u};e.jqplot.PieRenderer.prototype.makeGridData=function(t,u){var p=[];var v=[];var s=0;var o=this.startAngle/180*Math.PI;this._drawData=false;for(var r=0;r<t.length;r++){if(this.data[r][1]!=0){this._drawData=true}p.push(t[r][1]);v.push([t[r][0]]);if(r>0){p[r]+=p[r-1]}s+=t[r][1]}var q=Math.PI*2/p[p.length-1];for(var r=0;r<p.length;r++){v[r][1]=p[r]*q;v[r][2]=t[r][1]/s}return v};function h(o){return Math.sin((o-(o-Math.PI)/8/Math.PI)/2)}function j(u,t,o,v,r){var w=0;var q=t-u;var s=Math.abs(q);var p=o;if(v==false){p+=r}if(p>0&&s>0.01&&s<6.282){w=parseFloat(p)/2/h(q)}return w}e.jqplot.PieRenderer.prototype.drawSlice=function(B,z,y,u,w){if(this._drawData){var p=this._radius;var A=this.fill;var x=this.lineWidth;var s=this.sliceMargin;if(this.fill==false){s+=this.lineWidth}B.save();B.translate(this._center[0],this._center[1]);var D=j(z,y,this.sliceMargin,this.fill,this.lineWidth);var o=D*Math.cos((z+y)/2);var C=D*Math.sin((z+y)/2);if((y-z)<=Math.PI){p-=D}else{p+=D}B.translate(o,C);if(w){for(var v=0,t=this.shadowDepth;v<t;v++){B.save();B.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI),this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));q(p)}for(var v=0,t=this.shadowDepth;v<t;v++){B.restore()}}else{q(p)}B.restore()}function q(r){if(y>6.282+this.startAngle){y=6.282+this.startAngle;if(z>y){z=6.281+this.startAngle}}if(z>=y){return}B.beginPath();B.fillStyle=u;B.strokeStyle=u;B.lineWidth=x;B.arc(0,0,r,z,y,false);B.lineTo(0,0);B.closePath();if(A){B.fill()}else{B.stroke()}}};e.jqplot.PieRenderer.prototype.draw=function(B,z,E,o){var W;var H=(E!=undefined)?E:{};var t=0;var s=0;var N=1;var L=new e.jqplot.ColorGenerator(this.seriesColors);if(E.legendInfo&&E.legendInfo.placement=="insideGrid"){var J=E.legendInfo;switch(J.location){case"nw":t=J.width+J.xoffset;break;case"w":t=J.width+J.xoffset;break;case"sw":t=J.width+J.xoffset;break;case"ne":t=J.width+J.xoffset;N=-1;break;case"e":t=J.width+J.xoffset;N=-1;break;case"se":t=J.width+J.xoffset;N=-1;break;case"n":s=J.height+J.yoffset;break;case"s":s=J.height+J.yoffset;N=-1;break;default:break}}var K=(H.shadow!=undefined)?H.shadow:this.shadow;var A=(H.fill!=undefined)?H.fill:this.fill;var C=B.canvas.width;var I=B.canvas.height;var Q=C-t-2*this.padding;var X=I-s-2*this.padding;var M=Math.min(Q,X);var Y=M;this._sliceAngles=[];var v=this.sliceMargin;if(this.fill==false){v+=this.lineWidth}var q;var G=0;var R,aa,Z,ab;var D=this.startAngle/180*Math.PI;for(var W=0,V=z.length;W<V;W++){aa=(W==0)?D:z[W-1][1]+D;Z=z[W][1]+D;this._sliceAngles.push([aa,Z]);q=j(aa,Z,this.sliceMargin,this.fill,this.lineWidth);if(Math.abs(Z-aa)>Math.PI){G=Math.max(q,G)}}if(this.diameter!=null&&this.diameter>0){this._diameter=this.diameter-2*G}else{this._diameter=Y-2*G}if(this._diameter<6){e.jqplot.log("Diameter of pie too small, not rendering.");return}var S=this._radius=this._diameter/2;this._center=[(C-N*t)/2+N*t+G*Math.cos(D),(I-N*s)/2+N*s+G*Math.sin(D)];if(this.shadow){for(var W=0,V=z.length;W<V;W++){ab="rgba(0,0,0,"+this.shadowAlpha+")";this.renderer.drawSlice.call(this,B,this._sliceAngles[W][0],this._sliceAngles[W][1],ab,true)}}for(var W=0;W<z.length;W++){this.renderer.drawSlice.call(this,B,this._sliceAngles[W][0],this._sliceAngles[W][1],L.next(),false);if(this.showDataLabels&&z[W][2]*100>=this.dataLabelThreshold){var F,U=(this._sliceAngles[W][0]+this._sliceAngles[W][1])/2,T;if(this.dataLabels=="label"){F=this.dataLabelFormatString||"%s";T=e.jqplot.sprintf(F,z[W][0])}else{if(this.dataLabels=="value"){F=this.dataLabelFormatString||"%d";T=e.jqplot.sprintf(F,this.data[W][1])}else{if(this.dataLabels=="percent"){F=this.dataLabelFormatString||"%d%%";T=e.jqplot.sprintf(F,z[W][2]*100)}else{if(this.dataLabels.constructor==Array){F=this.dataLabelFormatString||"%s";T=e.jqplot.sprintf(F,this.dataLabels[W])}}}}var p=(this._radius)*this.dataLabelPositionFactor+this.sliceMargin+this.dataLabelNudge;var P=this._center[0]+Math.cos(U)*p+this.canvas._offsets.left;var O=this._center[1]+Math.sin(U)*p+this.canvas._offsets.top;var u=e('<div class="jqplot-pie-series jqplot-data-label" style="position:absolute;">'+T+"</div>").insertBefore(o.eventCanvas._elem);if(this.dataLabelCenterOn){P-=u.width()/2;O-=u.height()/2}else{P-=u.width()*Math.sin(U/2);O-=u.height()/2}P=Math.round(P);O=Math.round(O);u.css({left:P,top:O})}}};e.jqplot.PieAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.PieAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.PieAxisRenderer.prototype.constructor=e.jqplot.PieAxisRenderer;e.jqplot.PieAxisRenderer.prototype.init=function(o){this.tickRenderer=e.jqplot.PieTickRenderer;e.extend(true,this,o);this._dataBounds={min:0,max:100};this.min=0;this.max=100;this.showTicks=false;this.ticks=[];this.showMark=false;this.show=false};e.jqplot.PieLegendRenderer=function(){e.jqplot.TableLegendRenderer.call(this)};e.jqplot.PieLegendRenderer.prototype=new e.jqplot.TableLegendRenderer();e.jqplot.PieLegendRenderer.prototype.constructor=e.jqplot.PieLegendRenderer;e.jqplot.PieLegendRenderer.prototype.init=function(o){this.numberRows=null;this.numberColumns=null;e.extend(true,this,o)};e.jqplot.PieLegendRenderer.prototype.draw=function(){var r=this;if(this.show){var B=this._series;this._elem=e(document.createElement("table"));this._elem.addClass("jqplot-table-legend");var E={position:"absolute"};if(this.background){E.background=this.background}if(this.border){E.border=this.border}if(this.fontSize){E.fontSize=this.fontSize}if(this.fontFamily){E.fontFamily=this.fontFamily}if(this.textColor){E.textColor=this.textColor}if(this.marginTop!=null){E.marginTop=this.marginTop}if(this.marginBottom!=null){E.marginBottom=this.marginBottom}if(this.marginLeft!=null){E.marginLeft=this.marginLeft}if(this.marginRight!=null){E.marginRight=this.marginRight}this._elem.css(E);var I=false,A=false,o,y;var C=B[0];var p=new e.jqplot.ColorGenerator(C.seriesColors);if(C.show){var J=C.data;if(this.numberRows){o=this.numberRows;if(!this.numberColumns){y=Math.ceil(J.length/o)}else{y=this.numberColumns}}else{if(this.numberColumns){y=this.numberColumns;o=Math.ceil(J.length/this.numberColumns)}else{o=J.length;y=1}}var H,G;var q,w,v;var x,z,F;var D=0;var u,t;for(H=0;H<o;H++){q=e(document.createElement("tr"));q.addClass("jqplot-table-legend");if(A){q.prependTo(this._elem)}else{q.appendTo(this._elem)}for(G=0;G<y;G++){if(D<J.length){x=this.labels[D]||J[D][0].toString();F=p.next();if(!A){if(H>0){I=true}else{I=false}}else{if(H==o-1){I=false}else{I=true}}z=(I)?this.rowSpacing:"0";w=e(document.createElement("td"));w.addClass("jqplot-table-legend jqplot-table-legend-swatch");w.css({textAlign:"center",paddingTop:z});u=e(document.createElement("div"));u.addClass("jqplot-table-legend-swatch-outline");t=e(document.createElement("div"));t.addClass("jqplot-table-legend-swatch");t.css({backgroundColor:F,borderColor:F});w.append(u.append(t));v=e(document.createElement("td"));v.addClass("jqplot-table-legend jqplot-table-legend-label");v.css("paddingTop",z);if(this.escapeHtml){v.text(x)}else{v.html(x)}if(A){v.prependTo(q);w.prependTo(q)}else{w.appendTo(q);v.appendTo(q)}I=true}D++}}}}return this._elem};e.jqplot.PieRenderer.prototype.handleMove=function(q,p,t,s,r){if(s){var o=[s.seriesIndex,s.pointIndex,s.data];r.target.trigger("jqplotDataMouseOver",o);if(r.series[o[0]].highlightMouseOver&&!(o[0]==r.plugins.pieRenderer.highlightedSeriesIndex&&o[1]==r.series[o[0]]._highlightedPoint)){r.target.trigger("jqplotDataHighlight",o);d(r,o[0],o[1])}}else{if(s==null){k(r)}}};function c(s,r,p){p=p||{};p.axesDefaults=p.axesDefaults||{};p.legend=p.legend||{};p.seriesDefaults=p.seriesDefaults||{};var o=false;if(p.seriesDefaults.renderer==e.jqplot.PieRenderer){o=true}else{if(p.series){for(var q=0;q<p.series.length;q++){if(p.series[q].renderer==e.jqplot.PieRenderer){o=true}}}}if(o){p.axesDefaults.renderer=e.jqplot.PieAxisRenderer;p.legend.renderer=e.jqplot.PieLegendRenderer;p.legend.preDraw=true;p.seriesDefaults.pointLabels={show:false}}}function g(r,q,o){for(var p=0;p<this.series.length;p++){if(this.series[p].renderer.constructor==e.jqplot.PieRenderer){if(this.series[p].highlightMouseOver){this.series[p].highlightMouseDown=false}}}}function m(o){for(var p=0;p<this.series.length;p++){this.series[p].seriesColors=this.seriesColors;this.series[p].colorGenerator=e.jqplot.colorGenerator}}function d(t,r,q){var p=t.series[r];var o=t.plugins.pieRenderer.highlightCanvas;o._ctx.clearRect(0,0,o._ctx.canvas.width,o._ctx.canvas.height);p._highlightedPoint=q;t.plugins.pieRenderer.highlightedSeriesIndex=r;p.renderer.drawSlice.call(p,o._ctx,p._sliceAngles[q][0],p._sliceAngles[q][1],p.highlightColorGenerator.get(q),false)}function k(q){var o=q.plugins.pieRenderer.highlightCanvas;o._ctx.clearRect(0,0,o._ctx.canvas.width,o._ctx.canvas.height);for(var p=0;p<q.series.length;p++){q.series[p]._highlightedPoint=null}q.plugins.pieRenderer.highlightedSeriesIndex=null;q.target.trigger("jqplotDataUnhighlight")}function b(s,r,v,u,t){if(u){var q=[u.seriesIndex,u.pointIndex,u.data];var p=jQuery.Event("jqplotDataMouseOver");p.pageX=s.pageX;p.pageY=s.pageY;t.target.trigger(p,q);if(t.series[q[0]].highlightMouseOver&&!(q[0]==t.plugins.pieRenderer.highlightedSeriesIndex&&q[1]==t.series[q[0]]._highlightedPoint)){var o=jQuery.Event("jqplotDataHighlight");o.which=s.which;o.pageX=s.pageX;o.pageY=s.pageY;t.target.trigger(o,q);d(t,q[0],q[1])}}else{if(u==null){k(t)}}}function a(r,q,u,t,s){if(t){var p=[t.seriesIndex,t.pointIndex,t.data];if(s.series[p[0]].highlightMouseDown&&!(p[0]==s.plugins.pieRenderer.highlightedSeriesIndex&&p[1]==s.series[p[0]]._highlightedPoint)){var o=jQuery.Event("jqplotDataHighlight");o.which=r.which;o.pageX=r.pageX;o.pageY=r.pageY;s.target.trigger(o,p);d(s,p[0],p[1])}}else{if(t==null){k(s)}}}function l(q,p,t,s,r){var o=r.plugins.pieRenderer.highlightedSeriesIndex;if(o!=null&&r.series[o].highlightMouseDown){k(r)}}function f(r,q,u,t,s){if(t){var p=[t.seriesIndex,t.pointIndex,t.data];var o=jQuery.Event("jqplotDataClick");o.which=r.which;o.pageX=r.pageX;o.pageY=r.pageY;s.target.trigger(o,p)}}function n(s,r,v,u,t){if(u){var q=[u.seriesIndex,u.pointIndex,u.data];var o=t.plugins.pieRenderer.highlightedSeriesIndex;if(o!=null&&t.series[o].highlightMouseDown){k(t)}var p=jQuery.Event("jqplotDataRightClick");p.which=s.which;p.pageX=s.pageX;p.pageY=s.pageY;t.target.trigger(p,q)}}function i(){if(this.plugins.pieRenderer&&this.plugins.pieRenderer.highlightCanvas){this.plugins.pieRenderer.highlightCanvas.resetCanvas();this.plugins.pieRenderer.highlightCanvas=null}this.plugins.pieRenderer={highlightedSeriesIndex:null};this.plugins.pieRenderer.highlightCanvas=new e.jqplot.GenericCanvas();var p=e(this.targetId+" .jqplot-data-label");if(p.length){e(p[0]).before(this.plugins.pieRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-pieRenderer-highlight-canvas",this._plotDimensions,this))}else{this.eventCanvas._elem.before(this.plugins.pieRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-pieRenderer-highlight-canvas",this._plotDimensions,this))}var o=this.plugins.pieRenderer.highlightCanvas.setContext();this.eventCanvas._elem.bind("mouseleave",{plot:this},function(q){k(q.data.plot)})}e.jqplot.preInitHooks.push(c);e.jqplot.PieTickRenderer=function(){e.jqplot.AxisTickRenderer.call(this)};e.jqplot.PieTickRenderer.prototype=new e.jqplot.AxisTickRenderer();e.jqplot.PieTickRenderer.prototype.constructor=e.jqplot.PieTickRenderer})(jQuery);
|
js/jqplot/plugins/jqplot.trendline.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
2 |
-
jsDate | (c) 2010-2013 Chris Leonello
|
3 |
*/(function(f){f.jqplot.Trendline=function(){this.show=f.jqplot.config.enablePlugins;this.color="#666666";this.renderer=new f.jqplot.LineRenderer();this.rendererOptions={marker:{show:false}};this.label="";this.type="linear";this.shadow=true;this.markerRenderer={show:false};this.lineWidth=1.5;this.shadowAngle=45;this.shadowOffset=1;this.shadowAlpha=0.07;this.shadowDepth=3;this.isTrendline=true};f.jqplot.postSeriesInitHooks.push(e);f.jqplot.postDrawSeriesHooks.push(g);f.jqplot.addLegendRowHooks.push(a);function a(k){var j=null;if(k.trendline&&k.trendline.show){var i=k.trendline.label.toString();if(i){j={label:i,color:k.trendline.color}}}return j}function e(m,k,j,i,l){if(this._type&&(this._type==="line"||this._type=="bar")){this.trendline=new f.jqplot.Trendline();i=i||{};f.extend(true,this.trendline,{color:this.color},j.trendline,i.trendline);this.trendline.renderer.init.call(this.trendline,null)}}function g(m,i){i=f.extend(true,{},this.trendline,i);if(this.trendline&&i.show){var k;var l=i.data||this.data;k=c(l,this.trendline.type);var j=i.gridData||this.renderer.makeGridData.call(this,k.data);this.trendline.renderer.draw.call(this.trendline,m,j,{showLine:true,shadow:this.trendline.shadow})}}function b(w,v,n){var u=(n==null)?"linear":n;var s=w.length;var t;var z;var o=0;var m=0;var r=0;var q=0;var l=0;var j=[];var k=[];if(u=="linear"){k=w;j=v}else{if(u=="exp"||u=="exponential"){for(var p=0;p<v.length;p++){if(v[p]<=0){s--}else{k.push(w[p]);j.push(Math.log(v[p]))}}}}for(var p=0;p<s;p++){o=o+k[p];m=m+j[p];q=q+k[p]*j[p];r=r+k[p]*k[p];l=l+j[p]*j[p]}t=(s*q-o*m)/(s*r-o*o);z=(m-t*o)/s;return[t,z]}function h(k,j){var i;i=b(k,j,"linear");return[i[0],i[1]]}function d(o,m){var k;var i=o;var n=m;k=b(i,n,"exp");var l=Math.exp(k[0]);var j=Math.exp(k[1]);return[l,j]}function c(l,j){var p=(j==null)?"linear":j;var n;var o;var r=[];var q=[];var m=[];for(k=0;k<l.length;k++){if(l[k]!=null&&l[k][0]!=null&&l[k][1]!=null){r.push(l[k][0]);q.push(l[k][1])}}if(p=="linear"){n=h(r,q);for(var k=0;k<r.length;k++){o=n[0]*r[k]+n[1];m.push([r[k],o])}}else{if(p=="exp"||p=="exponential"){n=d(r,q);for(var k=0;k<r.length;k++){o=n[1]*Math.pow(n[0],r[k]);m.push([r[k],o])}}}return{data:m,slope:n[0],intercept:n[1]}}})(jQuery);
|
1 |
+
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
2 |
+
jsDate | (c) 2010-2013 Chris Leonello
|
3 |
*/(function(f){f.jqplot.Trendline=function(){this.show=f.jqplot.config.enablePlugins;this.color="#666666";this.renderer=new f.jqplot.LineRenderer();this.rendererOptions={marker:{show:false}};this.label="";this.type="linear";this.shadow=true;this.markerRenderer={show:false};this.lineWidth=1.5;this.shadowAngle=45;this.shadowOffset=1;this.shadowAlpha=0.07;this.shadowDepth=3;this.isTrendline=true};f.jqplot.postSeriesInitHooks.push(e);f.jqplot.postDrawSeriesHooks.push(g);f.jqplot.addLegendRowHooks.push(a);function a(k){var j=null;if(k.trendline&&k.trendline.show){var i=k.trendline.label.toString();if(i){j={label:i,color:k.trendline.color}}}return j}function e(m,k,j,i,l){if(this._type&&(this._type==="line"||this._type=="bar")){this.trendline=new f.jqplot.Trendline();i=i||{};f.extend(true,this.trendline,{color:this.color},j.trendline,i.trendline);this.trendline.renderer.init.call(this.trendline,null)}}function g(m,i){i=f.extend(true,{},this.trendline,i);if(this.trendline&&i.show){var k;var l=i.data||this.data;k=c(l,this.trendline.type);var j=i.gridData||this.renderer.makeGridData.call(this,k.data);this.trendline.renderer.draw.call(this.trendline,m,j,{showLine:true,shadow:this.trendline.shadow})}}function b(w,v,n){var u=(n==null)?"linear":n;var s=w.length;var t;var z;var o=0;var m=0;var r=0;var q=0;var l=0;var j=[];var k=[];if(u=="linear"){k=w;j=v}else{if(u=="exp"||u=="exponential"){for(var p=0;p<v.length;p++){if(v[p]<=0){s--}else{k.push(w[p]);j.push(Math.log(v[p]))}}}}for(var p=0;p<s;p++){o=o+k[p];m=m+j[p];q=q+k[p]*j[p];r=r+k[p]*k[p];l=l+j[p]*j[p]}t=(s*q-o*m)/(s*r-o*o);z=(m-t*o)/s;return[t,z]}function h(k,j){var i;i=b(k,j,"linear");return[i[0],i[1]]}function d(o,m){var k;var i=o;var n=m;k=b(i,n,"exp");var l=Math.exp(k[0]);var j=Math.exp(k[1]);return[l,j]}function c(l,j){var p=(j==null)?"linear":j;var n;var o;var r=[];var q=[];var m=[];for(k=0;k<l.length;k++){if(l[k]!=null&&l[k][0]!=null&&l[k][1]!=null){r.push(l[k][0]);q.push(l[k][1])}}if(p=="linear"){n=h(r,q);for(var k=0;k<r.length;k++){o=n[0]*r[k]+n[1];m.push([r[k],o])}}else{if(p=="exp"||p=="exponential"){n=d(r,q);for(var k=0;k<r.length;k++){o=n[1]*Math.pow(n[0],r[k]);m.push([r[k],o])}}}return{data:m,slope:n[0],intercept:n[1]}}})(jQuery);
|
js/jqplot/usage.txt
CHANGED
File without changes
|
js/jqplot/wp-piwik.jqplot.js
CHANGED
File without changes
|
js/sparkline/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
// Nothing to see...
|
1 |
+
<?php
|
2 |
// Nothing to see...
|
js/sparkline/jquery.sparkline.js
CHANGED
File without changes
|
js/sparkline/jquery.sparkline.min.js
CHANGED
File without changes
|
js/wp-piwik.js
CHANGED
File without changes
|
languages/.htaccess
CHANGED
File without changes
|
languages/.tx/config
CHANGED
File without changes
|
languages/update.sh
CHANGED
File without changes
|
languages/wp-piwik-az_AZ.mo
CHANGED
File without changes
|
languages/wp-piwik-az_AZ.po
CHANGED
File without changes
|
languages/wp-piwik-be_BY.mo
CHANGED
File without changes
|
languages/wp-piwik-be_BY.po
CHANGED
File without changes
|
languages/wp-piwik-cs_CZ.mo
CHANGED
File without changes
|
languages/wp-piwik-cs_CZ.po
CHANGED
File without changes
|
languages/wp-piwik-de_CH.mo
CHANGED
File without changes
|
languages/wp-piwik-de_CH.po
CHANGED
File without changes
|
languages/wp-piwik-de_DE.mo
CHANGED
File without changes
|
languages/wp-piwik-de_DE.po
CHANGED
File without changes
|
languages/wp-piwik-el.mo
CHANGED
File without changes
|
languages/wp-piwik-el.po
CHANGED
File without changes
|
languages/wp-piwik-el_GR.mo
CHANGED
File without changes
|
languages/wp-piwik-el_GR.po
CHANGED
File without changes
|
languages/wp-piwik-es_ES.mo
CHANGED
File without changes
|
languages/wp-piwik-es_ES.po
CHANGED
File without changes
|
languages/wp-piwik-fa_IR.mo
CHANGED
File without changes
|
languages/wp-piwik-fa_IR.po
CHANGED
File without changes
|
languages/wp-piwik-fr_FR.mo
CHANGED
File without changes
|
languages/wp-piwik-fr_FR.po
CHANGED
File without changes
|
languages/wp-piwik-hi.mo
CHANGED
File without changes
|
languages/wp-piwik-hi.po
CHANGED
File without changes
|
languages/wp-piwik-hu_HU.mo
CHANGED
File without changes
|
languages/wp-piwik-hu_HU.po
CHANGED
File without changes
|
languages/wp-piwik-id.mo
CHANGED
File without changes
|
languages/wp-piwik-id.po
CHANGED
File without changes
|
languages/wp-piwik-it_IT.mo
CHANGED
File without changes
|
languages/wp-piwik-it_IT.po
CHANGED
File without changes
|
languages/wp-piwik-lb.mo
CHANGED
File without changes
|
languages/wp-piwik-lb.po
CHANGED
File without changes
|
languages/wp-piwik-lt_LT.mo
CHANGED
File without changes
|
languages/wp-piwik-lt_LT.po
CHANGED
File without changes
|
languages/wp-piwik-nb_NO.mo
CHANGED
File without changes
|
languages/wp-piwik-nb_NO.po
CHANGED
File without changes
|
languages/wp-piwik-nl_NL.mo
CHANGED
File without changes
|
languages/wp-piwik-nl_NL.po
CHANGED
File without changes
|
languages/wp-piwik-pl_PL.mo
CHANGED
File without changes
|
languages/wp-piwik-pl_PL.po
CHANGED
File without changes
|
languages/wp-piwik-pt_BR.mo
CHANGED
File without changes
|
languages/wp-piwik-pt_BR.po
CHANGED
File without changes
|
languages/wp-piwik-ro_RO.mo
CHANGED
File without changes
|
languages/wp-piwik-ro_RO.po
CHANGED
File without changes
|
languages/wp-piwik-ru_RU.mo
CHANGED
File without changes
|
languages/wp-piwik-ru_RU.po
CHANGED
File without changes
|
languages/wp-piwik-sl_SI.mo
CHANGED
File without changes
|
languages/wp-piwik-sl_SI.po
CHANGED
File without changes
|
languages/wp-piwik-sq.mo
CHANGED
File without changes
|
languages/wp-piwik-sq.po
CHANGED
File without changes
|
languages/wp-piwik-sv_SE.mo
CHANGED
File without changes
|
languages/wp-piwik-sv_SE.po
CHANGED
File without changes
|
languages/wp-piwik-tr_TR.mo
CHANGED
File without changes
|
languages/wp-piwik-tr_TR.po
CHANGED
File without changes
|
languages/wp-piwik-ua_UA.mo
CHANGED
File without changes
|
languages/wp-piwik-ua_UA.po
CHANGED
File without changes
|
languages/wp-piwik-uk_UA.mo
CHANGED
File without changes
|
languages/wp-piwik-uk_UA.po
CHANGED
File without changes
|
languages/wp-piwik-zh_CN.mo
CHANGED
File without changes
|
languages/wp-piwik-zh_CN.po
CHANGED
File without changes
|
languages/wp-piwik.pot
CHANGED
File without changes
|
logs/.htaccess
CHANGED
File without changes
|
proxy/config.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
$wpRootDir = isset($wpRootDir)?$wpRootDir:'../../../../';
|
3 |
-
require ($wpRootDir.'wp-load.php');
|
4 |
-
|
5 |
-
require_once ('../classes/WP_Piwik/Settings.php');
|
6 |
-
require_once ('../classes/WP_Piwik/Logger.php');
|
7 |
-
require_once ('../classes/WP_Piwik/Logger/Dummy.php');
|
8 |
-
|
9 |
-
$logger = new WP_Piwik\Logger\Dummy ( __CLASS__ );
|
10 |
-
$settings = new WP_Piwik\Settings ( $logger );
|
11 |
-
|
12 |
-
$protocol = (isset ( $_SERVER ['HTTPS'] ) && $_SERVER ['HTTPS'] != 'off') ? 'https' : 'http';
|
13 |
-
|
14 |
-
switch ($settings->getGlobalOption ( 'piwik_mode' )) {
|
15 |
-
case 'php' :
|
16 |
-
$PIWIK_URL = $protocol . ':' . $settings->getGlobalOption ( 'proxy_url' );
|
17 |
-
break;
|
18 |
-
case 'cloud' :
|
19 |
-
$PIWIK_URL = 'https://' . $settings->getGlobalOption ( 'piwik_user' ) . '.innocraft.cloud/';
|
20 |
-
break;
|
21 |
-
case 'cloud-matomo' :
|
22 |
-
$PIWIK_URL = 'https://' . $settings->getGlobalOption ( 'matomo_user' ) . '.matomo.cloud/';
|
23 |
-
break;
|
24 |
-
default :
|
25 |
-
$PIWIK_URL = $settings->getGlobalOption ( 'piwik_url' );
|
26 |
-
}
|
27 |
-
|
28 |
-
if (substr ( $PIWIK_URL, 0, 2 ) == '//')
|
29 |
-
$PIWIK_URL = (isset ( $_SERVER ['HTTPS'] ) ? 'https:' : 'http:') . $PIWIK_URL;
|
30 |
-
|
31 |
-
$TOKEN_AUTH = $settings->getGlobalOption ( 'piwik_token' );
|
32 |
-
$timeout = $settings->getGlobalOption ( 'connection_timeout' );
|
33 |
-
$useCurl = (
|
34 |
-
(function_exists('curl_init') && ini_get('allow_url_fopen') && $settings->getGlobalOption('http_connection') == 'curl') || (function_exists('curl_init') && !ini_get('allow_url_fopen'))
|
35 |
-
);
|
36 |
-
|
37 |
-
$settings->getGlobalOption ( 'http_connection' );
|
38 |
-
|
39 |
ini_set ( 'display_errors', 0 );
|
1 |
+
<?php
|
2 |
+
$wpRootDir = isset($wpRootDir)?$wpRootDir:'../../../../';
|
3 |
+
require ($wpRootDir.'wp-load.php');
|
4 |
+
|
5 |
+
require_once ('../classes/WP_Piwik/Settings.php');
|
6 |
+
require_once ('../classes/WP_Piwik/Logger.php');
|
7 |
+
require_once ('../classes/WP_Piwik/Logger/Dummy.php');
|
8 |
+
|
9 |
+
$logger = new WP_Piwik\Logger\Dummy ( __CLASS__ );
|
10 |
+
$settings = new WP_Piwik\Settings ( $logger );
|
11 |
+
|
12 |
+
$protocol = (isset ( $_SERVER ['HTTPS'] ) && $_SERVER ['HTTPS'] != 'off') ? 'https' : 'http';
|
13 |
+
|
14 |
+
switch ($settings->getGlobalOption ( 'piwik_mode' )) {
|
15 |
+
case 'php' :
|
16 |
+
$PIWIK_URL = $protocol . ':' . $settings->getGlobalOption ( 'proxy_url' );
|
17 |
+
break;
|
18 |
+
case 'cloud' :
|
19 |
+
$PIWIK_URL = 'https://' . $settings->getGlobalOption ( 'piwik_user' ) . '.innocraft.cloud/';
|
20 |
+
break;
|
21 |
+
case 'cloud-matomo' :
|
22 |
+
$PIWIK_URL = 'https://' . $settings->getGlobalOption ( 'matomo_user' ) . '.matomo.cloud/';
|
23 |
+
break;
|
24 |
+
default :
|
25 |
+
$PIWIK_URL = $settings->getGlobalOption ( 'piwik_url' );
|
26 |
+
}
|
27 |
+
|
28 |
+
if (substr ( $PIWIK_URL, 0, 2 ) == '//')
|
29 |
+
$PIWIK_URL = (isset ( $_SERVER ['HTTPS'] ) ? 'https:' : 'http:') . $PIWIK_URL;
|
30 |
+
|
31 |
+
$TOKEN_AUTH = $settings->getGlobalOption ( 'piwik_token' );
|
32 |
+
$timeout = $settings->getGlobalOption ( 'connection_timeout' );
|
33 |
+
$useCurl = (
|
34 |
+
(function_exists('curl_init') && ini_get('allow_url_fopen') && $settings->getGlobalOption('http_connection') == 'curl') || (function_exists('curl_init') && !ini_get('allow_url_fopen'))
|
35 |
+
);
|
36 |
+
|
37 |
+
$settings->getGlobalOption ( 'http_connection' );
|
38 |
+
|
39 |
ini_set ( 'display_errors', 0 );
|
proxy/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
// Nothing to see...
|
1 |
+
<?php
|
2 |
// Nothing to see...
|
proxy/matomo.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Piwik - free/libre analytics platform
|
4 |
+
* Piwik Proxy Hide URL
|
5 |
+
*
|
6 |
+
* @link http://piwik.org/faq/how-to/#faq_132
|
7 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
8 |
+
*/
|
9 |
+
if (file_exists('config.php')) {
|
10 |
+
if (file_exists('config.local.php')) {
|
11 |
+
include 'config.local.php';
|
12 |
+
}
|
13 |
+
include 'config.php';
|
14 |
+
}
|
15 |
+
// -----
|
16 |
+
// Important: read the instructions in README.md or at:
|
17 |
+
// https://github.com/piwik/piwik/tree/master/misc/proxy-hide-piwik-url#piwik-proxy-hide-url
|
18 |
+
// -----
|
19 |
+
// Edit the line below, and replace http://your-piwik-domain.example.org/piwik/
|
20 |
+
// with your Piwik URL ending with a slash.
|
21 |
+
// This URL will never be revealed to visitors or search engines.
|
22 |
+
if (! isset($PIWIK_URL)) {
|
23 |
+
$PIWIK_URL = 'http://your-piwik-domain.example.org/piwik/';
|
24 |
+
}
|
25 |
+
// Edit the line below, and replace xyz by the token_auth for the user "UserTrackingAPI"
|
26 |
+
// which you created when you followed instructions above.
|
27 |
+
if (! isset($TOKEN_AUTH)) {
|
28 |
+
$TOKEN_AUTH = 'xyz';
|
29 |
+
}
|
30 |
+
// Maximum time, in seconds, to wait for the Piwik server to return the 1*1 GIF
|
31 |
+
if (! isset($timeout)) {
|
32 |
+
$timeout = 5;
|
33 |
+
}
|
34 |
+
function sendHeader($header, $replace = true)
|
35 |
+
{
|
36 |
+
headers_sent() || header($header, $replace);
|
37 |
+
}
|
38 |
+
function arrayValue($array, $key, $value = null)
|
39 |
+
{
|
40 |
+
if (!empty($array[$key])) {
|
41 |
+
$value = $array[$key];
|
42 |
+
}
|
43 |
+
return $value;
|
44 |
+
}
|
45 |
+
function getContents($useCurl, $url, $options = false)
|
46 |
+
{
|
47 |
+
if (!$useCurl && ini_get('allow_url_fopen')) {
|
48 |
+
$ctx = ($options?stream_context_create($options):NULL);
|
49 |
+
return file_get_contents($url, 0, $ctx);
|
50 |
+
} elseif ($useCurl && function_exists('curl_version'))
|
51 |
+
return piwikFileGetContentsCurl($url, $options);
|
52 |
+
else return 'Neither url_fopen nor cURL is available. Please enable at least one of them.';
|
53 |
+
}
|
54 |
+
function piwikFileGetContentsCurl($url, $options)
|
55 |
+
{
|
56 |
+
$ch = curl_init();
|
57 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
58 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
59 |
+
curl_setopt($ch, CURLOPT_USERAGENT, $options['http']['user_agent']);
|
60 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array($options['http']['header']));
|
61 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, $options['http']['timeout']);
|
62 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
63 |
+
$data = curl_exec($ch);
|
64 |
+
curl_close($ch);
|
65 |
+
return $data;
|
66 |
+
}
|
67 |
+
// DO NOT MODIFY BELOW
|
68 |
+
// ---------------------------
|
69 |
+
// 1) PIWIK.JS PROXY: No _GET parameter, we serve the JS file
|
70 |
+
if (empty($_GET)) {
|
71 |
+
$modifiedSince = false;
|
72 |
+
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
73 |
+
$modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
74 |
+
// strip any trailing data appended to header
|
75 |
+
if (false !== ($semicolon = strpos($modifiedSince, ';'))) {
|
76 |
+
$modifiedSince = substr($modifiedSince, 0, $semicolon);
|
77 |
+
}
|
78 |
+
$modifiedSince = strtotime($modifiedSince);
|
79 |
+
}
|
80 |
+
// Re-download the piwik.js once a day maximum
|
81 |
+
$lastModified = time() - 86400;
|
82 |
+
// set HTTP response headers
|
83 |
+
sendHeader('Vary: Accept-Encoding');
|
84 |
+
// Returns 304 if not modified since
|
85 |
+
if (!empty($modifiedSince) && $modifiedSince > $lastModified) {
|
86 |
+
sendHeader(sprintf("%s 304 Not Modified", $_SERVER['SERVER_PROTOCOL']));
|
87 |
+
} else {
|
88 |
+
sendHeader('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
89 |
+
sendHeader('Content-Type: application/javascript; charset=UTF-8');
|
90 |
+
if ($piwikJs = getContents($useCurl, $PIWIK_URL . 'piwik.js')) {
|
91 |
+
echo $piwikJs;
|
92 |
+
} else {
|
93 |
+
sendHeader($_SERVER['SERVER_PROTOCOL'] . '505 Internal server error');
|
94 |
+
}
|
95 |
+
}
|
96 |
+
exit;
|
97 |
+
}
|
98 |
+
@ini_set('magic_quotes_runtime', 0);
|
99 |
+
// 2) PIWIK.PHP PROXY: GET parameters found, this is a tracking request, we redirect it to Piwik
|
100 |
+
$url = sprintf("%spiwik.php?cip=%s&token_auth=%s&", $PIWIK_URL, getVisitIp(), $TOKEN_AUTH);
|
101 |
+
foreach ($_GET as $key => $value) {
|
102 |
+
$url .= urlencode($key ). '=' . urlencode($value) . '&';
|
103 |
+
}
|
104 |
+
sendHeader("Content-Type: image/gif");
|
105 |
+
$stream_options = array('http' => array(
|
106 |
+
'user_agent' => arrayValue($_SERVER, 'HTTP_USER_AGENT', ''),
|
107 |
+
'header' => sprintf("Accept-Language: %s\r\n", str_replace(array("\n", "\t", "\r"), "", arrayValue($_SERVER, 'HTTP_ACCEPT_LANGUAGE', ''))),
|
108 |
+
'timeout' => $timeout
|
109 |
+
));
|
110 |
+
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
111 |
+
// PHP 5.2 breaks with the new 204 status code so we force returning the image every time
|
112 |
+
echo getContents($useCurl, $url . '&send_image=1', $stream_options);
|
113 |
+
} else {
|
114 |
+
// PHP 5.3 and above
|
115 |
+
$content = getContents($useCurl, $url, $stream_options);
|
116 |
+
// Forward the HTTP response code
|
117 |
+
if (!headers_sent() && isset($http_response_header[0])) {
|
118 |
+
header($http_response_header[0]);
|
119 |
+
}
|
120 |
+
echo $content;
|
121 |
+
}
|
122 |
+
function getVisitIp()
|
123 |
+
{
|
124 |
+
$matchIp = '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/';
|
125 |
+
$ipKeys = array(
|
126 |
+
'HTTP_X_FORWARDED_FOR',
|
127 |
+
'HTTP_CLIENT_IP',
|
128 |
+
'HTTP_CF_CONNECTING_IP',
|
129 |
+
);
|
130 |
+
foreach($ipKeys as $ipKey) {
|
131 |
+
if (isset($_SERVER[$ipKey])
|
132 |
+
&& preg_match($matchIp, $_SERVER[$ipKey])) {
|
133 |
+
return $_SERVER[$ipKey];
|
134 |
+
}
|
135 |
+
}
|
136 |
+
return arrayValue($_SERVER, 'REMOTE_ADDR');
|
137 |
+
}
|
proxy/piwik.php
CHANGED
@@ -1,137 +1,2 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Piwik - free/libre analytics platform
|
4 |
-
* Piwik Proxy Hide URL
|
5 |
-
*
|
6 |
-
* @link http://piwik.org/faq/how-to/#faq_132
|
7 |
-
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
8 |
-
*/
|
9 |
-
if (file_exists('config.php')) {
|
10 |
-
if (file_exists('config.local.php')) {
|
11 |
-
include 'config.local.php';
|
12 |
-
}
|
13 |
-
include 'config.php';
|
14 |
-
}
|
15 |
-
// -----
|
16 |
-
// Important: read the instructions in README.md or at:
|
17 |
-
// https://github.com/piwik/piwik/tree/master/misc/proxy-hide-piwik-url#piwik-proxy-hide-url
|
18 |
-
// -----
|
19 |
-
// Edit the line below, and replace http://your-piwik-domain.example.org/piwik/
|
20 |
-
// with your Piwik URL ending with a slash.
|
21 |
-
// This URL will never be revealed to visitors or search engines.
|
22 |
-
if (! isset($PIWIK_URL)) {
|
23 |
-
$PIWIK_URL = 'http://your-piwik-domain.example.org/piwik/';
|
24 |
-
}
|
25 |
-
// Edit the line below, and replace xyz by the token_auth for the user "UserTrackingAPI"
|
26 |
-
// which you created when you followed instructions above.
|
27 |
-
if (! isset($TOKEN_AUTH)) {
|
28 |
-
$TOKEN_AUTH = 'xyz';
|
29 |
-
}
|
30 |
-
// Maximum time, in seconds, to wait for the Piwik server to return the 1*1 GIF
|
31 |
-
if (! isset($timeout)) {
|
32 |
-
$timeout = 5;
|
33 |
-
}
|
34 |
-
function sendHeader($header, $replace = true)
|
35 |
-
{
|
36 |
-
headers_sent() || header($header, $replace);
|
37 |
-
}
|
38 |
-
function arrayValue($array, $key, $value = null)
|
39 |
-
{
|
40 |
-
if (!empty($array[$key])) {
|
41 |
-
$value = $array[$key];
|
42 |
-
}
|
43 |
-
return $value;
|
44 |
-
}
|
45 |
-
function getContents($useCurl, $url, $options = false)
|
46 |
-
{
|
47 |
-
if (!$useCurl && ini_get('allow_url_fopen')) {
|
48 |
-
$ctx = ($options?stream_context_create($options):NULL);
|
49 |
-
return file_get_contents($url, 0, $ctx);
|
50 |
-
} elseif ($useCurl && function_exists('curl_version'))
|
51 |
-
return piwikFileGetContentsCurl($url, $options);
|
52 |
-
else return 'Neither url_fopen nor cURL is available. Please enable at least one of them.';
|
53 |
-
}
|
54 |
-
function piwikFileGetContentsCurl($url, $options)
|
55 |
-
{
|
56 |
-
$ch = curl_init();
|
57 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
58 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
59 |
-
curl_setopt($ch, CURLOPT_USERAGENT, $options['http']['user_agent']);
|
60 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array($options['http']['header']));
|
61 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, $options['http']['timeout']);
|
62 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
63 |
-
$data = curl_exec($ch);
|
64 |
-
curl_close($ch);
|
65 |
-
return $data;
|
66 |
-
}
|
67 |
-
// DO NOT MODIFY BELOW
|
68 |
-
// ---------------------------
|
69 |
-
// 1) PIWIK.JS PROXY: No _GET parameter, we serve the JS file
|
70 |
-
if (empty($_GET)) {
|
71 |
-
$modifiedSince = false;
|
72 |
-
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
73 |
-
$modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
74 |
-
// strip any trailing data appended to header
|
75 |
-
if (false !== ($semicolon = strpos($modifiedSince, ';'))) {
|
76 |
-
$modifiedSince = substr($modifiedSince, 0, $semicolon);
|
77 |
-
}
|
78 |
-
$modifiedSince = strtotime($modifiedSince);
|
79 |
-
}
|
80 |
-
// Re-download the piwik.js once a day maximum
|
81 |
-
$lastModified = time() - 86400;
|
82 |
-
// set HTTP response headers
|
83 |
-
sendHeader('Vary: Accept-Encoding');
|
84 |
-
// Returns 304 if not modified since
|
85 |
-
if (!empty($modifiedSince) && $modifiedSince > $lastModified) {
|
86 |
-
sendHeader(sprintf("%s 304 Not Modified", $_SERVER['SERVER_PROTOCOL']));
|
87 |
-
} else {
|
88 |
-
sendHeader('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
89 |
-
sendHeader('Content-Type: application/javascript; charset=UTF-8');
|
90 |
-
if ($piwikJs = getContents($useCurl, $PIWIK_URL . 'piwik.js')) {
|
91 |
-
echo $piwikJs;
|
92 |
-
} else {
|
93 |
-
sendHeader($_SERVER['SERVER_PROTOCOL'] . '505 Internal server error');
|
94 |
-
}
|
95 |
-
}
|
96 |
-
exit;
|
97 |
-
}
|
98 |
-
@ini_set('magic_quotes_runtime', 0);
|
99 |
-
// 2) PIWIK.PHP PROXY: GET parameters found, this is a tracking request, we redirect it to Piwik
|
100 |
-
$url = sprintf("%spiwik.php?cip=%s&token_auth=%s&", $PIWIK_URL, getVisitIp(), $TOKEN_AUTH);
|
101 |
-
foreach ($_GET as $key => $value) {
|
102 |
-
$url .= urlencode($key ). '=' . urlencode($value) . '&';
|
103 |
-
}
|
104 |
-
sendHeader("Content-Type: image/gif");
|
105 |
-
$stream_options = array('http' => array(
|
106 |
-
'user_agent' => arrayValue($_SERVER, 'HTTP_USER_AGENT', ''),
|
107 |
-
'header' => sprintf("Accept-Language: %s\r\n", str_replace(array("\n", "\t", "\r"), "", arrayValue($_SERVER, 'HTTP_ACCEPT_LANGUAGE', ''))),
|
108 |
-
'timeout' => $timeout
|
109 |
-
));
|
110 |
-
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
111 |
-
// PHP 5.2 breaks with the new 204 status code so we force returning the image every time
|
112 |
-
echo getContents($useCurl, $url . '&send_image=1', $stream_options);
|
113 |
-
} else {
|
114 |
-
// PHP 5.3 and above
|
115 |
-
$content = getContents($useCurl, $url, $stream_options);
|
116 |
-
// Forward the HTTP response code
|
117 |
-
if (!headers_sent() && isset($http_response_header[0])) {
|
118 |
-
header($http_response_header[0]);
|
119 |
-
}
|
120 |
-
echo $content;
|
121 |
-
}
|
122 |
-
function getVisitIp()
|
123 |
-
{
|
124 |
-
$matchIp = '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/';
|
125 |
-
$ipKeys = array(
|
126 |
-
'HTTP_X_FORWARDED_FOR',
|
127 |
-
'HTTP_CLIENT_IP',
|
128 |
-
'HTTP_CF_CONNECTING_IP',
|
129 |
-
);
|
130 |
-
foreach($ipKeys as $ipKey) {
|
131 |
-
if (isset($_SERVER[$ipKey])
|
132 |
-
&& preg_match($matchIp, $_SERVER[$ipKey])) {
|
133 |
-
return $_SERVER[$ipKey];
|
134 |
-
}
|
135 |
-
}
|
136 |
-
return arrayValue($_SERVER, 'REMOTE_ADDR');
|
137 |
-
}
|
1 |
<?php
|
2 |
+
require_once('matomo.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
Contributors: Braekling
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 1.0.
|
7 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
|
8 |
Tags: matomo, tracking, statistics, stats, analytics
|
9 |
|
@@ -48,7 +48,7 @@ is equal to *[wp-piwik module="overview" title="" period="day" date="yesterday"]
|
|
48 |
|
49 |
* 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).
|
50 |
* All translators at Transifex and WordPress.
|
51 |
-
* 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., Oleg I., M. N., Daniel K., James L., Jochen K., Cyril P., Thomas K., Patrik K., Zach, Sebastian W., Peakkom, Patrik K., Kati K., Helmut O., Valerie S., Jochen D., Atlas R., Harald W., Jan M., Addy K., Hans-Georg E.-B., Yvonne K., Andrew D., Nicolas
|
52 |
* All users who send me mails containing criticism, commendation, feature requests and bug reports - you help me to make WP-Matomo much better!
|
53 |
|
54 |
Thank you all!
|
@@ -141,6 +141,14 @@ Add WP-Matomo to your /wp-content/plugins folder and enable it as [Network Plugi
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
= 1.0.20 =
|
145 |
* Support for new Innocraft cloud URL (*.matomo.cloud)
|
146 |
* Changed naming from Piwik to Matomo
|
2 |
|
3 |
Contributors: Braekling
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 5.2.2
|
6 |
+
Stable tag: 1.0.22
|
7 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
|
8 |
Tags: matomo, tracking, statistics, stats, analytics
|
9 |
|
48 |
|
49 |
* 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).
|
50 |
* All translators at Transifex and WordPress.
|
51 |
+
* 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., Oleg I., M. N., Daniel K., James L., Jochen K., Cyril P., Thomas K., Patrik K., Zach, Sebastian W., Peakkom, Patrik K., Kati K., Helmut O., Valerie S., Jochen D., Atlas R., Harald W., Jan M., Addy K., Hans-Georg E.-B., Yvonne K., Andrew D., Nicolas J., Andre M., Steve J., Jakub P., ditho.berlin, Robert R., Simon B., Grzegorz O., Bjarne O., the Matomo team itself, and all people flattering this.
|
52 |
* All users who send me mails containing criticism, commendation, feature requests and bug reports - you help me to make WP-Matomo much better!
|
53 |
|
54 |
Thank you all!
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
+
= 1.0.22 =
|
145 |
+
* Bugfix: Innocraft cloud URL *.matomo.cloud will work
|
146 |
+
* Option to configure filter_limit parameter (see expert settings)
|
147 |
+
* Replaced piwik.php proxy script by matomo.php proxy script
|
148 |
+
|
149 |
+
= 1.0.21 =
|
150 |
+
* Bugfix: Get HTTP mode working again
|
151 |
+
|
152 |
= 1.0.20 =
|
153 |
* Support for new Innocraft cloud URL (*.matomo.cloud)
|
154 |
* Changed naming from Piwik to Matomo
|
screenshot-1.gif
CHANGED
File without changes
|
screenshot-2.gif
CHANGED
File without changes
|
screenshot-3.gif
CHANGED
File without changes
|
screenshot-4.gif
CHANGED
File without changes
|
screenshot-5.gif
CHANGED
File without changes
|
uninstall.php
CHANGED
File without changes
|
update/.htaccess
CHANGED
File without changes
|
update/2015051101.php
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Get & delete old version's options
|
4 |
-
if (self::$settings->checkNetworkActivation ()) {
|
5 |
-
$oldGlobalOptions = get_site_option ( 'wp-piwik_global-settings', array () );
|
6 |
-
delete_site_option('wp-piwik_global-settings');
|
7 |
-
} else {
|
8 |
-
$oldGlobalOptions = get_option ( 'wp-piwik_global-settings', array () );
|
9 |
-
delete_option('wp-piwik_global-settings');
|
10 |
-
}
|
11 |
-
|
12 |
-
$oldOptions = get_option ( 'wp-piwik_settings', array () );
|
13 |
-
delete_option('wp-piwik_settings');
|
14 |
-
|
15 |
-
if (self::$settings->checkNetworkActivation ()) {
|
16 |
-
global $wpdb;
|
17 |
-
$aryBlogs = \WP_Piwik\Settings::getBlogList();
|
18 |
-
if (is_array($aryBlogs))
|
19 |
-
foreach ($aryBlogs as $aryBlog) {
|
20 |
-
$oldOptions = get_blog_option ( $aryBlog['blog_id'], 'wp-piwik_settings', array () );
|
21 |
-
if (!$this->isConfigured())
|
22 |
-
foreach ( $oldOptions as $key => $value )
|
23 |
-
self::$settings->setOption ( $key, $value, $aryBlog['blog_id'] );
|
24 |
-
delete_blog_option($aryBlog['blog_id'], 'wp-piwik_settings');
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
if (!$this->isConfigured()) {
|
29 |
-
if (!$oldGlobalOptions['add_tracking_code']) $oldGlobalOptions['track_mode'] = 'disabled';
|
30 |
-
elseif (!$oldGlobalOptions['track_mode']) $oldGlobalOptions['track_mode'] = 'default';
|
31 |
-
elseif ($oldGlobalOptions['track_mode'] == 1) $oldGlobalOptions['track_mode'] = 'js';
|
32 |
-
elseif ($oldGlobalOptions['track_mode'] == 2) $oldGlobalOptions['track_mode'] = 'proxy';
|
33 |
-
|
34 |
-
// Store old values in new settings
|
35 |
-
foreach ( $oldGlobalOptions as $key => $value )
|
36 |
-
self::$settings->setGlobalOption ( $key, $value );
|
37 |
-
foreach ( $oldOptions as $key => $value )
|
38 |
-
self::$settings->setOption ( $key, $value );
|
39 |
-
}
|
40 |
-
|
41 |
self::$settings->save ();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Get & delete old version's options
|
4 |
+
if (self::$settings->checkNetworkActivation ()) {
|
5 |
+
$oldGlobalOptions = get_site_option ( 'wp-piwik_global-settings', array () );
|
6 |
+
delete_site_option('wp-piwik_global-settings');
|
7 |
+
} else {
|
8 |
+
$oldGlobalOptions = get_option ( 'wp-piwik_global-settings', array () );
|
9 |
+
delete_option('wp-piwik_global-settings');
|
10 |
+
}
|
11 |
+
|
12 |
+
$oldOptions = get_option ( 'wp-piwik_settings', array () );
|
13 |
+
delete_option('wp-piwik_settings');
|
14 |
+
|
15 |
+
if (self::$settings->checkNetworkActivation ()) {
|
16 |
+
global $wpdb;
|
17 |
+
$aryBlogs = \WP_Piwik\Settings::getBlogList();
|
18 |
+
if (is_array($aryBlogs))
|
19 |
+
foreach ($aryBlogs as $aryBlog) {
|
20 |
+
$oldOptions = get_blog_option ( $aryBlog['blog_id'], 'wp-piwik_settings', array () );
|
21 |
+
if (!$this->isConfigured())
|
22 |
+
foreach ( $oldOptions as $key => $value )
|
23 |
+
self::$settings->setOption ( $key, $value, $aryBlog['blog_id'] );
|
24 |
+
delete_blog_option($aryBlog['blog_id'], 'wp-piwik_settings');
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
if (!$this->isConfigured()) {
|
29 |
+
if (!$oldGlobalOptions['add_tracking_code']) $oldGlobalOptions['track_mode'] = 'disabled';
|
30 |
+
elseif (!$oldGlobalOptions['track_mode']) $oldGlobalOptions['track_mode'] = 'default';
|
31 |
+
elseif ($oldGlobalOptions['track_mode'] == 1) $oldGlobalOptions['track_mode'] = 'js';
|
32 |
+
elseif ($oldGlobalOptions['track_mode'] == 2) $oldGlobalOptions['track_mode'] = 'proxy';
|
33 |
+
|
34 |
+
// Store old values in new settings
|
35 |
+
foreach ( $oldGlobalOptions as $key => $value )
|
36 |
+
self::$settings->setGlobalOption ( $key, $value );
|
37 |
+
foreach ( $oldOptions as $key => $value )
|
38 |
+
self::$settings->setOption ( $key, $value );
|
39 |
+
}
|
40 |
+
|
41 |
self::$settings->save ();
|
update/2017080701.php
CHANGED
File without changes
|
update/90001.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
$aryWPMUConfig = get_site_option ( 'wpmu-piwik_global-settings', false );
|
3 |
-
if (self::$settings->checkNetworkActivation () && $aryWPMUConfig) {
|
4 |
-
foreach ( $aryWPMUConfig as $key => $value )
|
5 |
-
self::$settings->setGlobalOption ( $key, $value );
|
6 |
-
delete_site_option ( 'wpmu-piwik_global-settings' );
|
7 |
-
self::$settings->setGlobalOption ( 'auto_site_config', true );
|
8 |
-
} else
|
9 |
self::$settings->setGlobalOption ( 'auto_site_config', false );
|
1 |
+
<?php
|
2 |
+
$aryWPMUConfig = get_site_option ( 'wpmu-piwik_global-settings', false );
|
3 |
+
if (self::$settings->checkNetworkActivation () && $aryWPMUConfig) {
|
4 |
+
foreach ( $aryWPMUConfig as $key => $value )
|
5 |
+
self::$settings->setGlobalOption ( $key, $value );
|
6 |
+
delete_site_option ( 'wpmu-piwik_global-settings' );
|
7 |
+
self::$settings->setGlobalOption ( 'auto_site_config', true );
|
8 |
+
} else
|
9 |
self::$settings->setGlobalOption ( 'auto_site_config', false );
|
update/90801.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
<?php
|
2 |
-
if (self::$settings->getGlobalOption ( 'track_compress' ))
|
3 |
-
self::$settings->setGlobalOption ( 'track_mode', 1 );
|
4 |
-
else
|
5 |
self::$settings->setGlobalOption ( 'track_mode', 0 );
|
1 |
+
<?php
|
2 |
+
if (self::$settings->getGlobalOption ( 'track_compress' ))
|
3 |
+
self::$settings->setGlobalOption ( 'track_mode', 1 );
|
4 |
+
else
|
5 |
self::$settings->setGlobalOption ( 'track_mode', 0 );
|
update/91006.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
$aryRemoveOptions = array (
|
3 |
-
'wp-piwik_siteid',
|
4 |
-
'wp-piwik_404',
|
5 |
-
'wp-piwik_scriptupdate',
|
6 |
-
'wp-piwik_dashboardid',
|
7 |
-
'wp-piwik_jscode'
|
8 |
-
);
|
9 |
-
foreach ( $aryRemoveOptions as $strRemoveOption )
|
10 |
delete_option ( $strRemoveOption );
|
1 |
+
<?php
|
2 |
+
$aryRemoveOptions = array (
|
3 |
+
'wp-piwik_siteid',
|
4 |
+
'wp-piwik_404',
|
5 |
+
'wp-piwik_scriptupdate',
|
6 |
+
'wp-piwik_dashboardid',
|
7 |
+
'wp-piwik_jscode'
|
8 |
+
);
|
9 |
+
foreach ( $aryRemoveOptions as $strRemoveOption )
|
10 |
delete_option ( $strRemoveOption );
|
wp-piwik.php
CHANGED
@@ -1,83 +1,83 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: WP-Matomo
|
4 |
-
|
5 |
-
Plugin URI: http://wordpress.org/extend/plugins/wp-piwik/
|
6 |
-
|
7 |
-
Description: Adds Matomo statistics to your WordPress dashboard and is also able to add the Matomo Tracking Code to your blog.
|
8 |
-
|
9 |
-
Version: 1.0.
|
10 |
-
Author: André Bräkling
|
11 |
-
Author URI:
|
12 |
-
Text Domain: wp-piwik
|
13 |
-
Domain Path: /languages
|
14 |
-
License: GPL3
|
15 |
-
|
16 |
-
******************************************************************************************
|
17 |
-
Copyright (C) 2009-today Andre Braekling (email: webmaster@braekling.de)
|
18 |
-
|
19 |
-
This program is free software: you can redistribute it and/or modify
|
20 |
-
it under the terms of the GNU General Public License as published by
|
21 |
-
the Free Software Foundation, either version 3 of the License, or
|
22 |
-
at your option) any later version.
|
23 |
-
|
24 |
-
This program is distributed in the hope that it will be useful,
|
25 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
-
GNU General Public License for more details.
|
28 |
-
|
29 |
-
You should have received a copy of the GNU General Public License
|
30 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
31 |
-
*******************************************************************************************/
|
32 |
-
|
33 |
-
if (! function_exists ( 'add_action' )) {
|
34 |
-
header ( 'Status: 403 Forbidden' );
|
35 |
-
header ( 'HTTP/1.1 403 Forbidden' );
|
36 |
-
exit ();
|
37 |
-
}
|
38 |
-
|
39 |
-
if (! defined ( 'NAMESPACE_SEPARATOR' ))
|
40 |
-
define ( 'NAMESPACE_SEPARATOR', '\\' );
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Define WP-Piwik autoloader
|
44 |
-
*
|
45 |
-
* @param string $class
|
46 |
-
* class name
|
47 |
-
*/
|
48 |
-
function wp_piwik_autoloader($class) {
|
49 |
-
if (substr ( $class, 0, 9 ) == 'WP_Piwik' . NAMESPACE_SEPARATOR) {
|
50 |
-
$class = str_replace ( '.', '', str_replace ( NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, substr ( $class, 9 ) ) );
|
51 |
-
require_once ('classes' . DIRECTORY_SEPARATOR . 'WP_Piwik' . DIRECTORY_SEPARATOR . $class . '.php');
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Show notice about outdated PHP version
|
57 |
-
*/
|
58 |
-
function wp_piwik_phperror() {
|
59 |
-
echo '<div class="error"><p>';
|
60 |
-
printf ( __ ( 'WP-Piwik requires at least PHP 5.3. You are using the deprecated version %s. Please update PHP to use WP-Piwik.', 'wp-piwik' ), PHP_VERSION );
|
61 |
-
echo '</p></div>';
|
62 |
-
}
|
63 |
-
|
64 |
-
function wp_piwik_load_textdomain() {
|
65 |
-
load_plugin_textdomain( 'wp-piwik', false, plugin_basename( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR );
|
66 |
-
}
|
67 |
-
add_action( 'plugins_loaded', 'wp_piwik_load_textdomain' );
|
68 |
-
|
69 |
-
if (version_compare ( PHP_VERSION, '5.3.0', '<' ))
|
70 |
-
add_action ( 'admin_notices', 'wp_piwik_phperror' );
|
71 |
-
else {
|
72 |
-
define ( 'WP_PIWIK_PATH', dirname ( __FILE__ ) . DIRECTORY_SEPARATOR );
|
73 |
-
require_once (WP_PIWIK_PATH . 'config.php');
|
74 |
-
require_once (WP_PIWIK_PATH . 'classes' . DIRECTORY_SEPARATOR . 'WP_Piwik.php');
|
75 |
-
spl_autoload_register ( 'wp_piwik_autoloader' );
|
76 |
-
$GLOBALS ['wp-piwik_debug'] = false;
|
77 |
-
if (class_exists ( 'WP_Piwik' ))
|
78 |
-
add_action( 'init', 'wp_piwik_loader' );
|
79 |
-
}
|
80 |
-
|
81 |
-
function wp_piwik_loader() {
|
82 |
-
$GLOBALS ['wp-piwik'] = new WP_Piwik ();
|
83 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP-Matomo
|
4 |
+
|
5 |
+
Plugin URI: http://wordpress.org/extend/plugins/wp-piwik/
|
6 |
+
|
7 |
+
Description: Adds Matomo statistics to your WordPress dashboard and is also able to add the Matomo Tracking Code to your blog.
|
8 |
+
|
9 |
+
Version: 1.0.22
|
10 |
+
Author: André Bräkling
|
11 |
+
Author URI: https://www.braekling.de
|
12 |
+
Text Domain: wp-piwik
|
13 |
+
Domain Path: /languages
|
14 |
+
License: GPL3
|
15 |
+
|
16 |
+
******************************************************************************************
|
17 |
+
Copyright (C) 2009-today Andre Braekling (email: webmaster@braekling.de)
|
18 |
+
|
19 |
+
This program is free software: you can redistribute it and/or modify
|
20 |
+
it under the terms of the GNU General Public License as published by
|
21 |
+
the Free Software Foundation, either version 3 of the License, or
|
22 |
+
at your option) any later version.
|
23 |
+
|
24 |
+
This program is distributed in the hope that it will be useful,
|
25 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
+
GNU General Public License for more details.
|
28 |
+
|
29 |
+
You should have received a copy of the GNU General Public License
|
30 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
31 |
+
*******************************************************************************************/
|
32 |
+
|
33 |
+
if (! function_exists ( 'add_action' )) {
|
34 |
+
header ( 'Status: 403 Forbidden' );
|
35 |
+
header ( 'HTTP/1.1 403 Forbidden' );
|
36 |
+
exit ();
|
37 |
+
}
|
38 |
+
|
39 |
+
if (! defined ( 'NAMESPACE_SEPARATOR' ))
|
40 |
+
define ( 'NAMESPACE_SEPARATOR', '\\' );
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Define WP-Piwik autoloader
|
44 |
+
*
|
45 |
+
* @param string $class
|
46 |
+
* class name
|
47 |
+
*/
|
48 |
+
function wp_piwik_autoloader($class) {
|
49 |
+
if (substr ( $class, 0, 9 ) == 'WP_Piwik' . NAMESPACE_SEPARATOR) {
|
50 |
+
$class = str_replace ( '.', '', str_replace ( NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, substr ( $class, 9 ) ) );
|
51 |
+
require_once ('classes' . DIRECTORY_SEPARATOR . 'WP_Piwik' . DIRECTORY_SEPARATOR . $class . '.php');
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Show notice about outdated PHP version
|
57 |
+
*/
|
58 |
+
function wp_piwik_phperror() {
|
59 |
+
echo '<div class="error"><p>';
|
60 |
+
printf ( __ ( 'WP-Piwik requires at least PHP 5.3. You are using the deprecated version %s. Please update PHP to use WP-Piwik.', 'wp-piwik' ), PHP_VERSION );
|
61 |
+
echo '</p></div>';
|
62 |
+
}
|
63 |
+
|
64 |
+
function wp_piwik_load_textdomain() {
|
65 |
+
load_plugin_textdomain( 'wp-piwik', false, plugin_basename( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR );
|
66 |
+
}
|
67 |
+
add_action( 'plugins_loaded', 'wp_piwik_load_textdomain' );
|
68 |
+
|
69 |
+
if (version_compare ( PHP_VERSION, '5.3.0', '<' ))
|
70 |
+
add_action ( 'admin_notices', 'wp_piwik_phperror' );
|
71 |
+
else {
|
72 |
+
define ( 'WP_PIWIK_PATH', dirname ( __FILE__ ) . DIRECTORY_SEPARATOR );
|
73 |
+
require_once (WP_PIWIK_PATH . 'config.php');
|
74 |
+
require_once (WP_PIWIK_PATH . 'classes' . DIRECTORY_SEPARATOR . 'WP_Piwik.php');
|
75 |
+
spl_autoload_register ( 'wp_piwik_autoloader' );
|
76 |
+
$GLOBALS ['wp-piwik_debug'] = false;
|
77 |
+
if (class_exists ( 'WP_Piwik' ))
|
78 |
+
add_action( 'init', 'wp_piwik_loader' );
|
79 |
+
}
|
80 |
+
|
81 |
+
function wp_piwik_loader() {
|
82 |
+
$GLOBALS ['wp-piwik'] = new WP_Piwik ();
|
83 |
+
}
|
wpml-config.xml
CHANGED
File without changes
|