markdown() public static method

Format a string using Markdown syntax. Also purifies the output HTML.
public static markdown ( mixed $Mixed, boolean $Flavored = true ) : string
$Mixed mixed An object, array, or string to be formatted.
$Flavored boolean Optional. Parse with Vanilla-flavored settings? Default true
return string
Ejemplo n.º 1
0
 /**
  * Parse an addon's README file.
  *
  * @param string $Path The base path to search from.
  * @return string
  */
 protected function parseReadme($Path)
 {
     $ReadmePaths = array('/readme', '/README', '/readme.md', '/README.md', '/readme.txt', '/README.txt');
     $Description = '';
     // Get the list of potential files to analyze.
     $Entries = UpdateModel::findFiles($Path, $ReadmePaths);
     if ($Entries === false) {
         return '';
     }
     foreach ($Entries as $Entry) {
         $ReadMeContents = file_get_contents($Entry['Path']);
         $Description = Gdn_Format::markdown($ReadMeContents);
     }
     $FolderPath = substr($Path, 0, -4);
     Gdn_FileSystem::removeFolder($FolderPath);
     return $Description;
 }
Ejemplo n.º 2
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
<div class="SplashInfo">
    <div class="Center">
        <h1><?php 
echo $this->data('Title', t('Whoops!'));
?>
</h1>

        <div id="Message">
            <?php 
echo Gdn_Format::markdown($this->sanitize($this->data('Exception', 'No error message supplied.')));
?>
        </div>
    </div>
    <?php 
if (debug() && $this->data('Trace')) {
    ?>
        <h2>Error</h2>
        <?php 
    echo $this->data('Code') . ' ' . htmlspecialchars(Gdn_Controller::getStatusMessage($this->data('Code')));
    ?>
        <h2>Trace</h2>
        <pre stye="text-align"><?php 
    echo htmlspecialchars($this->data('Trace'));
    ?>
</pre>
Ejemplo n.º 3
0
     $typeHelp = t('AddonHelpFor' . $addonType, '');
     if ($typeHelp) {
         echo '<div class="Help">' . $typeHelp . '</div>';
     }
 }
 if ($this->data('Icon') != '') {
     echo '<img class="Icon" src="' . Gdn_Upload::url($this->data('Icon')) . '" itemprop="image" />';
 }
 $currentVersion = $this->data('CurrentVersion');
 if ($currentVersion && $currentVersion != $this->data('Version')) {
     echo '<p>', sprintf(t("This is not the most recent version of this plugin.", 'This is not the most recent version of this plugin. For the most recent version click <a href="%s">here</a>.'), URL('addon/' . AddonModel::Slug($this->Data, false))), '</p>';
 }
 echo '<div itemprop="description">';
 echo Gdn_Format::html($this->data('Description'));
 if ($this->data('Description2') && $ver != 'v1') {
     echo '<br /><br />', Gdn_Format::markdown($this->data('Description2'));
 }
 echo '</div>';
 ?>
 </div>
 <?php 
 if ($this->PictureData->numRows() > 0) {
     ?>
     <div class="PictureBox">
         <?php 
     foreach ($this->PictureData->result() as $picture) {
         echo '<span class="AddonPicture">';
         echo '<a rel="popable[gallery]" href="#Pic_' . $picture->AddonPictureID . '"><img src="' . Gdn_Upload::url(ChangeBasename($picture->File, 'at%s')) . '" itemprop="screenshot" /></a>';
         if ($session->UserID == $this->data('InsertUserID') || checkPermission('Addons.Addon.Manage')) {
             echo '<a class="Popup DeletePicture" href="' . Url('/addon/deletepicture/' . $picture->AddonPictureID) . '">x</a>';
         }