Example #1
0
<?php

namespace Langchecker;

use Transvision\Json;
$json_data = [];
// $filename is set in /inc/init.php
$current_filename = $filename != '' ? $filename : 'snippets.lang';
$string_id = isset($_GET['stringid']) ? Utils::secureText($_GET['stringid']) : false;
$supported_file = false;
// Search which website has the requested file
foreach (Project::getWebsitesByDataType($sites, 'lang') as $site) {
    if (in_array($current_filename, Project::getWebsiteFiles($site))) {
        $current_website = $site;
        $supported_file = true;
        break;
    }
}
if (!$supported_file) {
    // File is not managed, throw error
    http_response_code(400);
    die("File {$current_filename} is not supported. Check the file name and try again.");
}
$reference_locale = Project::getReferenceLocale($current_website);
$reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename);
if (!$string_id) {
    // Display list of links to strings
    header("Content-type:text/html; charset=utf-8");
    echo "<ul>\n";
    foreach ($reference_data['strings'] as $current_string => $value) {
        $string_hash = sha1($current_string);
Example #2
0
 /**
  * @dataProvider secureTextArrayDP
  */
 public function testsecureTextArray($a, $b, $c)
 {
     $obj = new _Utils();
     $this->array($obj->secureText($a, $b))->isEqualTo($c);
 }