Esempio n. 1
0
function PageViewAsText($token)
{
    header('content-type: text/html');
    if ($article = Entities::retrieveEntity($token)) {
        echo '<pre>' . Ascii::generateHTML($article->getContent()) . '</pre>';
    } else {
        echo "No matching article found.";
    }
    exit;
}
Esempio n. 2
0
    public function testSettingFormatSkipsNonNumericVertices()
    {
        $data = [['foo', '2016-12-15', 34]];
        $mA = new Matrix($data);
        $test1 = <<<EOF
+---------------------------------+
|        foo 2016-12-15         34|
+---------------------------------+

EOF;
        $this->assertEquals($test1, $this->object->format($mA, ['outputType' => AsciiNumeric::TP_FLOAT]));
        $this->assertEquals($test1, $this->object->format($mA, ['outputType' => AsciiNumeric::TP_INT]));
        $this->assertEquals($test1, $this->object->format($mA, ['outputType' => AsciiNumeric::TP_COMPLEX]));
        $this->assertEquals($test1, $this->object->format($mA, ['outputType' => AsciiNumeric::TP_RATIONAL]));
    }
Esempio n. 3
0
 public function setText($aText)
 {
     $this->text .= Ascii::generateHTML($aText);
 }
Esempio n. 4
0
 public function renderContent($aArray)
 {
     $result = array();
     $parent_width = $this->parent->getWidth();
     $content_width = $this->getWidth();
     $prefix = '';
     // Top
     for ($i = 0; $i < $this->margins['top']; ++$i) {
         $result[] = Ascii::generatePattern(' ', $parent_width);
     }
     if (Ascii::getStrippedSize($this->borders['top'])) {
         $result[] = $this->drawBorder($this->borders['top'], $parent_width);
     }
     for ($i = 0; $i < $this->paddings['top']; ++$i) {
         $result[] = $this->renderLine("", $content_width, $prefix);
     }
     $prefix = '';
     $backup = '';
     // Content
     foreach ($aArray as $line) {
         $debug = $this->renderLine($line, $content_width, $prefix, $backup);
         // echo "[" . $line . "] -> [" . $debug . "]\n";
         $result[] = $debug;
         $backup = $prefix;
     }
     // Bottom
     for ($i = 0; $i < $this->paddings['bottom']; ++$i) {
         $result[] = $this->renderLine("", $content_width, $prefix);
     }
     if (Ascii::getStrippedSize($this->borders['bottom'])) {
         $result[] = $this->drawBorder($this->borders['bottom'], $parent_width);
     }
     for ($i = 0; $i < $this->margins['bottom']; ++$i) {
         $result[] = Ascii::generatePattern(' ', $parent_width);
     }
     return $result;
 }
Esempio n. 5
0
 public function getSumUp()
 {
     $result = Ascii::generateHTML($this->article->getContent());
     return $result;
 }
Esempio n. 6
0
    <email>rannou.sebastien@gmail.com</email>
  </author>

  <?php 
foreach (Entities::retrieveGroupedEntities(ARTICLES) as $article) {
    ?>
  <entry>
    <title><?php 
    echo $article->getTitle();
    ?>
</title>
    <link href="<?php 
    echo ROOT_URI . Common::urlFor('view_article', array('token' => $article->getToken()));
    ?>
"/>
    <updated><?php 
    echo date(DATE_ATOM, $article->getTimestamp());
    ?>
</updated>
    <summary type="xhtml"><?php 
    echo substr(Ascii::generateHTML($article->getContent()), 0, 512);
    ?>
...</summary>
  </entry>
  <?php 
}
?>

</feed>
<?php 
exit;