From fbf7b9b6ce63bdedd4d15adb615af0291c684bbf Mon Sep 17 00:00:00 2001 From: grum Date: Wed, 22 Oct 2008 21:08:44 +0000 Subject: "remove grum_plugins_classes-2 and AMM plugin asked in topic #p98003" git-svn-id: http://piwigo.org/svn/branches/2.0@2791 68402e56-0260-453c-a942-63ccdbb3a9ee --- .../grum_plugins_classes-2/translate.class.inc.php | 192 --------------------- 1 file changed, 192 deletions(-) delete mode 100755 plugins/grum_plugins_classes-2/translate.class.inc.php (limited to 'plugins/grum_plugins_classes-2/translate.class.inc.php') diff --git a/plugins/grum_plugins_classes-2/translate.class.inc.php b/plugins/grum_plugins_classes-2/translate.class.inc.php deleted file mode 100755 index 255e5542d..000000000 --- a/plugins/grum_plugins_classes-2/translate.class.inc.php +++ /dev/null @@ -1,192 +0,0 @@ -> - ------------------------------------------------------------------------------ - - this classes provides base functions to manage call to "translate.google.com" - - release 2.x use durect call to Google Translate AJAX API, so all functions - from PHP class are removed (except for "can_translate") - class call API in HTML header, and provide a .js file manage API call - - - constructor translate() - - (public) function can_translate($from, $to) //v1.1 - - version 1.1.1 - - google have changed HTML code for translation page ; change search string of translation result - - bug corrected : if language given with uppercase, force them to lowercase - version 2.0.0 - - use of Google Translate javascript API - >> http://code.google.com/apis/ajaxlanguage/ - - ---------------------------------------------------------------------- */ -class translate -{ - var $language_list; - - function translate() - { - //alloweds from->to transations languages - $this->language_list=array_flip( - array( - 'ar', //arabic - 'bg', //Bulgarian - 'zh', //Chinese (simplified) - 'hr', //Croatian - 'cs', //Czech - 'da', //Danish - "nl", //Dutch - 'en', //English - 'fi', //Finnish - "fr", //French - "de", //German - "el", //Greek - 'hi', //Hindi - "it", //Italian - "ja", //Japanese - "ko", //Korean - 'no', //Norwegian - 'pl', //Polish - "pt", //Portuguese - 'ro', //Romanian - "ru", //Russian - "es", //Spanish - 'sv' //Swedish - ) - ); - add_event_handler('loc_end_page_header', array(&$this, 'load_JS')); - } - - function load_JS() - { - global $template; - - $googleload=' - -'; - - $template->append('head_elements', $googleload); - - - } - - function can_translate($from, $to) - { - if(isset($this->language_list[strtolower($from)])&&isset($this->language_list[strtolower($to)])) - { - return(true); - } - else - { - return(false); - } - } - - -/* - theses methods are removed for direct use of the Google AJAX API (better choice for - performance) - - how to : - create one instance of this classe - classe can be used by server to know authorized language to be translated - all translations have to be made with javascript functions - - =8<=========================================================================== - - function set_languages($lang) - { - $pair=explode('|', strtolower($lang)); - - if(isset($this->language_list[$pair[0]])&&isset($this->language_list[$pair[1]])) - { - $this->from_to_lang=strtolower($lang); - } - return($this->from_to_lang); - } - - function get_languages() - { - return($this->from_to_lang); - } - - function set_input_charset($charset) - { - $this->input_charset=$charset; - } - - function get_input_charset($charset) - { - return($this->input_charset); - } - - function set_output_charset($charset) - { - $this->output_charset=$charset; - } - - function get_output_charset($charset) - { - return($this->output_charset); - } - - function do_translation($text) - { - if(ini_get('allow_url_fopen')!="1") - { - return(""); - } - - $req="http://translate.google.com/translate_t?text=".urlencode($text). - "&langpair=".strtolower($this->from_to_lang); - if($this->input_charset!="") - { - $req.="&ie=".$this->input_charset; - } - if($this->output_charset!="") - { - $req.="&oe=".$this->output_charset; - } - - $handle=fopen($req, "r"); - if($handle) - { - $contents=""; - while (!feof($handle)) - { - $contents .= fread($handle, 4196); - } - fclose($handle); - - $search="
"; - $p = strpos($contents, $search); - if($p>0) - { - $contents=substr($contents, $p+strlen($search)); - $search="
"; - $p = strpos($contents, $search); - $contents=substr($contents, 0, $p); - } - else - { - $contents=""; - } - - return($contents); - } - else - { - return(""); - } - } -*/ - -} //class - -?> \ No newline at end of file -- cgit v1.2.3