Plugin Directory

Changeset 152364


Ignore:
Timestamp:
09/05/2009 11:05:20 PM (17 years ago)
Author:
hwde
Message:

Allow to specify the alignment for the widget/ads in the sidebar.

Location:
openx-wordpress-widget/trunk
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • openx-wordpress-widget/trunk/Changelog.txt

    r151808 r152364  
    11$Id$
     2
     32009-09-06:
     4
     5When using the widget in a sidebar, allow to
     6specify the alignment for the ads.
    27
    382009-09-02:
  • openx-wordpress-widget/trunk/openx-wp-widget.php

    r151808 r152364  
    44Plugin URI: http://xclose.de/wordpress/wordpress-widget-for-openx
    55Description: Sidebar-Widget, display a banner in a sidebar and replace magics {openx:zoneid} with calls to a openx adserver
    6 Version: 1.2
     6Version: 1.2.1
    77Author: Heiko Weber, heiko@wecos.de
    88Author URI: http://www.wecos.de
     
    7676        // get title
    7777        $title = empty($values['title']) ? '' : $values['title'];
     78        // get alignment, defaults to nothing
     79        $align = (empty($values['align']) || $values['align'] == 'none') ? false : $values['align'];
    7880        // how many banners/zones should we show
    7981        $zoneCount = empty($values['zonecount']) ? 0 : $values['zonecount'];
     
    9193        echo $title;
    9294        echo $after_title;
     95        if ($align !== false) { echo "<DIV align='{$align}'>"; }
    9396        echo $bannercode;
     97        if ($align !== false) { echo "</DIV>"; }
    9498        echo $after_widget;
    9599    }
     
    333337                    continue;print_r($widget_instance);
    334338                $newoptions['title'] = strip_tags(stripslashes($widget_instance['title']));
     339                $newoptions['align'] = strip_tags(stripslashes($widget_instance['align']));
    335340                $newoptions['zonecount'] = strip_tags(stripslashes($widget_instance['zonecount']));
    336341                for ($n = 0; $n < intval($newoptions['zonecount']); $n++)
     
    348353        if ($number == -1) {
    349354            $number = '%i%';
    350             $values = array('title' => '', 'zonecount' => 0);
     355            $values = array('title' => '', 'align' => false, 'zonecount' => 0);
    351356        }
    352357        else {
     
    361366
    362367        $title = htmlspecialchars($values['title'], ENT_QUOTES);
     368        $alignments = array('left', 'center', 'right', 'none');
     369        $align = htmlspecialchars($values['align'], ENT_QUOTES);
     370        if (!in_array($align, $alignments)) {
     371            $align = 'none';
     372        }
    363373        $zonecount = htmlspecialchars($values['zonecount'], ENT_QUOTES);
    364374        for ($n = 0; $n < intval($zonecount); $n++)
     
    372382                     id="widget_openxwpwidget-title-<?php echo $number; ?>"
    373383                  value="<?php echo $title; ?>" />
     384          </label><br />
     385          <label for="widget_openxwpwidget-align-<?php echo $number; ?>">
     386            Alignment:<br />
     387            <select name="widget-widget_openxwpwidget[<?php echo $number; ?>][align]"
     388                      id="widget_openxwpwidget-align-<?php echo $number; ?>">
     389              <?php
     390                foreach($alignments as $n) {
     391                    $sel = ($n == $align) ? 'selected' : '';
     392                    echo "<option value='$n' $sel>$n</option>\n";
     393                }
     394              ?>
     395            </select>
    374396          </label><br />
    375397          <label for="widget_openxwpwidget-zonecount-<?php echo $number; ?>">
     
    408430       
    409431        return array('version' => $widget_openxwpwidget_version,
    410                      'options' => array(1 => array('title' => '', 'zonecount' => 0)));
     432                     'options' => array(1 => array('title' => '', 'align' => false, 'zonecount' => 0)));
    411433    }
    412434    /** upgrade our options from single instance
Note: See TracChangeset for help on using the changeset viewer.