Browse Source

Merge pull request #1 from lltodoll/htmly-add-matomo-support

Htmly add matomo support
pull/497/head
lltodoll 4 years ago
committed by GitHub
parent
commit
a24d533f1e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 2557 additions and 102 deletions
  1. +6
    -0
      config/config.ini.example
  2. +95
    -90
      lang/de_DE.ini
  3. +6
    -1
      lang/en_US.ini
  4. +6
    -1
      lang/es_ES.ini
  5. +5
    -0
      lang/fr_FR.ini
  6. +6
    -1
      lang/hu_HU.ini
  7. +5
    -0
      lang/id_ID.ini
  8. +6
    -1
      lang/it_IT.ini
  9. +5
    -0
      lang/ko_KO.ini
  10. +5
    -0
      lang/ms_MY.ini
  11. +7
    -2
      lang/nl_NL.ini
  12. +6
    -1
      lang/pl_PL.ini
  13. +6
    -1
      lang/pt_BR.ini
  14. +6
    -1
      lang/ru_RU.ini
  15. +6
    -1
      lang/sv_SE.ini
  16. +6
    -1
      lang/tr_TR.ini
  17. +6
    -1
      lang/zh_TW.ini
  18. +48
    -0
      system/admin/views/config-widget.html.php
  19. +114
    -0
      system/includes/functions.php
  20. +2201
    -0
      system/plugins/matomo/MatomoTracker.php
  21. +1
    -0
      themes/blog/layout.html.php
  22. +1
    -0
      themes/clean/layout.html.php
  23. +1
    -0
      themes/logs/layout.html.php
  24. +1
    -0
      themes/readable/layout.html.php
  25. +1
    -0
      themes/twentyfifteen/layout.html.php
  26. +1
    -0
      themes/twentysixteen/layout.html.php

+ 6
- 0
config/config.ini.example View File

@ -134,3 +134,9 @@ views.root = "themes/twentyfifteen"
; Framework config. No need to edit. ; Framework config. No need to edit.
views.layout = "layout" views.layout = "layout"
; Matomo Config
matomo.url = ""
matomo.token = ""
matomo.id = ""
matomo.tracking = "disable"

+ 95
- 90
lang/de_DE.ini View File

