コード例 #1
1
ファイル: index.blade.php プロジェクト: sagaekakristi/ppla02
function convertToCurrency($uang)
{
    $number = (string) $uang;
    $numberLength = strlen($number);
    $numberArray = array();
    $currencyArray = array();
    $currency = "";
    for ($i = 0; $i < $numberLength; $i++) {
        array_push($numberArray, $number[$i]);
    }
    $j = $numberLength - 1;
    $k = $numberLength - 1;
    for ($i = 0; $i <= $j; $i++) {
        $currencyArray[$i] = $numberArray[$k];
        $k--;
    }
    $count = 0;
    for ($i = 0; $i < sizeof($currencyArray); $i++) {
        if ($count % 3 == 0 && $count != 0) {
            $currency = $currency . ".";
        }
        $currency = $currency . $currencyArray[$i];
        $count++;
    }
    return strrev($currency);
}
コード例 #2
0
ファイル: Encryptor.php プロジェクト: pecqueurS/hylacore
 /**
  * algo($mdp) algo
  * Ex : 'jean-paul' -> '5ORJpIwFYJlCIBbBoB'
  * @param STR $mdp
  * @return STR
  */
 public static function crypt($mdp)
 {
     $arr1 = str_split($mdp);
     $arr2 = array();
     $count = count($arr1);
     $lettre = array();
     for ($i = 65; $i <= 90; $i++) {
         $lettre[] = chr($i);
     }
     for ($i = 48; $i <= 57; $i++) {
         $lettre[] = chr($i);
     }
     for ($i = 97; $i <= 122; $i++) {
         $lettre[] = chr($i);
     }
     $code_int1 = '';
     for ($i = 0; $i < $count; $i++) {
         $arr1[$i] = ord($arr1[$i]);
         $arr2[$i] = intval(pow($i + 10, 4) * ($i + 7) / $arr1[$i]);
         $arr2[$i] = str_pad($arr2[$i], 6, "001", STR_PAD_LEFT);
         $arr3[$i] = str_split($arr2[$i], 3);
         $a = $arr3[$i][0] % 61;
         $b = $arr3[$i][1] % 61;
         $code_int1 .= $lettre[$a];
         $code_int1 .= $lettre[$b];
     }
     $code_int2 = strrev($code_int1);
     return $code_int2;
 }
コード例 #3
0
 private function inverse($text, $inverse = 1)
 {
     if ($inverse == 1) {
         $text = strrev($text);
     }
     return $text;
 }
コード例 #4
0
ファイル: func.php プロジェクト: vokson/scad.local
function bytes2double($number, $MNO, $STEP)
{
    //    echo 'Number has '.strlen($number).' bytes = '.$number.'<br/>';
    //переворачиваем строку
    $number = strrev($number);
    //создаем массив
    $mas = NULL;
    for ($i = 0; $i < 8; $i++) {
        $mas[$i] = sprintf("%08b", ord($number[$i]));
    }
    //    var_dump($mas);
    //создаем 64 битную строку
    $s = implode('', $mas);
    //    echo 'S = '.$s.'<br/>';
    //разделяем на биты знака, экспоненты и мантиссы
    $znak = substr($s, 0, 1);
    //    echo 'ZNAK = '.$znak.'<br/>';
    $exp = substr($s, 1, 11);
    //    echo 'EXP = '.bindec($exp).'<br/>';
    $mant = substr($s, 12, 52);
    //    echo 'MANT = '.bindec($mant).'<br/>';
    //находим множители
    $a = pow(-1, bindec($znak));
    //    echo 'A = '.$a.'<br/>';
    $b = pow(2, bindec($exp) - $STEP - 1023);
    //    echo 'B = '.$b.'<br/>';
    $c = 1 + bindec($mant) / pow(2, 52);
    //    echo 'C = '.$c.'<br/>';
    //считаем результат
    //    echo 'RESULT = '.($a*$b*$c*$MNO).'<br/>';
    return $a * $b * $c * $MNO;
}
コード例 #5
0
ファイル: RandomUtil.php プロジェクト: planetenkiller/core
 /**
  * Return a seed value for the srand() function
  *
  * @deprecated Since 1.3.0, as this is not required since PHP 4.2.0.
  *
  * @return The resulting seed value
  */
 public static function getSeed()
 {
     $factor = 95717;
     // prime
     list($usec, $sec) = explode(" ", microtime());
     return (double) strrev($usec * $factor / M_PI);
 }
