<?php use Json\Json; $file = INSTALL_ROOT . 'data/stats.json'; $link = isset($_GET['link']) ? $_GET['link'] : ''; $json_obj = new Json($file); if (file_exists($file)) { $stats = $json_obj->fetchContent(); if (!is_array($stats)) { trigger_error("JSON content is not an array, aborting stats recording.", E_USER_ERROR); exit; } } else { $stats = []; } $stats[$link] = in_array($link, array_keys($stats)) ? $stats[$link] + 1 : 1; $json_obj->saveFile($stats, $file, true);
/** * Return array with data for all repositories * * @return array Data repositories */ public function getRepositoriesJson() { $json_data = new Json($this->source_path . 'repositories.json'); return $json_data->fetchContent(); }
/** * Return array with data for all Bugzilla l10n components * * @return array Data repositories */ public function getBugzillaComponentsJson() { $json_data = new Json($this->source_path . 'bugzilla_components.json'); return $json_data->fetchContent(); }