• Watch videos at Vodpod and other videos from this collection.
  • Flickr Photos

    Ioanna

    Lake Tekapo

    the wood

    More Photos
  •  

    November 2009
    M T W T F S S
    « Mar    
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30  
  • <?php /* Plugin Name: Lib Dem Buttons Description: Adds a sidebar widget to let sites include a Lib Dem campaign buttons. Author: Martin Tod Version: 1.2 Author URI: http://www.martintod.org.uk/blog/ */ /* Version 1.0 (June 25, 2006) Original public version Version 1.1 (July 16, 2006) Fall back to Javascript if readfile fails Version 1.2 (January 3, 2007) Add option to switch off "Get this" link (by Liberal Democrats) */ // Put functions into one big function we'll call at the plugins_loaded // action. This ensures that all required plugin functions are defined. function widget_ldbuttons_init() { // Check for the required plugin functions. This will prevent fatal // errors occurring when you deactivate the dynamic-sidebar plugin. if ( !function_exists('register_sidebar_widget') ) return; // This is the function that outputs our little Google search form. function widget_ldbuttons($args) { // $args is an array of strings that help widgets to conform to // the active theme: before_widget, before_title, after_widget, // and after_title are the array keys. Default tags: li and h2. extract($args); // Each widget can store its own options. We keep strings here. $options = get_option('widget_ldbuttons'); $title = $options['title']; $buttonnumber = $options['buttonnumber']; settype($buttonnumber,"integer"); $text = $options['text']; // Set link $buttonlink = "http://petitions.libdems.org.uk/showButtons.php?format=html"; if(!empty($buttonnumber)) { $buttonlink .="&buttons=$buttonnumber"; } if($text == 'off') { $buttonlink .="&text=off"; } // These lines generate our output. Widgets can be very complex // but as you can see here, they can also be very, very simple. echo $before_widget . $before_title . $title . $after_title; # Here is the code that displays the input box or thank you message $result = @readfile($buttonlink); # If there's an error, then show the javascript version if(empty($result)) { $buttonlink = "http://petitions.libdems.org.uk/showButtons.php"; if(!empty($buttonnumber)) { $buttonlink .="?buttons=$buttonnumber"; } if ($text == 'off') { if (!empty($buttonnumber)) { $buttonlink .="&text=off"; } else { $buttonlink .="?text=off"; } } echo ''; } echo $after_widget; } // This is the function that outputs the form to let the users edit // the widget's title. It's an optional feature that users cry for. function widget_ldbuttons_control() { // Get our options and see if we're handling a form submission. $options = get_option('widget_ldbuttons'); if ( !is_array($options) ) $options = array('title'=>'Lib Dem campaigns', 'buttonnumber'=>'0', 'text'=>'on'); if ( $_POST['ldbuttons-submit'] ) { // Remember to sanitize and format use input appropriately. $options['title'] = strip_tags(stripslashes($_POST['ldbuttons-title'])); $options['buttonnumber'] = strip_tags(stripslashes($_POST['ldbuttons-buttonnumber'])); $options['text'] = strip_tags(stripslashes($_POST['ldbuttons-text'])); update_option('widget_ldbuttons', $options); } // Be sure you format your options to be valid HTML attributes. $title = htmlspecialchars($options['title'], ENT_QUOTES); $buttonnumber = htmlspecialchars($options['buttonnumber'], ENT_QUOTES); $text = htmlspecialchars($options['text'], ENT_QUOTES); // Here is our little form segment. Notice that we don't need a // complete form. This will be embedded into the existing form. echo '

    Title:

    '; echo '

    Number of buttons:'; for ($i=0;$i<11;$i++) { if($i==$buttonnumber){$selectString = ' selected';} else {$selectString ='';} if(empty($i)) {$istring="Default";} else {$istring=$i;} echo ' ".$istring."\n"; } echo '

    '; echo '

    "Get this for your blog" text:
    On
    Off '; echo ''; } // This registers our widget so it appears with the other available // widgets and can be dragged and dropped into any active sidebars. register_sidebar_widget('Lib Dem buttons', 'widget_ldbuttons'); // This registers our optional widget control form. Because of this // our widget will have a button that reveals a 300x100 pixel form. register_widget_control('Lib Dem buttons', 'widget_ldbuttons_control', 300, 200); } // Run our code later in case this loads prior to any required plugins. add_action('plugins_loaded', 'widget_ldbuttons_init'); ?>

  • Meta

  • Top Clicks

    • None

About Me and my Life…

Hello Readers,

Relatively new to the enormous expanse of knowledge open to all via the internet I have somewhat immersed myself in a fantastic ‘learning curve’. Piloting this knowledge gathering vessel fills me with ecstatic yearning and rooted to the spot fear in equitable measure.

 As inevitably perusing all the wonderful educational valued material herein has lead me to pursue an ultimate self questioning of how choices made along lifes highways have brought me to this point in time and space. Thoughts of examining then documenting my life story have become a necessity for recovery.

Whilst accepting this unravelling piece of historical revisionism is not unique by any description I claim only that far from being the rule, it is undoubtably a exception to many. Whilst it remains true people reliving events from their pasts immediately attempt to improve their particular part in any given situation, no one likes to be viewed in a bad light!. That being said introduces the concept of exactly why that is

  

One Response

Leave a Reply