コード例 #6
0
ファイル: staticstream.php プロジェクト: evanjt/core
 public function testMultipleFiles()
 {
     file_put_contents('static://foo', $this->sourceText);
     file_put_contents('static://bar', strrev($this->sourceText));
     $this->assertEquals($this->sourceText, file_get_contents('static://foo'));
     $this->assertEquals(strrev($this->sourceText), file_get_contents('static://bar'));
 }
コード例 #7
0
 public function SetEncryption()
 {
     $this->iv = mcrypt_create_iv(mcrypt_get_iv_size(self::ENCRYPTION_TYPE, self::ENCRYPTION_MODE), MCRYPT_DEV_URANDOM);
     $this->encryptionKey = strrev(Config::Init($this->app)->Get(\Puzzlout\Framework\Enums\AppSettingKeys::EncryptionKey));
     $this->hashSalt = strrev(Config::Init($this->app)->Get(\Puzzlout\Framework\Enums\AppSettingKeys::PasswordSalt));
     return $this;
 }
コード例 #8
0
ファイル: tel.php プロジェクト: akshayxhtmljunkies/brownglock
 /**
  * Converts strings of integers into more readable telephone format
  *
  * By default, the ITU-T format will automatically be used.
  * However, one of the allowed unit types may also be used instead.
  *
  * @param   integer  $number       The integers in a phone number with dot separated country code
  *                                 ccc.nnnnnnn where ccc represents country code and nnn represents the local number.
  * @param   string   $displayplan  The numbering plan used to display the numbers.
  *
  * @return  string  The formatted telephone number.
  *
  * @see     JFormRuleTel
  * @since   1.6
  */
 public static function tel($number, $displayplan)
 {
     $number = explode('.', $number);
     $countrycode = $number[0];
     $number = $number[1];
     if ($displayplan == 'ITU-T' || $displayplan == 'International' || $displayplan == 'int' || $displayplan == 'missdn' || $displayplan == null) {
         $display[0] = '+';
         $display[1] = $countrycode;
         $display[2] = ' ';
         $display[3] = implode(str_split($number, 2), ' ');
     } elseif ($displayplan == 'NANP' || $displayplan == 'northamerica' || $displayplan == 'US') {
         $display[0] = '(';
         $display[1] = substr($number, 0, 3);
         $display[2] = ') ';
         $display[3] = substr($number, 3, 3);
         $display[4] = '-';
         $display[5] = substr($number, 6, 4);
     } elseif ($displayplan == 'EPP' || $displayplan == 'IETF') {
         $display[0] = '+';
         $display[1] = $countrycode;
         $display[2] = '.';
         $display[3] = $number;
     } elseif ($displayplan == 'ARPA' || $displayplan == 'ENUM') {
         $number = implode(str_split(strrev($number), 1), '.');
         $display[0] = '+';
         $display[1] = $number;
         $display[2] = '.';
         $display[3] = $countrycode;
         $display[4] = '.e164.arpa';
     }
     $display = implode($display, '');
     return $display;
 }
コード例 #9
0
ファイル: Ean13.php プロジェクト: mnfjorge/moip-php
 /**
  * Defined by Zend_Validate_Interface
  *
  * Returns true if and only if $value contains a valid barcode
  *
  * @param  string $value
  * @return boolean
  */
 public function isValid($value)
 {
     $valueString = (string) $value;
     $this->_setValue($valueString);
     if (strlen($valueString) !== 13) {
         $this->_error(self::INVALID_LENGTH);
         return false;
     }
     $barcode = strrev(substr($valueString, 0, -1));
     $oddSum = 0;
     $evenSum = 0;
     for ($i = 0; $i < 12; $i++) {
         if ($i % 2 === 0) {
             $oddSum += $barcode[$i] * 3;
         } elseif ($i % 2 === 1) {
             $evenSum += $barcode[$i];
         }
     }
     $calculation = ($oddSum + $evenSum) % 10;
     $checksum = $calculation === 0 ? 0 : 10 - $calculation;
     if ($valueString[12] != $checksum) {
         $this->_error(self::INVALID);
         return false;
     }
     return true;
 }
