本文整理匯總了PHP中IPSText::resetTextClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::resetTextClass方法的具體用法?PHP IPSText::resetTextClass怎麽用?PHP IPSText::resetTextClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::resetTextClass方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _formatMessageForDisplay
/**
* Function to format the actual message (applies BBcode, etc)
*
* @param string Raw text
* @param array PM data
* @return string Processed text
*/
private function _formatMessageForDisplay($msgContent, $data = array())
{
IPSText::resetTextClass('bbcode');
$this->settings['max_emos'] = 0;
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'pms';
IPSText::getTextClass('bbcode')->parsing_mgroup = $data['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $data['mgroup_others'];
$msgContent = IPSText::getTextClass('bbcode')->preDisplayParse($msgContent);
return $msgContent;
}
示例2: doExecute
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if (!$this->memberData['g_use_pm']) {
$this->registry->getClass('output')->showError('messenger_disabled', 10222);
}
if ($this->memberData['members_disable_pm']) {
$this->registry->getClass('output')->showError('messenger_disabled', 10223);
}
if (!$this->memberData['member_id']) {
$this->registry->getClass('output')->showError('messenger_no_guests', 10224);
}
if (!IPSLib::moduleIsEnabled('messaging', 'members')) {
$this->registry->getClass('output')->showError('messenger_disabled', 10227);
}
//-----------------------------------------
// Reset Classes
//-----------------------------------------
IPSText::resetTextClass('bbcode');
IPSText::resetTextClass('editor');
//-----------------------------------------
// Load lang file
//-----------------------------------------
$this->registry->getClass('class_localization')->loadLanguageFile(array("public_error", "public_editors"), 'core');
//-----------------------------------------
// Post Key
//-----------------------------------------
$this->_postKey = ($this->request['postKey'] and $this->request['postKey'] != '') ? $this->request['postKey'] : md5(microtime());
//-----------------------------------------
// Can we upload?
//-----------------------------------------
if ($this->memberData['g_attach_max'] != -1 and $this->memberData['g_can_msg_attach']) {
$this->_canUpload = 1;
}
$this->lang->words['the_max_length'] = $this->settings['max_post_length'] * 1024;
//-----------------------------------------
// Language
//-----------------------------------------
/* Load post lang file for attachments stuff */
$this->registry->class_localization->loadLanguageFile(array('public_post'), 'forums');
$this->registry->class_localization->loadLanguageFile(array('public_messaging'), 'members');
//-----------------------------------------
// Grab class
//-----------------------------------------
require_once IPSLib::getAppDir('members') . '/sources/classes/messaging/messengerFunctions.php';
$this->messengerFunctions = new messengerFunctions($registry);
/* Messenger Totals */
$totals = $this->messengerFunctions->buildMessageTotals();
//-----------------------------------------
// Did we preview new topic?
//-----------------------------------------
if ($this->request['preview']) {
$this->request['do'] = 'form';
}
//-----------------------------------------
// Or a reply?
//-----------------------------------------
if ($this->request['previewReply']) {
if ($this->request['do'] == 'sendEdit') {
$this->request['do'] = 'editMessage';
} else {
$this->request['do'] = 'replyForm';
}
}
//-----------------------------------------
// What to do?
//-----------------------------------------
switch ($this->request['do']) {
default:
case 'form':
$html = $this->_showNewTopicForm();
break;
case 'replyForm':
$html = $this->_showForm('reply');
break;
case 'send':
$html = $this->_sendNewPersonalTopic();
break;
case 'sendReply':
$html = $this->_sendReply();
break;
case 'editMessage':
$html = $this->_showForm('edit');
break;
case 'sendEdit':
$html = $this->_sendEdit();
break;
case 'deleteReply':
$html = $this->_deleteReply();
break;
}
//.........這裏部分代碼省略.........
示例3: _formatMessageForDisplay
/**
* Function to format the actual message (applies BBcode, etc)
*
* @access private
* @param string Raw text
* @param array PM data
* @return string Processed text
*/
private function _formatMessageForDisplay($msgContent, $data = array())
{
//-----------------------------------------
// Reset Classes
//-----------------------------------------
IPSText::resetTextClass('bbcode');
//-----------------------------------------
// Post process the editor
// Now we have safe HTML and bbcode
//-----------------------------------------
$this->settings['max_emos'] = 0;
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parse_html = $this->settings['msg_allow_html'];
IPSText::getTextClass('bbcode')->parse_bbcode = $this->settings['msg_allow_code'];
IPSText::getTextClass('bbcode')->parsing_section = 'pms';
IPSText::getTextClass('bbcode')->parsing_mgroup = $data['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $data['mgroup_others'];
$msgContent = IPSText::getTextClass('bbcode')->preDisplayParse($msgContent);
if (IPSText::getTextClass('bbcode')->error != "") {
//throw new Exception( "BBCODE_" . IPSText::getTextClass('bbcode')->error );
}
return $msgContent;
}
示例4: _getPMNotification
/**
* Returns PM notification
*
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
protected function _getPMNotification()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$limit = intval($this->request['limit']);
//-----------------------------------------
// INIT the parser
//-----------------------------------------
IPSText::resetTextClass('bbcode');
IPSText::getTextClass('bbcode')->allow_update_caches = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parsing_section = 'pms';
//-----------------------------------------
// Get last PM details
//-----------------------------------------
$msg = $this->DB->buildAndFetch(array('select' => 'mt.*', 'from' => array('message_topics' => 'mt'), 'where' => "mt.mt_owner_id=" . $this->memberData['member_id'] . " AND mt.mt_vid_folder='in'", 'order' => 'mt.mt_date DESC', 'limit' => array(intval($limit), 1), 'add_join' => array(array('select' => 'msg.*', 'from' => array('message_text' => 'msg'), 'where' => 'msg.msg_id=mt.mt_msg_id', 'type' => 'left'), array('select' => 'm.member_id,m.name,m.member_group_id,m.mgroup_others,m.email,m.joined,m.posts, m.last_visit, m.last_activity, m.warn_level, m.warn_lastwarn, m.members_display_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=mt.mt_from_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=mt.mt_from_id', 'type' => 'left'), array('select' => 'g.g_id, g.g_title, g.g_icon, g.g_dohtml', 'from' => array('groups' => 'g'), 'where' => 'g.g_id=m.member_group_id', 'type' => 'left'))));
//-----------------------------------------
// Check...
//-----------------------------------------
if (!$msg['msg_id'] and !$msg['mt_id'] and !$msg['id']) {
$this->returnJsonError('noMsg');
}
//-----------------------------------------
// Strip and wrap
//-----------------------------------------
IPSText::getTextClass('bbcode')->parsing_mgroup = $msg['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $msg['mgroup_others'];
$msg['msg_post'] = IPSText::getTextClass('bbcode')->stripAllTags(strip_tags(str_replace('<br />', "\n", $msg['msg_post'])));
$msg['msg_post'] = wordwrap($msg['msg_post'], 50, "\n");
if (IPSText::mbstrlen($msg['msg_post']) > 300) {
$msg['msg_post'] = IPSText::truncate($msg['msg_post'], 350);
}
$msg['msg_post'] = nl2br($msg['msg_post']);
//-----------------------------------------
// Add attach icon
//-----------------------------------------
if ($msg['mt_hasattach']) {
$msg['attach_img'] = '<{ATTACH_ICON}> ';
}
//-----------------------------------------
// Date
//-----------------------------------------
$msg['msg_date'] = $this->registry->getClass('class_localization')->getDate($msg['msg_date'], 'TINY');
//-----------------------------------------
// Next / Total links
//-----------------------------------------
$msg['_cur_num'] = intval($limit) + 1;
$msg['_msg_count_total'] = intval($this->memberData['msg_count_new']) ? intval($this->memberData['msg_count_new']) : 1;
//-----------------------------------------
// Return loverly HTML
//-----------------------------------------
return $this->returnHtml($this->registry->getClass('output')->getTemplate('messaging')->PMNotificationBox($msg));
}
示例5: bbcodePopUpList
/**
* Show BBCode Helpy file
*
* @return @e void
*/
public function bbcodePopUpList()
{
/* Load the Parser */
IPSText::resetTextClass('bbcode');
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'global';
/* Loop through the bbcode and build the output array */
$rows = array();
/* Add in custom bbcode */
if (count($this->caches['bbcode'])) {
foreach ($this->caches['bbcode'] as $row) {
if ($row['bbcode_groups'] != 'all') {
$pass = false;
$groups = array_diff(explode(',', $row['bbcode_groups']), array(''));
$mygroups = array($this->memberData['member_group_id']);
$mygroups = array_diff(array_merge($mygroups, explode(',', IPSText::cleanPermString($this->memberData['mgroup_others']))), array(''));
foreach ($groups as $g_id) {
if (in_array($g_id, $mygroups)) {
$pass = true;
break;
}
}
if (!$pass) {
continue;
}
}
if ($row['bbcode_tag'] == 'member') {
$row['bbcode_example'] = str_replace('[member=admin]', '[member=' . $this->memberData['members_display_name'] . ']', $row['bbcode_example']);
}
$before = htmlspecialchars($row['bbcode_example']);
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
$parser = new $classToLoad();
/* Set up some settings */
$parser->set(array('memberData' => $this->memberData, 'parseBBCode' => true, 'parseHtml' => false, 'parseEmoticons' => true));
/* img is hardcoded as the new style format was never available in the php bbcode parser and is handled via js library now */
$t = $row['bbcode_tag'] == 'img' ? "<img src='http://www.google.com/intl/en_ALL/images/logo.gif' />" : ($t = $parser->display($before));
$before = preg_replace("#(\\[" . $row['bbcode_tag'] . "(?:[^\\]]+)?\\])#is", $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before);
$before = preg_replace("#(\\[/" . $row['bbcode_tag'] . "\\])#is", $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before);
$rows[] = array('title' => $row['bbcode_title'], 'desc' => $row['bbcode_desc'], 'before' => nl2br($before), 'after' => $t);
}
}
/* Output */
$this->page_title = $this->lang->words['bbc_title'];
$this->output .= $this->registry->getClass('output')->getTemplate('legends')->bbcodePopUpList($rows);
}
示例6: bbcodePopUpList
/**
* Show BBCode Helpy file
*
* @access public
* @return void
**/
public function bbcodePopUpList()
{
/* Load the Parser */
IPSText::resetTextClass('bbcode');
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'global';
/* Loop through the bbcode and build the output array */
$rows = array();
/* Add in custom bbcode */
if (count($this->caches['bbcode'])) {
foreach ($this->caches['bbcode'] as $row) {
if ($row['bbcode_groups'] != 'all') {
$pass = false;
$groups = array_diff(explode(',', $row['bbcode_groups']), array(''));
$mygroups = array($this->memberData['member_group_id']);
$mygroups = array_diff(array_merge($mygroups, explode(',', IPSText::cleanPermString($this->memberData['mgroup_others']))), array(''));
foreach ($groups as $g_id) {
if (in_array($g_id, $mygroups)) {
$pass = true;
break;
}
}
if (!$pass) {
continue;
}
}
if ($row['bbcode_tag'] == 'member') {
$row['bbcode_example'] = str_replace('[member=admin]', '[member=' . $this->memberData['members_display_name'] . ']', $row['bbcode_example']);
}
$before = htmlspecialchars($row['bbcode_example']);
$t = IPSText::getTextClass('bbcode')->preDisplayParse(IPSText::getTextClass('bbcode')->preDbParse($before));
$before = preg_replace("#(\\[" . $row['bbcode_tag'] . "(?:[^\\]]+)?\\])#is", $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before);
$before = preg_replace("#(\\[/" . $row['bbcode_tag'] . "\\])#is", $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before);
$rows[] = array('title' => $row['bbcode_title'], 'desc' => $row['bbcode_desc'], 'before' => nl2br($before), 'after' => $t);
}
}
/* Output */
$this->page_title = $this->lang->words['bbc_title'];
$this->output .= $this->registry->getClass('output')->getTemplate('legends')->bbcodePopUpList($rows);
}