Skip to content

Commit

Permalink
Merge pull request #4 from fritzmg/composer-support
Browse files Browse the repository at this point in the history
Composer & Contao 4 support. Thanks to @fritzmg <3
  • Loading branch information
math-GH authored Jan 11, 2021
2 parents 387f55b + e592072 commit fe6ccba
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 15 deletions.
33 changes: 18 additions & 15 deletions bepiwikcharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function PHPload($url, $parameter) {
* */
function JSONload($url, $parameter) {
$unserializedArray = json_decode($this->readfile($url));
$foundContent = [];

for ($i = 0; $i < count($unserializedArray); $i++) {
foreach ($unserializedArray[$i] as $item => $titel) {
Expand All @@ -173,21 +174,23 @@ function JSONload($url, $parameter) {
function printTable_downloads($inhalte, $cssklasse = "") {
$tabelle = "<table class=\"" . $cssklasse . "\">";
$tabelle .= "<tr><th class=\"col0\">" . $GLOBALS['TL_LANG']['be_piwikcharts']['template']['sheet']['table']['downloads_header_domain'] . "</th><th class=\"col1\">" . $GLOBALS['TL_LANG']['be_piwikcharts']['template']['sheet']['table']['downloads_header_file'] . "</th><th class=\"col2\">" . $GLOBALS['TL_LANG']['be_piwikcharts']['template']['sheet']['table']['downloads_header_count'] . "</th></tr>";

for ($i = 0; $i <= count($inhalte) / 2; $i = $i + 2) {
$maxZeilen = $this->tableMaxRows;

if ($maxZeilen > count($inhalte[$i + 1])) {
$maxZeilen = count($inhalte[$i + 1]);
}

for ($j = 0; $j < $maxZeilen; $j++) {
$tabelle .= "<tr>";
$tabelle .= "<td class=\"col0\">" . $inhalte[$i] . "</td>";
$path_parts = pathinfo($inhalte[$i + 1][$j]->label);
$tabelle .= "<td class=\"col1\"><a href=\"" . $inhalte[$i + 1][$j]->url . "\" target=\"_blank\" title=\"" . $inhalte[$i + 1][$j]->label . "\">" . $path_parts['basename'] . "</a></td>";
$tabelle .= "<td class=\"col2\">" . ($inhalte[$i + 1][$j]->nb_visits) . "</td>";
$tabelle .= "</tr>";

if (!empty($inhalte)) {
for ($i = 0; $i <= count($inhalte) / 2; $i = $i + 2) {
$maxZeilen = $this->tableMaxRows;

if ($maxZeilen > count($inhalte[$i + 1])) {
$maxZeilen = count($inhalte[$i + 1]);
}

for ($j = 0; $j < $maxZeilen; $j++) {
$tabelle .= "<tr>";
$tabelle .= "<td class=\"col0\">" . $inhalte[$i] . "</td>";
$path_parts = pathinfo($inhalte[$i + 1][$j]->label);
$tabelle .= "<td class=\"col1\"><a href=\"" . $inhalte[$i + 1][$j]->url . "\" target=\"_blank\" title=\"" . $inhalte[$i + 1][$j]->label . "\">" . $path_parts['basename'] . "</a></td>";
$tabelle .= "<td class=\"col2\">" . ($inhalte[$i + 1][$j]->nb_visits) . "</td>";
$tabelle .= "</tr>";
}
}
}

Expand Down
21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "mathcontao/be_piwikcharts",
"description": "Extension for the Contao Open Source Content Management System in order to show Matomo statistics directly in the back end.",
"type": "contao-module",
"license": "LGPL-3.0-or-later",
"require": {
"php": ">=5.6",
"contao/core-bundle": "^2.11 || ^3.0 || ^4.4",
"contao-community-alliance/composer-plugin": "~2.4 || ~3.0"
},
"replace": {
"contao-legacy/be_piwikcharts": "self.version"
},
"extra":{
"contao":{
"sources":{
"": "system/modules/be_piwikcharts"
}
}
}
}

0 comments on commit fe6ccba

Please sign in to comment.