Exemple #1
0
function ozh_yourls_randombg()
{
    $bg = glob(dirname(__FILE__) . '/img/*png');
    $url = yourls_plugin_url(dirname(__FILE__));
    $rnd = yourls_plugin_url($bg[mt_rand(0, count($bg) - 1)]);
    echo <<<CSS
<style type="text/css">
\t\tbody {background:#e3f3ff url({$rnd}) repeat;}
\t</style>

CSS;
}
<html>
    <head>
        <title>YOURLS Link Shortener: Fuzzy Keyword Suggestions</title>
        <!-- example of how to include/reference additional files that are kept in the plugin directory
        <link rel="stylesheet" media="all" href="<?php 
echo yourls_plugin_url(dirname(__FILE__) . '/my_styles.css');
?>
">
        -->
    </head>
    <body>
        <center>
            <h1 style="text-align: center;display: block;margin: 0;padding: 0;color: #202020;font-family: Helvetica;font-size: 26px;font-style: normal;font-weight: bold;line-height: 125%;letter-spacing: normal;">YOURLS Link Shortener: Fuzzy Keyword Suggestions</h1>
            <img align="center" alt="" src="<?php 
echo yourls_plugin_url(dirname(__FILE__) . '/img/yourls_logo.png');
?>
" width="600" style="max-width: 600px;padding-bottom: 0;display: inline !important;vertical-align: bottom;border: 0;height: auto;outline: none;text-decoration: none;">
            <p style="text-align: center;margin: 10px 0;padding: 0;font-family: Helvetica;font-size: 16px;line-height: 150%;">This site is used to provide shortened link forwarding, but you have requested a keyword/short link that doesn't exist.</p>

            <?php 
# just show a default block of text if we are NOT intercepting a typo - e.g. intercepting a request for the root YOURLS site
# use the $keyword_supplied variable to determine if we're intercepting anything
if (!$keyword_supplied) {
    ?>
                Contact the site owner/administrator of this site to learn more about their link shortener.  In the mean time, you may be interested in the following resources:<br>
                <ul>
                    <li><a href="http://yourls.org" target="_blank">YOURLS</a>: Home page for the YOURLS engine itself</li>
                    <li><a href="https://github.com/philhagen/ltc-fuzzy-keyword-suggestions" target="_blank">LTC Fuzzy Keyword Suggestions</a>: Code repository for this plugin</li>
                    <li><a href="http://lewestech.com" target="_blank">Lewes Technology Consulting</a>: Author of this plugin</li>
                </ul>
            <?php