Exemplo n.º 1
0
 function get()
 {
     $text = preg_replace_callback('!(?=[^\\]])\\((' . implode('|', $this->tags) . '):(.*?)\\)!i', array($this, 'parse'), (string) $this->text);
     $text = preg_replace_callback('!```(.*?)```!is', array($this, 'code'), $text);
     $text = $this->mdown ? markdown($text) : $text;
     $text = $this->smartypants ? smartypants($text) : $text;
     return $text;
 }
Exemplo n.º 2
0
function format($text)
{
    $text = markdown($text);
    $text = smartypants($text);
    $search = array("<table>", "</table>");
    $replace = array("<figure class='table'><table>", "</table></figure>");
    $text = str_replace($search, $replace, $text);
    return $text;
}
Exemplo n.º 3
0
 public function parse()
 {
     if (!$this->field) {
         return '';
     }
     $text = $this->field->value;
     // pre filters
     foreach (static::$pre as $filter) {
         $text = call_user_func_array($filter, array($this, $text));
     }
     // tags
     $text = preg_replace_callback('!(?=[^\\]])\\([a-z0-9]+:.*?\\)!i', array($this, 'tag'), $text);
     // markdownify
     $text = markdown($text);
     // smartypants
     if (kirby()->option('smartypants')) {
         $text = smartypants($text);
     }
     // post filters
     foreach (static::$post as $filter) {
         $text = call_user_func_array($filter, array($this, $text));
     }
     return $text;
 }
Exemplo n.º 4
0
    <meta name="twitter:image:src" content="http://bradshawsguide.org<?php 
    echo $page->images()->first()->url();
    ?>
">
<?php 
}
?>
    <meta name="twitter:card" content="summary">

    <title><?php 
if ($page->isHomePage() == false) {
    echo html($page->title);
    ?>
 - <?php 
}
echo smartypants($site->title);
?>
</title>
</head>

<body>
    <header role="banner" id="top">
        <h1><a href="<?php 
echo url();
?>
">Bradshaw&#8217;s <span>Guide</span></a></h1>
        <a href="#nav">Jump to navigation</a>
        <a href="#search">Jump to search</a>
    </header><!--/@banner-->

    <main role="main" id="main">
Exemplo n.º 5
0
</h2>
                <ul class="stations listing">
<?php 
        foreach ($items as $item) {
            ?>
                    <li><a href="<?php 
            echo $item->url();
            ?>
"<?php 
            if ($item->text() == '') {
                ?>
 class="unremarkable"<?php 
            }
            ?>
><?php 
            echo smartypants($item->title());
            ?>
</a></li>
<?php 
        }
        ?>
                </ul>
<?php 
    }
}
?>
            </section>
<?php 
snippet('shorturl');
snippet('prevnext');
?>
Exemplo n.º 6
0
"><?php 
            echo smartypants($item->title());
            ?>
</a></h2>
<?php 
            $regions = $item->children()->sortBy('title', 'asc');
            ?>
                <ul class="regions listing">
<?php 
            foreach ($regions as $region) {
                ?>
                    <li><a href="<?php 
                echo $region->url();
                ?>
"><?php 
                echo smartypants($region->title());
                ?>
</a></li>
<?php 
            }
            ?>
                </ul>
<?php 
        }
    }
}
?>
        </section>
