Changeset 431162
- Timestamp:
- 08/31/2011 10:37:14 AM (15 years ago)
- Location:
- flexible-widgets/trunk
- Files:
-
- 2 edited
-
flexible-widgets.php (modified) (58 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flexible-widgets/trunk/flexible-widgets.php
r423639 r431162 4 4 Plugin URI: http://www.netsans.dk/flexible-widgets-for-wordpress.html 5 5 Description: This plugin lets you display a widget on any category or page you wish. When setting up the widget, you are able to select the categories and/or pages where you want to display the widget. If none are selected, the widget will be displayed globally on your site, exactly like a default WordPress widget. 6 Version: 0. 26 Version: 0.3 7 7 Author: Morten Brunbjerg Bech 8 8 Author URI: http://www.netsans.dk/about/ … … 28 28 $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; 29 29 $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; 30 $blogpage = $instance['blogpage'] ? '1' : '0'; 30 31 $checkCats = $instance['checkCats']; 31 32 $checkPages = $instance['checkPages']; 32 33 33 34 if ( 34 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 35 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 36 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 37 || ($checkCats == 0 && $checkPages == 0 && (is_single() 35 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 36 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 37 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 38 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 39 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 40 (is_single() 38 41 || is_category() 39 || is_page())) // ............................................. All single posts, pages & categories. 42 || is_page() 43 || is_home())) // -------------------------------------------- All single posts, pages & categories. 40 44 ) { 41 42 45 if ( $sortby == 'menu_order' ) 43 46 $sortby = 'menu_order, post_title'; … … 69 72 70 73 $instance['exclude'] = strip_tags( $new_instance['exclude'] ); 74 75 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 71 76 $instance['checkCats'] = $new_instance['checkCats']; 72 77 $instance['checkPages'] = $new_instance['checkPages']; … … 80 85 $title = esc_attr( $instance['title'] ); 81 86 $exclude = esc_attr( $instance['exclude'] ); 87 88 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 82 89 $checkCats = $intance['checkCats']; 83 90 $checkPages = $intance['checkPages']; … … 142 149 <?php 143 150 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 144 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 151 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 152 ?> 153 <li> 154 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 155 </li> 156 157 <?php 145 158 foreach ($pages as $page) { 146 159 ?> … … 148 161 <li> 149 162 <label for="<?php $this->get_field_id( 'checkPages' ) .'[]'; ?>"><?php 150 $option='<input type="checkbox" id="'. $this->get_field_id( 'checkPages' ) .'[]" name="'. $this->get_field_name( 'checkPages' ) .'[]"';163 $option='<input class="checkbox" type="checkbox" id="'. $this->get_field_id( 'checkPages' ) .'[]" name="'. $this->get_field_name( 'checkPages' ) .'[]"'; 151 164 if (is_array($instance['checkPages'])) { 152 165 foreach ($instance['checkPages'] as $pages) { … … 195 208 $show_images = isset($instance['images']) ? $instance['images'] : true; 196 209 $category = isset($instance['category']) ? $instance['category'] : false; 210 $blogpage = $instance['blogpage'] ? '1' : '0'; 197 211 $checkCats = $instance['checkCats']; 198 212 $checkPages = $instance['checkPages']; 199 213 200 214 if ( 201 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 202 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 203 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 204 || ($checkCats == 0 && $checkPages == 0 && (is_single() 215 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 216 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 217 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 218 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 219 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 220 (is_single() 205 221 || is_category() 206 || is_page())) // ............................................. All single posts, pages & categories. 222 || is_page() 223 || is_home())) // -------------------------------------------- All single posts, pages & categories. 207 224 ) { 208 225 … … 231 248 $instance[$field] = 1; 232 249 } 233 $instance['category'] = intval($new_instance['category']); 250 $instance['category'] = intval($new_instance['category']); 251 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 234 252 $instance['checkCats'] = $new_instance['checkCats']; 235 253 $instance['checkPages'] = $new_instance['checkPages']; … … 243 261 $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false ) ); 244 262 $link_cats = get_terms( 'link_category'); 263 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 245 264 $checkCats = $intance['checkCats']; 246 265 $checkPages = $intance['checkPages']; … … 313 332 <?php 314 333 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 315 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 334 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 335 ?> 336 <li> 337 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 338 </li> 339 340 <?php 316 341 foreach ($pages as $page) { 317 342 ?> … … 360 385 extract($args); 361 386 $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); 387 $blogpage = $instance['blogpage'] ? '1' : '0'; 362 388 $checkCats = $instance['checkCats']; 363 $checkPages = $instance['checkPages']; 364 389 $checkPages = $instance['checkPages']; 390 365 391 if ( 366 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 367 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 368 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 369 || ($checkCats == 0 && $checkPages == 0 && (is_single() 392 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 393 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 394 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 395 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 396 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 397 (is_single() 370 398 || is_category() 371 || is_page())) // ............................................. All single posts, pages & categories. 399 || is_page() 400 || is_home())) // -------------------------------------------- All single posts, pages & categories. 372 401 ) { 373 402 … … 386 415 $instance = wp_parse_args( (array) $instance, array( 'title' => '') ); 387 416 $title = $instance['title']; 417 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 388 418 $checkCats = $intance['checkCats']; 389 419 $checkPages = $intance['checkPages']; … … 435 465 <?php 436 466 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 437 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 467 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 468 ?> 469 <li> 470 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 471 </li> 472 473 <?php 438 474 foreach ($pages as $page) { 439 475 ?> … … 468 504 $instance = $old_instance; 469 505 $new_instance = wp_parse_args((array) $new_instance, array( 'title' => '')); 470 $instance['title'] = strip_tags($new_instance['title']); 506 $instance['title'] = strip_tags($new_instance['title']); 507 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 471 508 $instance['checkCats'] = $new_instance['checkCats']; 472 509 $instance['checkPages'] = $new_instance['checkPages']; … … 494 531 $d = $instance['dropdown'] ? '1' : '0'; 495 532 $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base); 533 $blogpage = $instance['blogpage'] ? '1' : '0'; 496 534 $checkCats = $instance['checkCats']; 497 535 $checkPages = $instance['checkPages']; 498 536 499 537 if ( 500 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 501 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 502 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 503 || ($checkCats == 0 && $checkPages == 0 && (is_single() 538 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 539 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 540 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 541 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 542 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 543 (is_single() 504 544 || is_category() 505 || is_page())) // ............................................. All single posts, pages & categories. 545 || is_page() 546 || is_home())) // -------------------------------------------- All single posts, pages & categories. 506 547 ) { 507 548 … … 531 572 $instance['title'] = strip_tags($new_instance['title']); 532 573 $instance['count'] = $new_instance['count'] ? 1 : 0; 533 $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0; 574 $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0; 575 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 534 576 $instance['checkCats'] = $new_instance['checkCats']; 535 577 $instance['checkPages'] = $new_instance['checkPages']; … … 543 585 $count = $instance['count'] ? 'checked="checked"' : ''; 544 586 $dropdown = $instance['dropdown'] ? 'checked="checked"' : ''; 587 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 545 588 $checkCats = $intance['checkCats']; 546 589 $checkPages = $intance['checkPages']; … … 597 640 <?php 598 641 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 599 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 642 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 643 ?> 644 <li> 645 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 646 </li> 647 648 <?php 600 649 foreach ($pages as $page) { 601 650 ?> … … 646 695 extract($args); 647 696 $title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title'], $instance, $this->id_base); 697 $blogpage = $instance['blogpage'] ? '1' : '0'; 648 698 $checkCats = $instance['checkCats']; 649 699 $checkPages = $instance['checkPages']; 650 700 651 701 if ( 652 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 653 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 654 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 655 || ($checkCats == 0 && $checkPages == 0 && (is_single() 702 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 703 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 704 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 705 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 706 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 707 (is_single() 656 708 || is_category() 657 || is_page())) // ............................................. All single posts, pages & categories. 709 || is_page() 710 || is_home())) // -------------------------------------------- All single posts, pages & categories. 658 711 ) { 659 712 … … 677 730 function update( $new_instance, $old_instance ) { 678 731 $instance = $old_instance; 679 $instance['title'] = strip_tags($new_instance['title']); 732 $instance['title'] = strip_tags($new_instance['title']); 733 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 680 734 $instance['checkCats'] = $new_instance['checkCats']; 681 735 $instance['checkPages'] = $new_instance['checkPages']; … … 687 741 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 688 742 $title = strip_tags($instance['title']); 743 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 689 744 $checkCats = $intance['checkCats']; 690 745 $checkPages = $intance['checkPages']; … … 736 791 <?php 737 792 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 738 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 793 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 794 ?> 795 <li> 796 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 797 </li> 798 799 <?php 739 800 foreach ($pages as $page) { 740 801 ?> … … 783 844 extract($args); 784 845 $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base); 846 $blogpage = $instance['blogpage'] ? '1' : '0'; 785 847 $checkCats = $instance['checkCats']; 786 848 $checkPages = $instance['checkPages']; 787 849 788 850 if ( 789 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 790 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 791 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 792 || ($checkCats == 0 && $checkPages == 0 && (is_single() 851 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 852 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 853 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 854 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 855 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 856 (is_single() 793 857 || is_category() 794 || is_page())) // ............................................. All single posts, pages & categories. 858 || is_page() 859 || is_home())) // -------------------------------------------- All single posts, pages & categories. 795 860 ) { 796 861 … … 807 872 function update( $new_instance, $old_instance ) { 808 873 $instance = $old_instance; 809 $instance['title'] = strip_tags($new_instance['title']); 874 $instance['title'] = strip_tags($new_instance['title']); 875 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 810 876 $instance['checkCats'] = $new_instance['checkCats']; 811 877 $instance['checkPages'] = $new_instance['checkPages']; … … 817 883 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 818 884 $title = strip_tags($instance['title']); 885 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 819 886 $checkCats = $intance['checkCats']; 820 887 $checkPages = $intance['checkPages']; … … 867 934 <?php 868 935 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 869 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 936 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 937 ?> 938 <li> 939 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 940 </li> 941 942 <?php 870 943 foreach ($pages as $page) { 871 944 ?> … … 915 988 $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); 916 989 $text = apply_filters( 'widget_text', $instance['text'], $instance ); 990 $blogpage = $instance['blogpage'] ? '1' : '0'; 917 991 $checkCats = $instance['checkCats']; 918 992 $checkPages = $instance['checkPages']; 919 993 920 994 if ( 921 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 922 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 923 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 924 || ($checkCats == 0 && $checkPages == 0 && (is_single() 995 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 996 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 997 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 998 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 999 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 1000 (is_single() 925 1001 || is_category() 926 || is_page())) // ............................................. All single posts, pages & categories. 1002 || is_page() 1003 || is_home())) // -------------------------------------------- All single posts, pages & categories. 927 1004 ) { 928 1005 … … 942 1019 else 943 1020 $instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed 944 $instance['filter'] = isset($new_instance['filter']); 1021 $instance['filter'] = isset($new_instance['filter']); 1022 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 945 1023 $instance['checkCats'] = $new_instance['checkCats']; 946 1024 $instance['checkPages'] = $new_instance['checkPages']; … … 952 1030 $title = strip_tags($instance['title']); 953 1031 $text = esc_textarea($instance['text']); 1032 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 954 1033 $checkCats = $intance['checkCats']; 955 1034 $checkPages = $intance['checkPages']; … … 1006 1085 <?php 1007 1086 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 1008 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1087 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1088 ?> 1089 <li> 1090 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 1091 </li> 1092 1093 <?php 1009 1094 foreach ($pages as $page) { 1010 1095 ?> … … 1057 1142 $h = $instance['hierarchical'] ? '1' : '0'; 1058 1143 $d = $instance['dropdown'] ? '1' : '0'; 1144 $blogpage = $instance['blogpage'] ? '1' : '0'; 1059 1145 $checkCats = $instance['checkCats']; 1060 1146 $checkPages = $instance['checkPages']; 1061 1147 1062 1148 if ( 1063 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 1064 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 1065 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 1066 || ($checkCats == 0 && $checkPages == 0 && (is_single() 1149 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 1150 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 1151 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 1152 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 1153 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 1154 (is_single() 1067 1155 || is_category() 1068 || is_page())) // ............................................. All single posts, pages & categories. 1156 || is_page() 1157 || is_home())) // -------------------------------------------- All single posts, pages & categories. 1069 1158 ) { 1070 1159 … … 1113 1202 $instance['count'] = !empty($new_instance['count']) ? 1 : 0; 1114 1203 $instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0; 1115 $instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0; 1204 $instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0; 1205 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 1116 1206 $instance['checkCats'] = $new_instance['checkCats']; 1117 1207 $instance['checkPages'] = $new_instance['checkPages']; … … 1127 1217 $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false; 1128 1218 $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false; 1219 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 1129 1220 $checkCats = $intance['checkCats']; 1130 1221 $checkPages = $intance['checkPages']; … … 1186 1277 <?php 1187 1278 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 1188 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1279 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1280 ?> 1281 <li> 1282 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 1283 </li> 1284 1285 <?php 1189 1286 foreach ($pages as $page) { 1190 1287 ?> … … 1238 1335 function widget($args, $instance) { 1239 1336 $cache = wp_cache_get('widget_recent_posts', 'widget'); 1337 $blogpage = $instance['blogpage'] ? '1' : '0'; 1240 1338 $checkCats = $instance['checkCats']; 1241 1339 $checkPages = $instance['checkPages']; … … 1255 1353 if ( ! $number = absint( $instance['number'] ) ) 1256 1354 $number = 10; 1257 1355 1258 1356 if ( 1259 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 1260 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 1261 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 1262 || ($checkCats == 0 && $checkPages == 0 && (is_single() 1357 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 1358 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 1359 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 1360 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 1361 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 1362 (is_single() 1263 1363 || is_category() 1264 || is_page())) // ............................................. All single posts, pages & categories. 1364 || is_page() 1365 || is_home())) // -------------------------------------------- All single posts, pages & categories. 1265 1366 ) { 1266 1367 … … 1290 1391 $instance = $old_instance; 1291 1392 $instance['title'] = strip_tags($new_instance['title']); 1292 $instance['number'] = (int) $new_instance['number']; 1393 $instance['number'] = (int) $new_instance['number']; 1394 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 1293 1395 $instance['checkCats'] = $new_instance['checkCats']; 1294 1396 $instance['checkPages'] = $new_instance['checkPages']; … … 1309 1411 $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; 1310 1412 $number = isset($instance['number']) ? absint($instance['number']) : 5; 1413 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 1311 1414 $checkCats = $intance['checkCats']; 1312 1415 $checkPages = $intance['checkPages']; … … 1362 1465 <?php 1363 1466 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 1364 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1467 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1468 ?> 1469 <li> 1470 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 1471 </li> 1472 1473 <?php 1365 1474 foreach ($pages as $page) { 1366 1475 ?> … … 1430 1539 1431 1540 $cache = wp_cache_get('widget_recent_comments', 'widget'); 1541 $blogpage = $instance['blogpage'] ? '1' : '0'; 1432 1542 $checkCats = $instance['checkCats']; 1433 1543 $checkPages = $instance['checkPages']; … … 1447 1557 if ( ! $number = absint( $instance['number'] ) ) 1448 1558 $number = 5; 1449 1559 1450 1560 if ( 1451 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 1452 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 1453 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 1454 || ($checkCats == 0 && $checkPages == 0 && (is_single() 1561 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 1562 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 1563 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 1564 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 1565 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 1566 (is_single() 1455 1567 || is_category() 1456 || is_page())) // ............................................. All single posts, pages & categories. 1568 || is_page() 1569 || is_home())) // -------------------------------------------- All single posts, pages & categories. 1457 1570 ) { 1458 1571 … … 1480 1593 $instance = $old_instance; 1481 1594 $instance['title'] = strip_tags($new_instance['title']); 1482 $instance['number'] = absint( $new_instance['number'] ); 1595 $instance['number'] = absint( $new_instance['number'] ); 1596 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 1483 1597 $instance['checkCats'] = $new_instance['checkCats']; 1484 1598 $instance['checkPages'] = $new_instance['checkPages']; … … 1495 1609 $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; 1496 1610 $number = isset($instance['number']) ? absint($instance['number']) : 5; 1611 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 1497 1612 $checkCats = $intance['checkCats']; 1498 1613 $checkPages = $intance['checkPages']; … … 1548 1663 <?php 1549 1664 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 1550 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1665 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1666 ?> 1667 <li> 1668 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 1669 </li> 1670 1671 <?php 1551 1672 foreach ($pages as $page) { 1552 1673 ?> … … 1594 1715 $instance['checkExcerpt'] = $new_instance['checkExcerpt']; 1595 1716 $instance['checkAuthor'] = $new_instance['checkAuthor']; 1596 $instance['checkDate'] = $new_instance['checkDate']; 1717 $instance['checkDate'] = $new_instance['checkDate']; 1718 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 1597 1719 $instance['checkCats'] = $new_instance['checkCats']; 1598 1720 $instance['checkPages'] = $new_instance['checkPages']; … … 1608 1730 $checkAuthor = $instance['checkAuthor']; 1609 1731 $checkDate = $instance['checkDate']; 1732 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 1610 1733 $checkCats = $instance['checkCats']; 1611 1734 $checkPages = $instance['checkPages']; … … 1731 1854 <?php 1732 1855 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 1733 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1856 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 1857 ?> 1858 <li> 1859 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 1860 </li> 1861 1862 <?php 1734 1863 foreach ($pages as $page) { 1735 1864 ?> … … 1777 1906 $checkAuthor = $instance['checkAuthor']; 1778 1907 $checkDate = $instance['checkDate']; 1908 $blogpage = $instance['blogpage'] ? '1' : '0'; 1779 1909 $checkCats = $instance['checkCats']; 1780 1910 $checkPages = $instance['checkPages']; … … 1786 1916 1787 1917 $items = array_slice($feed->items, 0, $number); 1788 1918 1789 1919 if ( 1790 $checkCats !=0 && is_category($checkCats) // ............................................... Selected categories only. 1791 || ($checkCats !=0 && is_single() && in_category($checkCats)) // ........................... Single posts in selected categories only. 1792 || ($checkPages !=0 && is_page($checkPages)) // ............................................ Selected pages only. 1793 || ($checkCats == 0 && $checkPages == 0 && (is_single() 1794 || is_singular('anbefalinger') 1920 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 1921 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 1922 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 1923 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 1924 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 1925 (is_single() 1795 1926 || is_category() 1796 || is_ tax('materialetyper')1797 || is_ page())) // ......................................................................All single posts, pages & categories.1927 || is_page() 1928 || is_home())) // -------------------------------------------- All single posts, pages & categories. 1798 1929 ) { 1799 1930 echo $before_widget; … … 1865 1996 } 1866 1997 $title = apply_filters('widget_title', $title, $instance, $this->id_base); 1998 $blogpage = $instance['blogpage'] ? '1' : '0'; 1867 1999 $checkCats = $instance['checkCats']; 1868 2000 $checkPages = $instance['checkPages']; 1869 2001 1870 2002 if ( 1871 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 1872 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 1873 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 1874 || ($checkCats == 0 && $checkPages == 0 && (is_single() 2003 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 2004 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 2005 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 2006 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 2007 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 2008 (is_single() 1875 2009 || is_category() 1876 || is_page())) // ............................................. All single posts, pages & categories. 2010 || is_page() 2011 || is_home())) // -------------------------------------------- All single posts, pages & categories. 1877 2012 ) { 1878 2013 … … 1889 2024 function update( $new_instance, $old_instance ) { 1890 2025 $instance['title'] = strip_tags(stripslashes($new_instance['title'])); 1891 $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); 2026 $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); 2027 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 1892 2028 $instance['checkCats'] = $new_instance['checkCats']; 1893 2029 $instance['checkPages'] = $new_instance['checkPages']; … … 1897 2033 function form( $instance ) { 1898 2034 $current_taxonomy = $this->_get_current_taxonomy($instance); 2035 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 1899 2036 $checkCats = $intance['checkCats']; 1900 2037 $checkPages = $intance['checkPages']; … … 1958 2095 <?php 1959 2096 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 1960 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 2097 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 2098 ?> 2099 <li> 2100 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 2101 </li> 2102 2103 <?php 1961 2104 foreach ($pages as $page) { 1962 2105 ?> … … 2014 2157 // Get menu 2015 2158 $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] ); 2159 $blogpage = $instance['blogpage'] ? '1' : '0'; 2016 2160 $checkCats = $instance['checkCats']; 2017 2161 $checkPages = $instance['checkPages']; … … 2021 2165 2022 2166 $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); 2023 2167 2024 2168 if ( 2025 $checkCats !=0 && is_category($checkCats) // ...................... Selected categories only. 2026 || ($checkCats !=0 && is_single() && in_category($checkCats)) // .. Single posts in selected categories only. 2027 || ($checkPages !=0 && is_page($checkPages)) // ................... Selected pages only. 2028 || ($checkCats == 0 && $checkPages == 0 && (is_single() 2169 $blogpage != 0 && is_home() // ----------------------------------- On the blog page only. 2170 || ($checkCats !=0 && is_category($checkCats)) // ---------------- Selected categories only. 2171 || ($checkCats !=0 && is_single() && in_category($checkCats)) // - Single posts in selected categories only. 2172 || ($checkPages !=0 && is_page($checkPages)) // ------------------ Selected pages only. 2173 || ($checkCats == 0 && $checkPages == 0 && $blogpage == 0 && 2174 (is_single() 2029 2175 || is_category() 2030 || is_page())) // ............................................. All single posts, pages & categories. 2176 || is_page() 2177 || is_home())) // -------------------------------------------- All single posts, pages & categories. 2031 2178 ) { 2032 2179 … … 2044 2191 function update( $new_instance, $old_instance ) { 2045 2192 $instance['title'] = strip_tags( stripslashes($new_instance['title']) ); 2046 $instance['nav_menu'] = (int) $new_instance['nav_menu']; 2193 $instance['nav_menu'] = (int) $new_instance['nav_menu']; 2194 $instance['blogpage'] = $new_instance['blogpage'] ? 1 : 0; 2047 2195 $instance['checkCats'] = $new_instance['checkCats']; 2048 2196 $instance['checkPages'] = $new_instance['checkPages']; … … 2053 2201 $title = isset( $instance['title'] ) ? $instance['title'] : ''; 2054 2202 $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : ''; 2203 $blogpage = $instance['blogpage'] ? 'checked="checked"' : ''; 2055 2204 $checkCats = $intance['checkCats']; 2056 2205 $checkPages = $intance['checkPages']; … … 2125 2274 <?php 2126 2275 // Above - hidden input: Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 2127 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 2276 // Solution for saving checkboxes: http://wordpress.org/support/topic/widget-checkbox-group-not-registering?replies=3 2277 ?> 2278 <li> 2279 <input class="checkbox" type="checkbox" <?php echo $blogpage; ?> id="<?php echo $this->get_field_id('blogpage'); ?>" name="<?php echo $this->get_field_name('blogpage'); ?>" /> <label for="<?php echo $this->get_field_id('blogpage'); ?>"><?php _e('The Blog Page'); ?></label> 2280 </li> 2281 2282 <?php 2128 2283 foreach ($pages as $page) { 2129 2284 ?> -
flexible-widgets/trunk/readme.txt
r423642 r431162 5 5 Requires at least: 3.0 6 6 Tested up to: 3.2.1 7 Stable tag: 0. 27 Stable tag: 0.3 8 8 9 9 This plugin makes it possible to display a widget on selected categories and/or pages only. … … 16 16 17 17 Flexible Widgets will replace the default WordPress widgets. 18 19 =Known issues= 20 May conflict with themes or plugins which include custom widgets. Please see [the plugin support forum](http://wordpress.org/tags/flexible-widgets?forum_id=10). 21 22 =Background= 23 The Flexible Widgets plugin consists of a collection of classes originally written for the WordPress theme in use at the website of [Horsens Public Library](http://horsensbibliotek.dk/ "Horsens kommunes biblioteker - a public library in Denmark"). 18 24 19 25 == Installation == … … 36 42 == Changelog == 37 43 44 = 0.3 = 45 * Fixes an issue: Optionally display widgets on the home page, whether it is set up to be a static page or the blog posts page. 46 38 47 = 0.2 = 39 48 * Tiny update to get the plugin and author URIs right.
Note: See TracChangeset
for help on using the changeset viewer.