示例#1
0
function wowslider($id = 0, $write = true)
{
    if (is_array($id)) {
        // shortcodes
        $write = false;
        if (isset($id['id'])) {
            $id = (int) $id['id'];
        } else {
            if (isset($id['title'])) {
                $id = array('name' => $id['title']);
            } else {
                return '';
            }
        }
    } else {
        if (substr($id, 0, 6) == 'title:') {
            $id = array('name' => substr($id, 6));
        } else {
            $id = (int) $id;
        }
    }
    $out = wowslider_get($id);
    if (!$write) {
        return $out;
    }
    echo $out;
}
示例#2
0
function wowslider($id = 0, $write = true)
{
    static $active = array();
    $id = (int) $id;
    if (in_array($id, $active)) {
        return '';
    }
    $active[] = $id;
    $out = wowslider_get($id);
    if ($write) {
        echo $out;
    } else {
        return $out;
    }
}
    function months_dropdown($status = 'all')
    {
        global $wp_locale;
        $months = wowslider_get('months ' . $status);
        $month_count = count($months);
        if (!$month_count) {
            return;
        }
        $m = isset($_GET['m']) ? (int) $_GET['m'] : 0;
        ?>
		<select name="m">
			<option<?php 
        selected($m, 0);
        ?>
 value="0"><?php 
        _e('Show all dates');
        ?>
</option>
<?php 
        foreach ($months as $v) {
            $month = zeroise($v['month'], 2);
            $year = $v['year'];
            printf("<option %s value='%s'>%s</option>\n", selected($m, $year . $month, false), esc_attr($v['year'] . $month), $wp_locale->get_month($month) . " {$year}");
        }
        ?>
		</select>
<?php 
    }
示例#4
0
function wowslider_view()
{
    $id = (int) $_REQUEST['slider'];
    if ($html = wowslider_get($id, false)) {
        $slider = wowslider_get(array('where' => 'ID = ' . $id, 'limit' => 1));
        ?>
<div class="wrap">
    <div id="icon-wowslider" class="icon32"><br /></div><h2><?php 
        echo htmlspecialchars($slider[0]['name']);
        ?>
<a href="javascript://" onclick="history.back();" class="add-new-h2">&larr; back</a></h2>
        </div>
        <div id="wowslider-view"><?php 
        echo $html;
        ?>
</div>
        <strong class="shortcode"><?php 
        _e('shortcode:', 'wowslider');
        ?>
<br/><code>[wowslider id="<?php 
        echo $id;
        ?>
"]</code></strong>
        <strong class="shortcode"><?php 
        _e('php code:', 'wowslider');
        ?>
<br/><code>&lt;?php wowslider(<?php 
        echo $id;
        ?>
); ?&gt;</code></strong>
        <?php 
    } else {
        echo '<div id="message" class="error"><p>' . __('Slider not found!', 'wowslider') . '</p></div>';
    }
}