コード例 #10
0
ファイル: base.php プロジェクト: adhocore/dsa
/**
 * Converts base of numbers. Supports base 2 to 36.
 * Note: Native support exists http://php.net/base_convert.
 *
 * @author Jitendra Adhikari <*****@*****.**>
 *
 * @param  string $num      Numeric string.
 * @param  int    $tobase   To base
 * @param  int    $frombase From base (defaults to 10)
 * 
 * @return string           The number with converted base
 * 
 * @throws InvalidArgumentException  If input string or base is invalid
 */
function convert_base($num, $tobase, $frombase = 10)
{
    if ($tobase == $frombase) {
        return $num;
    }
    $map = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    if ($tobase > strlen($map) or $tobase < 2 or $frombase > strlen($map) or $frombase < 2) {
        throw new \InvalidArgumentException('Given base not yet supported');
    }
    // Validate $num
    if (trim(strtoupper($num), substr($map, 0, $frombase))) {
        throw new \InvalidArgumentException(sprintf('%s is not valid base %s number', $num, $frombase));
    }
    // Adapt to base 10 (only for first go, not used by recursion)
    if (10 != $frombase) {
        $tmp = 0;
        foreach (str_split(strrev($num)) as $pow => $n) {
            $tmp += stripos($map, $n) * pow($frombase, $pow);
        }
        $num = $tmp;
    }
    if ($num < $tobase) {
        return $map[(int) $num];
    }
    return convert_base(floor($num / $tobase), $tobase) . $map[$num % $tobase];
}
コード例 #11
0
 /**
  * Match sequences of three or more characters.
  *
  * @copydoc Match::match()
  */
 public static function match($password, array $userInputs = array())
 {
     $matches = array();
     $passwordLength = strlen($password);
     $sequences = self::LOWER . self::UPPER . self::DIGITS;
     $revSequences = strrev($sequences);
     for ($i = 0; $i < $passwordLength; $i++) {
         $pattern = false;
         $j = $i + 2;
         // Check for sequence sizes of 3 or more.
         if ($j < $passwordLength) {
             $pattern = substr($password, $i, 3);
         }
         // Find beginning of pattern and then extract full sequences intersection.
         if ($pattern && ($pos = strpos($sequences, $pattern)) !== false) {
             // Match only remaining password characters.
             $remainder = substr($password, $j + 1);
             $pattern .= static::intersect($sequences, $remainder, $pos + 3);
             $params = array('ascending' => true, 'sequenceName' => static::getSequenceName($pos), 'sequenceSpace' => static::getSequenceSpace($pos));
             $matches[] = new static($password, $i, $i + strlen($pattern) - 1, $pattern, $params);
             // Skip intersecting characters on next loop.
             $i += strlen($pattern) - 1;
         } elseif ($pattern && ($pos = strpos($revSequences, $pattern)) !== false) {
             $remainder = substr($password, $j + 1);
             $pattern .= static::intersect($revSequences, $remainder, $pos + 3);
             $params = array('ascending' => false, 'sequenceName' => static::getSequenceName($pos), 'sequenceSpace' => static::getSequenceSpace($pos));
             $matches[] = new static($password, $i, $i + strlen($pattern) - 1, $pattern, $params);
             $i += strlen($pattern) - 1;
         }
     }
     return $matches;
 }
コード例 #12
0
 function it_supports_default_action()
 {
     $this->setDefault(function ($value) {
         return strrev($value);
     })->shouldReturn($this);
     $this('some_value_to_match')->shouldReturn('hctam_ot_eulav_emos');
 }
コード例 #13
0
ファイル: menu.php プロジェクト: dalinhuang/shopexts
 /**
  * ShopEx licence
  *
  * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
  * @license  http://ecos.shopex.com/license/gpl GPL License
  */
 function function_menu()
 {
     $shop_base = app::get('site')->router()->gen_url(array('app' => 'site', 'ctl' => 'sitemaps', 'act' => 'catalog'));
     $shop_base = substr($shop_base, 0, -strpos(strrev($shop_base), '.')) . 'xml';
     $html[] = "<a href='{$shop_base}' target='_blank'>sitemaps</a>";
     return $html;
 }
