Дуплекс режим

Двойной режим и BB и HTML в seditio 170
Author
Message
function sed_cc($text, $ent_quotes = null) {
	  global  $cfg;
    if ($cfg['textmode']=='html')
    {
      return is_null($ent_quotes) ? htmlspecialchars($text) : htmlspecialchars($text, $ent_quotes);
    } else
    {
       $text = preg_replace('/&#([0-9]{2,4});/is','&&#35$1;',$text);
	     $text = str_replace(
	     array('{', '<', '>' , '$', '\'', '"', '\\', '&amp;', '&nbsp;'),
	     array('&#123;', '&lt;', '&gt;', '&#036;', '&#039;', '&quot;', '&#92;', '&amp;amp;', '&amp;nbsp;'), $text);
       return($text);
    }
}

Forever unshaven, red-eyed, detached from reality, with his cockroaches in my head. And let it always will be!


This post was edited by Amro (26-05-12 22:42 GMT, 4376 days ago)
/* ------------------ */
function sed_checkmore($text, $more = false) {
  global $cfg;
  if ($cfg['textmode']=='html')
    {
      if ($more == true) { $text = preg_replace('/(\<hr id="readmore"(.*?)?\>)/' ,'<!--readmore-->', $text);	}
      else { $text = preg_replace('/(\<!--readmore--\>)/' ,'<hr id="readmore" />', $text); }
    }
  return($text);
}
/* ------------------ */

Forever unshaven, red-eyed, detached from reality, with his cockroaches in my head. And let it always will be!

function sed_cutreadmore($text, $url) {
  global $cfg, $L;
  if ($cfg['textmode']=='html')
    { $readmore = strpos($text, "<!--readmore-->"); }
  else
    { $readmore = strpos($text, "[more]"); }
  if ($readmore > 0)
    {
      $text = substr($text, 0, $readmore)." ";
      $text .= "<span class=\"more\"><a href=\"".$url."\">".$L['ReadMore']."</a></span>";
    }
  return($text);
}

Forever unshaven, red-eyed, detached from reality, with his cockroaches in my head. And let it always will be!