@ -26,7 +26,7 @@ Filename = "Datei Name"
Follow = "Folgen" Follow = "Folgen"
Image_post = "Bild-Beitrag" Image_post = "Bild-Beitrag"
Image_post_comment = "Erstelle einen Beitrag mit hervorgehobenem Bild" Image_post_comment = "Erstelle einen Beitrag mit hervorgehobenem Bild"
Import = "Importieren"
Import = "Import"
Link_post = "Link-Beitrag" Link_post = "Link-Beitrag"
Link_post_comment = "Erstelle einen Beitrag mit hervorgehobenem Link" Link_post_comment = "Erstelle einen Beitrag mit hervorgehobenem Link"
Login = "Anmelden" Login = "Anmelden"
@ -69,12 +69,12 @@ Search_for = "Suche nach"
Static_page = "Statische Seite" Static_page = "Statische Seite"
Static_page_comment = "Erstelle eine statische Seite" Static_page_comment = "Erstelle eine statische Seite"
Static_pages = "Statische Seiten" Static_pages = "Statische Seiten"
Tag = "Etikett"
Tags = "Stichworte"
Tag = "Tag"
Tags = "Tags"
Title = "Titel" Title = "Titel"
Uncategorized = "Sonstiges" Uncategorized = "Sonstiges"
Uncategorized_comment = "Themen die keine Kategorie brauchen oder nicht in andere existierende Kategorien passen." Uncategorized_comment = "Themen die keine Kategorie brauchen oder nicht in andere existierende Kategorien passen."
Update = "Aktualisieren"
Update = "Update"
Update_draft = "Draft aktualisieren" Update_draft = "Draft aktualisieren"
Update_post = "Beitrag aktualisieren" Update_post = "Beitrag aktualisieren"
Video_post = "Video-Beitrag" Video_post = "Video-Beitrag"
@ -84,36 +84,36 @@ Views = "Ansichten"
Your_recent_posts = "Deine letzten Beiträge" Your_recent_posts = "Deine letzten Beiträge"
by = "von" by = "von"
read_more = "weiterlesen" read_more = "weiterlesen"
Dashboard="Instrumententafel"
Posts_list="Beitragsliste"
Posts_draft="Beiträge Entwurf"
Menus="Menü-Editor"
Settings="die Einstellungen"
Tools="Werkzeuge"
Check_update="Aktualisierung überprüfen"
Import_RSS="RSS importieren"
User="Benutzer"
Proudly_powered_by="Stolz angetrieben von"
Home="Zuhause"
Type_to_search="Tippe um zu suchen"
Admin_panel_style_based_on="Admin-Panel-Stil basierend auf"
Sign_in_to_start_your_session="Melden Sie sich an, um Ihre Sitzung zu starten"
Back_to="Zurück zu"
Login="Anmeldung"
User="Benutzer"
Password="Passwort"
Comma_separated_values="Komma-getrennte Werte"
If_leave_empty_we_will_excerpt_it_from_the_content_below="Wenn Sie das Feld leer lassen, wird es aus dem folgenden Inhalt extrahiert"
Dashboard="Dashboard"
Posts_list="Posts list"
Posts_draft="Posts draft"
Menus="Menu Editor"
Settings="Settings"
Tools="Tools"
Check_update="Check update"
Import_RSS="Import RSS"
User="User"
Proudly_powered_by="Proudly powered by"
Home="Home"
Type_to_search="Type to search"
Admin_panel_style_based_on="Admin panel style based on"
Sign_in_to_start_your_session="Sign in to start your session"
Back_to="Back to"
Login="Login"
User="User"
Password="Password"
Comma_separated_values="Comma separated values"
If_leave_empty_we_will_excerpt_it_from_the_content_below="If leave empty we will excerpt it from the content below"
optional="optional" optional="optional"
If_the_url_leave_empty_we_will_use_the_post_title="Wenn die URL leer bleibt, verwenden wir den Post-Titel"
If_the_url_leave_empty_we_will_use_the_page_title="Wenn die URL leer bleibt, verwenden wir den Seitentitel"
Only="Nur"
Featured_Audio="Empfohlenes Audio"
Featured_Video="Empfohlenes Video"
Featured_Image="Ausgewähltes Bild"
Featured_Quote="Ausgewähltes Zitat"
Featured_Link="Ausgewählter Link"
Content="Inhalt"
If_the_url_leave_empty_we_will_use_the_post_title="If the url leave empty we will use the post title"
If_the_url_leave_empty_we_will_use_the_page_title="If the url leave empty we will use the page title"
Only="Only"
Featured_Audio="Featured Audio"
Featured_Video="Featured Video"
Featured_Image="Featured Image"
Featured_Quote="Featured Quote"
Featured_Link="Featured Link"
Content="Content"
Preview="Preview" Preview="Preview"
Enter_image_URL="Enter image URL" Enter_image_URL="Enter image URL"
Upload="Upload" Upload="Upload"
@ -122,71 +122,71 @@ This_page_doesnt_exist="This page doesn't exist !"
Would_you_like_to_try_our="Would you like to try our " Would_you_like_to_try_our="Would you like to try our "
homepage="homepage" homepage="homepage"
instead="instead" instead="instead"
Your_backups="Ihre Backups"
Create_backup="Ein Backup erstellen"
All_cache_has_been_deleted="Der gesamte Cache wurde gelöscht!"
Edit_category="Kategorie bearbeiten"
Your_backups="Your backups"
Create_backup="Create backup"
All_cache_has_been_deleted="All cache has been deleted !"
Edit_category="Edit category"
Date="Date" Date="Date"
Time="Zeit"
No_available_backup="Derzeit ist kein Backup verfügbar."
You_dont_have_permission_to_access_this_page="Sie haben keine Berechtigung, auf diese Seite zuzugreifen."
Save_category="Kategorie speichern"
Import_RSS_Feed_2.0="RSS-Feed 2.0 importieren"
By_using_this_importer_you_are_agree_if_the_feed_is_yours_or_at_least_you_have_the_authority_to_publish_it="Durch die Verwendung dieses Importeurs stimmen Sie zu, ob der Feed Ihnen gehört oder zumindest die Berechtigung hat, ihn zu veröffentlichen."
Time="Time"
No_available_backup="No available backup at this time."
You_dont_have_permission_to_access_this_page="You don't have permission to access this page"
Save_category="Save category"
Import_RSS_Feed_2.0="Import RSS Feed 2.0"
By_using_this_importer_you_are_agree_if_the_feed_is_yours_or_at_least_you_have_the_authority_to_publish_it="By using this importer you are agree if the feed is yours or at least you have the authority to publish it."
Feed_Url="Feed URL" Feed_Url="Feed URL"
Add_source_link_optional="Quelllink hinzufügen (optional)"
Import_Feed="Importieren Feed starten"
At_the_moment_you_are_using_auto_generated_menu="Im Moment verwenden Sie ein automatisch generiertes Menü. "
Add_menu="Menü hinzufügen"
Add_source_link_optional="Add source link (optional)"
Import_Feed="Start Import Feed"
At_the_moment_you_are_using_auto_generated_menu="At the moment you are using auto generated menu."
Add_menu="Add menu"
Name="Name" Name="Name"
Link_name="Linkname"
Link_name="Link name"
Slug="Slug" Slug="Slug"
item_slug="Link URL einfügen"
CSS_Class_Optional="CSS-Klasse (optional) "
item_class="CSS Klasse einfügen"
Add_link="Link hinzufügen"
Save_Edit="Speichern Bearbeiten"
Save_Menu="Menü speichern"
Add_new_post="Neuen Beitrag hinzufügen"
Add_new_page="Neue Seite hinzufügen"
Update_Available="Update verfügbar"
Congrats_You_have_the_latest_version_of_HTMLy="Herzlichen Glückwunsch! Sie haben die neueste Version von HTMLy."
Update_to="Aktualisieren zu"
now="jetzt"
Performance_Settings="Leistungseinstellungen"
General="Allgemeines"
Reading="Lesen"
item_slug="Insert Link URL"
CSS_Class_Optional="CSS Class (optional)"
item_class="Insert CSS class"
Add_link="Add link"
Save_Edit="Save Edit"
Save_Menu="Save menu"
Add_new_post="Add new post"
Add_new_page="Add new page"
Update_Available="Update Available"
Congrats_You_have_the_latest_version_of_HTMLy="Congrats! You have the latest version of HTMLy."
Update_to="Update to"
now="now"
Performance_Settings="Performance Settings"
General="General"
Reading="Reading"
Widget="Widget" Widget="Widget"
Metatags="Metatags" Metatags="Metatags"
Performance="Performance" Performance="Performance"
Custom="Benutzerdefiniert"
General_Settings="Allgemeine Einstellungen"
Reading_Settings="Leseeinstellungen"
Widget_Settings="Widget Einstellungen"
Metatags_Settings="Metatags Einstellungen"
Custom_Settings="Benutzerdefinierte Einstellungen"
Address_URL="Adresse (URL)"
Blog_Title="Blog Titel"
Blog_Title_Placeholder="Mein HTMLy Blog "
Custom="Custom"
General_Settings="General Settings"
Reading_Settings="Reading Settings"
Widget_Settings="Widget Settings"
Metatags_Settings="Metatags Settings"
Custom_Settings="Custom Settings"
Address_URL="Address (URL)"
Blog_Title="Blog title"
Blog_Title_Placeholder="My HTMLy Blog"
Tagline="Tagline" Tagline="Tagline"
Tagline_Placeholder="Datenbanklose PHP Blogging Plattform"
Tagline_description="Erklären Sie in wenigen Worten, worum es in diesem Blog geht."
Blog_Description="Erzählen Sie uns in einem Absatz mehr über Ihr Blog."
Language="Systemsprache"
Timezone="Zeitzone"
Date_Format="Datumsformat"
Blog_Theme="Blog Thema"
Copyright_Line="Copyright Zeile"
Copyright_Line_Placeholder="(c) Dein Name."
Save_Config="Konfiguration speichern"
Front_page_displays="Titelseite wird angezeigt"
Your_latest_blog_posts="Deine neuesten Blog-Beiträge"
Enable_blog_URL="URL aktivieren / bloggen"
Enable="Aktivieren"
Disable="Deaktivieren"
Posts_in_front_page_show_at_most="Beiträge auf der Titelseite werden höchstens angezeigt"
Blog_posts_displayed_as="Blog-Beiträge angezeigt als"
Full_post="Vollständiger Beitrag"
Tagline_Placeholder="Databaseless PHP Blogging Platform"
Tagline_description="In a few words, explain what this blog is about."
Blog_Description="In one paragraph, tell us more about your blog."
Language="System Language"
Timezone="Timezone"
Date_Format="Date Format"
Blog_Theme="Blog Theme"
Copyright_Line="Copyright line"
Copyright_Line_Placeholder="(c) Your name."
Save_Config="Save config"
Front_page_displays="Front page displays"
Your_latest_blog_posts="Your latest blog posts"
Enable_blog_URL="Enable /blog URL"
Enable="Enable"
Disable="Disable"
Posts_in_front_page_show_at_most="Posts in front page show at most"
Blog_posts_displayed_as="Blog posts displayed as"
Full_post="Full post"
Summary="Summary" Summary="Summary"
Summary_character="Summary character" Summary_character="Summary character"
Read_more_text="Read more text" Read_more_text="Read more text"
@ -248,3 +248,8 @@ Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope" Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Seiten-ID"
Matomo_Tracking="Tracking Methode"

