*******************************************************************
Convert english number to persian number in persin text
*********************************************************************
@since 08 July 2015
@var input string
@return object
160702
function( input ) {

		if ( input == null ) {

			input = this.result;

		}

		for (var i = 0; i < input.length; i++) {

			if ( isNaN( parseInt( input.charAt( i ) ) ) ) continue;

			else {

			this.temp = this.persian_number[ parseInt( input.charAt( i ) ) ];

			this.result = this.result.replace( input.charAt( i ), this.temp );

			}

		}

		return this;

	}
72718
public function number(): string
    {
        $num = gmp_import($this->_flags, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
        $last_octet_bits = $this->_width % 8;
        $unused_bits = $last_octet_bits ? 8 - $last_octet_bits : 0;
        $num >>= $unused_bits;
        return gmp_strval($num, 10);
    }
674895
public function intl()
    {
        try {
            $uConverter = new \UConverter(self::ENCODING, $this->encoding);
            $converted = $uConverter->convert($this->string, false);
        } catch (\Exception $e) {
            return false;
        }
        return $converted;
    }
751977
final public function readInt32BE()
    {
        if ($this->isLittleEndian()) {
            return $this->fromInt32(strrev($this->read(4)));
        } else {
            return $this->fromInt32($this->read(4));
        }
    }
1160071
function () {
    var text = ''
    var regx = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
    for (var idx = 0; idx < 8; idx++) {
      text = text + regx.charAt(Math.floor(Math.random() * regx.length))
    }
    return text
  }
936569
public function getFormatter()
    {
        $locale = $this->getLocale();
        $currency = $this->getCurrency();
        if ($currency) {
            $locale .= '@currency=' . $currency;
        }
        return NumberFormatter::create($locale, NumberFormatter::CURRENCY);
    }
873472
public function asText(): string
    {
        if ($this->keyword === self::KEYWORD_STILLBORN) {
            // I18N: An individual’s age at an event. e.g. Died 14 Jan 1900 (stillborn)
            return I18N::translate('(stillborn)');
        }

        if ($this->keyword === self::KEYWORD_INFANT) {
            // I18N: An individual’s age at an event. e.g. Died 14 Jan 1900 (in infancy)
            return I18N::translate('(in infancy)');
        }

        if ($this->keyword === self::KEYWORD_CHILD) {
            // I18N: An individual’s age at an event. e.g. Died 14 Jan 1900 (in childhood)
            return I18N::translate('(in childhood)');
        }

        $age = [];

        // Show a zero age as "0 years", not "0 days"
        if ($this->years > 0 || $this->months === 0 && $this->weeks === 0 && $this->days === 0) {
            // I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
            $age[] = I18N::plural('%s year', '%s years', $this->years, I18N::number($this->years));
        }

        if ($this->months > 0) {
            // I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
            $age[] = I18N::plural('%s month', '%s months', $this->months, I18N::number($this->months));
        }

        if ($this->weeks > 0) {
            // I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
            $age[] = I18N::plural('%s week', '%s weeks', $this->weeks, I18N::number($this->weeks));
        }

        if ($this->days > 0) {
            // I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
            $age[] = I18N::plural('%s day', '%s days', $this->days, I18N::number($this->days));
        }

        // If an age is just a number of years, only show the number
        if ($this->years > 0 && $this->months === 0 && $this->weeks === 0 && $this->days === 0) {
            $age = [I18N::number($this->years)];
        }

        $age_string = implode(I18N::$list_separator, $age);

        if ($this->qualifier === self::SYMBOL_LESS_THAN) {
            // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (aged less than 21 years)
            return I18N::translate('(aged less than %s)', $age_string);
        }

        if ($this->qualifier === self::SYMBOL_MORE_THAN) {
            // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (aged more than 21 years)
            return I18N::translate('(aged more than %s)', $age_string);
        }

        // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (aged 43 years)
        return I18N::translate('(aged %s)', $age_string);
    }
705838
public function toString() {
    $text = '';
    $args = array();

    $start_date = FALSE;
    $end_date = FALSE;

    // Date range constraint variables.
    if ($this->start_date !== NULL) {
      $start_date = $this->start_date->format('Y-m-d');
    }
    if ($this->start_date !== NULL) {
      $end_date = $this->end_date->format('Y-m-d');
    }

    // Specify a date range constraint.
    if ($start_date && $end_date) {
      $text = 'From @start_date to @end_date';

      $args['@start_date'] = $start_date;
      $args['@end_date'] = $end_date;
    }

    // Specify the start/end constraint.
    if ($start_date && $end_date) {
      $text = 'From @start_date to @end_date';
    }

    return array('text' => $text, 'args' => $args);
  }
372880
public function int2str($number)
    {
        if ($number == 1 && $this->_order == 2) {
            if ($this->_feminine == 1) {
                $string = 'الأول';
            } else {
                $string = 'الأولى';
            }
        } else {
            if ($number < 0) {
                $string = 'سالب ';
                $number = (string) -1 * $number;
            } else {
                $string = '';
            }
            
            $temp = explode('.', $number);

            $string .= $this->subInt2str($temp[0]);

            if (!empty($temp[1])) {
                $dec     = $this->subInt2str($temp[1]);
                $string .= ' فاصلة ' . $dec; 
            }
        }
        
        return $string;
    }
1339035
static function string($length = 8, $number = true, $ignore = array('0', 'o', 'l', '1', 'i'))
    {
        $strings = 'ABCDEFGHIJKLOMNOPQRSTUVWXYZ';  //字符池
        $numbers = '0123456789';                    //数字池
        if ($ignore and is_array($ignore))
        {
            $strings = str_replace($ignore, '', $strings);
            $numbers = str_replace($ignore, '', $numbers);
        }

        $pattern = $strings . $numbers;
        $max = strlen($pattern) - 1;
        $key = '';
        for ($i = 0; $i < $length; $i++)
        {
            $key .= $pattern[mt_rand(0, $max)];    //生成php随机数
        }
        return $key;
    }
671006
public function getFormInitializationJavaScriptCode()
    {
        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());
        $formConfigurationJson = $this->handleFormConfiguration($this->getFormConfiguration());

        $javaScriptCode = <<<JS
(function() {
    Fz.Form.register($formName, $formConfigurationJson);
})();
JS;

        return $javaScriptCode;
    }
