2017-02-18
@used-by \Df\GingerPaymentsBase\Charge::pCustomer()
@used-by \Dfe\Spryng\P\Reg::p()
@param string $m
@param string $f
@return string|null
190908
final protected function customerGender($m, $f) {return dfa(
		[G::MALE => $m, G::FEMALE => $f], $this->o()->getCustomerGender()
	);}
446218
function _rsassa_pkcs1_v1_5_sign($m)
    {
        // EMSA-PKCS1-v1_5 encoding

        $em = $this->_emsa_pkcs1_v1_5_encode($m, $this->k);
        if ($em === false) {
            user_error('RSA modulus too short');
            return false;
        }

        // RSA signature

        $m = $this->_os2ip($em);
        $s = $this->_rsasp1($m);
        $s = $this->_i2osp($s, $this->k);

        // Output the signature S

        return $s;
    }
1128
public static function getMimetype($name)
    {
        $parts = explode('.', $name);
        if (count($parts) > 1) {
            $ext = strtolower(end($parts));
            if (isset(self::$mime_types[$ext])) {
                return self::$mime_types[$ext];
            }
        }

        return null;
    }
456043
@Override
    public INDArray mmul(INDArray other, INDArray result, MMulTranspose mMulTranspose) {
        return null;
    }
508736
protected function matchesCallback($m)
    {
        $this->paramNames[] = $m[1];
        if (isset($this->conditions[$m[1]])) {
            return '(?P<' . $m[1] . '>' . $this->conditions[$m[1]] . ')';
        }
        if (substr($m[0], -1) === '+') {
            $this->paramNamesPath[$m[1]] = 1;

            return '(?P<' . $m[1] . '>.+)';
        }

        return '(?P<' . $m[1] . '>[^/]+)';
    }
1255393
public function frm($txt, $att = '', $a = '', $m = '', $e = '')
    {
        $attList = array();
        if (!empty($a)) {
            $attList['action'] = $a;
        }
        if (!empty($m)) {
            $attList['method'] = $m;
        }
        if (!empty($e)) {
            $attList['enctype'] = $e;
        }
        $newatt = $this->addAttributes($attList, $att);

        return $this->tag('form', $txt, $newatt);
    }
431234
public function field_type($name = NULL, $length = NULL, $fvalue = '')
	{
		if ($this->fieldtype === TRUE) {
			$select	= '<option value="">-</option>
				<option value="INT" '.($name == 'INT' ? 'selected' : '').'>INT</option>
				<option value="TINYINT" '.($name == 'TINYINT' ? 'selected' : '').'>TINYINT</option>
				<option value="SMALLINT" '.($name == 'SMALLINT' ? 'selected' : '').'>SMALLINT</option>
				<option value="MEDIUMINT" '.($name == 'MEDIUMINT' ? 'selected' : '').'>MEDIUMINT</option>
				<option value="">-</option>
				<option value="DECIMAL" '.($name == 'DECIMAL' ? 'selected' : '').'>DECIMAL</option>
				<option value="FLOAT" '.($name == 'FLOAT' ? 'selected' : '').'>FLOAT</option>
				<option value="">-</option>
				<option value="CHAR" '.($name == 'CHAR' ? 'selected' : '').'>CHAR</option>
				<option value="VARCHAR" '.($name == 'VARCHAR' ? 'selected' : '').'>VARCHAR</option>
				<option value="TEXT" '.($name == 'TEXT' ? 'selected' : '').'>TEXT</option>
				<option value="MEDIUMTEXT" '.($name == 'MEDIUMTEXT' ? 'selected' : '').'>MEDIUMTEXT</option>';
		} elseif (count($this->fieldtype) > 1) {
			$select	= '<option value="">-</option>';
			foreach ($this->fieldtype as $t) {
				$select	= "<option value=\"{$t}\" ".($name == $t ? "selected" : "").">{$t}</option>";
			}
		} else {
			return '
			<div class="hstui-form-group hstui-form-group-sm">
	          <label class="hstui-u-sm-2 hstui-form-label">'.hst_lang('hstcms::fields.default.value').'</label>
	          <div class="hstui-u-sm-10 hstui-form-input">
	              <input type="text" name="setting[option][fvalue]" value="'.$fvalue.'" class="hstui-input hstui-length-5">
	            <div class="hstui-form-input-tips" id="J_form_tips_name" data-tips="'.hst_lang('hstcms::fields.default.value.tips').'">'.hst_lang('hstcms::fields.default.value.tips').'</div>
	          </div>
	        </div>';
		}
		$str = '
			<div class="hstui-form-group hstui-form-group-sm">
	          <label class="hstui-u-sm-2 hstui-form-label">'.hst_lang('hstcms::manage.fields.fieldtype').'</label>
	          <div class="hstui-u-sm-10 hstui-form-input">
	             	<select class="hstui-input hstui-textarea" name="setting[option][fieldtype]" onChange="setlength()" id="type">
						'.$select.'
					</select>
	            <div class="hstui-form-input-tips" id="J_form_tips_name" data-tips="'.hst_lang('hstcms::manage.fields.fieldtype.tips').'">'.hst_lang('hstcms::manage.fields.fieldtype.tips').'</div>
	          </div>
	        </div>
			<div class="hstui-form-group hstui-form-group-sm">
	          <label class="hstui-u-sm-2 hstui-form-label">'.hst_lang('hstcms::manage.fields.length.value').'</label>
	          <div class="hstui-u-sm-10 hstui-form-input">
	              <input type="text" name="setting[option][fieldlength]" value="'.$length.'" class="hstui-input hstui-length-5">
	            <div class="hstui-form-input-tips" id="J_form_tips_name" data-tips="'.hst_lang('hstcms::manage.fields.length.value.tips').'">'.hst_lang('hstcms::manage.fields.length.value.tips').'</div>
	          </div>
	        </div>
			<div class="hstui-form-group hstui-form-group-sm">
	          <label class="hstui-u-sm-2 hstui-form-label">'.hst_lang('hstcms::fields.default.value').'</label>
	          <div class="hstui-u-sm-10 hstui-form-input">
	              <input type="text" name="setting[option][fvalue]" value="'.$fvalue.'" class="hstui-input hstui-length-5">
	            <div class="hstui-form-input-tips" id="J_form_tips_name" data-tips="'.hst_lang('hstcms::fields.default.value.tips').'">'.hst_lang('hstcms::fields.default.value.tips').'</div>
	          </div>
	        </div>';
		return $str; 
	}
