Changeset 599083
- Timestamp:
- 09/14/2012 08:35:28 PM (13 years ago)
- Location:
- simple-link-list-widget
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
simple-link-list-widget/trunk/readme.txt
r599079 r599083 3 3 Tags: links, list, lists, widget 4 4 Requires at least: 2.8 5 Tested up to: 3. 0.46 Stable tag: 0. 15 Tested up to: 3.4.2 6 Stable tag: 0.2 7 7 8 8 This plugin makes a widget available which allows you to add a simple link list (bulleted or numbered) to a sidebar. … … 36 36 == Changelog == 37 37 38 = 0.2 = 39 * Added a Delete functionality to link items 40 * Added the ability to open link in new window 41 38 42 = 0.1 = 39 43 * Initial upload -
simple-link-list-widget/trunk/simple-link-list-widget.php
r599082 r599083 4 4 Description: Enables a link list widget, in which you can display items in an ordered or unordered list. Based on Frankie Roberto's List Widget 5 5 Author: James Bowles 6 Author URI: http://mesacc.edu/~ chago7 Version: 0. 16 Author URI: http://mesacc.edu/~jamul76751 7 Version: 0.2 8 8 */ 9 9 … … 24 24 $items[$i] = $instance['item' . $i]; 25 25 $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; 27 28 } 28 29 … … 35 36 echo("<li class='" . $item_classes[$num] . "'>" . $item . "</li>"); 36 37 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; 38 43 endif; 39 44 endif; … … 53 58 $instance['amount'] = $new_instance['new_amount']; 54 59 } 55 60 $j=0; //index to skip over blank items 56 61 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; 61 69 $instance['type'] = $new_instance['type']; 62 70 … … 73 81 $item_links[$i] = $instance['item_link' . $i]; 74 82 $item_classes[$i] = $instance['item_class' . $i]; 83 $item_targets[$i] = $instance['item_target' . $i]; 75 84 } 76 85 $title_link = $instance['title_link']; … … 80 89 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> 81 90 <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> 83 92 <ol> 84 93 <?php foreach ($items as $num => $item) : ?> … … 91 100 <label for="<?php echo $this->get_field_id('item_class' . $num); ?>">Custom Style Class:</label> 92 101 <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> 93 103 </li> 94 104 <?php endforeach; ?> … … 103 113 <label for="<?php echo $this->get_field_id('item_class' . $new_amount); ?>">Custom Style Class:</label> 104 114 <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> 105 116 </li> 106 117 </ol> … … 108 119 <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 ?>" /> 109 120 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> 112 123 113 124 <?php
Note: See TracChangeset
for help on using the changeset viewer.