public function actionPreview()
 {
     $parser = new CMarkdownParser();
     echo $parser->safeTransform($_POST['PortletCode'][$_GET['attribute']]);
 }
        <div class="panel-body">
            <?php 
    $parser = new CMarkdownParser();
    echo $parser->safeTransform($md);
    ?>

        </div>
    </div>

<?php 
} else {
    ?>

    <div class="container">

        <div class="row">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="custom_page_content">
                        <?php 
    $parser = new CMarkdownParser();
    echo $parser->safeTransform($md);
    ?>
                    </div>
                </div>
            </div>
        </div>
    </div>

<?php 
}
Пример #3
0
 /**
  * Returns a safe output to the theme
  * This includes setting nofollow tags on links, forcing them to open in new windows, and safely encoding the text
  * @return string
  */
 public function getSafeOutput()
 {
     $md = new CMarkdownParser();
     $dom = new DOMDocument();
     $dom->loadHtml('<?xml encoding="UTF-8">' . $md->safeTransform($this->content));
     $x = new DOMXPath($dom);
     foreach ($x->query('//a') as $node) {
         $element = $node->getAttribute('href');
         if (isset($element[0]) && $element[0] !== "/") {
             $node->setAttribute('rel', 'nofollow');
             $node->setAttribute('target', '_blank');
         }
     }
     return $md->safeTransform($dom->saveHtml());
 }
Пример #4
0
		<p style="text-align:center;"><?php 
    echo CHtml::image(Yii::app()->baseUrl . $meta['blog-image']['value'], NULL, array('class' => 'image'));
    ?>
</p>
	<?php 
}
?>
	<div class="post-inner">
		<div class="post-header">
			<h3><?php 
echo CHtml::link($content->title, Yii::app()->createUrl($content->slug));
?>
</h3>
			<?php 
$md = new CMarkdownParser();
echo strip_tags($md->safeTransform($content->extract), '<h1><h2><h3><h4><h5><6h><p><b><strong><i>');
?>
		</div>
		<div class="blog-meta">
			<span class="date"><?php 
echo Cii::timeAgo($content->published);
?>
</span>
			<span class="separator">⋅</span>
			<span class="blog-author minor-meta"><strong>by </strong>
				<span>
					<?php 
echo CHtml::link(CHtml::encode($content->author->displayName), $this->createUrl("/profile/{$content->author->id}/"));
?>
				</span>
				<span class="separator">⋅</span> 
 /**
  * Reads the specified file and returns either the {@link http://uk.php.net/htmlentities htmlentities} of title
  * or the {@link http://daringfireball.net/projects/markdown/ markdown} parsed description.
  *
  * @param string $file the path to the file
  * @param boolean $title whether to just get the title
  * @return string the text
  *
  */
 protected function getDescription($file, $title = false)
 {
     $_cache = isset(Yii::app()->cache) ? Yii::app()->cache->get('EGallery_' . $file . '_' . $title . '_description') : false;
     if ($_cache !== false) {
         return $_cache;
     } else {
         $i = 1;
         $fp = fopen($file, 'r');
         while (!feof($fp)) {
             $buffer .= fgets($fp, 10240);
             if ($i == 1) {
                 if ($title) {
                     return htmlentities($buffer, ENT_QUOTES);
                 }
                 $buffer = '';
             }
             $i++;
         }
         $parser = new CMarkdownParser();
         $buffer = $parser->safeTransform($buffer);
         if (isset(Yii::app()->cache)) {
             Yii::app()->cache->set('EGallery_' . $file . '_' . $title . '_description', $buffer);
         }
         return $buffer;
     }
 }
Пример #6
0
					<?php 
    echo Yii::t('Dashboard.main', 'In {{category}}', array('{{category}}' => CHtml::link(CHtml::encode($model->category->name), Yii::app()->createUrl($model->category->slug))));
    ?>
				</span>
			</span>
		</div>
		<?php 
    $md = new CMarkdownParser();
    ?>
		<div id="md-output"></div>
		<textarea id="markdown" style="display:none"><?php 
    echo $model->content;
    ?>