819209
protected static function findSign($dh, $m, $s, $f)
    {
        if ($dh != 0) {
            return $dh < 0 ? '-' : '+';
        } elseif ($m != 0) {
            return $m < 0 ? '-' : '+';
        } elseif ($s != 0) {
            return $s < 0 ? '-' : '+';
        } elseif ($f != 0) {
            return $f < 0 ? '-' : '+';
        } else {
            return '+';
        }
    }
110512
protected static function dmsf2asec($d, $m, $s, $f)
    {
        // Find the sign.
        $sign = static::findSign($d, $m, $s, $f);

        // Cast to integers.
        $d = (int)$d;
        $m = (int)$m;

        if ($f) {
            // If fraction is present, seconds should be cast to int.
            $s = (int)$s;

            if ($f >= 1) {
                // Fix for fraction given as integer instead of fraction.
                $f = (double)('0.' . (int)$f);
            }
        }

        // Calculate arcseconds
        $asec = (abs($d) * 3600) + (abs($m) * 60) + abs($s) + abs($f);

        //dd($asec, $d, $m, $s, $f);

        // Return arcseconds with appropriate sign.
        return $sign == '-' ? -1 * $asec : $asec;
    }
351251
protected static function hmsf2sec($h, $m, $s, $f)
    {
        return static::dmsf2asec($h, $m, $s, $f);
    }
148893
private static function _fvCallback($m)
    {
        if (array_key_exists($m[1], self::$tempFV))
            return self::$tempFV[$m[1]];

        return $m[0];
    }
753695
protected function _parseTemplateCallback($m) {
        if (!class_exists('block' . $m[1])) {
            $vars = explode(',', $m[2]);
            $varList = '';

            foreach ($vars as $value) {
                if ($value == '*') {
                    foreach ($this->_template->vars as $key => $value2) {
                        if (!in_array('$' . $key, $vars)) {
                            $varList .= '$' . $key . ',';
                        }
                        else {
                            $this->addError('the template function "template' . $m[1] . '" has already this parameter (' . $value . ')', __FILE__, __LINE__, ERROR_FATAL);
                            $varList .= '$' . $key . ',';
                        }
                    }
                }
                else {
                    $varList .= $value . ',';
                }
            }

            $varList = trim($varList, ',');

            $blockFunction = '<?php class template' . $m[1] . ' extends Gcs\Framework\Core\Template\Template{  ' . "\n";
            $blockFunction .= '		public function __construct(){' . "\n";
            $blockFunction .= '		}' . "\n";
            $blockFunction .= '		public function ' . $m[1] . '(' . $varList . '){ ?> ' . "\n";
            $blockFunction .= '			' . $m[3] . "\n";
            $blockFunction .= ' <?php } } ?>';

            return $blockFunction;
        }
        else {
            $this->addError('the class "template' . $m[1] . '" already exists', __FILE__, __LINE__, ERROR_FATAL);

            return '';
        }
    }
629639
protected function _parseBlockCallback($m) {
        if (!class_exists('block' . $m[1])) {
            $blockFunction = '<?php class block' . $m[1] . ' extends \Gcs\Framework\Core\Gcs\Framework\Core\Template\Template { public static function ' . $m[1] . '(){ ?> ';
            $blockFunction .= $m[2];
            $blockFunction .= ' <?php } } ?>';

            return $blockFunction;
        }
        else {
            $this->addError('the class "block' . $m[1] . '" already exists', __FILE__, __LINE__, ERROR_FATAL);

            return '';
        }
    }
