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':
             $Markdown = new PerchParsedown();
             $value = $Markdown->text($value);
             break;
     }
     if (defined('PERCH_XHTML_MARKUP') && PERCH_XHTML_MARKUP == false) {
         $value = str_replace(' />', '>', $value);
     }
     return $value;
 }
 /**
  * @return string
  */
 public function render()
 {
     $parser = new \Netcarver\Textile\Parser();
     $content = $this->renderChildren();
     $content = nl2br($content);
     $content = $parser->textileThis($content);
     $content = $this->keepTags($content);
     return $content;
 }
Beispiel #3
0
 protected function parseBody($source)
 {
     $event = Event::fire('theme.parser.init', []);
     if (count($event) == 1) {
         $parser = new \Netcarver\Textile\Parser($event[0]);
     } else {
         $parser = new \Netcarver\Textile\Parser();
     }
     //parse the body
     return $parser->textileThis($source);
 }
 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('#&lt;(http[a-zA-Z0-9-\\.\\/:]*)&gt;#', "<\$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;
 }
Beispiel #5
0
 public function parseTextile($value)
 {
     include_once __DIR__ . '/vendor/Netcarver/Textile/Parser.php';
     $parser = new \Netcarver\Textile\Parser();
     return $parser->textileThis($value);
 }
