XarayaTranslationMemory  1.6
Common.php
Go to the documentation of this file.
1 <?php
2 /***************************************************************************
3  * Copyright (C) 2005-2020 by Ferenc Veres *
4  * lion@netngine.hu *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 3 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18  ***************************************************************************/
19 include_once('/usr/share/php/adodb/adodb-exceptions.inc.php');
20 include_once('/usr/share/php/adodb/adodb.inc.php');
21 
22 include_once('TranslationProject.php');
23 include_once('TranslationString.php');
24 include_once('TranslationWordList.php');
25 include_once('TranslationWord.php');
26 include_once('ProjectIterator.php');
27 include_once('StringIterator.php');
28 
36 function fixstr($text)
37 {
38  return str_replace("'", "''", $text);
39 }
40 
49 function FixQuot($text)
50 {
51  $s = str_replace("&", "&amp;", $text);
52  $s = str_replace("\"", "&quot;", $s);
53  $s = str_replace("<", "&lt;", $s);
54  $s = str_replace(">", "&gt;", $s);
55  return $s;
56 }
61 function &GetDbConn()
62 {
63  global $DB;
64  return $DB;
65 }
66 
71 function &GetTables()
72 {
73  $tables["WordIndex"] = "WordIndex";
74  $tables["SentenceIndex"] = "SentenceIndex";
75  $tables["Strings"] = "Strings";
76  $tables["Projects"] = "Projects";
77  $tables["Locales"] = "Locales";
78  return $tables;
79 }
80 
84 function GetConfigVar($varName)
85 {
86  global $CONFIG;
87  return $CONFIG[$varName];
88 }
89 
94 function CacheIndexes()
95 {
97  //TranslationString::InitWordSentencesCache();
100 }
101 
107 function GetMicroTime()
108 {
109  list($usec, $sec) = explode(" ",microtime());
110  return ((float)$usec + (float)$sec);
111 }
112 
119 function ShowMicroTime($basetime, $comment = "")
120 {
121  echo("<p>$comment".($comment != "" ? ": " : "").number_format(GetMicroTime()-$basetime, 6, ".", " ")."</p>");
122 }
123 ?>
fixstr($text)
Definition: Common.php:36
static InitSentenceLengthCache()
CacheIndexes()
Definition: Common.php:94
FixQuot($text)
Definition: Common.php:49
& GetTables()
Definition: Common.php:71
& GetDbConn()
Definition: Common.php:61
GetMicroTime()
Definition: Common.php:107
$CONFIG['db_software']
Definition: config.inc.php:24
ShowMicroTime($basetime, $comment="")
Definition: Common.php:119
GetConfigVar($varName)
Definition: Common.php:84
$DB
Definition: export.php:28