+ 6
- 1
lang/en_US.ini View File

@ -247,4 +247,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/es_ES.ini View File

@ -246,4 +246,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 5
- 0
lang/fr_FR.ini View File

@ -248,3 +248,8 @@ Github_pre_release="Pré-release Github"
Pre_release="Pré-release" Pre_release="Pré-release"
Yes_Im_in="Oui, je suis prêt" Yes_Im_in="Oui, je suis prêt"
Nope="Non !" Nope="Non !"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/hu_HU.ini View File

@ -247,4 +247,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 5
- 0
lang/id_ID.ini View File

@ -248,3 +248,8 @@ Github_pre_release="Pra-rilis Github"
Pre_release="Pra-rilis" Pre_release="Pra-rilis"
Yes_Im_in="Ya, saya ikut" Yes_Im_in="Ya, saya ikut"
Nope="Nggak" Nope="Nggak"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/it_IT.ini View File

@ -247,4 +247,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 5
- 0
lang/ko_KO.ini View File

@ -248,3 +248,8 @@ Github_pre_release = "Github에서의 시험판"
Pre_release = "사전 출시" Pre_release = "사전 출시"
Yes_Im_in = "그래, 난에있어" Yes_Im_in = "그래, 난에있어"
Nope = "아니" Nope = "아니"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 5
- 0
lang/ms_MY.ini View File

