src/IrcParser.php
public static function stripCodes($text, $strip = self::STRIP_ALL)
    {
        if (!is_int($strip)) {
            throw new \Erebot\InvalidValueException("Invalid stripping flags");
        }

        if ($strip & self::STRIP_BOLD) {
            $text = str_replace("\002", '', $text);
        }

        if ($strip & self::STRIP_COLORS) {
            $text = preg_replace("/\003(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?/", '', $text);
        }

        if ($strip & self::STRIP_RESET) {
            $text = str_replace("\017", '', $text);
        }

        if ($strip & self::STRIP_REVERSE) {
            $text = str_replace("\026", '', $text);
        }

        if ($strip & self::STRIP_UNDERLINE) {
            $text = str_replace("\037", '', $text);
        }

        return $text;
    }
public static function stripCodes($text, $strip = self::STRIP_ALL)
    {
        if (!is_int($strip)) {
            throw new \Erebot\InvalidValueException("Invalid stripping flags");
        }

        if ($strip & self::STRIP_BOLD) {
            $text = str_replace("\002", '', $text);
        }

        if ($strip & self::STRIP_COLORS) {
            $text = preg_replace("/\003(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?/", '', $text);
        }

        if ($strip & self::STRIP_RESET) {
            $text = str_replace("\017", '', $text);
        }

        if ($strip & self::STRIP_REVERSE) {
            $text = str_replace("\026", '', $text);
        }

        if ($strip & self::STRIP_UNDERLINE) {
            $text = str_replace("\037", '', $text);
        }

        return $text;
    }
public static function stripCodes ( $ text , $ strip = self :: STRIP_ALL ) { if ( ! is_int ( $ strip ) ) { throw new \ Erebot \ InvalidValueException ( "Invalid stripping flags" ) ; } if ( $ strip & self :: STRIP_BOLD ) { $ text = str_replace ( "\002" , '' , $ text ) ; } if ( $ strip & self :: STRIP_COLORS ) { $ text = preg_replace ( "/\003(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?/" , '' , $ text ) ; } if ( $ strip & self :: STRIP_RESET ) { $ text = str_replace ( "\017" , '' , $ text ) ; } if ( $ strip & self :: STRIP_REVERSE ) { $ text = str_replace ( "\026" , '' , $ text ) ; } if ( $ strip & self :: STRIP_UNDERLINE ) { $ text = str_replace ( "\037" , '' , $ text ) ; } return $ text ; }
Strips IRC styles from a text.

\param string $text
The text from which styles must be stripped.

\param int $strip
A bitwise OR of the codes of the styles we want to strip.
The default is to strip all forms of styles from the text.
See also the Erebot::IrcParser::STRIP_* constants.

\retval string
The text with all the styles specified in $strip stripped.
Strips IRC styles from a text .