コード例 #14
0
 function generateSIN($separator = ' ')
 {
     $validPrefix = array(1, 2, 3, 4, 5, 6, 7, 9);
     $sin = array_rand($validPrefix, 1);
     $length = 9;
     while (strlen($sin) < $length - 1) {
         $sin .= rand(0, 9);
     }
     $sum = 0;
     $pos = 0;
     $reversedSIN = strrev($sin);
     while ($pos < $length - 1) {
         $odd = $reversedSIN[$pos] * 2;
         if ($odd > 9) {
             $odd -= 9;
         }
         $sum += $odd;
         if ($pos != $length - 2) {
             $sum += $reversedSIN[$pos + 1];
         }
         $pos += 2;
     }
     $checkdigit = ((floor($sum / 10) + 1) * 10 - $sum) % 10;
     $sin .= $checkdigit;
     $sin1 = substr($sin, 0, 3);
     $sin2 = substr($sin, 3, 3);
     $sin3 = substr($sin, 6, 3);
     return $sin1 . $separator . $sin2 . $separator . $sin3;
 }
コード例 #15
0
    /**
     * Render the captcha
     * 
     * @param  ElementInterface $element 
     * @return string
     */
    public function render(ElementInterface $element)
    {
        $attributes = $element->getAttributes();

        if (!isset($attributes['captcha']) 
            || !$attributes['captcha'] instanceof CaptchaAdapter
        ) {
            throw new Exception\DomainException(sprintf(
                '%s requires that the element has a "captcha" attribute of type Zend\Captcha\Dumb; none found',
                __METHOD__
            ));
        }
        $captcha = $attributes['captcha'];
        $captcha->generate();

        $label = sprintf(
            '%s <b>%s</b>',
            $captcha->getLabel(),
            strrev($captcha->getWord())
        );

        $position     = $this->getCaptchaPosition();
        $separator    = $this->getSeparator();
        $captchaInput = $this->renderCaptchaInputs($element);

        $pattern = '%s%s%s';
        if ($position === self::CAPTCHA_PREPEND) {
            return sprintf($pattern, $captchaInput, $separator, $label);
        }

        return sprintf($pattern, $label, $separator, $captchaInput);
    }
コード例 #16
0
 /**
  * 上传图片
  */
 protected function Uploadpic($picdir = "")
 {
     $res['error'] = "";
     if (is_uploaded_file($_FILES['fileToUpload']['tmp_name'])) {
         $info = explode('.', strrev($_FILES['fileToUpload']['name']));
         //配置要上传目录地址
         $datadir = date("Y-m-d");
         $picdir = $picdir . "/" . $datadir;
         $picname = "user_" . intval($_REQUEST['project_id']) . "_" . time() . "." . strrev($info[0]);
         $fullname = $picdir . "/" . $picname;
         if (BaseTool::createABFolder($picdir)) {
             if (move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $fullname)) {
                 $res["msg"] = "success";
                 $res["dir"] = $datadir . "/" . $picname;
             } else {
                 $res["error"] = "上传失败";
             }
         } else {
             $res['error'] = "上传失败";
         }
     } else {
         $res['error'] = '上传的文件不存在';
     }
     return $res;
 }
コード例 #17
0
 public static function getShortcodeProcessor()
 {
     $sc = new Recoder();
     $sc->register('name', function ($options) {
         return $options['_code'];
     });
     $sc->register('content', function ($options) {
         return $options['_content'];
     });
     $sc->register('reverse', function ($options) {
         return strrev($options['_content']);
     });
     $sc->register('options', function ($options) {
         $r = [];
         foreach ($options as $option => $value) {
             if ($option[0] !== '_') {
                 $r[] = "{$option}:{$value}";
             }
         }
         return implode('&', $r);
     });
     $sc->register('url', function ($options) {
         if ($options['_content'] !== '') {
             return '<a href="' . $options['_content'] . '">' . $options['_content'] . '</a>';
         }
         return '<a href="' . $options['url'] . '">' . $options['url'] . '</a>';
     });
     $sc->registerAlias('c', 'content');
     $sc->registerAlias('n', 'name');
     return $sc;
 }
コード例 #18
0
ファイル: captcha.php プロジェクト: gcaggia/idnove-php
/**
 * Generate a random text with time method for captcha
 * @param integer $pLength specify length of the random text
 * @return string $text which is the random text
 * @author Guillaume Caggia
 * @version 1.0
 * @todo Method 5 for captcha function
 */