@ -248,3 +248,8 @@ Github_pre_release = "Github pra keluaran"
Pre_release = "Pra-release" Pre_release = "Pra-release"
Yes_Im_in = "Ya saya setuju" Yes_Im_in = "Ya saya setuju"
Nope = "Nope" Nope = "Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 7
- 2
lang/nl_NL.ini View File

@ -207,7 +207,7 @@ post_your_post_slug="/bericht/uw-bericht-slug"
Meta_description_character="Meta beschrijving" Meta_description_character="Meta beschrijving"
Breadcrumb_home_text="Breadcrumb home tekst" Breadcrumb_home_text="Breadcrumb home tekst"
Sitemap="Sitemap" Sitemap="Sitemap"
Valid_values_range_from_0_to_1.0._See="Geldige waarden variëren van 0,0 tot 1,0. Zie"
Valid_values_range_from_0_to_1.0._See="Geldige waarden variëren van 0,0 tot 1,0. Zie"
hint_Use_CtrlCMDF_to_search_for_your_config_key_or_value="<u>hint:</u> Use <code>Ctrl</code>/<code>CMD</code> + <code>F</code> to search for your config key or value." hint_Use_CtrlCMDF_to_search_for_your_config_key_or_value="<u>hint:</u> Use <code>Ctrl</code>/<code>CMD</code> + <code>F</code> to search for your config key or value."
pro_tips_You_can_creating_custom_config_key_and_print_out_your_config_key_value_anywhere_in_your_template="<u>pro tips:</u> You can creating custom config key and print out your config key value anywhere in your template." pro_tips_You_can_creating_custom_config_key_and_print_out_your_config_key_value_anywhere_in_your_template="<u>pro tips:</u> You can creating custom config key and print out your config key value anywhere in your template."
your_key="your.key" your_key="your.key"
@ -247,4 +247,9 @@ Page_generation_time="Generatietijd pagina"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Ja, ik doe mee" Yes_Im_in="Ja, ik doe mee"
Nope="Nietes"
Nope="Nietes"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/pl_PL.ini View File

