错误提示
@param $message
@param null $url
@return string
356648
public function error($message,$url='',$wait=3){
        $url=is_null($url) || $url=='' ? 'javascript:history.back(-1)' : $url;
        if($this->instance->isTemplateFile('error')){
            $this->instance->assign(['status'=>false,'message'=>$message,'url'=>url($url),'wait'=>$wait]);
            echo $this->instance->render('error');
            exit;
        }else{
            $status=false;
            require CORE_PATH.'tpl/jump.php';
            exit;
        }
    }
531568
public function sendMessage(string $message) : ?Message 
    {
        $thread = $this->messageGroup();

        if ($thread === null) return null;

        return $thread->sendMessage($message);
    }
773717
protected function stringifyMessage($message)
    {
        if (is_array($message) || is_object($message) || is_bool($message)) {
            return (string)var_export($message, true);
        }
        return (string)$message;
    }
8240
protected function success($msg, $url = null)
    {
        return $this->msg($msg, self::MSG_GOOD, $url);
    }
845531
private function uriSafeDecode($message)
    {
        $message = str_replace(['-', '_'], ['+', '/'], $message);

        $decoded = base64_decode($message, true);
        if (!is_string($decoded)) {
            return null;
        }

        return $decoded;
    }
947181
protected function getMessage(string $url): ?string
    {
        $response = wp_remote_get($url);
        $responseCode = wp_remote_retrieve_response_code($response);

        if (! is_int($responseCode)) {
            return 'Unable to reach ' . $url;
        }

        return ($this->expectedStatusCode === $responseCode)
            ? null
            : $url . ' returns ' . $responseCode;
    }
739180
public function ping($message = null) {
        return $this->returnCommand(['PING'], null, isset($message) ? [$message] : null);
    }
239469
public function t(string $message)
    {
        // 不支持颜色，移除颜色标签
        if (!CommandHelper::supportColor()) {
            return $this->stripColor($message);
        }

        $isMatch = preg_match_all(self::TAGS_REG, $message, $matches);
        // 未匹配颜色标签
        if ($isMatch === false) {
            return $message;
        }

        // 颜色标签处理
        foreach ((array)$matches[0] as $i => $m) {
            if (array_key_exists($matches[1][$i], $this->tags)) {
                $message = $this->replaceColor($message, $matches[1][$i], $matches[2][$i], (string)$this->tags[$matches[1][$i]]);
            }
        }
        return $message;
    }
1271306
function formatAddressField($message, $field)
    {
        $headers = $message->getHeaders();

        if (!$headers->has($field)) {
            return null;
        }

        $mailboxes = $headers->get($field)->getFieldBodyModel();

        $strings = [];
        foreach ($mailboxes as $email => $name) {
            $mailboxStr = $email;
            if (null !== $name) {
                $mailboxStr = $name . ' <' . $mailboxStr . '>';
            }
            $strings[] = $mailboxStr;
        }
        return implode(', ', $strings);
    }
714309
public function getRedirectURL(Message $message) : string
    {
        /** @psalm-suppress UndefinedClass */
        $store = Store::getInstance();
        if ($store === false) {
            throw new \Exception('Unable to send artifact without a datastore configured.');
        }

        $generatedId = pack('H*', bin2hex(openssl_random_pseudo_bytes(20)));
        $issuer = $message->getIssuer();
        if ($issuer === null) {
            throw new \Exception('Cannot get redirect URL, no Issuer set in the message.');
        }
        $artifact = base64_encode("\x00\x04\x00\x00".sha1($issuer->getValue(), true).$generatedId);
        $artifactData = $message->toUnsignedXML();
        $artifactDataString = $artifactData->ownerDocument->saveXML($artifactData);

        $store->set('artifact', $artifact, $artifactDataString, Temporal::getTime() + 15*60);

        $params = [
            'SAMLart' => $artifact,
        ];
        $relayState = $message->getRelayState();
        if ($relayState !== null) {
            $params['RelayState'] = $relayState;
        }

        $destination = $message->getDestination();
        if ($destination === null) {
            throw new \Exception('Cannot get redirect URL, no destination set in the message.');
        }
        /** @psalm-suppress UndefinedClass */
        return HTTP::addURLparameters($destination, $params);
    }
554423
public static function mergeUrlProtocol($url, $protocol = null)
    {
        $protocol   = is_null($protocol) ? static::getProtocol() : $protocol; // 协议类型
        $pattern    = '/^([a-zA-z]+)(:\/\/[^\s]*)/';                           // 正则表达式

        // 执行正则匹配
        preg_match($pattern, $url, $match);

        if ( static::isArray($match) ) {
            if ( isset($match[1]) ) {
                return preg_replace($pattern, $protocol . '$2', $url);
            }
        }

        return $protocol . '://' . $url;
    }