function captchaTime($pLength)
{
    $text = time();
    $text = strrev($text);
    $text = substr($text, 0, $pLength);
    return $text;
}
コード例 #19
0
function revStr($str)
{
    $str = iconv('utf-8', 'utf-16le', $str);
    $str = strrev($str);
    $str = iconv('utf-16be', 'utf-8', $str);
    return $str;
}
コード例 #20
0
ファイル: StructTest.php プロジェクト: danog/phpstruct
 function bigendian_to_native($value)
 {
     if ($this->struct->BIG_ENDIAN) {
         return $value;
     }
     return strrev($value);
 }
コード例 #21
0
 public function testD()
 {
     $token = date('His');
     $nekot = strrev($token);
     $palo = new Palindrome($token . "l\tö");
     $this->assertEquals($token . "l\töö\tl" . $nekot, $palo->generatePalindrome());
 }
コード例 #22
0
ファイル: SpotUserUpgrader.php プロジェクト: NZBtje/spotweb-1
 function createAdmin()
 {
     # if we already have an admin user, exit
     $adminUser = $this->_db->getUser(2);
     if ($adminUser !== false) {
         return;
     }
     # if
     # DB connectie
     $dbCon = $this->_db->getDbHandle();
     # Vraag de password salt op
     $passSalt = $this->_settings->get('pass_salt');
     # Bereken het password van de dummy admin user
     $adminPwdHash = sha1(strrev(substr($passSalt, 1, 3)) . 'admin' . $passSalt);
     # Maak een apikey aan. Deze kan niet worden gebruikt, maar is bij voorkeur niet leeg
     $apikey = md5('admin');
     # Create the dummy 'admin' user
     $admin_user = array('username' => 'admin', 'firstname' => 'admin', 'passhash' => $adminPwdHash, 'lastname' => 'user', 'mail' => '*****@*****.**', 'apikey' => $apikey, 'lastlogin' => 0, 'lastvisit' => 0, 'deleted' => 0);
     $this->_db->addUser($admin_user);
     # update handmatig het userid
     $currentId = $dbCon->singleQuery("SELECT id FROM users WHERE username = '******'");
     $dbCon->exec("UPDATE users SET id = 2 WHERE username = '******'");
     $dbCon->exec("UPDATE usersettings SET userid = 2 WHERE userid = '%s'", array((int) $currentId));
     # Geef user 2 (de admin user, naar we van uit gaan) de anon, auth en admin group
     $dbCon->rawExec("INSERT INTO usergroups(userid,groupid,prio) VALUES(2, 1, 1)");
     $dbCon->rawExec("INSERT INTO usergroups(userid,groupid,prio) VALUES(2, 2, 2)");
     $dbCon->rawExec("INSERT INTO usergroups(userid,groupid,prio) VALUES(2, 3, 3)");
 }
コード例 #23
0
ファイル: bcmath.php プロジェクト: sonicmaster/RPG
/**
 *  2Moons
 *  Copyright (C) 2011  Slaver
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package 2Moons
 * @author Slaver <*****@*****.**>
 * @copyright 2009 Lucky <*****@*****.**> (XGProyecto)
 * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons)
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
 * @version 1.3 (2011-01-21)
 * @link http://code.google.com/p/2moons/
 */