@ -248,4 +248,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/pt_BR.ini View File

@ -247,4 +247,9 @@ Page_generation_time="Tempo de geração da página"
Github_pre_release="Pré-lançamento do Github" Github_pre_release="Pré-lançamento do Github"
Pre_release="Pré-lançamento" Pre_release="Pré-lançamento"
Yes_Im_in="Sim, estou dentro" Yes_Im_in="Sim, estou dentro"
Nope="Não"
Nope="Não"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/ru_RU.ini View File

@ -248,4 +248,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/sv_SE.ini View File

@ -265,4 +265,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/tr_TR.ini View File

@ -247,4 +247,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 6
- 1
lang/zh_TW.ini View File

@ -247,4 +247,9 @@ Page_generation_time="Page generation time"
Github_pre_release="Github pre-release" Github_pre_release="Github pre-release"
Pre_release="Pre-release" Pre_release="Pre-release"
Yes_Im_in="Yes I'm in" Yes_Im_in="Yes I'm in"
Nope="Nope"
Nope="Nope"
Matomo="Matomo"
Matomo_URL="Server"
Matomo_Token="Token"
Matomo_ID="Page ID"
Matomo_Tracking="Tracking Method"

+ 48
- 0
system/admin/views/config-widget.html.php View File

@ -150,6 +150,53 @@
<small><em><?php echo i18n('For_google_site_verification_meta');?></em></small> <small><em><?php echo i18n('For_google_site_verification_meta');?></em></small>
</div> </div>
</div> </div>
<br>
<h4><?php echo i18n('Matomo');?></h4>
<hr>
<div class="form-group row">
<label for="matamo.url" class="col-sm-2 col-form-label"><?php echo i18n('Matomo_URL');?></label>
<div class="col-sm-10">
<input type="text" name="-config-matomo.url" class="form-control" id="matomo.url" value="<?php echo valueMaker(config('matomo.url'));?>" placeholder="https://matomo.org/">
</div>
</div>
<div class="form-group row">
<label for="matomo.token" class="col-sm-2 col-form-label"><?php echo i18n('Matomo_Token');?></label>
<div class="col-sm-10">
<input type="text" name="-config-matomo.token" class="form-control" id="matomo.token" value="<?php echo valueMaker(config('matomo.token'));?>" placeholder="1234567890">
</div>
</div>
<div class="form-group row">
<label for="matomo.id" class="col-sm-2 col-form-label"><?php echo i18n('Matomo_ID');?></label>
<div class="col-sm-10">
<input type="text" name="-config-matomo.id" class="form-control" id="matomo.id" value="<?php echo valueMaker(config('matomo.id'));?>" placeholder="1">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><?php echo i18n('Matomo_Tracking');?></label>
<div class="col-sm-10">
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="radio" name="-config-matomo.tracking" id="matomo.tracking1" value="disable" <?php if (config('matomo.tracking') === 'disable'):?>checked<?php endif;?>>
<label class="form-check-label" for="matomo.tracking1">
<?php echo i18n('Disabled');?>
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="-config-matomo.tracking" id="matomo.tracking2" value="javascript" <?php if (config('matomo.tracking') === 'javascript'):?>checked<?php endif;?>>
<label class="form-check-label" for="matomo.tracking2">
Javascript
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="-config-matomo.tracking" id="matomo.tracking3" value="php" <?php if (config('matomo.tracking') === 'php'):?>checked<?php endif;?>>
<label class="form-check-label" for="matomo.tracking3">
PHP
</label>
</div>
</div>
</div>
</div>
<br> <br>
<h4><?php echo i18n('Social_Media');?></h4> <h4><?php echo i18n('Social_Media');?></h4>
<hr> <hr>
@ -170,4 +217,5 @@
<button type="submit" class="btn btn-primary"><?php echo i18n('Save_Config');?></button> <button type="submit" class="btn btn-primary"><?php echo i18n('Save_Config');?></button>
</div> </div>
</div> </div>
</form> </form>