Beispiel #6
0
        $permlink_mode = 'messy';
    }
}
$siteurl = str_replace("http://", '', $_SESSION['siteurl']);
$siteurl = str_replace(' ', '%20', rtrim($siteurl, "/"));
$urlpath = preg_replace('#^[^/]+#', '', $siteurl);
$theme = $_SESSION['theme'] ? $_SESSION['theme'] : 'hive';
$themedir = txpath . DS . 'setup';
$create_sql = array();
$create_sql[] = "CREATE TABLE `" . PFX . "textpattern` (\n    ID              INT          NOT NULL AUTO_INCREMENT,\n    Posted          DATETIME     NOT NULL,\n    Expires         DATETIME         NULL DEFAULT NULL,\n    AuthorID        VARCHAR(64)  NOT NULL DEFAULT '',\n    LastMod         DATETIME     NOT NULL,\n    LastModID       VARCHAR(64)  NOT NULL DEFAULT '',\n    Title           VARCHAR(255) NOT NULL DEFAULT '',\n    Title_html      VARCHAR(255) NOT NULL DEFAULT '',\n    Body            MEDIUMTEXT   NOT NULL,\n    Body_html       MEDIUMTEXT   NOT NULL,\n    Excerpt         TEXT         NOT NULL,\n    Excerpt_html    MEDIUMTEXT   NOT NULL,\n    Image           VARCHAR(255) NOT NULL DEFAULT '',\n    Category1       VARCHAR(64)  NOT NULL DEFAULT '',\n    Category2       VARCHAR(64)  NOT NULL DEFAULT '',\n    Annotate        INT          NOT NULL DEFAULT '0',\n    AnnotateInvite  VARCHAR(255) NOT NULL DEFAULT '',\n    comments_count  INT          NOT NULL DEFAULT '0',\n    Status          INT          NOT NULL DEFAULT '4',\n    textile_body    VARCHAR(32)  NOT NULL DEFAULT '1',\n    textile_excerpt VARCHAR(32)  NOT NULL DEFAULT '1',\n    Section         VARCHAR(255) NOT NULL DEFAULT '',\n    override_form   VARCHAR(255) NOT NULL DEFAULT '',\n    Keywords        VARCHAR(255) NOT NULL DEFAULT '',\n    description     VARCHAR(255) NOT NULL DEFAULT '',\n    url_title       VARCHAR(255) NOT NULL DEFAULT '',\n    custom_1        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_2        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_3        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_4        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_5        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_6        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_7        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_8        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_9        VARCHAR(255) NOT NULL DEFAULT '',\n    custom_10       VARCHAR(255) NOT NULL DEFAULT '',\n    uid             VARCHAR(32)  NOT NULL DEFAULT '',\n    feed_time       DATE         NOT NULL,\n\n    PRIMARY KEY                 (ID),\n    INDEX    categories_idx     (Category1(10), Category2(10)),\n    INDEX    Posted             (Posted),\n    INDEX    Expires_idx        (Expires),\n    INDEX    author_idx         (AuthorID),\n    INDEX    section_status_idx (Section(249), Status),\n    INDEX    url_title_idx      (url_title(250)),\n    FULLTEXT searching          (Title, Body)\n) {$tabletype} ";
$setup_comment_invite = gTxt('setup_comment_invite') == 'setup_comment_invite' ? 'Comment' : gTxt('setup_comment_invite');
$textile = new \Netcarver\Textile\Parser();
$article['body'] = file_get_contents(txpath . DS . 'setup' . DS . 'article.body.textile');
$article['excerpt'] = file_get_contents(txpath . DS . 'setup' . DS . 'article.excerpt.textile');
$article = str_replace('siteurl', $urlpath, $article);
$article['body_html'] = $textile->textileThis($article['body']);
$article['excerpt_html'] = $textile->textileThis($article['excerpt']);
$article = doSlash($article);
$create_sql[] = "INSERT INTO `" . PFX . "textpattern` VALUES (1, NOW(), NULL, '" . doSlash($_SESSION['name']) . "', NOW(), '', 'Welcome to your site', '', '" . $article['body'] . "', '" . $article['body_html'] . "', '" . $article['excerpt'] . "', '" . $article['excerpt_html'] . "', '', 'hope-for-the-future', 'meaningful-labor', 1, '" . $setup_comment_invite . "', 1, 4, '1', '1', 'articles', '', '', '', 'welcome-to-your-site', '', '', '', '', '', '', '', '', '', '', '" . md5(uniqid(rand(), true)) . "', NOW())";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_category` (\n    id          INT          NOT NULL AUTO_INCREMENT,\n    name        VARCHAR(64)  NOT NULL DEFAULT '',\n    type        VARCHAR(64)  NOT NULL DEFAULT '',\n    parent      VARCHAR(64)  NOT NULL DEFAULT '',\n    lft         INT          NOT NULL DEFAULT '0',\n    rgt         INT          NOT NULL DEFAULT '0',\n    title       VARCHAR(255) NOT NULL DEFAULT '',\n    description VARCHAR(255) NOT NULL DEFAULT '',\n\n    PRIMARY KEY (id)\n) {$tabletype} ";
$create_sql[] = "INSERT INTO `" . PFX . "txp_category` VALUES (1, 'root', 'article', '', 1, 8, 'root', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_category` VALUES (2, 'root', 'link', '', 1, 4, 'root', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_category` VALUES (3, 'root', 'image', '', 1, 4, 'root', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_category` VALUES (4, 'root', 'file', '', 1, 2, 'root', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_category` VALUES (5, 'hope-for-the-future', 'article', 'root', 2, 3, 'Hope for the future', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_category` VALUES (6, 'meaningful-labor', 'article', 'root', 4, 5, 'Meaningful labor', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_category` VALUES (7, 'reciprocal-affection', 'article', 'root', 6, 7, 'Reciprocal affection', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_category` VALUES (8, 'textpattern', 'link', 'root', 2, 3, 'Textpattern', '')";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_css` (\n    name VARCHAR(255) NOT NULL,\n    css  MEDIUMTEXT   NOT NULL,\n\n    UNIQUE name (name(250))\n) {$tabletype} ";
foreach (scandir($themedir . DS . 'styles') as $cssfile) {
    if (preg_match('/^(\\w+)\\.css$/', $cssfile, $match)) {
 /**
  * Legacy Textile function. Do not use.
  * @param  [type]  $string     [description]
  * @param  boolean $strip_tags [description]
  * @return [type]              [description]
  */
 public static function text_to_html($string, $strip_tags = true)
 {
     PerchUtil::debug('Converting to Textile using deprecated PerchUtil::text_to_html', 'notice');
     if ($strip_tags) {
         $string = strip_tags($string);
     }
     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) {
         $string = $Textile->setDimensionlessImages(true)->textileThis($string);
     } else {
         $string = $Textile->textileThis($string);
     }
     if (defined('PERCH_XHTML_MARKUP') && PERCH_XHTML_MARKUP == false) {
         $string = str_replace(' />', '>', $string);
     }
     return $string;
 }
Beispiel #8
0
<?php

use Netcarver\Textile;
$parser = new \Netcarver\Textile\Parser();
echo $parser->textileThis($task->text);
Beispiel #9
0
?>

    <?php 
//= $form->field($model, 'given_task_id')->textInput()
?>
    <div class='well well-sm'>
    <?php 
echo Html::tag('h5', 'Студент: ' . $model->student->user->fullname);
echo Html::tag('h5', 'Группа: ' . $model->student->group->name);
echo Html::tag('h5', 'Дисциплина: ' . $model->disciplineName);
?>
    </div>
    <?php 
echo Html::beginTag('div', ['class' => 'panel panel-info']);
echo Html::tag('div', $model->task->name, ['class' => 'panel-heading']);
echo Html::tag('div', $parser->textileThis($model->task->text), ['class' => 'panel-body']);
echo Html::endTag('div');
?>

    <?php 
echo $form->field($model, 'result')->dropDownList(['0' => '', '2' => 'Неудовлетворительно', '3' => 'Удовлетворительно', '4' => 'Хорошо', '5' => 'Отлично']);
?>

    <?php 
echo $form->field($model, 'comment')->textarea(['rows' => 6]);
?>
    
    <?php 
echo $form->field($model, 'status')->dropDownList(['0' => 'Не решено', '1' => 'Отправлено на проверку', '2' => 'Есть нарекания', '3' => 'Завершено']);
?>
    
Beispiel #10
0
 public function format($text)
 {
     $parser = new \Netcarver\Textile\Parser();
     return $parser->textileThis($text);
 }
Beispiel #11
0
}
if (!in_array('method', $txplog)) {
    safe_alter('txp_log', "ADD method VARCHAR(16) NOT NULL DEFAULT 'GET'");
}
if (!in_array('ip', $txplog)) {
    safe_alter('txp_log', "ADD ip VARCHAR(16) NOT NULL DEFAULT ''");
}
// 1.0: need to get Excerpt_html values into the textpattern table, so catch
// empty ones and populate them.
$rs = mysqli_query($DB->link, "SELECT ID, Excerpt, textile_excerpt FROM `" . PFX . "textpattern` WHERE Excerpt_html LIKE ''");
$textile = new \Netcarver\Textile\Parser();
while ($a = @mysqli_fetch_assoc($rs)) {
    extract($a);
    assert_int($ID);
    $lite = $textile_excerpt ? '' : 1;
    $Excerpt_html = $textile->textileThis($Excerpt, $lite);
    safe_update('textpattern', "Excerpt_html = '" . doSlash($Excerpt_html) . "'", "ID = {$ID}");
}
// 1.0 feed unique ids.
// Blog unique id.
if (safe_field("val", 'txp_prefs', "name = 'blog_uid'") === false) {
    $prefs['blog_uid'] = md5(uniqid(rand(), true));
    safe_insert('txp_prefs', "name = 'blog_uid', val = '" . $prefs['blog_uid'] . "', prefs_id = '1'");
}
if (safe_field("name", 'txp_prefs', "name = 'blog_mail_uid'") === false) {
    $mail = safe_field('email', 'txp_users', "privs = '1' LIMIT 1");
    safe_insert('txp_prefs', "name = 'blog_mail_uid', val = '" . doSlash($mail) . "', prefs_id = '1'");
}
if (safe_field("val", 'txp_prefs', "name = 'blog_time_uid'") === false) {
    safe_insert('txp_prefs', "name = 'blog_time_uid', val = '" . date("Y") . "', prefs_id = '1'");
}
Beispiel #12
0
<div class="complete-task-form">
    <?php 
Pjax::begin(['enablePushState' => false, 'id' => 'form-task']);
?>

    <?php 
$form = ActiveForm::begin(['options' => ['data-pjax' => true]]);
?>

    <?php 
//= $form->field($model, 'given_task_id')->textInput()
?>

    <?php 
echo Html::tag('blockquote', $parser->textileThis($model->givenTask->task->text));
?>
    

    <?php 
/*= $form->field($model, 'result')->dropDownList(['0' => '','2' => 'Неудовлетворительно','3' => 'Удовлетворительно',
  '4' => 'Хорошо', '5' => 'Отлично']) */
?>

    <?php 
echo Html::tag('blockquote', $parser->textileThis($model->comment));
?>
   
    
    <?php 
echo Html::tag('p', 'Дата выдачи задания: ' . DateHelper::getDateByUserTimezone($model->givenTask->date), ['class' => 'alert alert-info']);
Beispiel #13
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
$parser = new \Netcarver\Textile\Parser();
/* @var $this yii\web\View */
/* @var $model common\models\CompleteExercise 

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Complete Exercises', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;*/
?>
    <?php 
echo $parser->textileThis($model->text);
Beispiel #14
0
function wikify($text)
{
    global $SCRIPT_URL;
    // FIXME: Do not apply this in <pre> and <notextile> blocks.
    // Linkify
    $text = preg_replace('@([^:"])(https?://([-\\w\\.]+)+(:\\d+)?(/([%-\\w/_\\.]*(\\?\\S+)?)?)?)@', '$1<a href="$2">$2</a>', $text);
    // WikiLinkify
    $text = preg_replace('@\\[([\\w-\\.]+)\\]@', '<a href="' . $SCRIPT_URL . '/$1">$1</a>', $text);
    $text = preg_replace('@\\[([\\w-\\.]+)\\|([\\w-\\.\\s]+)\\]@', '<a href="' . $SCRIPT_URL . '/$1">$2</a>', $text);
    // Textilify
    $textile = new \Netcarver\Textile\Parser();
    return $textile->textileThis($text);
}
 public function get_raw($post = false, $Item = false)
 {
     if ($post === false) {
         $post = $_POST;
     }
     $id = $this->Tag->id();
     if (isset($post[$id])) {
         $raw = trim($post[$id]);
         $raw = PerchUtil::safe_stripslashes($raw);
         $value = $raw;
         $flang = 'plain';
         if ($this->Tag->html()) {
             $flang = 'html';
         }
         $formatting_language_used = false;
         // Strip HTML by default
         if (!is_array($value) && PerchUtil::bool_val($this->Tag->html()) == false) {
             $value = PerchUtil::html($value);
             $value = strip_tags($value);
         }
         // Textile
         if (!$formatting_language_used && PerchUtil::bool_val($this->Tag->textile()) == true) {
             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);
             }
             if (defined('PERCH_XHTML_MARKUP') && PERCH_XHTML_MARKUP == false) {
                 $value = str_replace(' />', '>', $value);
             }
             $formatting_language_used = true;
             $flang = 'textile';
         }
         // Markdown
         if (!$formatting_language_used && PerchUtil::bool_val($this->Tag->markdown()) == true) {
             $Markdown = new PerchParsedown();
             $value = $Markdown->text($value);
             $formatting_language_used = true;
             $flang = 'markdown';
         } else {
             // Smartypants without Markdown (MD gets it by default)
             if (PerchUtil::bool_val($this->Tag->smartypants()) == true) {
                 $Markdown = new PerchParsedown();
                 $value = $Markdown->smartypants($value);
                 $flang = 'smartypants';
             }
         }
         $store = array('_flang' => $flang, 'raw' => $raw, 'processed' => $value);
         $this->raw_item = $store;
         return $this->raw_item;
     }
     return null;
 }