public function smartypants($text) { if (!class_exists('\\Michelf\\SmartyPants', false) && class_exists('SmartyPants', true)) { // sneaky autoloading hack } $SmartyPants = new \Michelf\SmartyPants(\Michelf\SMARTYPANTS_ATTR_LONG_EM_DASH_SHORT_EN); $text = $SmartyPants->transform($text); if (PERCH_HTML_ENTITIES == false) { #$text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); #$text = PerchUtil::html($text, -1); $text = $this->de_entitize($text); } return $text; }
public function text_to_html($value) { switch (PERCH_APPS_EDITOR_MARKUP_LANGUAGE) { case 'textile': if (!class_exists('\\Netcarver\\Textile\\Parser', false) && class_exists('Textile', true)) { // sneaky autoloading hack } if (PERCH_HTML5) { $Textile = new \Netcarver\Textile\Parser('html5'); } else { $Textile = new \Netcarver\Textile\Parser(); } if (PERCH_RWD) { $value = $Textile->setDimensionlessImages(true)->textileThis($value); } else { $value = $Textile->textileThis($value); } break; case 'markdown': // Fix markdown blockquote syntax - > gets encoded. $value = preg_replace('/[\\n\\r]>\\s/', "\n> ", $value); // Fix autolink syntax $value = preg_replace('#<(http[a-zA-Z0-9-\\.\\/:]*)>#', "<\$1>", $value); $Markdown = new ParsedownExtra(); $value = $Markdown->text($value); if (!class_exists('\\Michelf\\SmartyPants', false) && class_exists('SmartyPants', true)) { // sneaky autoloading hack } $SmartyPants = new \Michelf\SmartyPants(); $value = $SmartyPants->transform($value); if (PERCH_HTML_ENTITIES == false) { $value = html_entity_decode($value, ENT_NOQUOTES, 'UTF-8'); } break; } if (defined('PERCH_XHTML_MARKUP') && PERCH_XHTML_MARKUP == false) { $value = str_replace(' />', '>', $value); } return $value; }