+ 114
- 0
system/includes/functions.php View File

@ -5,6 +5,7 @@ use \Michelf\MarkdownExtra;
use \Suin\RSSWriter\Feed; use \Suin\RSSWriter\Feed;
use \Suin\RSSWriter\Channel; use \Suin\RSSWriter\Channel;
use \Suin\RSSWriter\Item; use \Suin\RSSWriter\Item;
use function Composer\Autoload\includeFile;
// Get blog post path. Unsorted. Mostly used on widget. // Get blog post path. Unsorted. Mostly used on widget.
function get_post_unsorted() function get_post_unsorted()
@ -2021,6 +2022,119 @@ EOF;
} }
} }
// Matomo
function matomo($title)
{
$matomoURL = config('matomo.url');
$matomoToken = config('matomo.token');
$matomoID = config('matomo.id');
$matomoTracking = config('matomo.tracking');
if($matomoTracking == 'disable')
{
return;
}
if(empty($matomoURL) || empty($matomoTracking) || empty($matomoID))
{
error_log("Please set all Matomo configuration values", 0);
return;
}
if($matomoTracking == 'javascript')
{
$jsURL = $matomoURL;
$imageURL = $matomoURL;
// remove http | https
if (startsWith($matomoURL, 'https'))
{
$jsURL = replace_first_str('https', '', $matomoURL);
}
else if (startsWith($matomoURL, 'http'))
{
$jsURL = replace_first_str('http', '', $matomoURL);
}
if(!endsWith($matomoURL, '/'))
{
$jsURL = $jsURL . '/';
$imageURL = $imageURL . "/";
}
$script = <<<EOF
<script type="text/javascript">
var _paq = window._paq || [];
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="{$jsURL}";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '{$matomoID}']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="{$imageURL}matomo.php?idsite={$matomoID}&amp;rec=1" style="border:0;" alt="" /></p></noscript>
EOF;
return $script;
}
else if($matomoTracking == 'php')
{
if(empty($matomoToken))
{
error_log("Please set Matomo Token for PHP Tracking Method", 0);
return;
}
$jsURL = 'system/plugins/matomo/MatomoTracker.php';
require_once ($jsURL);
MatomoTracker::$URL = $matomoURL;
// Matomo object
$matomoTracker = new MatomoTracker((int) $matomoID, $matomoURL);
// do not wait
$matomoTracker->setRequestTimeout(1);
// Set authentication token
$matomoTracker->setTokenAuth($matomoToken);
// Track page view
$matomoTracker->doTrackPageView($title);
}
}
function startsWith($haystack, $needle, $case = true)
{
if ($case)
{
return (strcmp(substr($haystack, 0, strlen($needle)), $needle) === 0);
}
return (strcasecmp(substr($haystack, 0, strlen($needle)), $needle) === 0);
}
function endsWith($haystack, $needle, $case = true)
{
if ($case)
{
return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0);
}
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0);
}
function replace_first_str($search_str, $replacement_str, $src_str)
{
return (false !== ($pos = strpos($src_str, $search_str))) ? substr_replace($src_str, $replacement_str, $pos, strlen($search_str)) : $src_str;
}
function slashUrl($url) { function slashUrl($url) {
return rtrim($url, '/') . '/'; return rtrim($url, '/') . '/';
} }