312369
private function readMccMncAndMobileCarrierName($pointer) {
    if (false === $pointer) {
      // Deal with invalid IPs
      $mcc               = self::INVALID_IP_ADDRESS;
      $mnc               = self::INVALID_IP_ADDRESS;
      $mobileCarrierName = self::INVALID_IP_ADDRESS;
    } elseif (0 === self::$columns[self::MCC][$this->type]) {
      // If the field is not suported, return accordingly
      $mcc               = self::FIELD_NOT_SUPPORTED;
      $mnc               = self::FIELD_NOT_SUPPORTED;
      $mobileCarrierName = self::FIELD_NOT_SUPPORTED;
    } else {
      // Read MCC, MNC, and mobile carrier name
      $mcc               = $this->readString($pointer + self::$columns[self::MCC][$this->type]);
      $mnc               = $this->readString($pointer + self::$columns[self::MNC][$this->type]);
      $mobileCarrierName = $this->readString($pointer + self::$columns[self::MOBILE_CARRIER_NAME][$this->type]);
    }
    return [$mcc, $mnc, $mobileCarrierName];
  }
195913
function _cmpfcn( $a, $b ) {
    if(  'vtimezone' == $a->objName)                   return -1;
    if(  'vtimezone' == $b->objName)                   return  1;
    if(          isset( $a->dtstart['value'] ) ||
                 isset( $b->dtstart['value'] )) {
      foreach( $this->_sortkeys as $key ) {
        if(     !isset( $a->dtstart['value'][$key] ))  return -1;
        elseif( !isset( $b->dtstart['value'][$key] ))  return  1;
        if    (         $a->dtstart['value'][$key]
                     == $b->dtstart['value'][$key] )
          continue;
        if    ((  (int) $a->dtstart['value'][$key] ) <
               (  (int) $b->dtstart['value'][$key] ))  return -1;
        elseif((  (int) $a->dtstart['value'][$key] ) >
               (  (int) $b->dtstart['value'][$key] ))  return  1;
      }
    }
    if( isset( $a->dtend['value'] ))
      $c = $a->dtend['value'];
    if(     empty( $c ) && !empty( $a->due['value'] ))
      $c = $a->due['value'];
    if(     empty( $c ) && !empty( $a->duration['value'] ))
      $c = $a->duration2date();
    if( isset( $b->dtend['value'] ))
      $d = $b->dtend['value'];
    if(     empty( $d ) && !empty( $b->due['value'] ))
      $d = $b->due['value'];
    if(     empty( $d ) && !empty( $b->duration['value'] ))
      $d = $b->duration2date();
    if(          isset( $c ) ||   isset( $d )) {
      if(       !isset( $c ) &&   isset( $d ))         return -1;
      if(        isset( $c ) &&  !isset( $d ))         return  1;
      foreach( $this->_sortkeys as $key ) {
        if    ( !isset( $c[$key] ))                    return -1;
        elseif( !isset( $d[$key] ))                    return  1;
        if    (         $c[$key]
                     == $d[$key] )
          continue;
        if    ((  (int) $c[$key] ) <
               (  (int) $d[$key] ))                    return -1;
        elseif((  (int) $c[$key] ) >
               (  (int) $d[$key] ))                    return  1;
      }
    }
    $c = ( isset( $a->created['value'] )) ? $a->created['value'] : $a->dtstamp['value'];
    $d = ( isset( $b->created['value'] )) ? $b->created['value'] : $b->dtstamp['value'];
    foreach( $this->_sortkeys as $key ) {
      if(       !isset( $a->created['value'][$key] ))  return -1;
      elseif(   !isset( $b->created['value'][$key] ))  return  1;
      if    (           $a->created['value'][$key]
                     == $b->created['value'][$key] )
        continue;
      if    ((    (int) $a->created['value'][$key] ) <
             (    (int) $b->created['value'][$key] ))  return -1;
      elseif((    (int) $a->created['value'][$key] ) >
             (    (int) $b->created['value'][$key] ))  return  1;
    }
    if    ((            $a->uid['value'] ) <
           (            $b->uid['value'] ))            return -1;
    elseif((            $a->uid['value'] ) >
           (            $b->uid['value'] ))            return  1;
    return 0;
  }
1005706
public static function get(
        int $mastercardActionId,
        int $noteTextMasterCardActionId,
        int $monetaryAccountId = null,
        array $customHeaders = []
    ): BunqResponseNoteTextMasterCardAction {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->get(
            vsprintf(
                self::ENDPOINT_URL_READ,
                [
                    static::determineUserId(),
                    static::determineMonetaryAccountId($monetaryAccountId),
                    $mastercardActionId,
                    $noteTextMasterCardActionId,
                ]
            ),
            [],
            $customHeaders
        );

        return BunqResponseNoteTextMasterCardAction::castFromBunqResponse(
            static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
        );
    }
1244090
public function mimetype_from_storedfile($file) {
        if (!$file->get_filesize()) {
            // Files with an empty filesize are treated as directories and have no mimetype.
            return null;
        }
        return $this->mimetype_from_hash($file->get_contenthash(), $file->get_filename());
    }