Plugin Directory

Changeset 599083


Ignore:
Timestamp:
09/14/2012 08:35:28 PM (13 years ago)
Author:
jimmywb
Message:
 
Location:
simple-link-list-widget
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • simple-link-list-widget/trunk/readme.txt

    r599079 r599083  
    33Tags: links, list, lists, widget
    44Requires at least: 2.8
    5 Tested up to: 3.0.4
    6 Stable tag: 0.1
     5Tested up to: 3.4.2
     6Stable tag: 0.2
    77
    88This plugin makes a widget available which allows you to add a simple link list (bulleted or numbered) to a sidebar.
     
    3636== Changelog ==
    3737
     38= 0.2 =
     39* Added a Delete functionality to link items
     40* Added the ability to open link in new window
     41
    3842= 0.1 =
    3943* Initial upload
  • simple-link-list-widget/trunk/simple-link-list-widget.php

    r599082 r599083  
    44Description: Enables a link list widget, in which you can display items in an ordered or unordered list.  Based on Frankie Roberto's List Widget
    55Author: James Bowles
    6 Author URI: http://mesacc.edu/~chago
    7 Version: 0.1
     6Author URI: http://mesacc.edu/~jamul76751
     7Version: 0.2
    88*/
    99
     
    2424            $items[$i] = $instance['item' . $i];
    2525            $item_links[$i] = $instance['item_link' . $i];
    26             $item_classes[$i] = $instance['item_class' . $i];
     26            $item_classes[$i] = $instance['item_class' . $i];   
     27            $item_targets[$i] = isset($instance['item_target' . $i]) ? $instance['item_target' . $i] : false;
    2728        }
    2829
     
    3536                            echo("<li class='" . $item_classes[$num] . "'>" . $item . "</li>");
    3637                        else :
    37                             echo("<li class='" . $item_classes[$num] . "'><a href='" . $item_links[$num] . "'>" . $item . "</a></li>");
     38                            if($item_targets[$num]) :
     39                                echo("<li class='" . $item_classes[$num] . "'><a href='" . $item_links[$num] . "' target='_blank'>" . $item . "</a></li>");
     40                            else :
     41                                echo("<li class='" . $item_classes[$num] . "'><a href='" . $item_links[$num] . "'>" . $item . "</a></li>");
     42                            endif;
    3843                        endif;
    3944                    endif;
     
    5358            $instance['amount'] = $new_instance['new_amount'];
    5459        }
    55 
     60        $j=0; //index to skip over blank items
    5661        for ($i = 1; $i <= $instance['amount']; $i++) {
    57             $instance['item' . $i] = strip_tags($new_instance['item' . $i]);
    58             $instance['item_link' . $i] = $new_instance['item_link' . $i];
    59             $instance['item_class' . $i] = strip_tags($new_instance['item_class' . $i]);
    60         }       
     62            if(empty($new_instance['item' . $i])){ $j++; }
     63            $instance['item' . $i] = strip_tags($new_instance['item' . ($j+$i)]);
     64            $instance['item_link' . $i] = $new_instance['item_link' . ($j+$i)];
     65            $instance['item_class' . $i] = strip_tags($new_instance['item_class' . ($j+$i)]);
     66            $instance['item_target' . $i] = $new_instance['item_target' . ($j+$i)];
     67        }
     68        $instance['amount'] = $instance['amount'] - $j;
    6169        $instance['type'] = $new_instance['type'];
    6270       
     
    7381            $item_links[$i] = $instance['item_link' . $i];
    7482            $item_classes[$i] = $instance['item_class' . $i];
     83            $item_targets[$i] = $instance['item_target' . $i];
    7584        }
    7685        $title_link = $instance['title_link'];     
     
    8089        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
    8190        <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
    82         <p><small>Leave the Link and Custom Style Class fields blank if not desired. Click Save for additional blank fields.</small></p>
     91        <p><small>Leave the Link and Custom Style Class fields blank if not desired. Click Save for additional blank fields. To remove an item simply delete the "Text:" field content.</small></p>
    8392        <ol>
    8493        <?php foreach ($items as $num => $item) : ?>
     
    91100                <label for="<?php echo $this->get_field_id('item_class' . $num); ?>">Custom Style Class:</label>
    92101                <input class="widefat" id="<?php echo $this->get_field_id('item_class' . $num); ?>" name="<?php echo $this->get_field_name('item_class' . $num); ?>" type="text" value="<?php echo esc_attr($item_classes[$num]); ?>" />
     102                <label for="<?php echo $this->get_field_id('item_target' . $num); ?>"><input type="checkbox" name="<?php echo $this->get_field_name('item_target' . $num); ?>" id="<?php echo $this->get_field_id('item_target' . $num); ?>" <?php checked($item_targets[$num], 'on'); ?> /> Open in new window</label>
    93103            </li>
    94104        <?php endforeach; ?>
     
    103113                <label for="<?php echo $this->get_field_id('item_class' . $new_amount); ?>">Custom Style Class:</label>
    104114                <input class="widefat" id="<?php echo $this->get_field_id('item_class' . $new_amount); ?>" name="<?php echo $this->get_field_name('item_class' . $new_amount); ?>" type="text" value="" />
     115                <label for="<?php echo $this->get_field_id('item_target' . $new_amount); ?>"><input type="checkbox" name="<?php echo $this->get_field_name('item_target' . $new_amount); ?>" id="<?php echo $this->get_field_id('item_target' . $new_amount); ?>" />  Open in new window</label>
    105116            </li>
    106117        </ol>
     
    108119        <input type="hidden" id="<?php echo $this->get_field_id('new_amount'); ?>" name="<?php echo $this->get_field_name('new_amount'); ?>" value="<?php echo $new_amount ?>" />
    109120
    110         <label for="<?php echo $this->get_field_id('ordered'); ?>"><input type="radio" name="<?php echo $this->get_field_name('type'); ?>" value="ordered" id="<?php echo $this->get_field_id('ordered'); ?>" <?php checked($type, "ordered"); ?>></input>  Ordered</label>
    111         <label for="<?php echo $this->get_field_id('unordered'); ?>"><input type="radio" name="<?php echo $this->get_field_name('type'); ?>" value="unordered" id="<?php echo $this->get_field_id('unordered'); ?>" <?php checked($type, "unordered"); ?>></input> Unordered</label>
     121        <label for="<?php echo $this->get_field_id('ordered'); ?>"><input type="radio" name="<?php echo $this->get_field_name('type'); ?>" value="ordered" id="<?php echo $this->get_field_id('ordered'); ?>" <?php checked($type, "ordered"); ?> />  Ordered</label>
     122        <label for="<?php echo $this->get_field_id('unordered'); ?>"><input type="radio" name="<?php echo $this->get_field_name('type'); ?>" value="unordered" id="<?php echo $this->get_field_id('unordered'); ?>" <?php checked($type, "unordered"); ?> /> Unordered</label>
    112123
    113124<?php
Note: See TracChangeset for help on using the changeset viewer.