Esempio n. 1
0
 /**
  * @dataProvider data
  * @param $section
  * @param $markdown
  * @param $expectedHtml
  */
 function test_($section, $markdown, $expectedHtml)
 {
     $Parsedown = new Parsedown();
     $Parsedown->setUrlsLinked(false);
     $actualHtml = $Parsedown->text($markdown);
     $actualHtml = $this->normalizeMarkup($actualHtml);
     $this->assertEquals($expectedHtml, $actualHtml);
 }
function parseMdText($content)
{
    $parseDownConfig = Morfy::$config['parsedown'];
    if ($parseDownConfig['extra']) {
        $Parsedown = new ParsedownExtra();
    } else {
        $Parsedown = new Parsedown();
    }
    $Parsedown->setUrlsLinked($parseDownConfig['autoLink']);
    return $Parsedown->text($content);
}
Esempio n. 3
0
/**
 * Show Masonry Grid on Grid Template
 *
 * @author Jordan Pakrosnis
 * @link http://ucfbands.com/
 */
function show_masonry_grid()
{
    // PASSWORD PROTECTION
    if (post_password_required(get_post()) == false) {
        // Include Parsedown
        require_once CHILD_DIR . '/inc/parsedown/Parsedown.php';
        $Parsedown = new Parsedown();
        // Get post object.
        $post = get_post();
        // Get blocks attached to this page.
        $blocks = get_post_meta($post->ID, '_ucfbands_blocks_meta', true);
        // Leave if there's no boxes
        if (empty($blocks)) {
            echo '<div class="entry block one-fourth">';
            echo '<h3>Coming Soon&nbsp;&nbsp;<i class="fa fa-wrench"></i></h3>';
            if (is_user_logged_in()) {
                echo '<br>';
                echo '<i class="mkmc-note">MKMC Note: There are no blocks found on this page. This page <b>does not</b> show its main content.</i>';
            }
            echo '</div>';
            return;
        }
        // MASONRY GRID CONTAINER //
        // Get Layout Option
        $masonry_column_layout = get_post_meta($post->ID, '_ucfbands_blocks_column_layout', true);
        // Use Layout Option with container output
        echo '<section class="masonry-' . $masonry_column_layout . '-grid">';
        echo '<div class="masonry-' . $masonry_column_layout . '-grid-sizer"></div>';
        echo '<div class="masonry-' . $masonry_column_layout . '-gutter-sizer"></div>';
        //-- BLOCK LOOP --//
        foreach ($blocks as $block) {
            // Get Block Meta Data
            $block_title = esc_attr($block['title']);
            $block_icon = esc_attr($block['icon']);
            $block_width = esc_attr($block['width']);
            $block_is_featured = esc_attr($block['featured']);
            $block_content = $block['block-content'];
            $block_render_html = esc_attr($block['render_html']);
            $block_remove_background_padding = esc_attr($block['remove-background']);
            $block_is_breaker = esc_attr($block['breaker']);
            // If there's only one block and there's no content; display nothing.
            if (sizeof($blocks) == 1 && $block_content == '' && $block_title == '') {
                break;
            }
            // If the block isn't a "breaker", proceed as normal
            if ($block_is_breaker == false) {
                // SET INITIAL CLASSES
                $block_classes = 'block masonry-block masonry-block-size--' . $block_width;
                // Featured?
                if ($block_is_featured == true) {
                    $block_classes .= ' block-featured';
                }
                // Background/Padding Disabled?
                if ($block_remove_background_padding) {
                    $block_classes .= ' block-remove-background-padding';
                }
                // Block Icon?
                if ($block_icon) {
                    $block_icon = '<i class="fa fa-' . $block_icon . '"></i>&nbsp;&nbsp;';
                } else {
                    $block_icon = '';
                }
                ?>

                <!-- MASONRY BLOCK -->
                <div class="<?php 
                echo $block_classes;
                ?>
">


                    <!-- BLOCK TITLE & ICON -->
                    <?php 
                if ($block_title != '') {
                    ?>
                        <h2 class="block-header"><?php 
                    echo $block_icon . $block_title;
                    ?>
</h2>
                    <?php 
                }
                ?>

                    <?php 
                // FOR TESTING: Show Block Width
                ?>
                    <?php 
                //echo '<h4 style="color:red;">' . $block_width . '</h4>';
                ?>


                    <div class="entry-content">

                        <!-- BLOCK MARKDOWN CONTENT -->
                        <?php 
                // Parse block content into Markdown HTML
                if ($block_render_html) {
                    echo apply_filters('the_content', $block_content);
                } else {
                    $block_content = $Parsedown->setUrlsLinked(false)->text($block_content);
                    echo apply_filters('the_content', $block_content);
                }
                ?>

                    </div><!-- /.entry-content -->

                </div><!-- /BLOCK -->

                <?php 
            } else {
                ?>

                <!-- MASONRY BLOCK -->
                <div class="masonry-block masonry-block-size--one-whole masonry-breaker-block"></div><!-- /BLOCK -->

                <?php 
            }
            // else
        }
        // foreach block
        // End Masonry Grid Container
        echo '</div>';
    }
    // PASSWORD PROTECTION
}
Esempio n. 4
0
 /**
  * Passes a string through the Markdown parser
  * @param  string $str
  * @return string
  */
 protected function _parseMarkdown($str)
 {
     $mkd = new Parsedown();
     $mkd->setUrlsLinked(false);
     return $mkd->text($str);
 }
Esempio n. 5
0
function markdown($text, $allow_html = false)
{
    static $parsedown = null;
    if ($parsedown === null) {
        include BOOTSTRAP_ROOT . 'includes/Parsedown.php';
        $parsedown = new Parsedown();
    }
    $parsedown->setBreaksEnabled(true);
    // should convert \n to <br/>?
    $parsedown->setMarkupEscaped(!$allow_html);
    // should escape HTML?
    $parsedown->setUrlsLinked(true);
    // should automatically link urls?
    return $parsedown->text($text);
}
Esempio n. 6
0
 /**
  * 
  *
  * @static 
  */
 public static function setUrlsLinked($urlsLinked)
 {
     return \Parsedown::setUrlsLinked($urlsLinked);
 }
            return new \Domynation\Cache\RedisCache(REDIS_HOST, REDIS_PORT);
        default:
            return new \Domynation\Cache\InMemoryCache();
            break;
    }
}, \Domynation\Communication\WebSocketInterface::class => function () {
    switch (WEBSOCKET_DRIVER) {
        case 'pusher':
        default:
            return new \Domynation\Communication\PusherWebSocket(PUSHER_API_KEY, PUSHER_API_SECRET_KEY, PUSHER_APP_ID);
            break;
    }
}, \Domynation\Communication\MarkdownParserInterface::class => function () {
    $parsedown = new Parsedown();
    $parsedown->setBreaksEnabled(true);
    $parsedown->setUrlsLinked(true);
    $parsedown->setMarkupEscaped(true);
    return new \Domynation\Communication\ParsedownMarkdownParser($parsedown);
}, \Domynation\Security\PasswordInterface::class => function () {
    switch (PASSWORD_DRIVER) {
        case 'md5':
            return new \Domynation\Security\Md5Password();
            break;
        case 'native':
        default:
            return new \Domynation\Security\NativePassword();
            break;
    }
}, \Domynation\Security\PasswordGeneratorInterface::class => function () {
    return new \Domynation\Security\BasicPasswordGenerator();
}, \Domynation\Authentication\AuthenticatorInterface::class => function (\Doctrine\DBAL\Connection $db, \Domynation\Session\SessionInterface $session, \Domynation\Security\PasswordInterface $password) {