matomo-org / matomo-for-wordpress

Get a fully functioning Matomo Analytics for your WordPress. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Privacy is built-in. 100% data ownership, no one else can see your data. We love Pull Requests!
https://matomo.org
GNU General Public License v3.0
119 stars 25 forks source link

Problem in twig files #86

Closed Chafalleiro closed 4 years ago

Chafalleiro commented 4 years ago

For some reason I need to delete " and icon and icon starts with 'icon-'" and "and icon starts with 'icon-'" form several .twig files in /app/plugins/CoreHome/templates in order to see the stats. It drops this error codes

Unexpected token "name" of value "starts" ("end of statement block" expected) in @CoreHome/_topBar.twig" at line 4

File is /app/plugins/CoreHome/templates/_topBar.twig, error dropped at line 4 Changed {% if icon is defined and icon and icon starts with 'icon-%} to {% if icon is defined %}

Error: Unexpected token "name" of value "starts" ("end of statement block" expected) in "@CoreHome/_dataTableActions.twig" at line 22

File is /app/plugins/CoreHome/templates/_dataTableActions.twig, error dropped at line 22 Changed {% if footerIcon.icon starts with 'icon-' %} to {% if footerIcon.icon %}

Error: Unexpected token "name" of value "starts" ("end of statement block" expected) in "@CoreHome/_dataTableActions.twig" at line 58

File is /app/plugins/CoreHome/templates/_dataTableActions.twig, error dropped at line 58 Changed {% if activeFooterIcon starts with 'icon-' %} to {% if activeFooterIcon %}

Error: Unexpected token "name" of value "starts" ("end of statement block" expected) in "@CoreHome/_dataTableActions.twig" at line 114

File is /app/plugins/CoreHome/templates/_dataTableActions.twig, error dropped at line 114 Changed {% if action.icon starts with 'icon-' %} to {% if action.icon %}

The data seems to be stored normally, but if I don't edit the templates I can't see the analytics.

Tested in wordpress 5.3 in Xammp for windows x64 and Debian squeeze under Plesk

tsteur commented 4 years ago

Thanks @Chafalleiro

That's quite an interesting an issue. Any chance you could send us the details of your system report?

I'm having the feeling that maybe some other plugin is using Twig as well and is using a quite old version of Twig.

Chafalleiro commented 4 years ago

Thank you very much @tsteur . I have indeed some very old plugins running. And thanks to your observation I've found the culprit, "Background manager" from Myatus, it isn't listed anywhere anymore XD

It is totally incompatible with the new version of Twig, and drops infinite fatal errors when I try to use it with background manager. Seems that I must retire that pluging ;,,( It had very cool background features.

1WD Slider 1.0  
AceIDE 2.6.2  
Advanced TinyMCE Configuration 1.5  
Aesop Story Engine 2.0.13  
Attachments Handler 1.1.7  
Background Manager 1.2.5.2  
Backup Scheduler 1.5.13  
Basic Google Maps Placemarks 1.10.7  
Better RSS Feeds 2.0.1  
Better WordPress Minify 1.3.3  
Buy Me A Coffee - Free and Beautiful Donate Button 1.2  
Chapters 2.2  
Chapters for Authors 1.1  
Check Plagiarism 1.0  
Child Theme Configurator 2.5.0  
Classic Editor 1.5  
Clear All Cache for WP Super Cache 2.0  
Clear Cache For Me 1.0  
Code Snippets Extended 1.4.6  
Comic Easel 1.15  
Crayon Syntax Highlighter 2.8.4  
Creative Clans Embed Script 1.2  
Creative Commons 2019.9.1  
Creative Commons Configurator 1.8.27  
Custom Header Extended 1.0.0  
Custom Header Images 1.2.1  
Duplicate Post 3.2.3  
Duplicator 1.3.22  
Dynamic Featured Image 3.7.0  
Embed Plus for YouTube - Gallery, Channel, Playlist, Live Stream 13.1.2.1  
ExtraWatch (See your visitors in real time, on a map) 4.0.46  
ExtraWatch PRO (Live Stats, Heatmap, Click tracking, Download Monitor and more) 2.3.2690 PRO  
FavIcon Switcher 1.2.11  
Featured Image 2.1  
GDPR Cookie Consent 1.8.1  
Greg's High Performance SEO 1.7.1  
Header Footer Code Manager 1.1.6  
Hello Dolly 1.7.2  
Hitsteps Web Analytics 5.73  
Image Map Edit 1.0  
ImageMapper 1.2.6  
Jetpack by WordPress.com 7.9  
Just Another Mapping Tool 0.1 (Alpha release)  
Ko-Fi Button 0.3.0  
List Plugins 1.4.4  
Manga+Press Comic Manager 3.0.0  
Maps Builder 2.1.2  
Matomo Analytics & Tag Manager 0.2.0  
Media Library Assistant 2.81  
Mivhak Syntax Highlighter 1.3.9  
Modern Footnotes 1.3.8  
Multi Device Switcher 1.7.0  
Multisite Toolbar Additions 2.0.1 Network enabled
Next Level Cache 0.0.9  
Nginx Cache Controller 3.3.3  
OG 2.7.6  
oik 3.3.3  
Patreon Button, Widgets and Plugin by CodeBard 2.0.8  
Patreon Wordpress 1.3.8  
Plagiarism Checker Wordpress Plugin By SmallSeoTools.com 2.1.1  
Plagiary Search 1.2.2  
Processing.js for WordPress 1.6.6  
Quick Featured Images 13.3.5  
Really Simple SSL 3.2.6  
Related Articles 1.2.3  
Responsive Image Maps 1.4  
Scalable Vector Graphics (SVG) 3.4  
Simple Custom Post Order 2.4.7  
Simple Tooltips 2.1.3  
Slimstat Analytics 4.8.8.1  
SSL Insecure Content Fixer 2.7.2  
Styles For WP Pagenavi Addon 1.0.1  
Styles selector 1.1.1  
Syntax Highlighter for Theme/Plugin Editor 4.39  
Theme Switcha 2.3  
TM Style Switcher 1.0.6  
Transposh Translation Filter 1.0.5.1  
WassUp Real Time Analytics 1.9.4.4  
WCK - Custom Fields and Custom Post Types Creator 2.2.4  
Webcomic 5.0.6  
Widget Context 1.2.0  
WordPress Admin Style 1.5.4  
WordPress Importer 0.6.4  
WP-Optimize - Clean, Compress, Cache 3.0.13  
WP-PageNavi 2.93.1  
WP Cleanup and Basic Options Functions 2.2.1  
WP Extra File Types 0.4.4.1  
Wp Pagenavi Style 1.4  
WPSiteSync for Content 1.5.3  
WP Super Cache 1.7.0  
WP SVG Icons 3.2.3  
WP User Stylesheet Switcher v2.2.0  
Writer Helper 1.0.5  
WriteShare Writing Community Platform 1.1.18  
ZenCache 160316 Network enabled
Zoom OpenSeadragon 1.4  
Active Plugins 31 advanced-tinymce-configuration/adv-mce-config.php, attachments-handler/attachments-handler.php, background-manager/background-manager.php, child-theme-configurator/child-theme-configurator.php, classic-editor/classic-editor.php, clear-cache-for-widgets/clear-cache-for-widgets.php, cookie-law-info/cookie-law-info.php, custom-header-extended/custom-header-extended.php, custom-header-images/custom-header-images.php, duplicate-post/duplicate-post.php, favicon-switcher/favicon-switcher.php, featured-image/featured-image.php, header-footer-code-manager/99robots-header-footer-code-manager.php, jetpack/jetpack.php, ko-fi-button/Ko_fi.php, matomo/matomo.php, modern-footnotes/modern-footnotes.php, multi-device-switcher/multi-device-switcher.php, next-level-cache/next-level-cache.php, nginx-champuru/nginx-champuru.php, plagiary-search/plagiary-search.php, simple-tooltips/index.php, styles-for-wp-pagenavi-addon/styles-for-wp-pagenavi-addon.php, styles-selector/styleselector.php, transposh-translation-filter-for-wordpress/transposh.php, wassup/wassup.php, wp-pagenavi-style/wp-pagenavi-style.php, wp-pagenavi/wp-pagenavi.php, wp-slimstat/wp-slimstat.php, wp-super-cache-clear-cache-menu/wp-super-cache-clear-cache-menu.php, wp-super-cache/wp-cache.php
Findus23 commented 4 years ago

@Chafalleiro I found the code in https://github.com/Myatu/Background-Manager-WP and indeed it ships with a 6 year old twig version.

I'm not sure how exactly twig is loaded (in https://github.com/Myatu/Background-Manager-WP/blob/06ae8cedce43feabec888cf530aadffbf727f4df/background-manager.php#L31), but it seems to load the classes globally using some equally old utility: https://github.com/Myatu/pf4wp

I guess there is nothing that can be done to avoid this issue.

Chafalleiro commented 4 years ago

Thank you very much :)

Well, since deactivating the plugin solves the issues, I supose that I could deactivate when checking the stats, and reactivate when I've done the checkings.

tsteur commented 4 years ago

fyi created: https://matomo.org/faq/wordpress/which-plugins-is-matomo-for-wordpress-known-to-be-not-compatible-with/ to document not compatible plugins and created issue to show not compatible plugins in system report: https://github.com/matomo-org/wp-matomo/issues/89

tsteur commented 4 years ago

Thanks for your help @Chafalleiro