生成支付签名
@param array $option
@param string $partnerKey
@return string
776469
static public function getPaySign($option, $partnerKey)
    {
        ksort($option);
        $buff = '';
        foreach ($option as $k => $v) {
            $buff .= "{$k}={$v}&";
        }
        return strtoupper(md5("{$buff}key={$partnerKey}"));
    }
343533
public function get_key( $key = '', $is_option = false ) {
		if ( true === $is_option ) {
			return $this->option_prefix . $key . $this->option_surfix;
		}

		return $this->transient_prefix . $key . $this->transient_surfix;
	}
721230
public static function getComposerPackageNameFromPackageKey(string $packageKey): string
    {
        $nameParts = explode('.', $packageKey);
        $vendor = array_shift($nameParts);
        return strtolower($vendor . '/' . implode('-', $nameParts));
    }
388248
public function getCreateTableSql($tableName, array $options=null)
    {
        $sql = '';
        if (!isset($options['fields'])) {
            $sql = 'SHOW CREATE TABLE ' . $tableName;
            $this->adapter->query($sql);
            $result = $this->adapter->fetchAll();
            if (empty($result)) {
                return '';
            }
            return $result['Create Table'];
        } elseif ($fields = $options['fields']) {
            $fieldsSql = array();
            $primaryKeys = array();
            foreach ($fields as $v) {
                if (empty($v)) continue;
                
                $fieldsSql[] = $this->getColumnSubSql($v);
                
                if (isset($v['is_primary']) && $v['is_primary']) $primaryKeys[] = $v['field_name'];
            }
            
            if (!empty($fieldsSql)) {
                $sql = 'CREATE TABLE IF NOT EXISTS ' . $tableName . ' (' . PHP_EOL;
                $sql .= implode(',' . PHP_EOL, $fieldsSql) . PHP_EOL ;
                
                // 主键
                //$sql .= (!empty($primaryKeys)) ? ',' . PHP_EOL . 'PRIMARY KEY ('. implode('`,`', $primaryKeys) . ')'. PHP_EOL : '';
                
                // 索引
                $indexesSql = array();
                foreach ($fields as $v) {
                    $temp = $this->getColumnIndexSql($v);
                    if ($temp) $indexesSql[] = $temp;
                }
                if ($indexesSql) {
                    $sql .= ',' . implode(',' . PHP_EOL, $indexesSql);
                }
                
                $sql .= ') ENGINE=' . $this->tableEngine . ' DEFAULT CHARSET=' . $this->charset;
                $sql .= (isset($options['comment']) && !empty($options['comment'])) ? ' COMMENT=\'' . $options['comment'] . '\'' : '';
            }
        }
        return $sql;
    }
1161098
public function generateKeyPair($keyOption = null)
    {
        if (null === $keyOption) {
            $keyOption = new RsaKeyOption();
        }
        if (\is_int($keyOption)) {
            @trigger_error('Passing a keySize to "generateKeyPair" is deprecated since version 1.1 and will be removed in 2.0. Pass an instance of KeyOption instead', E_USER_DEPRECATED);
            $keyOption = new RsaKeyOption($keyOption);
        }
        Assert::isInstanceOf($keyOption, KeyOption::class);

        try {
            $privateKey = $this->generator->generatePrivateKey($keyOption);
        } catch (KeyGenerationException $e) {
            throw new KeyPairGenerationException('Fail to generate a KeyPair with the given options', 0, $e);
        }

        return new KeyPair(
            $privateKey->getPublicKey(),
            $privateKey
        );
    }
1297027
public function makeSign()
	{
		//签名步骤一：按字典序排序参数
		ksort($this->values);
		$string = $this->toUrlParams();
		//签名步骤二：在string后加入KEY
		$string = $string . '&key=' . Wxpay::getConfig('key');
		//签名步骤三：MD5加密
		$string = md5($string);
		//签名步骤四：所有字符转为大写
		$result = strtoupper($string);
		return $result;
	}
872809
public function getWithOption($key, $option, $default = false)
    {
        if ($this->hasOption($key, $option)) {
            return $this->container[$key][$option];
        } else {
            return $default;
        }
    }
832025
public function name($stringName, $option = PINYIN_NAME)
    {
        $pinyin = $this->romanize($stringName, $option);

        return $this->splitWords($pinyin, $option);
    }
