function pico_textwiki($mydirname, $text, $content4assign)
{
    // add XOOPS_TRUST_PATH/PEAR/ into include_path
    if (!defined('PATH_SEPARATOR')) {
        define('PATH_SEPARATOR', DIRECTORY_SEPARATOR == '/' ? ':' : ';');
    }
    if (!strstr(ini_get('include_path'), XOOPS_TRUST_PATH . '/PEAR')) {
        ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . XOOPS_TRUST_PATH . '/PEAR');
    }
    include_once "Text/Wiki.php";
    // include_once "Text/sunday_Wiki.php";
    if (!class_exists('Text_Wiki')) {
        die('PEAR/Text/Wiki is not installed correctly');
    }
    $wiki = new Text_Wiki();
    // create instance
    // Configuration
    $wiki->deleteRule('Wikilink');
    // remove a rule for auto-linking
    $wiki->setFormatConf('Xhtml', 'translate', false);
    // HTML_ENTITIES -> HTML_SPECIALCHARS -> false
    // $wiki = new sunday_Text_Wiki(); // create instance
    //$text = str_replace ( "\r\n", "\n", $text );
    //$text = str_replace ( "~\n", "[br]", $text );
    //$text = $wiki->transform($text);
    //$content = str_replace ( "[br]", "<br/>", $text );
    // special thx to minahito! you are great!!
    return $wiki->transform($text);
}
Esempio n. 2
0
function sitewiki_filter_body($body)
{
    $wiki = new Text_Wiki();
    $wiki->setRenderConf('xhtml', 'wikilink', 'view_url', site_prefix() . '/index/sitewiki-app/show.');
    $wiki->setRenderConf('xhtml', 'wikilink', 'new_url', site_prefix() . '/index/sitewiki-app/show.');
    $pages = db_shift_array('select distinct id from sitewiki_page');
    $wiki->setRenderConf('xhtml', 'wikilink', 'pages', $pages);
    return $wiki->transform($body, 'Xhtml');
}
 /**
  * Executes show action
  *
  * @param sfRequest $request A request object
  */
 public function executeShow($request)
 {
     //$this->form = new CommunityWikiCommentForm();
     $libPath = realpath(dirname(__FILE__) . "/../vendor/Text_Wiki");
     $oldPath = get_include_path();
     set_include_path($oldPath . ":" . $libPath);
     require_once "Text/Wiki.php";
     $wiki = new Text_Wiki();
     $wiki->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS);
     // bodyの内容をパース後の内容に置換
     $this->communityWiki->body = $wiki->transform($this->communityWiki->getBody());
     return sfView::SUCCESS;
 }
Esempio n. 4
0
 static function render_page($str)
 {
     if ($str == "") {
         return "";
     }
     if (!class_exists("Text_Wiki", false)) {
         require "lib/wiki/Wiki.php";
     }
     $wiki = new Text_Wiki();
     $wiki->disableRule("Interwiki");
     $wiki->disableRule("Image");
     return str_replace("<p>", "<p style='padding-bottom:16px;'>", $wiki->transform($str, "Xhtml"));
 }
Esempio n. 5
0
 function getParsedDescription()
 {
     if (empty($this->pkg_description)) {
         return '';
     }
     // Switching markup types
     switch ($this->markup) {
         case 'wiki':
             include_once 'Text/Wiki.php';
             $wiki = new Text_Wiki();
             $wiki->disableRule('wikilink');
             $description = $wiki->transform($this->pkg_description);
             break;
         case 'bbcode':
         default:
             include_once 'HTML/BBCodeParser.php';
             $bbparser = new HTML_BBCodeParser(array('filters' => 'Basic,Images,Links,Lists,Extended'));
             $description = $bbparser->qparse(nl2br(htmlentities($this->pkg_description)));
             break;
     }
     return $description;
 }
Esempio n. 6
0
 /**
  * Convert wiki-formatted text to (X)HTML
  *
  * @param    string  $wikitext   wiki-formatted text
  * @return   string              XHTML formatted text
  *
  */
 public static function renderWikiText($wikitext)
 {
     global $_CONF;
     if (!$_CONF['wikitext_editor']) {
         return $wikitext;
     }
     require_once 'Text/Wiki.php';
     $wiki = new Text_Wiki();
     $wiki->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS);
     $wiki->setRenderConf('Xhtml', 'charset', COM_getCharset());
     $wiki->disableRule('wikilink');
     $wiki->disableRule('freelink');
     $wiki->disableRule('interwiki');
     return $wiki->transform($wikitext, 'Xhtml');
 }
