コード例 #1
0
 /**
  * Render body of a given element
  *
  * @return string
  * @throws Exception
  */
 public function renderBody()
 {
     $smarty =& Shade::getSmarty();
     $template = $smarty->createTemplate($this->getIndexFilePath());
     SmartyHelpers::setCurrentElement($this);
     if ($this instanceof Element) {
         SmartyHelpers::setCurrentProject($this->getProject());
     } elseif ($this instanceof Project) {
         SmartyHelpers::setCurrentProject($this);
     }
     $content = $template->fetch();
     SmartyHelpers::resetCurrentElementAndProject();
     $separator_pos = strpos($content, $this->properties_separator);
     if ($separator_pos === false) {
         if (substr($content, 0, 1) == '*') {
             $content = '*Content Not Provided*';
         }
     } else {
         $content = trim(substr($content, $separator_pos + strlen($this->properties_separator)));
     }
     return Shade::markdownToHtml($content);
 }
コード例 #2
0
ファイル: SmartyHelpers.php プロジェクト: activecollab/shade
 /**
  * Render security block in release notes
  *
  * Note: This block is available only in release notes!
  *
  * @param  array       $params
  * @param  string      $content
  * @param  Smarty      $smarty
  * @param  boolean     $repeat
  * @return string|void
  * @throws ParamRequiredError
  * @throws Exception
  */
 public static function block_security($params, $content, &$smarty, &$repeat)
 {
     if ($repeat) {
         return;
     }
     if (self::$current_element instanceof Release) {
         return '<p>Security:</p>' . Shade::markdownToHtml(trim($content));
     } else {
         throw new Exception('added block is available for release notes only');
     }
 }