$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'))));
}else{
$errorMessage=\WP_Piwik\Request::getLastError();
if(empty($errorMessage))
$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()));
else
$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));
}
}else
$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()));
$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')));
$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')));
$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'));
$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);
$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);
$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());
$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());
$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);
$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,'jQuery(\'tr.wp-piwik-auto-option\').toggle(\'hidden\');'.($piwikSiteId?'jQuery(\'#site_id\').val('.$piwikSiteId.');':''));
$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));
$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);
),__('Default date shown on statistics page.','wp-piwik'));
$this->showCheckbox('stats_seo',__('Show SEO data','wp-piwik'),__('Display SEO ranking data on statistics page.','wp-piwik').' ('.__('Slow!','wp-piwik').')');
$this->showCheckbox('stats_ecommerce',__('Show e-commerce data','wp-piwik'),__('Display e-commerce data on statistics page.','wp-piwik'));
$this->showCheckbox('toolbar',__('Show graph on WordPress Toolbar','wp-piwik'),__('Display a last 30 days visitor graph on WordPress\' toolbar.','wp-piwik'));
echo'<span class="dashicons dashicons-editor-help" onclick="jQuery(\'#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>';
$this->showSelect('perpost_stats',__('Show per post stats','wp-piwik'),array(
'disabled'=>__('Disabled','wp-piwik'),
'yesterday'=>__('Yesterday','wp-piwik'),
'today'=>__('Today','wp-piwik'),
'last30'=>__('Last 30 days','wp-piwik'),
'last60'=>__('Last 60 days','wp-piwik'),
'last90'=>__('Last 90 days','wp-piwik')
),__('Show stats about single posts at the post edit admin page.','wp-piwik'));
$this->showCheckbox('piwik_shortcut',__('Matomo shortcut','wp-piwik'),__('Display a shortcut to Matomo itself.','wp-piwik'));
$this->showInput('plugin_display_name',__('WP-Matomo display name','wp-piwik'),__('Plugin name shown in WordPress.','wp-piwik'));
$this->showCheckbox('shortcodes',__('Enable shortcodes','wp-piwik'),__('Enable shortcodes in post or page content.','wp-piwik'));
$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'):''));
$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);
),__('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');
$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);
$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');
$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');
'visible'=>__('Track only visible content blocks','wp-piwik')
),__('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');
$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');
$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);
),__('Enable support for consent managers.').' '.sprintf(__('See %sMatomo documentation%s.','wp-piwik'),'<a href="https://developer.matomo.org/guides/tracking-consent" target="_BLANK">','</a>'),'',$isNotGeneratedTracking,$fullGeneratedTrackingGroup);
$this->showCheckbox('disable_cookies',__('Disable cookies','wp-piwik'),__('Disable all tracking cookies for a visitor.','wp-piwik'),$isNotGeneratedTracking,$fullGeneratedTrackingGroup);
$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,'jQuery(\'tr.wp-piwik-cookielifetime-option\').toggleClass(\'wp-piwik-hidden\');');
$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');
echo'<span class="dashicons dashicons-editor-help" onclick="jQuery(\'#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>';
$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" target="_BLANK">','</a>'),$isNotGeneratedTracking,$fullGeneratedTrackingGroup);
$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);
$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');
$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');
$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,'jQuery(\'tr.wp-piwik-feed_campaign-option\').toggle(\'hidden\');');
$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');
$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);
$this->showSelect('track_user_id',__('User ID Tracking','wp-piwik'),array(
'disabled'=>__('Disabled','wp-piwik'),
'uid'=>__('WP User ID','wp-piwik'),
'email'=>__('Email Address','wp-piwik'),
'username'=>__('Username','wp-piwik'),
'displayname'=>__('Display Name (Not Recommended!)','wp-piwik')
),__('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);
$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'));
$this->showCheckbox('cache',__('Enable cache','wp-piwik'),__('Cache API calls, which not contain today\'s values, for a week.','wp-piwik'));
),__('Choose whether WP-Matomo should use POST or GET in HTTP or Cloud mode.','wp-piwik'));
$this->showCheckbox('disable_timelimit',__('Disable time limit','wp-piwik'),__('Use set_time_limit(0) if stats page causes a time out.','wp-piwik'));
$this->showInput('filter_limit',__('Filter limit','wp-piwik'),__('Use filter_limit if you need to get more than 100 results per page.','wp-piwik'));
$this->showInput('connection_timeout',__('Connection timeout','wp-piwik'),'Define a connection timeout for all HTTP requests done by WP-Matomo in seconds.');
'php'=>__('Use the PHP default user agent','wp-piwik').(ini_get('user_agent')?'('.ini_get('user_agent').')':' ('.__('empty','wp-piwik').')'),
'own'=>__('Define a specific user agent','wp-piwik')
),'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.','jQuery(\'tr.wp-piwik-useragent-option\').toggleClass(\'hidden\');');
$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');
$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'));
$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'));
$this->showInput('track_cdnurl',__('CDN URL','wp-piwik').' http://','Enter URL if you want to load the tracking code via CDN.');
$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.');
$this->showSelect('force_protocol',__('Force Matomo to use a specific protocol','wp-piwik'),array(
'disabled'=>__('Disabled (default)','wp-piwik'),
'http'=>__('http','wp-piwik'),
'https'=>__('https (SSL)','wp-piwik')
),__('Choose if you want to explicitly force Matomo to use HTTP or HTTPS. Does not work with a CDN URL.','wp-piwik'));
$this->showCheckbox('remove_type_attribute',__('Remove type attribute','wp-piwik'),__('Removes the type attribute from Matomo\'s tracking code script tag.','wp-piwik'));
'enabled'=>__('Show always if WP-Matomo is updated','wp-piwik'),
'script'=>__('Show only if WP-Matomo is updated and settings were changed','wp-piwik'),
'disabled'=>__('Disabled','wp-piwik')
),__('Choose if you want to get an update notice if WP-Matomo is updated.','wp-piwik'));
$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>'));
$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>'));
$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>'));
<p><strong><?php_e('Thank you very much, everyone who donates to the WP-Matomo project, including the Matomo team!','wp-piwik');?></strong></p>
<p><?php_e('Graphs powered by <a href="https://www.chartjs.org" target="_BLANK">Chart.js</a> (MIT License).','wp-piwik');?></p>
<p><?php_e('Thank you very much','wp-piwik');?>, <?php _e('Transifex and WordPress translation community for your translation work.','wp-piwik'); ?>!</p>
<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>
<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>
<?php
}
/**
*Showsupportinformation
*/
publicfunctionshowSupport(){
?><ul>
<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>
<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>
</ul>
<h3><?php_e('Debugging','wp-piwik');?></h3>
<p><?php_e('Either allow_url_fopen has to be enabled <em>or</em> cURL has to be available:','wp-piwik');?></p>