1149002
private function format_signature($opt) {
		$flags = "";
		$content = '';
		if (! isset ( $opt [self::AK] ) || ! isset ( $opt [self::SK] )) {
			trigger_error ( 'ak or sk is not in the array when create factor!' );
			return false;
		}
		if (isset ( $opt [self::BUCKET] ) && isset ( $opt [self::METHOD] ) && isset ( $opt [self::OBJECT] )) {
			$flags .= 'MBO';
			$content .= "Method=" . $opt [self::METHOD] . "\n"; //method
			$content .= "Bucket=" . $opt [self::BUCKET] . "\n"; //bucket
			$content .= "Object=" . self::trimUrl ( $opt [self::OBJECT] ) . "\n"; //object
		} else {
			trigger_error ( 'bucket、method and object cann`t be NULL!' );
			return false;
		}
		if (isset ( $opt ['ip'] )) {
			$flags .= 'I';
			$content .= "Ip=" . $opt ['ip'] . "\n";
		}
		if (isset ( $opt ['time'] )) {
			$flags .= 'T';
			$content .= "Time=" . $opt ['time'] . "\n";
		}
		if (isset ( $opt ['size'] )) {
			$flags .= 'S';
			$content .= "Size=" . $opt ['size'] . "\n";
		}
		$content = $flags . "\n" . $content;
		$sign = base64_encode ( hash_hmac ( 'sha1', $content, $opt [self::SK], true ) );
		return 'sign=' . $flags . ':' . $opt [self::AK] . ':' . urlencode ( $sign );
	}
1350843
private static function generatePrimaryKey(array $pk, array $columns)
    {
        if (empty($pk)) {
            return '';
        }
        // Composite primary keys
        if (2 <= count($pk)) {
            $compositePk = implode(', ', $pk);
            return "    'PRIMARY KEY ($compositePk)',\n";
        }
        // Primary key not an auto-increment
        $flag = false;
        foreach ($columns as $column) {
            if ($column->autoIncrement) {
                $flag = true;
            }
        }
        if (false === $flag) {
            return sprintf("    'PRIMARY KEY (%s)',\n", $pk[0]);
        }
        return '';
    }
338685
public static function generateIndexName(array $key)
    {
        $nameParts = [];
        foreach ($key as $fieldName => $direction) {
            $nameParts[] = $fieldName;
            $nameParts[] = (string) $direction;
        }

        return implode('_', $nameParts);
    }
1205836
private function _convertOptions(array $options = [])
    {
        $converted = [];
        if (!empty($options)) {
            foreach ($options as $name => $value) {
                if (is_array($value)) {
                    if (!empty($value['AND'])) {
                        $converted[$name] = implode(self::PMP_AND, $value['AND']);
                    } else if (!empty($value['OR'])) {
                        $converted[$name] = implode(self::PMP_OR, $value['OR']);
                    } else {
                        $converted[$name] = ''; // bad params
                    }
                } elseif (is_bool($value)) {
                    $converted[$name] = $value ? 'true' : 'false';
                } else {
                    $converted[$name] = $value;
                }
            }
        }
        return $converted;
    }
954683
private function getOptionNames(Option $option) : string
    {
        $optionNames = "--{$option->getName()}";

        if ($option->getShortName() !== null) {
            $optionNames .= "|-{$option->getShortName()}";
        }

        return $optionNames;
    }
58549
public function generateKey(array $options = [])
	{
		// Generate the encryption key.
		$pair = Compat::crypto_box_keypair();

		return new Key('sodium', Compat::crypto_box_secretkey($pair), Compat::crypto_box_publickey($pair));
	}
97535
public function get_option( $_key ) {
		$key         = $this->key( $_key, true );
		$version_key = $this->get_version_key( $key );
		$version     = $this->wp_get_option( $version_key, true );
		if ( $this->validate_version( $version, 'option' ) === false ) {
			$this->delete_version_issue( $_key );
			return false;
		}

		return $this->wp_get_option( $key );
	}
870828
protected function romanize($string, $option = \PINYIN_DEFAULT)
    {
        $string = $this->prepare($string, $option);

        $dictLoader = $this->getLoader();

        if ($this->hasOption($option, \PINYIN_NAME)) {
            $string = $this->convertSurname($string, $dictLoader);
        }

        $dictLoader->map(function ($dictionary) use (&$string) {
            $string = strtr($string, $dictionary);
        });

        return $string;
    }
781254
protected function _buildOptions($options = []) {
		$gravatarOptions = array_intersect(array_keys($options), array_keys($this->_defaultConfig));
		if (!empty($gravatarOptions)) {
			$optionArray = [];
			foreach ($gravatarOptions as $key) {
				$value = $options[$key];
				$optionArray[] = $key . '=' . mb_strtolower($value);
			}
			return '?' . implode('&amp;', $optionArray);
		}
		return '';
	}