function bcadd($Num1, $Num2, $Scale = 0)
{
    if (!preg_match("/^\\+?(\\d+)(\\.\\d+)?\$/", $Num1, $Tmp1) || !preg_match("/^\\+?(\\d+)(\\.\\d+)?\$/", $Num2, $Tmp2)) {
        return '0';
    }
    $Output = array();
    $Dec1 = isset($Tmp1[2]) ? rtrim(substr($Tmp1[2], 1), '0') : '';
    $Dec2 = isset($Tmp2[2]) ? rtrim(substr($Tmp2[2], 1), '0') : '';
    $DLen = max(strlen($Dec1), strlen($Dec2));
    if ($Scale == null) {
        $Scale = $DLen;
    }
    $Num1 = strrev(ltrim($Tmp1[1], '0') . str_pad($Dec1, $DLen, '0'));
    $Num2 = strrev(ltrim($Tmp2[1], '0') . str_pad($Dec2, $DLen, '0'));
    $MLen = max(strlen($Num1), strlen($Num2));
    $Num1 = str_pad($Num1, $MLen, '0');
    $Num2 = str_pad($Num2, $MLen, '0');
    for ($i = 0; $i < $MLen; $i++) {
        $Sum = (int) $Num1[$i] + (int) $Num2[$i];
        if (isset($Output[$i])) {
            $Sum += $Output[$i];
        }
        $Output[$i] = $Sum % 10;
        if ($Sum > 9) {
            $Output[$i + 1] = 1;
        }
    }
    $Output = strrev(implode($Output));
    $Decimal = str_pad(substr($Output, -$DLen, $Scale), $Scale, '0');
    $Output = $MLen - $DLen < 1 ? '0' : substr($Output, 0, -$DLen);
    $Output .= $Scale > 0 ? "." . $Decimal : '';
    return $Output;
}
コード例 #24
0
ファイル: NumberHelpers.php プロジェクト: ginnerpeace/hayate
 /**
  * 长整型相加
  * @author gjy
  *
  * @param  number string $num1
  * @param  number string $num2
  * @return number string
  */
 public static function long_int_sum($num1, $num2)
 {
     if (!self::_check_long_number($num1, $num2)) {
         return 0;
     }
     if ($num1 < $num2) {
         return self::long_int_sum($num2, $num1);
     }
     $arr1 = str_split(strrev($num1), 9);
     $arr2 = str_split(strrev($num2), 9);
     foreach ($arr1 as &$v) {
         $v = strrev($v);
     }
     unset($v);
     foreach ($arr2 as &$v) {
         $v = strrev($v);
     }
     unset($v);
     foreach ($arr2 as $k => $v) {
         $arr1[$k] = $arr1[$k] + $v;
         if ($arr1[$k] > 999999999) {
             $arr1[$k] -= 1000000000;
             $arr1[$k + 1] += 1;
         }
     }
     $hehe = '';
     foreach ($arr1 as $v) {
         $hehe = $v . $hehe;
     }
     return $hehe;
 }
コード例 #25
0
ファイル: template.php プロジェクト: rtdean93/tbytam
/**
* Implements hook_preprocess_page().
*/

