Example #1
0
});

Herbie\Hook::attach('renderContent', function($content) {
    return str_replace('CMS', 'C.M.S.', $content);
});
*/
Herbie\Hook::attach('shortcodeInitialized', function ($shortcode) {
    // homepage: box1
    $shortcode->add('box1', function ($atts, $content) {
        return '<div class="pure-u-1-2 box box-1"><div markdown="1">' . $content . '</div></div>';
    });
    // homepage: box2
    $shortcode->add('box2', function ($atts, $content) {
        return '<div class="pure-u-1-2 box box-2"><div markdown="1">' . $content . '</div></div>';
    });
    // github: readme abrufen, parsen und darstellen
    $shortcode->add('githubreadme', function ($attribs) {
        $url = $attribs['0'];
        $content = @file_get_contents($url);
        if ($content === false) {
            $content = "Die Readme-Seite konnte nicht von GitHub geladen werden:<br>{$url}";
        }
        // parse string
        $content = herbie\sysplugin\markdown\MarkdownPlugin::parseMarkdown($content);
        $replaced = str_replace(['<h1>Herbie ', '<table>'], ['<h1>', '<table class="pure-table pure-table-horizontal">'], $content);
        return '<div class="github-readme">' . $replaced . '</div>';
    });
});
$app = new Herbie\Application('../site');
#require_once(__DIR__ . '/shortcodes.php');
$app->run();
Example #2
0
<?php

Herbie\Hook::attach('pluginsInitialized', function () {
    $config = Herbie\DI::get('Config');
    if ($config->isEmpty('plugins.config.feed.no_page')) {
        $config->push('pages.extra_paths', '@plugin/feed/pages');
    }
});