CHips L MINI SHELL

CHips L pro

Current Path : /opt/cpanel/ea-php54/root/usr/share/pear/RVSeagullMod/lib/RVSGL/rvsLibs/
Upload File :
Current File : //opt/cpanel/ea-php54/root/usr/share/pear/RVSeagullMod/lib/RVSGL/rvsLibs/Charset.php

<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// WebSite:  http://www.rvglobalsoft.com
// Unauthorized copying is strictly forbidden and may result in severe legal action.
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
//
// =====YOU MUST KEEP THIS COPYRIGHTS NOTICE INTACT AND CAN NOT BE REMOVE =======
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
// This Agreement is a legal contract, which specifies the terms of the license
// and warranty limitation between you and RV Global Soft Co.,Ltd. and RV Site Builder.
// You should carefully read the following terms and conditions before
// installing or using this software.  Unless you have a different license
// agreement obtained from RV Global Soft Co.,Ltd., installation or use of this software
// indicates your acceptance of the license and warranty limitation terms
// contained in this Agreement. If you do not agree to the terms of this
// Agreement, promptly delete and destroy all copies of the Software.
//
// =====  Grant of License =======
// The Software may only be installed and used on a single host machine.
//
// =====  Disclaimer of Warranty =======
// THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
// WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
// WARRANTIES WHETHER EXPRESSED OR IMPLIED.   BECAUSE OF THE VARIOUS HARDWARE
// AND SOFTWARE ENVIRONMENTS INTO WHICH RV SITE BUILDER MAY BE USED, NO WARRANTY OF
// FITNESS FOR A PARTICULAR PURPOSE IS OFFERED.  THE USER MUST ASSUME THE
// ENTIRE RISK OF USING THIS PROGRAM.  ANY LIABILITY OF RV GLOBAL SOFT CO.,LTD. WILL BE
// LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
// IN NO CASE SHALL RV GLOBAL SOFT CO.,LTD. BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
// CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
// OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
// BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
// NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
// RV GLOBAL SOFT CO.,LTD. IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
// RV GLOBAL SOFT CO.,LTD.'S LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
// BY LICENSEE TO RV GLOBAL SOFT CO.,LTD.
// +---------------------------------------------------------------------------+
// $Id$
// +---------------------------------------------------------------------------+

/**
 * RvSiteBuilder net libary
 *
 * @package RvsLibs
 * @author  Pairote Manunphol <pairote@rvglobalsoft.com>
 * @version $Revision$
 * @since   PHP 5.1
 */
if (class_exists('RvsLibs_Charset') === false) {
	class RvsLibs_Charset
	{
		public static function getCharsetData($charsetId)
		{
			SGL::logMessage(null, PEAR_LOG_DEBUG);
			$aCharsetData = DaoFactory::Charset()->findCharsetDataByCharsetId($charsetId, 'getrowobj');
			if (isset($aCharsetData)) {
				return $aCharsetData;
			} else {
				return array();
			}
		}

		/* ฟังก์ชั่นแสดงชุดตัวอักษร charset */
		public static function getAllLangData()
		{
			$cache = &RvsLibs_File::rvsCache();
			if ($serialized = $cache->get('aLank', 'cachedata')) {
				$aLank = unserialize($serialized);
				SGL::logMessage('rvdebug ====== optimize aLangData from cache', PEAR_LOG_DEBUG);
			} else {

				$aChar = RvsLibs_Util::getlistcharset();
				$aLank = array();
				foreach ($GLOBALS['_SGL']['LANGUAGE'] as $k => $v) {
					if (!strstr($k,'utf-8')) {
						continue;
					}
					$langKey = array_search(RvsLibs_String::strtolower($v[4]), $aChar);
					if ($langKey) {
						//is utf-8 or english และแปลเกิน 20%
						if ( (isset($v[7]) && $v[7] == true && self::isLangOver20($k) == true) 
							  || $v[4] == 'english') {
							$aLank[$langKey] = ucfirst($v[4]);
						} else {
							if (self::isLangOver20($k) === true) {
								//show lang if owner translate
								$tranRootFile = RVS_ROOT_HOME . '/.rvsitebuilder/lang/sitebuilder/' . $v[1] . '.php';
								$tranResellerFile = RVS_OWNER_HOME . '/.rvsitebuilder/lang/sitebuilder/' .  $v[1] . '.php';
								if (is_file($tranRootFile) == true) {
									$aLank[$langKey] = ucfirst($v[4]);
								} elseif (is_file($tranResellerFile) == true) {
									$aLank[$langKey] = ucfirst($v[4]);
								} else {
									//case : admin donot translation validate with file distribuild
									//echo ucfirst($v[4]) .'<br>';
									$aLank[$langKey] = ucfirst($v[4]);
								}
							}
						}

					}

				}
				asort($aLank);

				$serialized = serialize($aLank);
				$cache->save($serialized, 'aLank', 'cachedata');
				SGL::logMessage('rvdebug ====== optimize aLangData from file', PEAR_LOG_DEBUG);
			}

			return $aLank;

		}

		/**
		 * Total = key ที่ admin แปล +  แปลแล้ว ที่ distribuild ไป
		 *  Total >= 20% ของทั้งหมด
		 * @param $lang
		 * @return unknown_type
		 */
		public static function isLangOver20($lang)
		{
			$langFile = RvsLibs_File::buildPath(array(RVS_OWNER_HOME, '.rvsitebuilder', 'lang', 'sitebuilder', $GLOBALS['_SGL']['LANGUAGE'][$lang][1] . '.php'));
			$aDistEngLang = RvsLibs_Project::getSitebuilderDistLang('sitebuilder' , 'en-utf-8');
			$aDistLang = RvsLibs_Project::getSitebuilderDistLang('sitebuilder' , $lang);

			$numEng = array_intersect($aDistEngLang, $aDistLang);
			$total = count($aDistLang);
			$totalEng = count($numEng);

			$twentyPercense = round((20/100)*($total));
			//ทั้งหมด - key อังกฤษ = แปลแล้ว
			$tranComplete = $total - $totalEng;
			//SGL::logMessage($lang . " culculate tranComplete: " . $tranComplete, PEAR_LOG_DEBUG);
			//case 1:  admin translation have file
			if (is_file($langFile)) {
				include_once $langFile;
				if (isset($words)) {
					SGL::logMessage("All key num:" . $twentyPercense, PEAR_LOG_DEBUG);
					SGL::logMessage("Admin key num:" . count($words), PEAR_LOG_DEBUG);
					if ((count($words) + $tranComplete) >= $twentyPercense) {
						return true;
					}
				}
			} elseif ($tranComplete != 0 && ($tranComplete) >= $twentyPercense) {
				//case 2: admin donot translation validate with file distribuild
				return true;
			}
			return false;
		}

	}
}
?>

Copyright 2K16 - 2K18 Indonesian Hacker Rulez