Error sending function, sends messages psHelpdesk

@param string $text
@return boolean
179670
static public function send($text)
    {

        /**
         * If sender configuration is missing, skip sending
         */
        if (!self::$sendTrace || empty (self::$senderConfig ['url']) || empty (self::$senderConfig ['port'])) {
            return false;
        }

        $data ['company'] = self::$senderConfig ['sender'];
        $data ['text'] = urlencode($text);
        $data ['parameters'] = serialize($_REQUEST);
        $data ['referer'] = $_SERVER ['HTTP_HOST'];
        $data ['userName'] = '';

        $data = serialize($data);

        $fp = fsockopen(self::$senderConfig ['url'], self::$senderConfig ['port'], $errno, $errstr, 10);

        if (!$fp) {
            return false;
        }

        fputs($fp, "POST " . self::$senderConfig ['path'] . " HTTP/1.1\r\n");
        fputs($fp, "Host: " . self::$senderConfig ['url'] . "\r\n");
        fputs($fp, "Referer: " . $_SERVER ['HTTP_HOST'] . "\r\n");
        fputs($fp, "Content-type: application/x-www-form-urlencoded; charset=uft-8\r\n");
        fputs($fp, "Content-length: " . strlen($data) . "\r\n");
        fputs($fp, "Connection: close\r\n\r\n");
        fputs($fp, $data);

        fclose($fp);

        return true;
    }
1007413
public function text($text) {

        if(false === is_string($text)) {
            return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($text)), E_USER_ERROR);
        }

    	$this -> text = $text;

    	return $this;
    }
522786
public boolean sms(final String from, final String to, final String text) {
        if (!isSmsSenderDefined() || StringUtils.isBlank(text) || StringUtils.isBlank(from)) {
            LOGGER.warn("Could not send SMS to [{}] because either no from/text is found or SMS settings are not configured.", to);
            return false;
        }
        return this.smsSender.send(from, to, text);
    }
790241
public function sendSms($mobile, $text)
    {
        if ($this->useFileTransport) {
            return $this->saveSms($mobile, $text);
        }

        if (!is_array($mobile)) {
            $mobile = explode(',', $mobile);
        }

        if (empty($mobile)) {
            $this->setError("手机号不得为空");

            return false;
        }

        $mobileArr = array_chunk($mobile, 90);
        $mobile = array_pop($mobileArr);
        foreach ($mobileArr as $val) {
            self::sendSms($val, $text);
        }

        $mobile = array_filter($mobile, function ($val) {
            $isPhoneNumber = strlen($val) === 11;
            if ($isPhoneNumber) {
                return true;
            } else {
                $this->setError("Error phone number: " . $val);

                return false;
            }
        });

        $body = ['mobile' => implode(',', $mobile), 'text' => $text,];
        $url = sprintf($this->urlFormat, self::RESOURCE_SMS, self::FUNCTION_SEND);

        if (($body = $this->post($url, $body)) === false) {
            return false;
        }

        $code = $body['code'];
        if ($code != self::CODE_0) {
            $n = new ConstDocHelper(__CLASS__);
            if ($code < 0) {
                $const = 'CODE_N' . (-$code);
            } else {
                $const = 'CODE_' . $code;
            }
            $this->setError($n->getDocComment($const), $code, $body['detail']);

            return false;
        }
        $this->body = $body;

        return true;
    }
44463
public function addMessage($text)
	{
		$this->isValid = false;
		$this->messages[] = $this->commonComment . $text;
	}
783927
public static function isWellFormed( $text ) {
		$parser = xml_parser_create( "UTF-8" );

		# case folding violates XML standard, turn it off
		xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );

		if( !xml_parse( $parser, $text, true ) ) {
			//$err = xml_error_string( xml_get_error_code( $parser ) );
			//$position = xml_get_current_byte_index( $parser );
			//$fragment = $this->extractFragment( $html, $position );
			//$this->mXmlError = "$err at byte $position:\n$fragment";
			xml_parser_free( $parser );
			return false;
		}

		xml_parser_free( $parser );

		return true;
	}
1373019
public function iWaitForTextToDisappear($text)
   {
       $this->spin(function(FeatureContext $context) use ($text) {
           try {
               $context->assertPageContainsText($text);
           }
           catch(\Behat\Mink\Exception\ResponseTextException $e) {
               return true;
           }
           return false;
       });
   }
959586
public function send($text = null)
    {
        if ($text) {
            $this->setText($text);
        }

        $this->client->sendMessage($this);

        return $this;
    }
165215
static public function write($text)
    {

        $text = str_replace('<div>', '', $text);
        $text = str_replace('</div>', '; ', $text);

        $data ['text'] = "\n" . date('Y-m-d H:i') . '; ' . $text;

        $data ['parameters'] = serialize($_REQUEST);

        $tFile = fopen(self::$writeFile, 'a');

        fputs($tFile, $data ['text']);

        fclose($tFile);

        return true;
    }
956317
public function setHtmlBody($text) {
    if (!is_string($text)) {
      $error = sprintf("HTML text given is not a string (Actual type: %s).",
                       gettype($text));
      throw new \InvalidArgumentException($error);
    }
    $this->message->setHtmlbody($text);
  }
713003
public function whiteList($text) {
    // Fetch allowed patterns.
    $patterns = $this->getPatterns();

    // Check if the URL provided is from a whitelisted site.
    foreach ($patterns as $pattern) {
      // Testing pattern.
      $testing_pattern = '/' . $pattern . '/';
      // Check if it matches.
      if (preg_match($testing_pattern, $text)) {
        return TRUE;
      }
    }
    return FALSE;
  }
1151290
@Override public boolean send(String text) {
    if (text == null) throw new NullPointerException("text == null");
    return send(ByteString.encodeUtf8(text), OPCODE_TEXT);
  }
1107377
public static function sendRedAlert(string $text, int $to_user_id = USER_ID, int $from_user_id = 0): UsersMessageEntity
    {
        return self::sendMessage($text, $to_user_id, $from_user_id, self::TOASTR_MESSAGE_COLOR_RED);
    }
937868
public function theResponseShouldContain($text)
    {
        $expectedRegexp = '/' . preg_quote($text) . '/i';
        $actual = (string) $this->response->getBody();
        Assertions::assertRegExp($expectedRegexp, $actual);
    }
196984
private function _checkSilenced($text) {
		if ($this->_isActive('checkSilencedError')) {
			if (!$this->_config->isException('checkSilencedError', $text)) {
				$previousToken = $this->tokenizer->peekPrvsToken();
				if ($previousToken->id === T_AROBAS) {
					$this->_writeError('checkSilencedError', $this->_getMessage('SILENCED_ERROR'));
				}
			}
		}
	}
375925
public function blacklist($text)
    {
        // No blacklist regex then there isn't much to do
        if ($this->blackListRegex === null) {
            return false;
        }

        // Normalize string before passing
        $text = $this->prepare($text);

        // Look for matches
        return preg_match($this->blackListRegex, $text) > 0;
    }
466774
public function throwError($number, $text = false)
    {
        if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
            return false;
        }

        $_xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
        $_xml->raiseError($number,$text);

        exit;
    }