永久二维码请求体.

@param      $data
@param bool $isString

@return array
185212
private function forever($data, bool $isString)
    {
        $action_name = $isString ? 'QR_LIMIT_STR_SCENE' : 'QR_LIMIT_SCENE';
        $scene_type = $isString ? 'scene_str' : 'scene_id';

        $content = [
            'action_name' => $action_name,
            'action_info' => [
                'scene' => [$scene_type => $data],
            ],
        ];

        return $content;
    }
1085670
public static function parseLabels(&$data, $orig = null)
    {
        $str = '';
        while (mb_orig_strlen($data) > 0) {
            $l = ord($data[0]);

            if ($l >= 192) {
                $pos = Binary::bytes2int(chr($l - 192) . mb_orig_substr($data, 1, 1));
                $data = mb_orig_substr($data, 2);
                $ref = mb_orig_substr($orig, $pos);
                return $str . Binary::parseLabels($ref, $orig);
            }

            $p = mb_orig_substr($data, 1, $l);
            $str .= $p . (($l !== 0) ? '.' : '');
            $data = mb_orig_substr($data, $l + 1);
            if ($l === 0) {
                break;
            }
        }
        return $str;
    }
742354
private function create($data, bool $forever = true, bool $isString = true)
    {
        $url = self::CREATE.$this->access_token;
        $content = $forever ? $this->forever($data, $isString) : $this->temporary($data, $isString);
        $res = json_decode($this->curl->post($url, json_encode($content)), true);
        $ticket = urlencode($res['ticket']);
        $url = self::SHOW.http_build_query(['ticket' => $ticket]);

        return $url;
    }
560673
public function checkString($data)
    {
    	$data = trim($data);
		$data = stripslashes($data);
		$data = htmlspecialchars($data);
		return $data;
    }
790864
private function initType($data)
    {
        if (!is_string($data)) return false;

        $data = trim($data);
        switch (true) {
            case (in_array($data, ['true', 'false'])):
                $this->data = (bool)(strpos($data, 'true') !== false) ? true : false;
                break;
            case !is_numeric($data):
                if ($res = json_decode($data)) {
                    $this->data = $res;
                } else if (($res = @unserialize($data)) !== false) {
                    $this->data = $res;
                } else if ((preg_match('/^["|\']{1}(.*)["|\']{1}$/', $data, $match)) === 1) {
                    $this->data = (string)$match[1];
                } else {
                    $this->data = (string)$data;
                }
                break;

            default:
                // integer
                if (is_numeric($data) && strpos($data, '.') === false) {
                    $this->data = (int)$data;
                } else {
                    $this->data = (float)$data;
                }
                break;
        }

        return true;
    }
805359
public static function decodeMimeStringPart(&$data)
    {
        array_shift($data);
        $encode = strtoupper(array_shift($data));
        $type = strtoupper(array_shift($data));
        if ($type === '') {
            return [];
        }

        $str = array_shift($data);

        return [
            $encode => [
                $type => $str
            ]
        ];
    }
335627
public function next($is_string = false)
    {
        $package = '';
        while (true) {
            if ($this->pointer >= $this->length) {
                return false;
            }

            $string = $this->string[$this->pointer];
            $this->pointer++;

            if ($is_string === true) {
                return ord($string);
            }

            $value = decbin(ord($string));

            if ($value >= 10000000 && $is_string === false) {
                // now fill to eight with 00
                $package .= $value;
            } else {
                // now fill to length of eight with 0
                $value = substr('00000000', 0, 8 - strlen($value) % 8) . $value;
                return $this->base128->getValue($package . $value);
            }
        }
        return $package;
    }
76420
private function getSignContent(array $data, $needSignType = false)
    {
        list($attrs,) = [[], ksort($data)];
        if (isset($data['sign'])) unset($data['sign']);
        if (empty($needSignType)) unset($data['sign_type']);
        foreach ($data as $key => $value) {
            if ($value === '' || is_null($value)) continue;
            array_push($attrs, "{$key}={$value}");
        }
        return join('&', $attrs);
    }
253182
protected function isJsonString($data)
    {
        if (!is_string($data) && !is_null($data)) {
            return false;
        }

        // We json_encode here to see if there might be a json_last_error
        json_decode($data, true);
        if (json_last_error() !== JSON_ERROR_NONE) {
            return false;
        }
        return true;
    }
1370181
protected static function _arrayToString($data, $options)
    {
        if (empty($data)) {
            return '[]';
        }

        extract($options['array']);
        /**
         * @var string $char
         * @var int $indent
         * @var int $multiplier
         */
        $comma = false;

        $tab = str_repeat($char, $indent * $multiplier);

        $string = "[\n";

        foreach ($data as $key => $value) {
            if ($comma) {
                $string .= ",\n";
            }
            $comma = true;
            $key = filter_var($key, FILTER_VALIDATE_INT) ? $key : static::dump($key, $options['quote']);
            $string .= $tab . $key . ' => ';
            if (is_array($value)) {
                $options['array']['indent'] = $indent + 1;
                $string .= static::_arrayToString($value, $options);
            } else {
                $string .= static::toString($value, $options);
            }
        }
        $tab = str_repeat($char, ($indent - 1) * $multiplier);
        return $string . "\n" . $tab . "]";
    }
170762
private static function stringStartsWithNumberFollowedByResource($inString,$resource)
		{
			$followingTextArray = $resource->resourceContent;
			$count = 0;
			
			foreach (str_split($inString) as $character) 
			{
				if(EndBlockFilter::characterIsDigit($character))
				{
					$count++;
				}
				else
				{
					break;
				}
			}
			
			if($count > 0)
			{
				foreach ($followingTextArray as $followingEntry) 
				{
					$formStr = sprintf('%s %s',$count,$followingEntry);
					if (0 === strpos($inString, $formStr)) 
					{
   						return true;
					}
				}
			}
			
			return false;
		}
1113101
protected function getString($data)/*# : string */
    {
        if (is_scalar($data)) {
            return strval($data);
        } elseif (is_array($data)) {
            return 'ARRAY[' . count($data) . ']';
        } elseif (is_object($data)) {
            return $this->getObjectString($data);
        } else {
            return 'TYPE: ' . gettype($data);
        }
    }
566132
private function parseAttributes($columnName, array $attrs, $isCreate = true) {
        $return = $this->checkType($columnName, $attrs); // type

        if (strtolower($attrs['type']) === 'timestamp' && !isset($attrs['attrs']['default'])) {
            $attrs['attrs']['default'] = '"0000-00-00 00:00:00"';
        }

        if (isset($attrs['attrs']['size']))
            $return .= '(' . $attrs['attrs']['size'] . ')'; // size

        if (isset($attrs['attrs']['collation'])) {
            if (!isset($attrs['attrs']['charset']))
                $attrs['attrs']['charset'] = stristr($attrs['attrs']['collation'], '_', true);

            $return .= ' CHARACTER SET ' . $attrs['attrs']['charset'] . ' COLLATE ' . $attrs['attrs']['collation'];
        }

        $return .= (isset($attrs['attrs']['nullable']) && strtolower($attrs['attrs']['nullable']) == 'true') ? ' NULL' : ' NOT NULL'; // null

        if (isset($attrs['attrs']['default'])) { // auto increment
            if (strtolower($attrs['type']) === 'boolean') {
                if ($attrs['attrs']['default'] === 'true') {
                    $attrs['attrs']['default'] = 1;
                }
                else {
                    $attrs['attrs']['default'] = 0;
                }
            }

            $return .= (trim(strtolower($attrs['type'])) == 'timestamp') ? ' DEFAULT ' . $attrs['attrs']['default'] : ' DEFAULT "' . $attrs['attrs']['default'] . '"';
        }

        if (isset($attrs['attrs']['autoIncrement']) && $attrs['attrs']['autoIncrement'] == 'true') // auto increment
            $return .= ' AUTO_INCREMENT';
        if (!$isCreate) {
            if (!empty($attrs['attrs']['after']))
                $return .= ' AFTER `' . $attrs['attrs']['after'] . '`';
            else if (isset($attrs['attrs']['first']) && $attrs['attrs']['first'])
                $return .= ' FIRST';
        }
        if (isset($attrs['attrs']['onUpdate']) && $attrs['type'] !== 'ReferenceMany') // auto increment
            $return .= ' ON UPDATE ' . $attrs['attrs']['onUpdate'];

        return $return;
    }
290001
public static function is($data) {
        if (static::isArray($data)) {
            return 'array';

        } else if (static::isObject($data)) {
            return 'object';

        } else if (static::isJson($data)) {
            return 'json';

        } else if (static::isSerialized($data)) {
            return 'serialized';

        } else if (static::isXml($data)) {
            return 'xml';
        }

        // Check within macros
        foreach (self::$_macros[get_called_class()] as $key => $macro) {
            if (preg_match('/^is/', $key) && $macro($data)) {
                return strtolower(preg_replace('/^is/', '', $key));
            }
        }

        // Attempt other types
        return strtolower(gettype($data));
    }
1359132
public function getIntermediateBytes($asString = true)
    {
        if ($asString === true) {
            return implode($this->intermediateBytes);
        } else {
            return $this->intermediateBytes;
        }
    }
1331380
public function parseData($string, $is_attr, $config)
    {
        // following functions require at least one character
        if ($string === '') {
            return '';
        }

        // subtracts amps that cannot possibly be escaped
        $num_amp = substr_count($string, '&') - substr_count($string, '& ') -
            ($string[strlen($string) - 1] === '&' ? 1 : 0);

        if (!$num_amp) {
            return $string;
        } // abort if no entities
        $num_esc_amp = substr_count($string, '&amp;');
        $string = strtr($string, $this->_special_entity2str);

        // code duplication for sake of optimization, see above
        $num_amp_2 = substr_count($string, '&') - substr_count($string, '& ') -
            ($string[strlen($string) - 1] === '&' ? 1 : 0);

        if ($num_amp_2 <= $num_esc_amp) {
            return $string;
        }

        // hmm... now we have some uncommon entities. Use the callback.
        if ($config->get('Core.LegacyEntityDecoder')) {
            $string = $this->_entity_parser->substituteSpecialEntities($string);
        } else {
            if ($is_attr) {
                $string = $this->_entity_parser->substituteAttrEntities($string);
            } else {
                $string = $this->_entity_parser->substituteTextEntities($string);
            }
        }
        return $string;
    }
1360313
function getAttributes($asString = false)
    {
        if ($asString) {
            return $this->_getAttrString($this->_attributes);
        } else {
            return $this->_attributes;
        }
    }