+ 2201
- 0
system/plugins/matomo/MatomoTracker.php
File diff suppressed because it is too large
View File


+ 1
- 0
themes/blog/layout.html.php View File

@ -192,5 +192,6 @@
<script type="text/javascript" src="<?php echo site_url();?>themes/blog/js/jquery-latest.min.js"></script> <script type="text/javascript" src="<?php echo site_url();?>themes/blog/js/jquery-latest.min.js"></script>
<script type="text/javascript" src="<?php echo site_url();?>themes/blog/js/bootstrap.min.js"></script> <script type="text/javascript" src="<?php echo site_url();?>themes/blog/js/bootstrap.min.js"></script>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?> <?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
<?php if (matomo($title)): ?><?php echo matomo($title) ?><?php endif; ?>
</body> </body>
</html> </html>

+ 1
- 0
themes/clean/layout.html.php View File

@ -45,5 +45,6 @@
<?php echo content() ?> <?php echo content() ?>
</section> </section>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?> <?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
<?php if (matomo($title)): ?><?php echo matomo($title) ?><?php endif; ?>
</body> </body>
</html> </html>

+ 1
- 0
themes/logs/layout.html.php View File

@ -93,5 +93,6 @@
</div> </div>
</div> </div>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?> <?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
<?php if (matomo($title)): ?><?php echo matomo($title) ?><?php endif; ?>
</body> </body>
</html> </html>

+ 1
- 0
themes/readable/layout.html.php View File

@ -58,5 +58,6 @@
</div> </div>
</div> </div>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?> <?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
<?php if (matomo($title)): ?><?php echo matomo($title) ?><?php endif; ?>
</body> </body>
</html> </html>

+ 1
- 0
themes/twentyfifteen/layout.html.php View File

@ -132,6 +132,7 @@
<script type="text/javascript" src="<?php echo site_url();?>themes/twentyfifteen/js/functions.js"></script> <script type="text/javascript" src="<?php echo site_url();?>themes/twentyfifteen/js/functions.js"></script>
<script type="text/javascript" src="<?php echo site_url();?>themes/twentyfifteen/js/skip-link-focus-fix.js"></script> <script type="text/javascript" src="<?php echo site_url();?>themes/twentyfifteen/js/skip-link-focus-fix.js"></script>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?> <?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
<?php if (matomo($title)): ?><?php echo matomo($title) ?><?php endif; ?>
</body> </body>
</html> </html>

+ 1
- 0
themes/twentysixteen/layout.html.php View File

@ -157,5 +157,6 @@
</script> </script>
<script type="text/javascript" src="<?php echo site_url();?>themes/twentysixteen/js/functions.js"></script> <script type="text/javascript" src="<?php echo site_url();?>themes/twentysixteen/js/functions.js"></script>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?> <?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
<?php if (matomo($title)): ?><?php echo matomo($title) ?><?php endif; ?>
</body> </body>
</html> </html>

Loading…
Cancel
Save