Skip to content

Commit 69f0eb0

Browse files
committed
Updates old file link for GoogleTranslate.php.
1 parent 4ce91a6 commit 69f0eb0

3 files changed

Lines changed: 18 additions & 14 deletions

File tree

‎ggl.php‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
require_once 'inc/session_utility.php';
2020
require_once 'inc/googleTimeToken.php' ;
21-
require_once 'inc/classes/googleTranslateClass.php';
21+
require_once 'inc/classes/GoogleTranslate.php';
2222

2323
use Lwt\Classes\GoogleTranslate as GoogleTranslate;
2424

@@ -39,7 +39,8 @@ function translate_sentence($text, $translation)
3939
<span title="Translated via Google Translate">
4040
<?php echo tohtml($translation); ?>
4141
</span>
42-
<p>Original sentence: </p><blockquote><?php echo tohtml($text); ?></blockquote>
42+
<p>Original sentence: </p>
43+
<blockquote><?php echo tohtml($text); ?></blockquote>
4344
<?php
4445
}
4546

@@ -61,8 +62,8 @@ function translate_term($text, $file, $sl, $tl)
6162
<img id="textToSpeech" style="cursor: pointer;" title="Click to read!"
6263
src="<?php print_file_path('icn/speaker-volume.png'); ?>" ></img>
6364

64-
<img id="del_translation" style="cursor: pointer;" title="Empty Translation Field"
65-
onclick="deleteTranslation ();"
65+
<img id="del_translation" style="cursor: pointer;"
66+
title="Empty Translation Field" onclick="deleteTranslation ();"
6667
src="<?php print_file_path('icn/broom.png'); ?>" ></img>
6768
</h2>
6869

@@ -113,7 +114,9 @@ function translate_term($text, $file, $sl, $tl)
113114
*/
114115
function translate_text($text, $sl, $tl, $sentence_mode)
115116
{
116-
$file = GoogleTranslate::staticTranslate($text, $sl, $tl, getGoogleTimeToken());
117+
$file = GoogleTranslate::staticTranslate(
118+
$text, $sl, $tl, getGoogleTimeToken()
119+
);
117120

118121
if ($file === false) {
119122
my_die("Unable to get translation from Google!");
@@ -151,12 +154,12 @@ function do_content($text)
151154
if (trim($text) != '') {
152155
translate_text($text, $_GET["sl"], $_GET["tl"], isset($_GET['sent']));
153156
} else {
154-
echo "<p class=\"msgblue\">Term is not set!</p>";
157+
echo '<p class="msgblue">Term is not set!</p>';
155158
}
156159
pageend();
157160
}
158161

159-
if (isset($_GET['text'])) {
162+
if (isset($_GET["text"])) {
160163
do_content($_GET["text"]);
161164
}
162165
?>

‎inc/classes/GoogleTranslate.php‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* \brief Defines GoogleTranslate class for word translation
66
*
77
* Usage:
8-
* require_once( 'googleTranslateClass.php' );
8+
* use Lwt\Classes\GoogleTranslte;
9+
* require_once( 'GoogleTranslate.php' );
910
* $translations = GoogleTranslate::staticTranslate('Hello','en','de');
1011
* if(!$translations) echo 'Error: No translation found!';
1112
* else
@@ -34,7 +35,7 @@ class GoogleTranslate
3435
"?client=t&q=%s&hl=en&sl=%s&tl=%s&dt=t&dt=at&dt=bd&ie=UTF-8&oe=UTF-8&oc=1&" .
3536
"otf=2&ssel=0&tsel=3&tk=%s";
3637

37-
private static final function setHeaders(): void
38+
private static function setHeaders(): void
3839
{
3940
self::$headers = array(
4041
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
@@ -47,7 +48,7 @@ private static final function setHeaders(): void
4748
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'
4849
);
4950
}
50-
private static final function generateToken($str, $tok): string
51+
private static function generateToken($str, $tok): string
5152
{
5253
$t = $c = isset($tok)?$tok[0]:408254;//todo floor(time()/3600);
5354
$x = hexdec(80000000);
@@ -119,7 +120,7 @@ private static final function generateToken($str, $tok): string
119120
*
120121
* @return string
121122
*/
122-
public static final function getDomain($domain)
123+
public static function getDomain($domain)
123124
{
124125
$loc = array(
125126
'com.ar', 'at', 'com.au', 'be', 'com.br', 'ca', 'cat', 'ch', 'cl', 'cn',
@@ -159,7 +160,7 @@ public function __construct($from, $to)
159160
{
160161
$this->setLangFrom($from)->setLangTo($to);
161162
}
162-
public static final function makeCurl($url, $cookieSet = false): string|bool
163+
public static function makeCurl($url, $cookieSet = false): string|bool
163164
{
164165
if (is_callable('curl_init')) {
165166
if (!$cookieSet) {

‎psalm.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<directory name="vendor" />
1313
<!-- Ignore WordPress server configuration files-->
1414
<file name="wp_lwt_st*.php" />
15-
<!-- Should this file be deleted? -->
16-
<file name="googleTranslateClass.php" />
15+
<!-- Should this really be ignored? -->
16+
<file name="inc/classes/GoogleTranslate.php" />
1717
</ignoreFiles>
1818
</projectFiles>
1919

0 commit comments

Comments
 (0)