</textarea>
		<span id="item-id" style="display:none;"><?php 
    echo $model->id;
    ?>
</span>
		<span id="item-status" style="display:none;"><?php 
    echo (int) $model->isPublished();
    ?>
</span>
		<noscript>
			<?php 
    echo $md->safeTransform($model->content);
    ?>
		<noscript>

	</div>
<?php 
}
Пример #7
0
 /**
  * Prepares attributes before performing validation.
  */
 protected function beforeValidate($on)
 {
     $parser = new CMarkdownParser();
     $this->contentDisplay = $parser->safeTransform($this->content);
     if ($this->isNewRecord) {
         $this->createTime = time();
     }
     return true;
 }
Пример #8
0
 public function actionPreview()
 {
     $parser=new CMarkdownParser;
     echo $parser->safeTransform($_POST['data']);
 }
 /**
  * Prepare content
  * @return string content
  */
 protected function prepareContent($value)
 {
     if ($this->markdown) {
         $parser = new CMarkdownParser();
         return $this->safeTransform ? $parser->safeTransform($value) : $parser->transform($value);
     } else {
         return CHtml::encode($value);
     }
 }
Пример #10
0
?>
</strong>
            <span class="usertime"><?php 
echo '@' . $user->username;
?>
</span>
           <span class="usertime" data-livestamp="<?php 
echo $data->created;
?>
"></span>
           <div class="share-body">
               <?php 
$data->text = preg_replace("/#([A-Za-z0-9\\/\\.]*)/", "<a target=\"_new\" href=\"" . Yii::app()->controller->createAbsoluteUrl('timeline/search') . "?q=\$1\">#\$1</a>", $data->text);
$data->text = preg_replace("/@([A-Za-z0-9\\/\\.]*)/", "<a href=\"" . Yii::app()->controller->createAbsoluteUrl('timeline/index') . "/\$1\">@\$1</a>", $data->text);
$md = new CMarkdownParser();
echo $md->safeTransform($data->text);
?>
           </div>

           <div class="actions">
               <span style="cursor: pointer" class="fa fa-heart <?php 
echo $data->isLiked() ? 'liked' : NULL;
?>
"></span>
               <?php 
if ($data->author_id != Yii::app()->user->id) {
    ?>
                   <span style="cursor: pointer" class="fa fa-mail-forward"></span>
               <?php 
}
?>
Пример #11
0
} else {
    ?>
						<?php 
    echo Yii::t('DefaultTheme', '{{count}} Comments', array('{{count}}' => $content->getCommentCount()));
    ?>
					<?php 
}
?>
			
				</span>
			</div>
			<div class="clearfix"></div>
				<?php 
$md = new CMarkdownParser();
$dom = new DOMDocument();
$dom->loadHtml('<?xml encoding="UTF-8">' . $md->safeTransform($content->content));
$x = new DOMXPath($dom);
foreach ($x->query('//a') as $node) {
    $element = $node->getAttribute('href');
    // Don't follow links outside of this site, and always open them in a new tab
    if ($element[0] !== "/") {
        $node->setAttribute('rel', 'nofollow');
        $node->setAttribute('target', '_blank');
    }
}
?>

				<div id="md-output"><?php 
echo $md->safeTransform($dom->saveHtml());
?>
</div>
Пример #12
0
			<?php 
    } else {
        ?>
				<div class="alert alert-info">
					<?php 
        echo Yii::t('DefaultTheme', "{{oops}} This user hasn't added any information about themself yet.", array('{{oops}}' => CHtml::tag('strong', array(), Yii::t('DefaultTheme', 'Oops!'))));
        ?>
				</div>
			<?php 
    }
    ?>
		<?php 
} else {
    ?>
			<?php 
    $md = new CMarkdownParser();
    ?>
			<?php 
    echo $md->safeTransform($about);
    ?>
		<?php 
}
?>
	</div>
</div>
<style>
 	main .main-body { margin-left: 0px; }
 	table td, table th { padding: 0px; padding-left: 5px; font-size: 12px; color: #777; }
</style>
<?php 
$this->widget('ext.timeago.JTimeAgo', array('selector' => ' .timeago'));