本文整理汇总了PHP中cleanText函数的典型用法代码示例。如果您正苦于以下问题:PHP cleanText函数的具体用法?PHP cleanText怎么用?PHP cleanText使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cleanText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upd_profile
function upd_profile($x)
{
$x['description'] = cleanText($x['description']);
$query = "UPDATE user_member SET nickname='{$x['nickname']}', email='{$x['email']}', description='{$x['description']}', image_profile='{$x['image']}' WHERE id = {$_SESSION['admin']['id']}";
// pr($query);
$result = $this->query($query);
}
示例2: cleanCode
function cleanCode($data)
{
$data = cleanText($data);
$data = str_replace("<!--?", "<?", $data);
$data = str_replace("?-->", "?>", $data);
return $data;
}
示例3: generateRSSItem
function generateRSSItem()
{
global $settings;
$item = "<item>\n";
//echo "<id>".$this->id."</id>";
$item .= "<title>" . $this->title . "</title>\n";
$item .= "<author>" . $this->author . "</author>\n";
$item .= "<link>" . $this->link . "</link>\n";
if (!empty($this->commentLink)) {
$item .= "<comments>" . $this->commentLink . "</comments>\n";
}
$item .= "<pubDate>" . date("r", $this->timestamp) . "</pubDate>\n";
for ($i = 0; $i < sizeof($this->categories); $i++) {
if (empty($this->categories[$i])) {
continue;
}
$item .= "<category>" . cleanText($this->categories[$i]) . "</category>\n";
}
$item .= "<guid>" . $this->link . "</guid>\n";
$item .= "<description>" . $this->summary . "</description>\n";
if (!empty($this->text)) {
$item .= "<content:encoded><![CDATA[";
$item .= $this->text;
$item .= "]]></content:encoded>\n";
}
if (!empty($this->commentRSS)) {
$item .= "<wfw:commentRss>" . $this->commentRSS . "</wfw:commentRss>\n";
}
$item .= "</item>\n\n";
return $item;
}
示例4: cleanText
function cleanText($s)
{
$s = trim($s);
if ($s == '|-') {
return '';
}
if (substr($s, 0, 2) == '| ') {
$s = substr($s, 2);
}
$p1 = strpos($s, '<!--');
if ($p1 !== false) {
$p2 = strpos($s, '-->');
if ($p2 !== false) {
$s = substr($s, 0, $p1) . substr($s, $p2 + strlen('-->'));
return cleanText($s);
}
return '';
}
$p1 = strpos($s, '<ref>');
if ($p1 !== false) {
$p2 = strpos($s, '</ref>');
if ($p2 !== false) {
$s = substr($s, 0, $p1) . substr($s, $p2 + strlen('</ref>'));
return cleanText($s);
}
return '';
}
return $s;
}
示例5: handle
/**
* handle user request
*/
function handle()
{
if ($_POST['redirdata']) {
if (io_saveFile(dirname(__FILE__) . '/redirect.conf', cleanText($_POST['redirdata']))) {
msg($this->getLang('saved'), 1);
}
}
}
示例6: val
/**
* Get or set the element's value
*
* This is the preferred way of setting the element's value
*
* @param null|string $value
* @return string|$this
*/
public function val($value = null)
{
if ($value !== null) {
$this->text = cleanText($value);
return $this;
}
return $this->text;
}
示例7: test_win
function test_win()
{
$unix = "one\ntwo\nthree";
$win = "one\r\ntwo\r\nthree";
$this->assertEquals(bin2hex($unix), '6f6e650a74776f0a7468726565');
$this->assertEquals(bin2hex($win), '6f6e650d0a74776f0d0a7468726565');
$this->assertNotEquals($unix, $win);
$this->assertEquals($unix, cleanText($win));
}
示例8: handle_start
/**
* Start an oAuth login
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
public function handle_start(Doku_Event &$event, $param)
{
global $INPUT, $RANGE, $DATE_AT, $REV;
global $ID;
global $_SESSION;
if (isset($_SESSION[DOKU_COOKIE]['oauth-done']['do']) || !empty($_SESSION[DOKU_COOKIE]['oauth-done']['rev'])) {
global $ACT, $TEXT, $PRE, $SUF, $SUM;
$ACT = $_SESSION[DOKU_COOKIE]['oauth-done']['do'];
if (isset($_SESSION[DOKU_COOKIE]['oauth-done']['wikitext'])) {
$TEXT = cleanText($_SESSION[DOKU_COOKIE]['oauth-done']['wikitext']);
$PRE = cleanText(substr($_SESSION[DOKU_COOKIE]['oauth-done']['prefix'], 0, -1));
$SUF = cleanText($_SESSION[DOKU_COOKIE]['oauth-done']['suffix']);
$SUM = $_SESSION[DOKU_COOKIE]['oauth-done']['summary'];
$INPUT->post->set('sectok', $_SESSION[DOKU_COOKIE]['oauth-done']['sectok']);
}
// resetting INPUT, ->post and ->get
foreach ($_SESSION[DOKU_COOKIE]['oauth-done'] as $key => $value) {
if ($key === 'post' || $key === 'get') {
continue;
}
$INPUT->set($key, $value);
if ($key === 'range') {
$RANGE = $value;
}
}
foreach ($_SESSION[DOKU_COOKIE]['oauth-done']['post'] as $key => $value) {
$INPUT->post->set($key, $value);
}
foreach ($_SESSION[DOKU_COOKIE]['oauth-done']['get'] as $key => $value) {
$INPUT->get->set($key, $value);
if ($key === 'at') {
$DATE_AT = $value;
}
if ($key === 'rev') {
$REV = $value;
}
}
unset($_SESSION[DOKU_COOKIE]['oauth-done']);
return;
}
/** @var helper_plugin_oauth $hlp */
$hlp = plugin_load('helper', 'oauth');
$servicename = $INPUT->str('oauthlogin');
$service = $hlp->loadService($servicename);
if (is_null($service)) {
return;
}
// remember service in session
session_start();
$_SESSION[DOKU_COOKIE]['oauth-inprogress']['service'] = $servicename;
$_SESSION[DOKU_COOKIE]['oauth-inprogress']['id'] = $ID;
session_write_close();
$service->login();
}
示例9: test_win
function test_win()
{
$unix = 'one
two
three';
$win = 'one
two
three';
$this->assertEqual(bin2hex($unix), '6f6e650a2020202020202020202020202020202074776f0a0a202020202020202020202020202020207468726565');
$this->assertEqual(bin2hex($win), '6f6e650d0a2020202020202020202020202020202074776f0d0a0d0a202020202020202020202020202020207468726565');
$this->assertNotEqual($unix, $win);
$this->assertEqual($unix, cleanText($win));
}
示例10: handle_newtable
/**
* Handle the click on the new table button in the toolbar
*
* @param Doku_Event $event
*/
function handle_newtable($event)
{
global $INPUT;
global $TEXT;
global $ACT;
if (!$INPUT->post->has('edittable__new')) {
return;
}
/*
* $fields['pre'] has all data before the selection when the "Insert table" button was clicked
* $fields['text'] has all data inside the selection when the "Insert table" button was clicked
* $fields['suf'] has all data after the selection when the "Insert table" button was clicked
* $TEXT has the table created by the editor (from action_plugin_edittable_editor::handle_table_post())
*/
$fields = $INPUT->post->arr('edittable__new');
// clean the fields (undos formText()) and update the post and request arrays
$fields['pre'] = cleanText($fields['pre']);
$fields['text'] = cleanText($fields['text']);
$fields['suf'] = cleanText($fields['suf']);
$INPUT->post->set('edittable__new', $fields);
$ACT = act_clean($ACT);
switch ($ACT) {
case 'preview':
// preview view of a table edit
$INPUT->post->set('target', 'table');
break;
case 'edit':
// edit view of a table (first edit)
$INPUT->post->set('target', 'table');
$TEXT = "^ ^ ^\n";
foreach (explode("\n", $fields['text']) as $line) {
$TEXT .= "| {$line} | |\n";
}
break;
case 'draftdel':
// not sure if/how this would happen, we restore all data and hand over to section edit
$INPUT->post->set('target', 'section');
$TEXT = $fields['pre'] . $fields['text'] . $fields['suf'];
$ACT = 'edit';
break;
case 'save':
// return to edit page
$INPUT->post->set('target', 'section');
$TEXT = $fields['pre'] . $TEXT . $fields['suf'];
$ACT = 'edit';
break;
}
}
示例11: p_get_instructions
function p_get_instructions($text)
{
$modes = p_get_parsermodes();
// Create the parser
$Parser =& new Doku_Parser();
// Add the Handler
$Parser->Handler =& new Doku_Handler();
//add modes to parser
foreach ($modes as $mode) {
$Parser->addMode($mode['mode'], $mode['obj']);
}
// Do the parsing
$p = $Parser->parse(cleanText($text));
//dbg($p);
return $p;
}
示例12: restoreSessionEnvironment
private function restoreSessionEnvironment()
{
global $INPUT, $ACT, $TEXT, $PRE, $SUF, $SUM, $RANGE, $DATE_AT, $REV;
$ACT = $_SESSION[DOKU_COOKIE]['oauth-done']['do'];
$_REQUEST = $_SESSION[DOKU_COOKIE]['oauth-done']['$_REQUEST'];
$REV = $INPUT->int('rev');
$DATE_AT = $INPUT->str('at');
$RANGE = $INPUT->str('range');
if ($INPUT->post->has('wikitext')) {
$TEXT = cleanText($INPUT->post->str('wikitext'));
}
$PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1));
$SUF = cleanText($INPUT->post->str('suffix'));
$SUM = $INPUT->post->str('summary');
unset($_SESSION[DOKU_COOKIE]['oauth-done']);
}
示例13: getCounts
function getCounts($cat)
{
$url = "http://www.livejournal.com/support/help.bml?sort=date&state=&cat=".$cat."&usescheme=lynx";
$content = HTTP::getResponse($url);
// Extract <b> tags
preg_match_all("/<b>.*?<\/b>/", $content, $b);
if (count($b) < 1) { error(); }
if (count($b[0]) < 4) { error(); }
$result = array();
$result[0] = cleanText($b[0][0]);
$result[1] = cleanText($b[0][1]);
$result[2] = cleanText($b[0][2]);
$result[3] = cleanText($b[0][3]);
return $result;
}
示例14: page_inp
function page_inp($data)
{
$data['title'] = cleanText($data['title']);
$data['brief'] = cleanText($data['brief']);
$data['content'] = cleanText($data['content']);
$date = date('Y-m-d H:i:s');
$datetime = array();
if (!empty($data['expiredate'])) {
$data['expiredate'] = date("Y-m-d", strtotime($data['expiredate']));
}
if ($data['action'] == 'insert') {
$query = "INSERT INTO \n\t\t\t\t\t\tcdc_news_content (title,brief,content,image,thumbnailimage,categoryid,articletype,\n\t\t\t\t\t\t\t\t\t\t\ttags,createdate,postdate,expiredate,fromwho,authorid,n_status)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $data['title'] . "','" . $data['brief'] . "','" . $data['content'] . "','" . $data['image'] . "','" . $data['thumbnailimage'] . "','" . $data['categoryid'] . "','" . $data['articletype'] . "','" . $data['tags'] . "','" . $date . "','" . date("Y-m-d", strtotime($data['postdate'])) . "','" . $data['expiredate'] . "','" . $_SESSION['admin']['usertype'] . "','" . $_SESSION['admin']['id'] . "',{$data['status']})";
} else {
$query = "UPDATE cdc_news_content\n\t\t\t\t\t\tSET \n\t\t\t\t\t\t\ttitle = '{$data['title']}',\n\t\t\t\t\t\t\tbrief = '{$data['brief']}',\n\t\t\t\t\t\t\tcontent = '{$data['content']}',\n\t\t\t\t\t\t\timage = '{$data['image']}',\n\t\t\t\t\t\t\tthumbnailimage = '{$data['thumbnailimage']}',\n\t\t\t\t\t\t\tcategoryid = '{$data['categoryid']}',\n\t\t\t\t\t\t\tarticletype = '{$data['articletype']}',\n\t\t\t\t\t\t\ttags = '{$data['tags']}',\n\t\t\t\t\t\t\tpostdate = '" . date("Y-m-d", strtotime($data['postdate'])) . "',\n\t\t\t\t\t\t\texpiredate = '" . $data['expiredate'] . "',\n\t\t\t\t\t\t\tfromwho = '{$_SESSION['admin']['usertype']}',\n\t\t\t\t\t\t\tauthorid = '{$_SESSION['admin']['id']}',\n\t\t\t\t\t\t\tn_status = {$data['status']}\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tid = '{$data['id']}'";
}
// pr($query);
$result = $this->query($query);
return $result;
}
示例15: processText
public function processText($text)
{
$text = $this->processDates($text);
$this->_set('edit_text', $text);
$planloves = array();
$html_text = cleanText($text, $planloves);
$this->_set('plan', $html_text);
Doctrine_Query::create()->delete('Planlove p')->where('p.lover_id = ?', $this->user_id)->execute();
// cleanText will return multiple copies of a username if different capitalizations are used
// on a plan. Make sure we don't try to add a row twice.
$done = array();
foreach ($planloves as $planlove) {
$lovee = Doctrine_Query::create()->select('a.userid')->from('Accounts a')->where('a.username = ?', $planlove)->fetchOne();
if (!in_array($lovee->userid, $done)) {
$love = new Planlove();
$love->Lover = $this->Account;
$love->Lovee = $lovee;
$love->save();
$done[] = $lovee->userid;
}
}
}