Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /home/mendipla/public_html/includes/src/Mage_Core_functions.php on line 60
Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/mendipla/public_html/includes/src/Mage_Core_functions.php on line 32
m string $currency
* @return Zend_Currency
*/
public function currency($currency)
{
Varien_Profiler::start('locale/currency');
if (!isset(self::$_currencyCache[$this->getLocaleCode()][$currency])) {
$options = array();
try {
$currencyObject = new Zend_Currency($currency, $this->getLocale());
} catch (Exception $e) {
/**
* catch specific exceptions like "Currency 'USD' not found"
* - back end falls with specific locals as Malaysia and etc.
*
* as we can see from Zend framework ticket
* http://framework.zend.com/issues/browse/ZF-10038
* zend team is not going to change it behaviour in the near time
*/
$currencyObject = new Zend_Currency($currency);
$options['name'] = $currency;
$options['currency'] = $currency;
$options['symbol'] = $currency;
}
$options = new Varien_Object($options);
Mage::dispatchEvent('currency_display_options_forming', array(
'currency_options' => $options,
'base_code' => $currency
));
$currencyObject->setFormat($options->toArray());
self::$_currencyCache[$this->getLocaleCode()][$currency] = $currencyObject;
}
Varien_Profiler::stop('locale/currency');
return self::$_currencyCache[$this->getLocaleCode()][$currency];
}
/**
* Returns the first found number from an string
* Parsing depends on given locale (grouping and decimal)
*
* Examples for input:
* ' 2345.4356,1234' = 23455456.1234
* '+23,3452.123' = 233452.123
* ' 12343 ' = 12343
* '-9456km' = -9456
* '0' = 0
* '2 054,10' = 2054.1
* '2'054.52' = 2054.52
* '2,46 GB' = 2.46
*
* @param string|float|int $value
* @return float|null
*/
public function getNumber($value)
{
if (is_null($value)) {
return null;
}
if (!is_string($value)) {
return floatval($value);
}
//trim spaces and apostrophes
$value = str_replace(array('\'', ' '), '', $value);
$separatorComa = strpos($value, ',');
$separatorDot = strpos($value, '.');
if ($separatorComa !== false && $separatorDot !== false) {
if ($separatorComa > $separatorDot) {
$value = str_replace('.', '', $value);
$value = str_replace(',', '.', $value);
}
else {
$value = str_replace(',', '', $value);
}
}
elseif ($separatorComa !== false) {
$value = str_replace(',', '.', $value);
}
return floatval($value);
}
/**
* Functions returns array with price formatting info for js function
* formatCurrency in js/varien/js.js
*
* @return array
*/
public function getJsPriceFormat()
{
$format = Zend_Locale_Data::getContent($this->getLocaleCode(), 'currencynumber');
$symbols = Zend_Locale_Data::getList($this->getLocaleCode(), 'symbols');
$pos = strpos($format, ';');
if ($pos !== false){
$format = substr($format, 0, $pos);
}
$format = preg_replace("/[^0\#\.,]/", "", $format);
$totalPrecision = 0;
$decimalPoint = strpos($format, '.');
if ($decimalPoint !== false) {
$totalPrecision = (strlen($format) - (strrpos($format, '.')+1));
} else {
$decimalPoint = strlen($format);
}
$requiredPrecision = $totalPrecision;
$t = substr($format, $decimalPoint);
$pos = strpos($t, '#');
if ($pos !== false){
$requiredPrecision = strlen($t) - $pos - $totalPrecision;
}
$group = 0;
if (strrpos($format, ',') !== false) {
$group = ($decimalPoint - strrpos($format, ',') - 1);
} else {
$group = strrpos($format, '.');
}
$integerRequired = (strpos($format, '.') - strpos($format, '0'));
$result = array(
'pattern' => Mage::app()->getStore()->getCurrentCurrency()->getOutputFormat(),
'precision' => $totalPrecision,
'requiredPrecision' => $requiredPrecision,
'decimalSymbol' => $symbols['decimal'],
'groupSymbol' => $symbols['group'],
'groupLength' => $group,
'integerRequired' => $integerRequired
);
return $result;
}
/**
* Push current locale to stack and replace with locale from specified store
* Event is not dispatched.
*
* @param int $storeId
*/
public function emulate($storeId)
{
if ($storeId) {
$this->_emulatedLocales[] = clone $this->getLocale();
$this->_locale = new Zend_Locale(Mage::getStoreConfig(self::XML_PATH_DEFAULT_LOCALE, $storeId));
$this->_localeCode = $this->_locale->toString();
Mage::getSingleton('core/translate')->setLocale($this->_locale)->init('frontend', true);
}
else {
$this->_emulatedLocales[] = false;
}
}
/**
* Get last locale, used before last emulation
*
*/
public function revert()
{
if ($locale = array_pop($this->_emulatedLocales)) {
$this->_locale = $locale;
$this->_localeCode = $this->_locale->toString();
Mage::getSingleton('core/translate')->setLocale($this->_locale)->init('adminhtml', true);
}
}
/**
* Returns localized informations as array, supported are several
* types of informations.
* For detailed information about the types look into the documentation
*
* @param string $path (Optional) Type of information to return
* @param string $value (Optional) Value for detail list
* @return array Array with the wished information in the given language
*/
public function getTranslationList($path = null, $value = null)
{
return $this->getLocale()->getTranslationList($path, $this->getLocale(), $value);
}
/**
* Returns a localized information string, supported are several types of informations.
* For detailed information about the types look into the documentation
*
* @param string $value Name to get detailed information about
* @param string $path (Optional) Type of information to return
* @return string|false The wished information in the given language
*/
public function getTranslation($value = null, $path = null)
{
return $this->getLocale()->getTranslation($value, $path, $this->getLocale());
}
/**
* Replace all yy date format to yyyy
*
* @param $currentFormat
* @return mixed
*/
protected function _convertYearTwoDigitTo4($currentFormat)
{
return preg_replace('/(\byy\b)/', 'yyyy', $currentFormat);
}
/**
* Returns the localized country name
*
* @param string $value Name to get detailed information about
* @return array
*/
public function getCountryTranslation($value)
{
return $this->getLocale()->getTranslation($value, 'country', $this->getLocale());
}
/**
* Returns an array with the name of all countries translated to the given language
*
* @return array
*/
public function getCountryTranslationList()
{
return $this->getLocale()->getTranslationList('territory', $this->getLocale(), 2);
}
/**
* Checks if current date of the given store (in the store timezone) is within the range
*
* @param int|string|Mage_Core_Model_Store $store
* @param string|null $dateFrom
* @param string|null $dateTo
* @return bool
*/
public function isStoreDateInInterval($store, $dateFrom = null, $dateTo = null)
{
if (!$store instanceof Mage_Core_Model_Store) {
$store = Mage::app()->getStore($store);
}
$storeTimeStamp = $this->storeTimeStamp($store);
$fromTimeStamp = strtotime($dateFrom);
$toTimeStamp = strtotime($dateTo);
if ($dateTo) {
// fix date YYYY-MM-DD 00:00:00 to YYYY-MM-DD 23:59:59
$toTimeStamp += 86400;
}
$result = false;
if (!is_empty_date($dateFrom) && $storeTimeStamp < $fromTimeStamp) {
}
elseif (!is_empty_date($dateTo) && $storeTimeStamp > $toTimeStamp) {
}
else {
$result = true;
}
return $result;
}
}
Fatal error: Uncaught Error: Class 'Mage_Core_Model_Locale' not found in /home/mendipla/public_html/includes/src/Mage_Core_Model_App.php:378
Stack trace:
#0 /home/mendipla/public_html/includes/src/Mage_Core_Model_App.php(299): Mage_Core_Model_App->_initEnvironment()
#1 /home/mendipla/public_html/includes/src/Mage_Core_Model_App.php(348): Mage_Core_Model_App->baseInit(Array)
#2 /home/mendipla/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#3 /home/mendipla/public_html/index.php(83): Mage::run('', 'store')
#4 {main}
thrown in /home/mendipla/public_html/includes/src/Mage_Core_Model_App.php on line 378