本文整理匯總了PHP中IPSText::unconvertSmilies方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::unconvertSmilies方法的具體用法?PHP IPSText::unconvertSmilies怎麽用?PHP IPSText::unconvertSmilies使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::unconvertSmilies方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: preEditParse
/**
* This function processes the text before showing for editing, etc
*
* @access public
* @param string Raw text
* @return string Converted text
*/
public function preEditParse($txt = "")
{
//-----------------------------------------
// Clean up BR tags
//-----------------------------------------
if (!$this->parse_html) {
$txt = str_replace("\n", "", $txt);
$txt = str_replace("<br>", "\n", $txt);
$txt = str_replace("<br />", "\n", $txt);
}
//-----------------------------------------
// Unconvert smilies
//-----------------------------------------
$txt = IPSText::unconvertSmilies($txt);
//-----------------------------------------
// Clean up nbsp
//-----------------------------------------
$txt = str_replace(' ', "\t", $txt);
$txt = str_replace(' ', " ", $txt);
//-----------------------------------------
// Parse html
//-----------------------------------------
if ($this->parse_html) {
$txt = str_replace("'", "'", $txt);
}
//-----------------------------------------
// Fix "{style_images_url}"
//-----------------------------------------
$txt = str_replace("{style_images_url}", "{style_images_url}", $txt);
/* check for missing options in bbcode tags */
$txt = preg_replace('#\\[(\\S+?)=\\]#', '[\\1]', $txt);
return trim($txt);
}
示例2: unconvertSmilies
/**
* Unconvert emoticons
*
* @param string Raw posted text
* @return string Raw text with text emoticons
*/
public function unconvertSmilies($t)
{
return IPSText::unconvertSmilies($t);
}
示例3: preEditParse
/**
* This function processes the text before showing for editing, etc
* Used for rebuilding after upgrade to 3.0
*
* @access public
* @param string Raw text
* @return string Converted text
*/
public function preEditParse($txt = "")
{
//-----------------------------------------
// Before we start, strip newlines or we'll
// end up duplicating them
//-----------------------------------------
$txt = str_replace("\n", "", $txt);
$txt = str_replace("\r", "", $txt);
//-----------------------------------------
// Clean up BR tags
//-----------------------------------------
if (!$this->parse_html or $this->parse_nl2br) {
$txt = str_replace("<br>", "\n", $txt);
$txt = str_replace("<br />", "\n", $txt);
}
# Make EMO_DIR safe so the ^> regex works
$txt = str_replace("<#EMO_DIR#>", "<#EMO_DIR>", $txt);
# New emo
$txt = preg_replace("#(\\s)?<([^>]+?)emoid=\"(.+?)\"([^>]*?)" . ">(\\s)?#is", "\\1\\3\\5", $txt);
# And convert it back again...
$txt = str_replace("<#EMO_DIR>", "<#EMO_DIR#>", $txt);
# Legacy
$txt = preg_replace("#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1", $txt);
# New (3.0)
$txt = IPSText::unconvertSmilies($txt);
//-----------------------------------------
// Clean up nbsp
//-----------------------------------------
$txt = str_replace(' ', "\t", $txt);
$txt = str_replace(' ', " ", $txt);
if ($this->parse_bbcode) {
//-----------------------------------------
// Custom bbcode...
//-----------------------------------------
$txt = preg_replace("#<acronym title=[\"'](.+?)['\"]>(.+?)</acronym>#is", "[acronym=\"\\1\"]\\2[/acronym]", $txt);
$txt = preg_replace("#<a href=[\"']index\\.php\\?automodule=blog(&|&)showentry=(.+?)['\"]>(.+?)</a>#is", "[entry=\"\\2\"]\\3[/entry]", $txt);
$txt = preg_replace("#<a href=[\"']index\\.php\\?automodule=blog(&|&)blogid=(.+?)['\"]>(.+?)</a>#is", "[blog=\"\\2\"]\\3[/blog]", $txt);
$txt = preg_replace("#<a href=[\"']index\\.php\\?act=findpost(&|&)pid=(.+?)['\"]>(.+?)</a>#is", "[post=\"\\2\"]\\3[/post]", $txt);
$txt = preg_replace("#<a href=[\"']index\\.php\\?showtopic=(.+?)['\"]>(.+?)</a>#is", "[topic=\"\\1\"]\\2[/topic]", $txt);
$txt = preg_replace("#<a href=[\"'](.*?)index\\.php\\?act=findpost(&|&)pid=(.+?)['\"]><\\{POST_SNAPBACK\\}></a>#is", "[snapback]\\3[/snapback]", $txt);
$txt = preg_replace("#<div class=[\"']codetop['\"]>(.+?)</div><div class=[\"']codemain['\"] style=[\"']height:200px;white\\-space:pre;overflow:auto['\"]>(.+?)</div>#is", "[codebox]\\2[/codebox]", $txt);
$txt = preg_replace("#<!--blog\\.extract\\.start-->(.+?)<!--blog\\.extract\\.end-->#is", "[extract]\\1[/extract]", $txt);
$txt = preg_replace("#<span style=[\"']color:\\#000000;background:\\#000000['\"]>(.+?)</span>#is", "[spoiler]\\1[/spoiler]", $txt);
//-----------------------------------------
// SQL
//-----------------------------------------
$txt = preg_replace_callback("#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#is", array(&$this, 'unconvert_sql'), $txt);
//-----------------------------------------
// HTML
//-----------------------------------------
$txt = preg_replace_callback("#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#is", array(&$this, 'unconvert_htm'), $txt);
//-----------------------------------------
// Images / Flash
//-----------------------------------------
$txt = preg_replace_callback("#<!--Flash (.+?)-->.+?<!--End Flash-->#", array(&$this, 'unconvert_flash'), $txt);
$txt = preg_replace("#<img(?:.+?)src=[\"'](\\S+?)['\"][^>]+?>#is", "\\[img\\]\\1\\[/img\\]", $txt);
//-----------------------------------------
// Email, URLs
//-----------------------------------------
$txt = preg_replace("#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#s", "\\[email=\\1\\]\\2\\[/email\\]", $txt);
$txt = preg_replace("#<a href=[\"'](http://|https://|ftp://|news://)?(\\S+?)['\"].*?" . ">(.+?)</a>#s", "\\[url=\"\\1\\2\"\\]\\3\\[/url\\]", $txt);
//-----------------------------------------
// Quote
//-----------------------------------------
$txt = preg_replace("#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#", '[quote]', $txt);
$txt = preg_replace("#<!--QuoteBegin-{1,2}([^>]+?)\\+([^>]+?)-->(.+?)<!--QuoteEBegin-->#", "[quote name='\\1' date='\\2']", $txt);
$txt = preg_replace("#<!--QuoteBegin-{1,2}([^>]+?)\\+-->(.+?)<!--QuoteEBegin-->#", "[quote name='\\1']", $txt);
$txt = preg_replace("#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#", '[/quote]', $txt);
//-----------------------------------------
// Super old quotes
//-----------------------------------------
$txt = preg_replace("#\\[quote=(.+?),(.+?)\\]#i", "[quote name='\\1' date='\\2']", $txt);
//-----------------------------------------
// URL Inside Quote
//-----------------------------------------
$txt = preg_replace("#\\[quote=(.*?)\\[url(.*?)\\](.+?)\\[\\/url\\]\\]#i", "[quote=\\1\\3]", str_replace("\\", "", $txt));
//-----------------------------------------
// New quote
//-----------------------------------------
$txt = preg_replace_callback("#<!--quoteo([^>]+?)?-->(.+?)<!--quotec-->#si", array(&$this, '_parse_new_quote'), $txt);
//-----------------------------------------
// Ident => Block quote
//-----------------------------------------
while (preg_match("#<blockquote>(.+?)</blockquote>#is", $txt)) {
$txt = preg_replace("#<blockquote>(.+?)</blockquote>#is", "[indent]\\1[/indent]", $txt);
}
//-----------------------------------------
// CODE
//-----------------------------------------
$txt = preg_replace("#<!--c1-->(.+?)<!--ec1-->#", '[code]', $txt);
$txt = preg_replace("#<!--c2-->(.+?)<!--ec2-->#", '[/code]', $txt);
//-----------------------------------------
//.........這裏部分代碼省略.........
示例4: cleanMessage
/**
* Cleans an email message
*
* @param string Email content
* @param bool Skip converting < and >
* @param bool Fix up plain text links
* @return string Cleaned email content
*/
public function cleanMessage($message = "", $skipAngleBrackets = false, $fixPlainTextLinks = true)
{
if (!$this->html_email) {
$message = preg_replace_callback('#\\[url=(.+?)\\](.+?)\\[/url\\]#', array($this, "_formatUrl"), $message);
}
//-----------------------------------------
// Unconvert smilies 'cos at this point they are img tags
//-----------------------------------------
$message = IPSText::unconvertSmilies($message);
//-----------------------------------------
// We may want to adjust this later, but for
// now just strip any other html
//-----------------------------------------
$message = preg_replace('#</p>(\\s+?)?<p([^>]+?)?>#is', '<br />', $message);
/* We need to fix links in plaintext templates so people don't get "http://some..ing" instead of "http://something" */
if ($fixPlainTextLinks) {
$message = $this->fixPlaintextLinks($message);
}
$message = IPSText::stripTags($message, '<br>,<blockquote>');
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parse_bbcode = 0;
/* Textual representations of certain bbcodes to attempt to keep context */
$plainText = '<br /><br />------------ QUOTE ----------<br />\\1<br />-----------------------------<br /><br />';
$message = preg_replace('#\\[quote(?:[^\\]]+?)?\\](.+?)\\[/quote\\]#s', $plainText, $message);
$message = preg_replace('#<blockquote(?:[^>]+?)?>(.+?)</blockquote>#s', $plainText, $message);
$plainTextCode = '*CODE* \\1 */CODE*';
$message = preg_replace('#\\[code(?:[^\\]]+?)?\\](.+?)\\[/code\\]#s', $plainTextCode, $message);
$message = preg_replace('#\\[member=(.+?)\\]#s', "\\1", $message);
$message = IPSText::getTextClass('bbcode')->stripAllTags($message, true);
//-----------------------------------------
// Bear with me...
//-----------------------------------------
$message = str_replace("\n", "\r\n", $message);
$message = str_replace("\r", "", $message);
$message = str_replace("<br>", "\r\n", $message);
$message = str_replace("<br />", "\r\n", $message);
$message = str_replace("\r\n\r\n", "\r\n", $message);
$message = str_replace(""", '"', $message);
$message = str_replace("\", "\\", $message);
$message = str_replace("$", "\$", $message);
$message = str_replace("!", "!", $message);
$message = str_replace(""", '"', $message);
$message = str_replace("'", "'", $message);
$message = str_replace("(", "(", $message);
$message = str_replace(")", ")", $message);
$message = str_replace("<", "<", $message);
$message = str_replace(">", ">", $message);
$message = str_replace("|", '|', $message);
$message = str_replace("&", "&", $message);
$message = str_replace("&", '&', $message);
$message = str_replace(":", ":", $message);
$message = str_replace("[", "[", $message);
$message = str_replace("]", "]", $message);
$message = str_replace("@", '@', $message);
$message = str_replace(" ", ' ', $message);
if (!$skipAngleBrackets) {
$message = str_replace("<", '<', $message);
$message = str_replace(">", '>', $message);
}
return $message;
}