818788
public function email($message = null)
    {
        $this->setRule(__FUNCTION__, function($email)
                       {
                           if (strlen($email) == 0) return true;
                           $isValid = true;
                           $atIndex = strrpos($email, '@');
                           if (is_bool($atIndex) && !$atIndex) {
                               $isValid = false;
                           } else {
                               $domain = substr($email, $atIndex+1);
                               $local = substr($email, 0, $atIndex);
                               $localLen = strlen($local);
                               $domainLen = strlen($domain);
                               if ($localLen < 1 || $localLen > 64) {
                                   $isValid = false;
                               }
                               else if ($domainLen < 1 || $domainLen > 255) {
                                   // domain part length exceeded
                                   $isValid = false;
                               }
                               else if ($local[0] == '.' || $local[$localLen-1] == '.') {
                                   // local part starts or ends with '.'
                                   $isValid = false;
                               }
                               else if (preg_match('/\\.\\./', $local)) {
                                   // local part has two consecutive dots
                                   $isValid = false;
                               }
                               else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
                                   // character not valid in domain part
                                   $isValid = false;
                               }
                               else if (preg_match('/\\.\\./', $domain)) {
                                   // domain part has two consecutive dots
                                   $isValid = false;
                               }
                               else if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\","",$local))) {
                                   // character not valid in local part unless
                                   // local part is quoted
                                   if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\","",$local))) {
                                       $isValid = false;
                                   }
                               }
                               // check DNS
                               if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))) {
                                   // hmm, the domain has no MX records
                                   if (checkdnsrr('gmail.com',"MX")) {
                                       // but Gmail does. the other domain must be dodgy
                                       $isValid = false;
                                   }
                                   // otherwise: probably running off-line or maybe DNS service is not working
                               }
                           }
                           return $isValid;
                       }, $message);
        return $this;
    }
816094
protected function getDecoratedMessage($message, $params = [])
    {
        $result = '';
        $prefix = '';
        foreach ($params as $option => $value) {
            if ($value) {
                $result .= $prefix . $this->decorations[$option][$value];
                $prefix = ';';
            }
        }

        if ($prefix) {
            $message = 'm' . $message;
        }

        return $result . $message;
    }
77567
protected function handleMessage($message)
    {
        $handler = $this->messageHandler;

        if (!is_callable($handler)) {
            Log::debug('No handler enabled.');

            return null;
        }

        Log::debug('Message detail:', $message->all());

        $type = $this->messageTypeMapping[ $message->get('InfoType') ];

        $response = null;

        if ($type) {
            $response = call_user_func_array($handler, [$message]);
        }

        return $response;
    }
150020
public function getByUrl(?string $url, $locale): ?Page
	{
		/* @var $orm Orm */
		$orm = $this->getRepository()->getModel();
		if ($locale instanceof Locale) {
			$eLocale = $locale;
		} else {
			$eLocale = $orm->locales->getByLocale($locale);
		}

		$urls = $this->getPageList();
		if (isset($urls[$url])) {
			$builder = $this->builder()
				->andWhere('[id] = %i', $urls[$url])
				->andWhere('[localeId] = %i', $eLocale->id);
			return $this->toEntity($builder);
		}
		return null;
	}
341745
public function publishPost( $message, $url = null ) {
        throw new Exception( Yii::t( 'SyncSocial', '{service} not support post publish', [
            'service' => $this->service->getName()
        ] ) );

    }
1065257
public function _link($title, $url = null, $options = array(), $confirmMessage = false) {
			
		$escapeTitle = true;
		if($url === null) {
			$url = $this->url($title,true);
			$title = htmlspecialchars_decode($url, ENT_QUOTES);
			$title = h(urldecode($title));
			$escapeTitle = false;
		} elseif($url !== false){
			$url = $this->url($url,true);	
		}
		
	

		if (isset($options['escapeTitle'])) {
			$escapeTitle = $options['escapeTitle'];
			unset($options['escapeTitle']);
		} elseif (isset($options['escape'])) {
			$escapeTitle = $options['escape'];
		}

		if ($escapeTitle === true) {
			$title = h($title);
		} elseif (is_string($escapeTitle)) {
			$title = htmlentities($title, ENT_QUOTES, $escapeTitle);
		}

		if (!empty($options['confirm'])) {
			$confirmMessage = $options['confirm'];
			unset($options['confirm']);
		}
		if ($confirmMessage) {
			$options['onclick'] = $this->_confirm($confirmMessage, 'return true;', 'return false;', $options);
		} elseif (isset($options['default']) && !$options['default']) {
			if (isset($options['onclick'])) {
				$options['onclick'] .= ' ';
			} else {
				$options['onclick'] = '';
			}
			$options['onclick'] .= 'event.returnValue = false; return false;';
			unset($options['default']);
		}

		if ($url === false) {
			return sprintf($this->_tags['linknohref'], $this->_parseAttributes($options), $title);
		}		
		return sprintf($this->_tags['link'], $url, $this->_parseAttributes($options), $title);
	}