当前位置: 首页>>代码示例>>PHP>>正文


PHP MyTextSanitizer::nl2Br方法代码示例

本文整理汇总了PHP中MyTextSanitizer::nl2Br方法的典型用法代码示例。如果您正苦于以下问题:PHP MyTextSanitizer::nl2Br方法的具体用法?PHP MyTextSanitizer::nl2Br怎么用?PHP MyTextSanitizer::nl2Br使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MyTextSanitizer的用法示例。


在下文中一共展示了MyTextSanitizer::nl2Br方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: transfer_dokuwiki

function transfer_dokuwiki(&$data)
{
	global $xoopsModule, $xoopsConfig, $xoopsUser, $xoopsModuleConfig;
	global $xoopsLogger, $xoopsOption, $xoopsTpl, $xoopsblock;

	$_config = require(dirname(__FILE__)."/config.php");
	
	$hiddens["id"] = $_config["namespace"].":".$_config["prefix"].$data["id"];
	$content = MyTextSanitizer::nl2Br($data["content"]);
	
	// Comment open: we need a lite html2wiki convertor
	$content = str_replace("<br />", "\\\\ ", $content);
	$content = str_replace("<br>", "\\\\ ", $content);
	$content = preg_replace_callback("/<a[\s]+href=(['\"]?)([^\"'<>]*)\\1[^>]*>([^<]*)<\/a>/imu", "transfer_parse_html_to_wiki", $content);
	$content = preg_replace_callback("/<img[\s]+src=(['\"]?)([^\"'<>]*)\\1[\s]+(alt=(['\"]?)([^\"'<>]*)\\3)?[^>]*>/imu", "transfer_parse_img_to_wiki", $content);
	$content  = forum_html2text($content);
	// Comment close;
	
	$hiddens["wikitext"] = "=====".$data["title"]."===== \n".
							$content . "\\\\ \\\\ [[".$data["url"]."|".$data["title"].": "._MORE."]]";
	$hiddens["summary"] = $data["title"];
	$hiddens["do"] = "preview";
	
	include XOOPS_ROOT_PATH."/header.php";
	
	require_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
	$form_dokuwiki = new XoopsThemeForm(_MD_TRANSFER_DOKUWIKI, "formdokuwiki", XOOPS_URL."/modules/".$_config["module"]."/doku.php");
	foreach(array_keys($hiddens) as $key){
		$form_dokuwiki->addElement(new XoopsFormHidden($key, str_replace("'", "&#039;",$hiddens[$key])));
	}
	
	$namespace_option_tray = new XoopsFormElementTray(_MD_TRANSFER_DOKUWIKI_NAMESPACE, "<br />");
	require XOOPS_ROOT_PATH."/modules/".$_config["module"]."/inc/init.php";
	$dir_array =& transfer_getDirListAsArray($conf["datadir"], $_config["namespace_skip"]);
	
	$dir_array = array_merge(array(0=>_NONE), $dir_array);
	
	$namespace_select = new XoopsFormSelect(_SELECT, "namespace_sel", "transfer");
	$namespace_select->addOptionArray($dir_array);
	$namespace_option_tray->addElement($namespace_select);
	$namespace_option_tray->addElement(new XoopsFormText(_ADD, "namespace_new", 50, 100));
	
	$form_dokuwiki->addElement($namespace_option_tray);
	$form_dokuwiki->addElement(new XoopsFormText(_MD_TRANSFER_DOKUWIKI_NAME, "name", 50, 255, $_config["prefix"].$data["id"]));
	
	$submit_button = new XoopsFormButton("", "ok", _SUBMIT, "button");
	$submit_button->setExtra('onclick="
		var namespace = escape(\''.$_config["namespace"].'\');
		var name = escape(\''.$_config["prefix"].$data["id"].'\');
		var changed = 0;
		if(window.document.formdokuwiki.name.value.length>0){
			name = window.document.formdokuwiki.name.value;
			changed = 1;
		}
		if(window.document.formdokuwiki.namespace_new.value.length>0){
			namespace = window.document.formdokuwiki.namespace_new.value;
			changed = 1;
		}else{
			var namespace_sel = window.document.formdokuwiki.namespace_sel.options[window.document.formdokuwiki.namespace_sel.selectedIndex].value;
			if(namespace_sel != namespace){
				namespace = namespace_sel;
				changed = 1;
			}
		}
		if(changed ==1){
			window.document.formdokuwiki.id.value = null;
			if(namespace !=0) window.document.formdokuwiki.id.value = namespace+\':\';
			window.document.formdokuwiki.id.value += name;
		}
		window.document.formdokuwiki.submit();
		"');
	
	$cancel_button = new XoopsFormButton('', 'cancel', _CANCEL, 'button');
	
	$button_tray = new XoopsFormElementTray("");
	$button_tray->addElement($submit_button);
	$button_tray->addElement($cancel_button);
	$form_dokuwiki->addElement($button_tray);
	
	$form_dokuwiki->display();
	
	$GLOBALS["xoopsOption"]['output_type'] = "plain";
	include XOOPS_ROOT_PATH."/footer.php";
	exit();
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:85,代码来源:index.php

示例2: array

 function &nl2Br($text)
 {
     $text = parent::nl2Br($text);
     if ($this->nbsp) {
         $patterns = array('  ', '\\"');
         $replaces = array(' &nbsp;', '"');
         $text = substr(preg_replace('/\\>.*\\</esU', "str_replace(\$patterns,\$replaces,'\\0')", ">{$text}<"), 1, -1);
     }
     return $text;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:10,代码来源:d3forum.textsanitizer.php

示例3: getScraps

 function getScraps($nbscraps, $criteria)
 {
     $myts = new MyTextSanitizer();
     $ret = array();
     $sql = 'SELECT scrap_id, uid, uname, user_avatar, scrap_from, scrap_text FROM ' . $this->db->prefix('yogurt_scraps') . ', ' . $this->db->prefix('users');
     if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
         $sql .= ' ' . $criteria->renderWhere();
         //attention here this is kind of a hack
         $sql .= " AND uid = scrap_from";
         if ($criteria->getSort() != '') {
             $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
         }
         $limit = $criteria->getLimit();
         $start = $criteria->getStart();
         $result = $this->db->query($sql, $limit, $start);
         $vetor = array();
         $i = 0;
         while ($myrow = $this->db->fetchArray($result)) {
             $vetor[$i]['uid'] = $myrow['uid'];
             $vetor[$i]['uname'] = $myrow['uname'];
             $vetor[$i]['user_avatar'] = $myrow['user_avatar'];
             $temptext = $myts->xoopsCodeDecode($myrow['scrap_text'], 1);
             $vetor[$i]['text'] = $myts->nl2Br($temptext);
             $vetor[$i]['id'] = $myrow['scrap_id'];
             $i++;
         }
         return $vetor;
     }
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:29,代码来源:yogurt_scraps.php


注:本文中的MyTextSanitizer::nl2Br方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。