<?php 
if (!isset($_GET['ajax'])) {
    snippet('_footer');
Exemplo n.º 7
0
?>
            </section>

            <footer>
                <details class="related-links">
                    <summary>Related Links</summary>
<?php 
if ($page->related) {
    echo kirbytext($page->related());
} else {
    ?>
                    <p><a href="http://en.wikipedia.org/w/index.php?search=<?php 
    echo urlencode($page->title());
    ?>
"><?php 
    echo smartypants($page->title());
    ?>
 on Wikipedia</a></p>
<?php 
}
?>
                </details>
            </footer>

<?php 
snippet('shorturl');
?>
        </article>
<?php 
if (!isset($_GET['ajax'])) {
    snippet('_footer');
Exemplo n.º 8
0
?>

<?php 
if ($page->related()) {
    ?>
            <section>
                <h1>Related</h1>
                <ul class="listing">
<?php 
    foreach (related($page->related()) as $related) {
        ?>
                    <li><a href="<?php 
        echo $related->url();
        ?>
"><?php 
        echo smartypants($related->title());
        ?>
</a></li>
<?php 
    }
    ?>
                </ul>
            </section>
<?php 
}
?>

<?php 
snippet('shorturl');
?>
        </article>
Exemplo n.º 9
0
<?php 
include $dr . "header.php";
?>

<main>

<nav><a href="/#panel-<?php 
echo $cat_id;
?>
" class="back"><img src="/i/chevron-left.svg" alt="Back to"> <?php 
echo $category;
?>
</a></nav>
<h1><?php 
echo smartypants($heading);
?>
</h1>

<article class="prose">
<?php 
if (!$error) {
    echo format($text);
} else {
    echo format("# Oh dear.\n");
    echo format($title);
}
?>
</article>

</main>
Exemplo n.º 10
0
            <ul class="<?php 
    echo $type;
    ?>
 listing">
<?php 
    foreach ($items as $item) {
        if ($item->shorttitle() != null) {
            $title = $item->shorttitle();
        } else {
            $title = $item->title();
        }
        ?>
                <li><a href="<?php 
        echo $item->url();
        ?>
"<?php 
        if ($item->text() == '') {
            ?>
 class="unremarkable"<?php 
        }
        ?>
><?php 
        echo smartypants(html($title));
        ?>
</a></li>
<?php 
    }
    ?>
            </ul>
<?php 
}
Exemplo n.º 11
0
<nav role="navigation" id="nav">
    <h1 class="hidden">Explore <?php 
echo smartypants($site->short_title());
?>
 Handbook</h1>
    <ul>
    <?php 
foreach ($pages->visible() as $page) {
    ?>
        <li>
            <a href="<?php 
    echo $page->url();
    ?>
"<?php 
    e($page->isOpen(), ' class="active"');
    ?>
>
                <?php 
    echo $page->title();
    ?>
            </a>
        </li>
    <?php 
}
?>
    </ul>
    <a href="#top" class="return">&#9652; Return to top</a>
</nav><!--/@navigation-->
Exemplo n.º 12
0
                <li><a href="/regions/england/london/places-of-amusement">Places of Amusement, &#38;c.</a></li>
                <li><a href="/regions/england/london/summary">London Summary</a></li>
            <?php 
        }
        ?>
            <?php 
        foreach ($routes as $route) {
            ?>
                <?php 
            if ($route->text() != '') {
                ?>
                    <li><a href="<?php 
                echo $route->url();
                ?>
"><?php 
                echo smartypants($route->title());
                ?>
</a></li>
                <?php 
            }
            ?>
            <?php 
        }
        ?>
            </ul>
    <?php 
    }
}
?>
</section>
<?php 
Exemplo n.º 13
0
 */
kirbytext::$tags['blockquote'] = array('attr' => array('lang', 'attribution', 'cite', 'link'), 'html' => function ($tag) {
    $text = $tag->attr('blockquote');
    $lang = $tag->attr('lang');
    $attribution = $tag->attr('attribution');
    $cite = $tag->attr('cite');
    $link = $tag->attr('link');
    if (!empty($lang)) {
        $lang_attr = ' lang="' . $lang . '"';
    } else {
        $lang_attr = '';
    }
    $html = '<figure class="Blockquote">';
    $html .= '<blockquote' . $lang_attr . '>';
    $html .= kirbytext($text);
    $html .= '</blockquote>';
    // open figcaption with attribution, citation and link if one is available
    if (!empty($attribution)) {
        if (!empty($cite)) {
            if (!empty($link)) {
                $html .= '<figcaption>' . smartypants($attribution) . ' <cite><a href="' . html($link) . '" rel="external nofollow">' . smartypants($cite) . '</a></cite></figcaption>';
            } else {
                $html .= '<figcaption>' . smartypants($attribution) . ' <cite>' . smartypants($cite) . '</cite></figcaption>';
            }
        } else {
            $html .= '<figcaption>' . smartypants($attribution) . '</figcaption>';
        }
    }
    $html .= '</figure>';
    return $html;
});
Exemplo n.º 14
0
</h1>