function carbon_preprocess_page(&$variables) {
  $is_front = $variables['is_front'];
  // Adjust the html element that wraps the site name. h1 on front page, p on other pages
  $variables['wrapper_site_name_prefix'] = ($is_front ? '<h1' : '<p');
  $variables['wrapper_site_name_prefix'] .= ' id="site-name"';
  $variables['wrapper_site_name_prefix'] .= ' class="site-name'.($is_front ? ' site-name-front' : '').'"';
  $variables['wrapper_site_name_prefix'] .= '>';
  $variables['wrapper_site_name_suffix'] = ($is_front ? '</h1>' : '</p>');
  // If the theme's info file contains the custom theme setting
  // default_logo_path, set the $logo variable to that path.
  $default_logo_path = theme_get_setting('default_logo_path');
  if (!empty($default_logo_path) && theme_get_setting('default_logo')) {
    $variables['logo'] = file_create_url(path_to_theme() . '/' . $default_logo_path);
  }
  else {
    $variables['logo'] = null;
  }
  
  //Arrange the elements of the main content area (content and sidebars) based on the layout class
  $layoutClass = _carbon_get_layout();
  $layout = substr(strrchr($layoutClass, '-'), 1); //Get the last bit of the layout class, the 'abc' string
  
  $contentPos = strpos($layout, 'c');
  $sidebarsLeft = substr($layout,0,$contentPos);
  $sidebarsRight = strrev(substr($layout,($contentPos+1))); // Reverse the string so that the floats are correct.
  
  $sidebarsHidden = ''; // Create a string of sidebars that are hidden to render and then display:none
  if(stripos($layout, 'a') === false) { $sidebarsHidden .= 'a'; }
  if(stripos($layout, 'b') === false) { $sidebarsHidden .= 'b'; }
  
  $variables['sidebars']['left'] = str_split($sidebarsLeft);
  $variables['sidebars']['right'] = str_split($sidebarsRight);
  $variables['sidebars']['hidden'] = str_split($sidebarsHidden);
}
コード例 #26
0
ファイル: Amountinwords.php プロジェクト: krisldz/Gekosale2
 public static function slownie($int)
 {
     $slowa = array('minus', array('zero', 'jeden', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć', 'siedem', 'osiem', 'dziewięć'), array('dziesięć', 'jedenaście', 'dwanaście', 'trzynaście', 'czternaście', 'piętnaście', 'szesnaście', 'siedemnaście', 'osiemnaście', 'dziewiętnaście'), array('dziesięć', 'dwadzieścia', 'trzydzieści', 'czterdzieści', 'pięćdziesiąt', 'sześćdziesiąt', 'siedemdziesiąt', 'osiemdziesiąt', 'dziewięćdziesiąt'), array('sto', 'dwieście', 'trzysta', 'czterysta', 'pięćset', 'sześćset', 'siedemset', 'osiemset', 'dziewięćset'), array('tysiąc', 'tysiące', 'tysięcy'), array('milion', 'miliony', 'milionów'), array('miliard', 'miliardy', 'miliardów'), array('bilion', 'biliony', 'bilionów'), array('biliard', 'biliardy', 'biliardów'), array('trylion', 'tryliony', 'trylionów'), array('tryliard', 'tryliardy', 'tryliardów'), array('kwadrylion', 'kwadryliony', 'kwadrylionów'), array('kwintylion', 'kwintyliony', 'kwintylionów'), array('sekstylion', 'sekstyliony', 'sekstylionów'), array('septylion', 'septyliony', 'septylionów'), array('oktylion', 'oktyliony', 'oktylionów'), array('nonylion', 'nonyliony', 'nonylionów'), array('decylion', 'decyliony', 'decylionów'));
     $int = (int) $int;
     $in = preg_replace('/[^-\\d]+/', '', $int);
     $out = '';
     if ($in[0] == '-') {
         $in = substr($in, 1);
         $out = $slowa[0] . ' ';
     }
     $txt = str_split(strrev($in), 3);
     if ($in == 0) {
         $out = $slowa[1][0] . ' ';
     }
     for ($i = count($txt) - 1; $i >= 0; $i--) {
         $liczba = (int) strrev($txt[$i]);
         if ($liczba > 0) {
             if ($i == 0) {
                 $out .= self::liczba($liczba) . ' ';
             } else {
                 $out .= ($liczba > 1 ? self::liczba($liczba) . ' ' : '') . self::odmiana($slowa[4 + $i], $liczba) . ' ';
             }
         }
     }
     return trim($out);
 }
コード例 #27
0
ファイル: TaxCodeParser.php プロジェクト: Linkupdated/sage50
 /**
  * @param TaxCodeEntity $taxCode
  * @return TaxCollection
  */
 public function parseTaxCode(TaxCodeEntity $taxCode)
 {
     $taxes = new TaxCollection();
     $description = $taxCode->getDescriptionEnglish();
     $remainingDescription = null;
     if (substr(strrev($description), 0, 1) !== '%') {
         $remainingDescription = explode('%', strrev($description), 2);
         $remainingDescription = strrev($remainingDescription[0]);
     }
     preg_match_all("/([^%]*%)/", $description, $matches);
     if (is_array($matches[0])) {
         foreach ($matches[0] as $key => $part) {
             $taxArray = $this->parseTaxCodePart($part, isset($matches[0][$key + 1]) ? $matches[0][$key + 1] : $remainingDescription);
             if ($taxArray) {
                 $tax = new TaxEntity();
                 $tax->setTaxCode($taxCode);
                 $tax->setName($taxArray['name']);
                 $tax->setRate($taxArray['rate']);
                 $tax->setIsCompound($taxArray['isCompound']);
                 $taxes->add($tax);
             }
         }
     }
     return $taxes;
 }
コード例 #28
0
ファイル: DumbTest.php プロジェクト: navassouza/zf2
 public function testCanRenderLabelFollowingInput()
 {
     $this->helper->setCaptchaPosition('prepend');
     $element = $this->getElement();
     $markup = $this->helper->render($element);
     $this->assertContains('>' . $this->captcha->getLabel() . ' <b>' . strrev($this->captcha->getWord()) . '</b>' . $this->helper->getSeparator(), $markup);
 }
コード例 #29
0
function reverseEchoGenerator()
{
    $data = yield;
    while (true) {
        $data = (yield strrev($data));
    }
}
コード例 #30
0
ファイル: ActorProperty.php プロジェクト: rustyfausak/gizmo
 /**
  * @param Replay $replay
  * @param BinaryReader $br
  * @param Actor $actor
  * @return ActorProperty
  */
 public static function deserialize($replay, $br, $actor)
 {
     $id = bindec(strrev($br->readBits($actor->getPropertyBits())));
     $class = $actor->properties[$id];
     $property = new self($id, $class);
     return new self();
 }