本文整理匯總了PHP中IPSText::stripUrls方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::stripUrls方法的具體用法?PHP IPSText::stripUrls怎麽用?PHP IPSText::stripUrls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::stripUrls方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _makeNameSafe
/**
* Make the name used for the quote safe for regex parsing
*
* @access protected
* @param array preg_replace_callback Matches
* @return string Output
* @note This looks complicated (and is somewhat) but it's done this way to try to quote correctly users with ' in their names
* @link http://community.invisionpower.com/tracker/issue-18588-bbcode-mistake-when-quoting-users-with-a-in-their-name
*/
protected function _makeNameSafe($matches)
{
$quote = $matches[1];
$name = $matches[2];
$next = '';
if (strpos($name, 'post=') !== false) {
$next = substr($name, strpos($name, 'post='));
$name = substr($name, 0, strpos($name, 'post=') - 1);
}
if (strpos($name, 'date=') !== false) {
$next = $next . ' ' . substr($name, strpos($name, 'date='));
$name = substr($name, 0, strpos($name, 'date=') - 1);
}
if (strpos($name, 'timestamp=') !== false) {
$next = $next . ' ' . substr($name, strpos($name, 'timestamp='));
$name = substr($name, 0, strpos($name, 'timestamp=') - 1);
}
$name = substr($name, 0, -strlen($quote));
# Squeeze past the parser...
$name = str_replace(array(''', "'"), "'", $name);
$_last = $next ? ' ' . $next : '';
return 'name=' . $quote . IPSText::getTextClass('bbcode')->xssHtmlClean($this->_parent->stripAllTags(IPSText::stripUrls($name))) . $quote . $_last . ']';
}