<?php 
if ($page->hasPrev() == true) {
    ?>
    <a href="<?php 
    echo $page->prev()->url();
    ?>
" rel="prev"><span><?php 
    echo smartypants($page->prev()->title());
    ?>
</span></a>
<?php 
}
?>

<?php 
if ($page->hasNext() == true) {
    ?>
    <a href="<?php 
    echo $page->next()->url();
    ?>
" rel="next"><span><?php 
    echo smartypants($page->next()->title());
    ?>
</span></a>
<?php 
}
?>
</nav><!--/.prevnext-->
Exemplo n.º 15
0
"/>
<?php 
}
if ($page->hasImages()) {
    ?>
    <meta name="twitter:image:src" content="http://bradshawsguide.org<?php 
    echo $page->images()->first()->url();
    ?>
">
<?php 
}
?>

    <title><?php 
if (!$page->isHomePage()) {
    echo smartypants(html($page->title()));
    ?>
 - <?php 
}
echo smartypants(html($site->title()));
?>
</title>
</head>

<body>
    <?php 
snippet('banner');
?>

    <main role="main" id="main">
Exemplo n.º 16
0
    ?>
 listing">
    <?php 
    foreach ($items as $item) {
        ?>
        <?php 
        if ($item->short_title()->isNotEmpty()) {
            $title = $item->short_title();
        } else {
            $title = $item->title();
        }
        ?>
        <li><a href="<?php 
        echo $item->url();
        ?>
"<?php 
        if ($item->text()->isEmpty()) {
            ?>
 class="unremarkable"<?php 
        }
        ?>
><?php 
        echo smartypants($title);
        ?>
</a></li>
    <?php 
    }
    ?>
    </ul>
<?php 
}
Exemplo n.º 17
0
            <nav class="prevnext">
                <h1 class="hidden">Previous and Next <?php 
echo $page->parent->title;
?>
</h1>
<?php 
if ($page->hasPrev() == true) {
    ?>
                <a href="<?php 
    echo $page->prev()->url();
    ?>
" rel="prev"><span><?php 
    echo smartypants($prevTitle);
    ?>
</span></a>
<?php 
}
if ($page->hasNext() == true) {
    ?>
                <a href="<?php 
    echo $page->next()->url();
    ?>
" rel="next"><span><?php 
    echo smartypants($nextTitle);
    ?>
</span></a>
<?php 
}
?>
            </nav><!--/.prevnext-->
Exemplo n.º 18
0
                ?>
                        <ul>
                    <?php 
            }
            ?>
                    <?php 
            foreach ($routes as $connection) {
                ?>
                        <?php 
                if ($connection->title() !== $page->title()) {
                    ?>
                            <li><a href="<?php 
                    echo $connection->url();
                    ?>
"><?php 
                    echo smartypants($connection->destination());
                    ?>
</a></li>
                        <?php 
                }
                ?>
                    <?php 
            }
            ?>
                    <?php 
            if ($type == 'interchange') {
                ?>
                        </ul>
                    <?php 
            }
            ?>
Exemplo n.º 19
0
    </main><!--/@main-->

    <nav role="navigation" id="nav">
        <h1 class="hidden">Explore <?php 
echo smartypants($site->shorttitle);
?>
 Handbook</h1>
        <ul>
<?php 
foreach ($pages->visible() as $page) {
    ?>
            <li><a href="<?php 
    echo $page->url();
    ?>
" id="nav-<?php 
    echo str::lower($page->title);
    ?>
"<?php 
    echo $page->isOpen() ? ' class="is-active"' : '';
    ?>
><?php 
    echo html($page->title());
    ?>
</a></li>
<?php 
}
?>
        </ul>
        <a href="#top" class="return">&#9652; Return to top</a>
    </nav><!--/@navigation-->
Exemplo n.º 20
0
<?php

/**
 * Smartypants Plugin
 *
 * @author Jonathan van Wunnik <*****@*****.**>
 * @version 1.0.0
 */
if ($this->options['smartypants']) {
    field::$methods['smartypants'] = function ($field) {
        $field->value = smartypants($field);
        return $field;
    };
}