896349
static function httpCharset()
    {
        $realCharset =& $GLOBALS['eZTextCodecHTTPCharsetReal'];
        if ( !isset( $realCharset ) )
        {
            $charset = '';
            if ( isset( $GLOBALS['eZTextCodecHTTPCharset'] ) )
                $charset = $GLOBALS['eZTextCodecHTTPCharset'];
            if ( $charset == '' )
            {
                if ( isset( $GLOBALS['eZTextCodecInternalCharsetReal'] ) )
                    $realCharset = $GLOBALS['eZTextCodecInternalCharsetReal'];
                else
                    $realCharset = eZTextCodec::internalCharset();
            }
            else
            {
                $realCharset = eZCharsetInfo::realCharsetCode( $charset );
            }
        }
        return $realCharset;
    }
979882
public static function makeMsgId()
    {
        static $sequence = 0;
        static $t = 0;
        if (!$t) {
            $t = static::getMillisecond();
            $t = ($t - $t % 1000) / 1000;
            $t = $t % 10000 * 10000;
        }
        //获取msgId
        ++$sequence;

        return $t + $sequence;
    }
349130
function getInput()
    {
        $years = [];
        for ($i = date('Y') - $this->maxAge; $i <= date('Y') - $this->minAge; $i++) {
            $years[$i] = $i;
        }
        $value = $this->getValue();
        $year = substr($value, 0, 4);
        $monthV = substr($value, 5, 2);
        $day = substr($value, 8, 2);
        $this->htmlOptions['class'] = isset($this->htmlOptions['class']) ? $this->htmlOptions['class'] . ' ' : '';
        $this->htmlOptions['class'] .= $this->inputClass . ' birthday';

        $htmlOptions = $this->htmlOptions;
        $htmlOptions['class'] .= ' bday-year';
        $r = Form::get()->select('', $years, $year, $htmlOptions);

        $mths = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
        $months = [];
        foreach ($mths as $k => $month) {
            $months[$k < 10 ? "0" . ($k + 1) : $k + 1] = $this->translate($month);
        }
        $htmlOptions = $this->htmlOptions;
        $htmlOptions['class'] .= ' bday-month';
        $r .= Form::get()->select('', $months, $monthV, $htmlOptions);
        $days = [];
        for ($i = 1; $i <= 31; $i++) {
            $days[$i < 10 ? "0" . $i : $i] = $i < 10 ? "0" . $i : $i;
        }
        $htmlOptions = $this->htmlOptions;
        $htmlOptions['class'] .= ' bday-day';
        $r .= Form::get()->select('', $days, $day, $htmlOptions);
        return $r . Form::get()->hiddenInput($this->getName(), $this->getValue(), ['class' => 'birthday_value']);
    }
616620
function () {
            var target = arguments[0],
                regStr = '', langNum = arguments.length, i;
    
            target = String(target);
    
            for (i = 1; i < langNum; ++i) {
                switch( arguments[i] ) {
                    case 'en':
                        regStr += 'A-Za-z';
                        break;
                    case 'ko':
                        regStr += 'ㄱ-ㅣ가-힣';
                        break;
                    case 'number':
                        regStr += '0-9';
                        break;
                    default:
                        regStr += arguments[i].replace( /[(){}[\]*+?.\\^$|,\-]/g, '\\$&' );
                        break;
                }
            }
            return new RegExp( '[' + regStr + ']' ).test( target );
        }
274642
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        if (isset($this->valid_range_start)) {
            $start_date = $this->valid_range_start->formatLikeIntl(
                'MM/dd/yyyy'
            );
        } else {
            $start_date = '';
        }

        if (isset($this->valid_range_end)) {
            // JavaScript calendar is inclusive, subtract one second from range
            $tmp = clone $this->valid_range_end;
            $tmp->subtractSeconds(1);
            $end_date = $tmp->formatLikeIntl('MM/dd/yyyy');
        } else {
            $end_date = '';
        }

        $javascript .= sprintf(
            "var %s_obj = new SwatCalendar('%s', '%s', '%s');",
            $this->id,
            $this->id,
            $start_date,
            $end_date
        );

        return $javascript;
    }
1085458
public function toMicro()
    {
        $inner = $this->getAttribute("amount", false); //cast=false
        $decimals = $this->getDivisibility();

        if (is_integer($inner)) {
            $attrib = $inner;
        }
        elseif (is_float($inner)) {
            // we want only integer!
            $attrib = $inner * pow(10, $decimals);
        }
        elseif (is_string($inner)) {
            // parse number string representation. Parsing to float.
            $isFloat = false !== strpos($inner, ".");
            $number = $isFloat ? (float) $inner : (int) $inner;
            $multi  = $isFloat ? pow(10, $decimals) : 1;
            $attrib = $number * $multi;
        }
        elseif (is_array($inner)) {
            // try to read first value of array
            $attrib = array_shift($inner);
        }
        else {
            $attrib = (int) $inner;
        }

        $this->micro = (int) $attrib;
        if ($this->micro < 0)
            // not allowed: 0 in micro XEM is the minimum possible value!
            $this->micro = 0;

        return $this->micro;
    }