Esempio n. 7
0
 function contentRender($text, $nohtml, $nosmiley, $nobreaks, $nbsp = 0)
 {
     $myts =& TinyDTextSanitizer::getInstance();
     if ($nohtml >= 16) {
         // db content (PEAR wiki)
         if (!defined('PATH_SEPARATOR')) {
             define('PATH_SEPARATOR', DIRECTORY_SEPARATOR == '/' ? ':' : ';');
         }
         ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . XOOPS_ROOT_PATH . '/common/PEAR');
         include_once 'Text/Wiki.php';
         // include_once "Text/sunday_Wiki.php";
         $wiki = new Text_Wiki();
         // create instance
         // Configuration
         $wiki->deleteRule('Wikilink');
         // remove a rule for auto-linking
         $wiki->setFormatConf('Xhtml', 'translate', false);
         // remove HTML_ENTITIES
         // $wiki = new sunday_Text_Wiki(); // create instance
         //$text = str_replace ( "\r\n", "\n", $text );
         //$text = str_replace ( "~\n", "[br]", $text );
         //$text = $wiki->transform($text);
         //$content = str_replace ( "[br]", "<br/>", $text );
         // special thx to minahito! you are great!!
         $content = $wiki->transform($text);
         if ($nohtml & 2) {
             $content = $myts->displayTarea($content, 1, !$nosmiley, 1, 1, !$nobreaks, $nbsp);
         }
     } else {
         if ($nohtml >= 8) {
             // db content (PHP)
             ob_start();
             eval($text);
             $content = ob_get_contents();
             ob_end_clean();
             if ($nohtml & 2) {
                 $content = $myts->displayTarea($content, 1, !$nosmiley, 1, 1, !$nobreaks, $nbsp);
             }
         } else {
             if ($nohtml < 4) {
                 //			echo "go...".$nohtml;
                 switch ($nohtml) {
                     case 0:
                         // HTML with BB
                         $content = $myts->displayTarea($text, 1, !$nosmiley, 1, 1, !$nobreaks, $nbsp);
                         break;
                     case 1:
                         // Text with BB
                         $content = $myts->displayTarea($text, 0, !$nosmiley, 1, 1, !$nobreaks, $nbsp);
                         break;
                     case 2:
                         // HTML without BB
                         //					$content = '<pre>'.$text.'</pre>';
                         $content = $myts->displayTarea($text, 1, !$nosmiley, 0, 1, !$nobreaks, $nbsp);
                         break;
                     case 3:
                         // Text without BB
                         $content = $myts->makeTboxData4Show($text);
                         break;
                 }
             } else {
                 $content = $text;
             }
         }
     }
     //echo "in=".$text;
     //echo "out=".$content;
     return $content;
 }
 /**
  * transform the wiki text.
  *
  * @param  string $text
  * @param  array  $rules
  * @return Text_Wiki
  */
 public function execute($text, $rules = null)
 {
     $wiki = new Text_Wiki($rules);
     return $wiki->transform($text);
 }
include_once "Text/Wiki.php";
// include_once "Text/sunday_Wiki.php";
$wiki = new Text_Wiki();
// create instance
// Configuration
$wiki->deleteRule('Wikilink');
// remove a rule for auto-linking
$wiki->setFormatConf('Xhtml', 'translate', false);
// remove HTML_ENTITIES
// $wiki = new sunday_Text_Wiki(); // create instance
//$text = str_replace ( "\r\n", "\n", $text );
//$text = str_replace ( "~\n", "[br]", $text );
//$text = $wiki->transform($text);
//$content = str_replace ( "[br]", "<br/>", $text );
// special thx to minahito! you are great!!
$wiki_body = $wiki->transform($wiki_source);
echo '
	<html>
	<head>
		<title>PEAR::Text_Wiki Sample</title>
		<style>
		body, p, br, td, th {
			font-family: "Lucida Grande", Verdana, Arial, Geneva;
			font-size: 9pt;
			color: black;
			line-spacing: 120%;
		}
		
		table {
			border-spacing: 0px;
			border: 1px solid gray;