Пример #1
0
<?php

use Pronto\ShortcodeContainer;
use Pronto\ConfigContainer;
use Pronto\GlobalContainer;
use Pronto\HelperContainer;
ShortcodeContainer::add('image', function ($attributes) {
    $page = GlobalContainer::get('page');
    $image = array_shift($attributes);
    if (HelperContainer::relative($image)) {
        $image = $page->folder() . $image;
    }
    $defaults = array('alt' => '');
    $options = array_merge($defaults, $attributes);
    $xhtml = ConfigContainer::get('xtml') ? ' /' : '';
    if (isset($options['url'])) {
        $url = $options['url'];
        if (HelperContainer::relative($url)) {
            $url = $page->folder() . $url;
        }
        return '<img src="' . $image . '" alt=""' . $xhtml . '>';
    }
    return '<img src="' . $image . '" alt=""' . $xhtml . '>';
});
Пример #2
0
        echo date('M j', $page->date());
        ?>
<span><?php 
        echo date('S', $page->date());
        ?>
</span> <?php 
        echo date('Y', $page->date());
        ?>
</time></a>
            ·
            <?php 
        foreach (explode(',', $page->contributors()) as $contributor) {
            ?>
            <a href="https://github.com/<?php 
            echo trim($contributor);
            ?>
" target="_blank" class="github-contributor"><span class="github-username"><?php 
            echo trim($contributor);
            ?>
</span></a>
            <?php 
        }
        ?>
        </div>
    </div>
</article>
<?php 
    }
}
GlobalContainer::set('page', $cache);
template('footer');