aboutsummaryrefslogtreecommitdiffstats
path: root/langs/report_tx_git.php
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2016-07-10 19:02:30 +0200
committerfilip <filip.komar@gmail.com>2016-07-10 19:02:30 +0200
commit709662a027a4280534ed3d7df197e30e1e66948b (patch)
tree891291f45486a72f55ed56787f88c6817b8df55a /langs/report_tx_git.php
parent99253d57c142de06a51953f073c7f2265480bde1 (diff)
downloadwww-709662a027a4280534ed3d7df197e30e1e66948b.tar
www-709662a027a4280534ed3d7df197e30e1e66948b.tar.gz
www-709662a027a4280534ed3d7df197e30e1e66948b.tar.bz2
www-709662a027a4280534ed3d7df197e30e1e66948b.tar.xz
www-709662a027a4280534ed3d7df197e30e1e66948b.zip
adjusting the whole report to the use of a new function
Diffstat (limited to 'langs/report_tx_git.php')
-rw-r--r--langs/report_tx_git.php42
1 files changed, 19 insertions, 23 deletions
diff --git a/langs/report_tx_git.php b/langs/report_tx_git.php
index 952197195..c980763c4 100644
--- a/langs/report_tx_git.php
+++ b/langs/report_tx_git.php
@@ -42,12 +42,11 @@ if (in_array($c, array('Webpages', 'Documentation', 'Cauldron'))) {
} else {
$resource_type = 'Webpages'; // default
}
-if (isset($_GET['l'])) {
- $wanted_language = get_sane_string('l');
+$wanted_language = get_sane_string('l');
+$wanted_lang_name = '';
+if (!empty($wanted_language)) {
$wanted_lang_name = get_language_name($wanted_language) . " (";
$wanted_lang_name .= build_transifex_link($wanted_language, NULL, $resource_type) . ")";
-} else {
- $wanted_language = NULL;
}
// NOTE: there is a different naming convention between Tx and git for some lanuages:
// Tx git
@@ -55,10 +54,7 @@ if (isset($_GET['l'])) {
// sr@latin vs. sr@latin.po exception: http://gitweb.mageia.org/software/i18n/system-config-printer/plain/po
// uz@Cyrl vs. uz@cyrillic.po
// en_GB vs. en_gb.po exception: http://gitweb.mageia.org/web/identity/plain/lib/CatDap/I18N
-$wanted_resource = (string) filter_input(INPUT_GET, 'r', FILTER_SANITIZE_STRING);
-if (empty($wanted_resource)) {
- $wanted_resource = NULL;
-}
+$wanted_resource = get_sane_string('r');
if ('Documentation' == $resource_type) {
$git_resources = array(
@@ -474,9 +470,9 @@ foreach ($tx_resources as $one_resource) {
}
// limit resource type only on one
if ($category == $resource_type) {
- if (is_null($wanted_resource) || $tx_resource_name == $wanted_resource) {
+ if (empty($wanted_resource) || $tx_resource_name == $wanted_resource) {
// add statistic
- if (is_null($wanted_language)) {
+ if (empty($wanted_language)) {
$tx_stat_for_resource = tx_call("resource/$tx_resource_name/stats");
} else {
$tx_stat_for_resource[$wanted_language] = tx_call("resource/$tx_resource_name/stats/$wanted_language");
@@ -489,7 +485,7 @@ foreach ($tx_resources as $one_resource) {
}
}
$tx_languages = array();
-if (is_null($wanted_language)) {
+if (empty($wanted_language)) {
foreach ($tx_stat_for_resource as $tx_resource_language => $tx_resource_language_stat) {
$tx_languages[] = $tx_resource_language;
}
@@ -506,7 +502,7 @@ if ('Webpages' == $resource_type) {
} else {
foreach ($git_resources as $git_resource_details) {
$tx_name = $git_resource_details['tx_name'];
- if (!is_null($wanted_resource) && $tx_name != $wanted_resource) {
+ if (!empty($wanted_resource) && $tx_name != $wanted_resource) {
continue;
}
$git_path = $git_resource_details['git_path'];
@@ -523,7 +519,7 @@ if ('Webpages' == $resource_type) {
preg_match_all("/('>)([a-z_A-Z@-]+)(\.po<)/", $raw_html_dump, $language_codes);
}
$git_language_codes = $language_codes[2];
- if (is_null($wanted_language)) {
+ if (empty($wanted_language)) {
$report_language_codes = $git_language_codes;
} else {
if (in_array($wanted_language, $git_language_codes)) {
@@ -639,11 +635,11 @@ $git_only_languages = array_diff($git_all_languages, $tx_all_languages);
// preparing text for languages not present yet in our git repositories
$tx_only_languages_details = '';
if (0 < count($tx_only_languages)) {
- if (!is_null($wanted_language) && !is_null($wanted_resource)) {
+ if (!empty($wanted_language) && !empty($wanted_resource)) {
$tx_only_languages_details = "<h3>Language $wanted_lang_name with $wanted_resource resource for $resource_type translated over treshold ";
- } else if (!is_null($wanted_language) && is_null($wanted_resource)) {
+ } else if (!empty($wanted_language) && empty($wanted_resource)) {
$tx_only_languages_details = "<h3>Language $wanted_lang_name with at least one resource for $resource_type translated over treshold ";
- } else if (is_null($wanted_language) && !is_null($wanted_resource)) {
+ } else if (empty($wanted_language) && !empty($wanted_resource)) {
$tx_only_languages_details = "<h3>Languages with $wanted_resource resource for $resource_type translated over treshold ";
} else {
$tx_only_languages_details = "<h3>Languages with at least one resource for $resource_type translated over treshold ";
@@ -652,7 +648,7 @@ if (0 < count($tx_only_languages)) {
foreach ($tx_only_languages as $tx_only_language) {
$language_name = get_language_name($tx_only_language);
$tx_only_languages_details .= '<li><span class="bold">' . $language_name . '</span>: ';
- if (is_null($wanted_resource)) {
+ if (empty($wanted_resource)) {
$tx_only_languages_details .= build_transifex_link($tx_only_language, NULL, $resource_type);
$tx_only_languages_details .= " (resources over treshold: ";
$resources_above_treshold = array();
@@ -871,11 +867,11 @@ echo $tx_only_languages_details . PHP_EOL;
$diff_desc = "between Transifex and our git repository for $resource_type.";
if (0 < $num_of_resources_w_difference) {
// print any differences between Transifex and our git repository
- if (!is_null($wanted_resource) && !is_null($wanted_language)) {
+ if (!empty($wanted_resource) && !empty($wanted_language)) {
$diff_title = "<h3>Language $wanted_lang_name below have some differences in resource $wanted_resource $diff_desc</h3>";
- } else if (!is_null($wanted_resource) && is_null($wanted_language)) {
+ } else if (!empty($wanted_resource) && empty($wanted_language)) {
$diff_title = "<h3>Languages below have some differences in resource $wanted_resource $diff_desc</h3>";
- } else if (is_null($wanted_resource) && !is_null($wanted_language)) {
+ } else if (empty($wanted_resource) && !empty($wanted_language)) {
$diff_title = "<h3>Language $wanted_lang_name below have some differences $diff_desc</h3>";
} else {
$diff_title = "<h3>Languages below have some differences in resources $diff_desc</h3>";
@@ -892,11 +888,11 @@ if (0 < $num_of_resources_w_difference) {
echo $list_of_resource_diff . PHP_EOL;
}
} else if (0 == count($tx_only_languages)) {
- if (!is_null($wanted_resource) && !is_null($wanted_language)) {
+ if (!empty($wanted_resource) && !empty($wanted_language)) {
$diff_title = "<h3>Congratulations. It seems that resource $wanted_resource in language $wanted_lang_name have no differences $diff_desc</h3>";
- } else if (!is_null($wanted_resource) && is_null($wanted_language)) {
+ } else if (!empty($wanted_resource) && empty($wanted_language)) {
$diff_title = "<h3>Congratulations. It seems that resource $wanted_resource has no differences $diff_desc</h3>";
- } else if (is_null($wanted_resource) && !is_null($wanted_language)) {
+ } else if (empty($wanted_resource) && !empty($wanted_language)) {
$diff_title = "<h3>Congratulations. It seems that in language $wanted_lang_name there is no resources with differences $diff_desc</h3>";
} else {
$diff_title = "<h3>Congratulations. It seems that there is no resources with differences $diff_desc</h3>";