本文整理匯總了PHP中IPSText::raw2form方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::raw2form方法的具體用法?PHP IPSText::raw2form怎麽用?PHP IPSText::raw2form使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::raw2form方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _showNewTopicForm
/**
* Show PM form
*
* @param string Error message
* @return string returns HTML
*/
protected function _showNewTopicForm($errors = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
/* Check max per day */
if ($this->messengerFunctions->checkHasHitMax()) {
$this->registry->getClass('output')->showError('maxperday_hit', 10271);
}
/* Check PM flood */
if ($this->messengerFunctions->floodControlCheck() !== TRUE) {
$this->registry->getClass('output')->showError(sprintf($this->lang->words['pm_flood_stop'], $this->messengerFunctions->exceptionData[0]), 010271);
}
/* Check limit*/
if (!$this->messengerFunctions->withinPMQuota($this->memberData)) {
$this->registry->getClass('output')->showError('cannot_send_new_limit', 10273, FALSE, '', 40);
}
$_msg_id = 0;
$formMemberID = intval($this->request['fromMemberID']);
# WAS MID
$topicID = intval($this->request['topicID']);
$preview = $this->request['preview'];
$inviteUsers = array();
$displayData = array('errors' => $errors ? array($errors) : array(), 'topicID' => $topicID, 'preview' => '', 'name' => '', 'title' => '', 'message' => '');
$_POST['Post-NS'] = isset($_POST['Post']) ? $_POST['Post'] : '';
$_POST['Post'] = IPSText::raw2form(isset($_POST['Post']) ? $_POST['Post'] : '');
//-----------------------------------------
// Load editor
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
$_editor = new $classToLoad();
$_editor->setAllowHtml(false);
//-----------------------------------------
// Preview post?
//-----------------------------------------
if ($preview) {
/* Grab language for attachment previews */
$this->registry->getClass('class_localization')->loadLanguageFile(array("public_topic"), 'forums');
/* Load parser */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
$parser = new $classToLoad();
$parser->set(array('memberData' => $this->memberData, 'parseBBCode' => 1, 'parseArea' => 'pms', 'parseHtml' => 0, 'parseEmoticons' => 1));
if ($this->request['_from'] == 'quickPM') {
$old_msg = $_editor->process($_editor->fromPlainTextArea($_POST['Post']));
} else {
$old_msg = $_editor->process($_POST['Post']);
}
$old_msg = $parser->display($old_msg);
if (!is_object($this->class_attach)) {
//-----------------------------------------
// Grab render attach class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach');
$this->class_attach = new $classToLoad($this->registry);
}
//-----------------------------------------
// Continue...
//-----------------------------------------
$this->class_attach->type = 'msg';
$this->class_attach->attach_post_key = $this->_postKey;
$this->class_attach->init();
$attachData = $this->class_attach->renderAttachments(array(0 => $old_msg));
$displayData['preview'] = $attachData[0]['html'] . $attachData[0]['attachmentHtml'];
}
//-----------------------------------------
// Errors
//-----------------------------------------
if ($errors or IPSText::getTextClass('bbcode')->error != "") {
if (IPSText::getTextClass('bbcode')->error) {
$displayData['errors'][] = $this->lang->words[IPSText::getTextClass('bbcode')->error];
}
$preview = 1;
}
//-----------------------------------------
// Did we come from a button with a user ID?
//-----------------------------------------
if ($formMemberID) {
$name = IPSMember::load($formMemberID, 'core');
if ($name['member_id']) {
$displayData['name'] = $name['members_display_name'];
}
} else {
$displayData['name'] = $this->request['entered_name'] ? $this->request['entered_name'] : '';
}
//-----------------------------------------
// Are we quoting an old message?
//-----------------------------------------
if ($preview) {
$displayData['message'] = $_POST['Post-NS'];
if ($this->request['_from'] == 'quickPM') {
$displayData['message'] = IPSText::parseCleanValue($displayData['message'], true);
}
$displayData['title'] = str_replace("'", "'", str_replace('"', '"', IPSText::stripslashes($_POST['msg_title'])));
} else {
//.........這裏部分代碼省略.........
示例2: _showNewTopicForm
/**
* Show PM form
*
* @access private
* @param array Array of errors
* @return string returns HTML
*/
private function _showNewTopicForm($errors = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
/* Check max per day */
if ($this->messengerFunctions->checkHasHitMax()) {
$this->registry->getClass('output')->showError('maxperday_hit', 10271);
}
/* Check PM flood */
if ($this->messengerFunctions->floodControlCheck() !== TRUE) {
$this->registry->getClass('output')->showError(sprintf($this->lang->words['pm_flood_stop'], $this->messengerFunctions->exceptionData[0]), 010271);
}
$_msg_id = 0;
$formMemberID = intval($this->request['fromMemberID']);
# WAS MID
$topicID = intval($this->request['topicID']);
$preview = $this->request['preview'];
$inviteUsers = array();
$displayData = array('errors' => $errors, 'topicID' => $topicID, 'preview' => '', 'name' => '', 'title' => '', 'message' => '');
$_POST['Post-NS'] = isset($_POST['Post']) ? $_POST['Post'] : '';
$_POST['Post'] = IPSText::removeMacrosFromInput(IPSText::raw2form(isset($_POST['Post']) ? $_POST['Post'] : ''));
//-----------------------------------------
// Preview post?
//-----------------------------------------
if ($preview) {
/* Grab language for attachment previews */
$this->registry->getClass('class_localization')->loadLanguageFile(array("public_topic"), 'forums');
IPSText::getTextClass('bbcode')->parse_html = $this->settings['msg_allow_html'];
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_bbcode = $this->settings['msg_allow_code'];
IPSText::getTextClass('bbcode')->parsing_section = 'pms';
IPSText::getTextClass('bbcode')->parsing_mgroup = $this->memberData['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $this->memberData['mgroup_others'];
$this->settings['max_emos'] = 0;
$old_msg = IPSText::getTextClass('editor')->processRawPost('Post-NS');
$old_msg = IPSText::getTextClass('bbcode')->preDisplayParse(IPSText::getTextClass('bbcode')->preDbParse($old_msg));
if (!is_object($this->class_attach)) {
//-----------------------------------------
// Grab render attach class
//-----------------------------------------
require_once IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php';
$this->class_attach = new class_attach($this->registry);
}
//-----------------------------------------
// Continue...
//-----------------------------------------
$this->class_attach->type = 'msg';
$this->class_attach->attach_post_key = $this->_postKey;
$this->class_attach->init();
$attachData = $this->class_attach->renderAttachments(array(0 => $old_msg));
$displayData['preview'] = $attachData[0]['html'] . $attachData[0]['attachmentHtml'];
}
//-----------------------------------------
// Errors
//-----------------------------------------
if ($errors or IPSText::getTextClass('bbcode')->error != "") {
if (IPSText::getTextClass('bbcode')->error) {
$displayData['errors'][] = $this->lang->words[IPSText::getTextClass('bbcode')->error];
}
$preview = 1;
}
//-----------------------------------------
// Did we come from a button with a user ID?
//-----------------------------------------
if ($formMemberID) {
$name = IPSMember::load($formMemberID, 'core');
if ($name['member_id']) {
$displayData['name'] = $name['members_display_name'];
}
} else {
$displayData['name'] = $this->request['entered_name'] ? $this->request['entered_name'] : '';
}
//-----------------------------------------
// Are we quoting an old message?
//-----------------------------------------
if ($preview) {
$displayData['message'] = $_POST['Post-NS'];
$displayData['title'] = str_replace("'", "'", str_replace('"', '"', IPSText::stripslashes($_POST['msg_title'])));
} else {
if ($topicID) {
$draftTopic = $this->messengerFunctions->fetchTopicDataWithMessage($topicID, TRUE);
if ($draftTopic['mt_to_member_id']) {
$displayData['name'] = $draftTopic['from_name'];
}
if ($draftTopic['mt_title']) {
$_member = IPSMember::load($draftTopic['mt_to_member_id'], 'core');
$displayData['name'] = $_member['members_display_name'];
$displayData['title'] = $draftTopic['mt_title'];
$_msg_id = $draftTopic['msg_id'];
$this->_postKey = $draftTopic['msg_post_key'];
IPSText::getTextClass('bbcode')->parse_html = $this->settings['msg_allow_html'];
//.........這裏部分代碼省略.........
示例3: _checkMultiQuote
/**
* Check Multi Quote
* Checks for quoted information
*
* @access public
* @param string Any raw post
* @return string Formatted post
*/
protected function _checkMultiQuote($postContent)
{
$raw_post = '';
if (!$this->request['qpid']) {
$this->request['qpid'] = IPSCookie::get('mqtids');
if ($this->request['qpid'] == ",") {
$this->request['qpid'] = "";
}
} else {
//-----------------------------------------
// Came from reply button
//-----------------------------------------
$this->request['parent_id'] = $this->request['qpid'];
}
$this->request['qpid'] = preg_replace("/[^,\\d]/", "", trim($this->request['qpid']));
if ($this->request['qpid']) {
$this->quoted_pids = preg_split('/,/', $this->request['qpid'], -1, PREG_SPLIT_NO_EMPTY);
//-----------------------------------------
// Get the posts from the DB and ensure we have
// suitable read permissions to quote them
//-----------------------------------------
if (count($this->quoted_pids)) {
$this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => "p.pid IN(" . implode(',', $this->quoted_pids) . ")", 'add_join' => array(array('select' => 't.forum_id', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'), array('select' => 'member_id, members_display_name', 'from' => array('members' => 'm'), 'where' => 'p.author_id=m.member_id', 'type' => 'left'))));
$this->DB->execute();
while ($tp = $this->DB->fetch()) {
//if( IPSMember::checkPermissions('read', $this->getForumID() ) == TRUE )
$perm_id = $this->getAuthor('org_perm_id') ? $this->getAuthor('org_perm_id') : $this->getAuthor('g_perm_id');
$perm_array = explode(",", $perm_id);
if ($this->registry->permissions->check('read', $this->getForumData(), $perm_array) === TRUE) {
$tmp_post = $this->_afterPostCompile($tp['post'], 'reply');
$tp['author_name'] = $tp['members_display_name'] ? $tp['members_display_name'] : $tp['author_name'];
/*if ( IPSText::getTextClass( 'editor' )->method == 'rte' )
{
$tmp_post = IPSText::getTextClass( 'bbcode' )->convertForRTE( $tp['post'] );
}
else
{
$tmp_post = trim( IPSText::getTextClass( 'bbcode' )->preEditParse( $tp['post'] ) );
}*/
if ($this->settings['strip_quotes']) {
$tmp_post = trim($this->_recursiveKillQuotes($tmp_post));
}
$extra = "";
if ($tmp_post) {
if (IPSText::getTextClass('editor')->method == 'rte') {
$raw_post .= "[quote name='" . IPSText::getTextClass('bbcode')->makeQuoteSafe($tp['author_name']) . "' date='" . IPSText::getTextClass('bbcode')->makeQuoteSafe($this->registry->getClass('class_localization')->getDate($tp['post_date'], 'LONG', 1)) . "' timestamp='" . $tp['post_date'] . "' post='" . $tp['pid'] . "']<br />{$tmp_post}<br />" . $extra . '[/quote]<br /><br /><br />';
} else {
/* Knocks out <br /> */
$tmp_post = trim(IPSText::getTextClass('bbcode')->preEditParse($tmp_post));
$raw_post .= "[quote name='" . IPSText::getTextClass('bbcode')->makeQuoteSafe($tp['author_name']) . "' date='" . IPSText::getTextClass('bbcode')->makeQuoteSafe($this->registry->getClass('class_localization')->getDate($tp['post_date'], 'LONG', 1)) . "' timestamp='" . $tp['post_date'] . "' post='" . $tp['pid'] . "']\n{$tmp_post}\n" . $extra . "[/quote]\n\n\n";
}
}
}
}
$raw_post = trim($raw_post) . "\n";
}
}
//-----------------------------------------
// Need to put into RTE format..
//-----------------------------------------
if (IPSText::getTextClass('editor')->method == 'rte') {
$raw_post = IPSText::getTextClass('bbcode')->convertForRTE($raw_post);
}
//-----------------------------------------
// Make raw POST safe for the text area
//-----------------------------------------
$raw_post .= IPSText::raw2form($postContent);
return $raw_post;
}