⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 message.class.php

📁 phpMyAdmin图形界面化操作,我已经配置好了,只要把解要压缩后的文件放到站点下就可以用了
💻 PHP
📖 第 1 页 / 共 2 页
字号:
     */    public function setMessage($message, $sanitize = false)    {        if ($sanitize) {            $message = PMA_Message::sanitize($message);        }        $this->_message = $message;    }    /**     * set string (does not take effect if raw message is set)     *     * @uses    PMA_Message::$_string to set it     * @uses    PMA_Message::sanitize()     * @param   string  $_string     * @param   boolean $sanitize whether to sanitize $string or not     */    public function setString($_string, $sanitize = true)    {        if ($sanitize) {            $_string = PMA_Message::sanitize($_string);        }        $this->_string = $_string;    }    /**     * set message type number     *     * @uses    PMA_Message::$_number to set it     * @param   integer $number     */    public function setNumber($number)    {        $this->_number = $number;    }    /**     * add parameter, usually in conjunction with strings     *     * usage     * <code>     * $message->addParam('strLocale', false);     * $message->addParam('[em]somes tring[/em]');     * $message->addParam('<img src="img" />', false);     * </code>     *     * @uses    htmlspecialchars()     * @uses    PMA_Message::$_params to fill     * @uses    PMA_Message::notice()     * @param   mixed   $param     * @param   boolean $raw     */    public function addParam($param, $raw = true)    {        if ($param instanceof PMA_Message) {            $this->_params[] = $param;        } elseif ($raw) {            $this->_params[] = htmlspecialchars($param);        } else {            $this->_params[] = PMA_Message::notice($param);        }    }    /**     * add another string to be concatenated on displaying     *     * @uses    PMA_Message::$_added_messages to fill     * @uses    PMA_Message::notice()     * @param   string  $string    to be added     * @param   string  $separator to use between this and previous string/message     */    public function addString($string, $separator = ' ')    {        $this->_added_messages[] = $separator;        $this->_added_messages[] = PMA_Message::notice($string);    }    /**     * add a bunch of messages at once     *     * @uses    PMA_Message::addMessage()     * @param   array   $messages  to be added     * @param   string  $separator to use between this and previous string/message     */    public function addMessages($messages, $separator = ' ')    {        foreach ($messages as $message) {            $this->addMessage($message, $separator);        }    }    /**     * add another raw message to be concatenated on displaying     *     * @uses    PMA_Message::$_added_messages to fill     * @uses    PMA_Message::rawNotice()     * @param   mixed   $message   to be added     * @param   string  $separator to use between this and previous string/message     */    public function addMessage($message, $separator = ' ')    {        if (strlen($separator)) {            $this->_added_messages[] = $separator;        }        if ($message instanceof PMA_Message) {            $this->_added_messages[] = $message;        } else {            $this->_added_messages[] = PMA_Message::rawNotice($message);        }    }    /**     * set all params at once, usually used in conjunction with string     *     * @uses    PMA_Message::sanitize()     * @uses    PMA_Message::$_params to set     * @param   array   $params     * @param   boolean $sanitize     */    public function setParams($params, $sanitize = false)    {        if ($sanitize) {            $params = PMA_Message::sanitize($params);        }        $this->_params = $params;    }    /**     * return all parameters     *     * @uses    PMA_Message::$_params as return value     * @return array     */    public function getParams()    {        return $this->_params;    }    /**     * return all added messages     *     * @uses    PMA_Message::$_added_messages as return value     * @return array     */    public function getAddedMessages()    {        return $this->_added_messages;    }    /**     * Sanitizes $message     *     * @static     * @uses    is_array()     * @uses    htmlspecialchars()     * @uses    PMA_Message::sanitize() recursiv     * @param   mixed   the message(s)     * @return  mixed   the sanitized message(s)     * @access  public     */    static public function sanitize($message)    {        if (is_array($message)) {            foreach ($message as $key => $val) {                $message[$key] = PMA_Message::sanitize($val);            }            return $message;        }        return htmlspecialchars($message);    }    /**     * decode $message, taking into account our special codes     * for formatting     *     * @static     * @uses    PREG_SET_ORDER     * @uses    in_array()     * @uses    preg_match_all()     * @uses    preg_match()     * @uses    preg_replace()     * @uses    substr()     * @uses    strtr()     * @param   string  $message the message     * @return  string  the decoded message     * @access  public     */    static public function decodeBB($message)    {        $replace_pairs = array(            '[i]'       => '<em>',      // deprecated by em            '[/i]'      => '</em>',     // deprecated by em            '[em]'      => '<em>',            '[/em]'     => '</em>',            '[b]'       => '<strong>',  // deprecated by strong            '[/b]'      => '</strong>', // deprecated by strong            '[strong]'  => '<strong>',            '[/strong]' => '</strong>',            '[tt]'      => '<code>',    // deprecated by CODE or KBD            '[/tt]'     => '</code>',   // deprecated by CODE or KBD            '[code]'    => '<code>',            '[/code]'   => '</code>',            '[kbd]'     => '<kbd>',            '[/kbd]'    => '</kbd>',            '[br]'      => '<br />',            '[/a]'      => '</a>',            '[sup]'     => '<sup>',            '[/sup]'    => '</sup>',        );        $message = strtr($message, $replace_pairs);        $pattern = '/\[a@([^"@]*)@([^]"]*)\]/';        if (preg_match_all($pattern, $message, $founds, PREG_SET_ORDER)) {            $valid_links = array(                'http',  // default http:// links (and https://)                './Do',  // ./Documentation            );            foreach ($founds as $found) {                // only http... and ./Do... allowed                if (! in_array(substr($found[1], 0, 4), $valid_links)) {                    return $message;                }                // a-z and _ allowed in target                if (! empty($found[2]) && preg_match('/[^a-z_]+/i', $found[2])) {                    return $message;                }            }            $message = preg_replace($pattern, '<a href="\1" target="\2">', $message);        }        return $message;    }    /**     * wrapper for sprintf()     *     * @uses    sprintf()     * @uses    func_get_args()     * @uses    is_array()     * @uses    array_unshift()     * @uses    call_user_func_array()     * @return  string formated     */    static public function format()    {        $params = func_get_args();        if (is_array($params[1])) {            array_unshift($params[1], $params[0]);            $params = $params[1];        }        return call_user_func_array('sprintf', $params);    }    /**     * returns unique PMA_Message::$_hash, if not exists it will be created     *     * @uses    PMA_Message::$_hash as return value and to set it if required     * @uses    PMA_Message::getNumber()     * @uses    PMA_Message::$_string     * @uses    PMA_Message::$_message     * @uses    md5()     * @param   string $file     * @return  string PMA_Message::$_hash     */    public function getHash()    {        if (null === $this->_hash) {            $this->_hash = md5(                $this->getNumber() .                $this->_string .                $this->_message            );        }        return $this->_hash;    }    /**     * returns compiled message     *     * @uses    PMA_Message::$_message as return value     * @uses    PMA_Message::getString()     * @uses    PMA_Message::getParams()     * @uses    PMA_Message::format()     * @uses    PMA_Message::decodeBB()     * @uses    PMA_Message::getAddedMessages()     * @uses    strlen()     * @return  string complete message     */    public function getMessage()    {        $message = $this->_message;        if (0 === strlen($message)) {            $string = $this->getString();            if (isset($GLOBALS[$string])) {                $message = $GLOBALS[$string];            } elseif (0 === strlen($string)) {                $message = '';            } else {                $message = $string;            }        }        if (count($this->getParams()) > 0) {            $message = PMA_Message::format($message, $this->getParams());        }        $message = PMA_Message::decodeBB($message);        foreach ($this->getAddedMessages() as $add_message) {            $message .= $add_message;        }        return $message;    }    /**     * returns PMA_Message::$_string     *     * @uses    PMA_Message::$_string as return value     * @return  string PMA_Message::$_string     */    public function getString()    {        return $this->_string;    }    /**     * returns PMA_Message::$_number     *     * @uses    PMA_Message::$_number as return value     * @return  integer PMA_Message::$_number     */    public function getNumber()    {        return $this->_number;    }    /**     * returns level of message     *     * @uses    PMA_Message::$level     * @uses    PMA_Message::getNumber()     * @return  string  level of message     */    public function getLevel()    {        return PMA_Message::$level[$this->getNumber()];    }    /**     * Displays the message in HTML     *     * @uses    PMA_Message::getLevel()     * @uses    PMA_Message::getMessage()     * @uses    PMA_Message::isDisplayed()     */    public function display()    {        echo $this->getDisplay();        $this->isDisplayed(true);    }    /**     * returns HTML code for displaying this message     *     * @return string whole message box     */    public function getDisplay()    {        return '<div class="' . $this->getLevel() . '">'            . $this->getMessage() . '</div>';    }    /**     * sets and returns whether the message was displayed or not     *     * @uses    PMA_Message::$_is_displayed to set it and/or return it     * @param   boolean $is_displayed     * @return  boolean PMA_Message::$_is_displayed     */    public function isDisplayed($is_displayed = false)    {        if ($is_displayed){            $this->_is_displayed = $is_displayed;        }        return $this->_is_displayed;    }}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -