Link Library - Version 7.3.0.Beta3

Version Description

Download this release

Release Info

Developer jackdewey
Plugin Icon 128x128 Link Library
Version 7.3.0.Beta3
Comparing to
See all releases

Code changes from version 7.3.0.Beta2 to 7.3.0.Beta3

link-library-admin.php CHANGED
@@ -4852,6 +4852,7 @@ function general_custom_fields_meta_box( $data ) {
4852
  <option value="dropdown" <?php selected( $options['flatlist'] == 'dropdown' ); ?>><?php _e( 'Drop-Down List', 'link-library' ); ?></option>
4853
  <option value="dropdowndirect" <?php selected( $options['flatlist'] == 'dropdowndirect' ); ?>><?php _e( 'Drop-Down List Direct Access', 'link-library' ); ?></option>
4854
  <option value="toggles" <?php selected( $options['flatlist'] == 'toggles' ); ?>><?php _e( 'Visibility Toggles', 'link-library' ); ?></option>
 
4855
  </select>
4856
  </td>
4857
  </tr>
4852
  <option value="dropdown" <?php selected( $options['flatlist'] == 'dropdown' ); ?>><?php _e( 'Drop-Down List', 'link-library' ); ?></option>
4853
  <option value="dropdowndirect" <?php selected( $options['flatlist'] == 'dropdowndirect' ); ?>><?php _e( 'Drop-Down List Direct Access', 'link-library' ); ?></option>
4854
  <option value="toggles" <?php selected( $options['flatlist'] == 'toggles' ); ?>><?php _e( 'Visibility Toggles', 'link-library' ); ?></option>
4855
+ <option value="togglesshowhideall" <?php selected( $options['flatlist'] == 'togglesshowhideall' ); ?>><?php _e( 'Visibility Toggles with Show/Hide All buttons', 'link-library' ); ?></option>
4856
  </select>
4857
  </td>
4858
  </tr>
readme.txt CHANGED
@@ -48,6 +48,9 @@ Further configuration is available under the Link Library Settings panel.
48
 
49
  == Changelog ==
50
 
 
 
 
51
  = 7.3 Beta 2 =
52
  * Added new global option to specify articles to be ignored when sorting links by title
53
 
48
 
49
  == Changelog ==
50
 
51
+ = 7.3 Beta 3 =
52
+ * Added new option when displaying categories as visibility toggles to add show all and hide all buttons
53
+
54
  = 7.3 Beta 2 =
55
  * Added new global option to specify articles to be ignored when sorting links by title
56
 
render-link-library-cats-sc.php CHANGED
@@ -452,17 +452,17 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
452
  }
453
  } else if ( $catanchor ) {
454
  if ( !$pagination || ( !$pagination && $searchfiltercats && isset( $_GET['searchll'] ) && !empty( $_GET['searchll'] ) ) ) {
455
- if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist ) {
456
  $cattext = '<a href="';
457
  }
458
 
459
  if ( $searchfiltercats && isset( $_GET['searchll'] ) && !empty( $_GET['searchll'] ) ) {
460
  $cattext .= '?searchll=' . sanitize_text_field( $_GET['searchll'] ) . '&cat_id=' . $catname->term_id;
461
- } elseif ( 'toggles' != $flatlist ) {
462
  $cattext .= '#' . $catname->slug;
463
  }
464
 
465
- if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist ) {
466
  $cattext .= '">';
467
  }
468
  } elseif ( $pagination ) {
@@ -474,23 +474,23 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
474
  $ceilpageposition = ceil( $pageposition );
475
 
476
  if ( 0 == $ceilpageposition && !isset( $_GET['linkresultpage'] ) ) {
477
- if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist ) {
478
  $cattext = '<a href="';
479
  }
480
 
481
  $cattext .= get_permalink() . '#' . $catname->slug;
482
 
483
- if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist ) {
484
  $cattext .= '">';
485
  }
486
  } else {
487
- if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist ) {
488
  $cattext = '<a href="';
489
  }
490
 
491
  $cattext .= '?linkresultpage=' . ( $ceilpageposition == 0 ? 1 : $ceilpageposition ) . '#' . $catname->slug;
492
 
493
- if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist ) {
494
  $cattext .= '">';
495
  }
496
  }
@@ -507,7 +507,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
507
  }
508
 
509
  if ( !$showcategorydescheaders || ( $showcategorydescheaders && ( 'right' == $catlistdescpos || empty( $catlistdescpos ) ) ) ) {
510
- if ( 'toggles' == $flatlist ) {
511
  $catitem .= '<div class="linkcatname cattoggle catactive" data-cat="' . $catname->term_id . '">';
512
  } elseif ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist ) {
513
  $catitem .= '<span class="linkcatname">';
@@ -519,7 +519,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
519
  if ( $showcatlinkcount && ( $linkcount != 0 || ( $linkcount == 0 && !$cat_has_children ) ) ) {
520
  $catitem .= '<span class="linkcatcount"> (' . $linkcount . ')</span>';
521
  }
522
- if ( 'toggles' == $flatlist ) {
523
  $catitem .= '</div>';
524
  } elseif ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist ) {
525
  $catitem .= '</span>';
@@ -549,7 +549,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
549
  $catitem .= '<span class="linkcatcount"> (' . $linkcount . ')</span>';
550
  }
551
 
552
- if ( 'toggles' == $flatlist ) {
553
  $catitem .= '</div>';
554
  } else {
555
  $catitem .= '</span>';
@@ -619,6 +619,11 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
619
  $output .= '</form>';
620
  }
621
 
 
 
 
 
 
622
  $output .= "</div>\n";
623
  } elseif ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && $link_categories ) {
624
  $output .= '</ul>';
@@ -664,7 +669,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
664
  $output .= '<!-- End of Link Library Categories Output -->';
665
  }
666
 
667
- if ( 'toggles' == $flatlist ) {
668
  $output .= '<script type="text/javascript">';
669
  $output .= "jQuery(document).ready(function() {\n";
670
  $output .= "\tjQuery( '.cattoggle' ).click( function() {\n";
@@ -681,11 +686,43 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
681
  $output .= "\t\t\tjQuery( targetLibrary ).removeClass( 'masonry-brick' );\n";
682
  $output .= "\t\t} else {\n";
683
  $output .= "\t\t\tjQuery( targetLibrary ).addClass( 'grid-item' );\n";
 
684
  $output .= "\t\t}\n";
685
  $output .= "\t\tjQuery( targetLibrary ).toggle();\n";
686
  $output .= "\t\tjQuery('.grid').masonry('reloadItems');";
687
  $output .= "\t\tjQuery('.grid').masonry('layout');";
688
  $output .= "\t});\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  $output .= "});\n";
690
  $output .= '</script>';
691
  }
452
  }
453
  } else if ( $catanchor ) {
454
  if ( !$pagination || ( !$pagination && $searchfiltercats && isset( $_GET['searchll'] ) && !empty( $_GET['searchll'] ) ) ) {
455
+ if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist && 'togglesshowhideall' != $flatlist ) {
456
  $cattext = '<a href="';
457
  }
458
 
459
  if ( $searchfiltercats && isset( $_GET['searchll'] ) && !empty( $_GET['searchll'] ) ) {
460
  $cattext .= '?searchll=' . sanitize_text_field( $_GET['searchll'] ) . '&cat_id=' . $catname->term_id;
461
+ } elseif ( 'toggles' != $flatlist && 'togglesshowhideall' != $flatlist ) {
462
  $cattext .= '#' . $catname->slug;
463
  }
464
 
465
+ if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist && 'togglesshowhideall' != $flatlist) {
466
  $cattext .= '">';
467
  }
468
  } elseif ( $pagination ) {
474
  $ceilpageposition = ceil( $pageposition );
475
 
476
  if ( 0 == $ceilpageposition && !isset( $_GET['linkresultpage'] ) ) {
477
+ if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist && 'togglesshowhideall' != $flatlist ) {
478
  $cattext = '<a href="';
479
  }
480
 
481
  $cattext .= get_permalink() . '#' . $catname->slug;
482
 
483
+ if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist && 'togglesshowhideall' != $flatlist ) {
484
  $cattext .= '">';
485
  }
486
  } else {
487
+ if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist && 'togglesshowhideall' != $flatlist ) {
488
  $cattext = '<a href="';
489
  }
490
 
491
  $cattext .= '?linkresultpage=' . ( $ceilpageposition == 0 ? 1 : $ceilpageposition ) . '#' . $catname->slug;
492
 
493
+ if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && 'toggles' != $flatlist && 'togglesshowhideall' != $flatlist ) {
494
  $cattext .= '">';
495
  }
496
  }
507
  }
508
 
509
  if ( !$showcategorydescheaders || ( $showcategorydescheaders && ( 'right' == $catlistdescpos || empty( $catlistdescpos ) ) ) ) {
510
+ if ( 'toggles' == $flatlist || 'togglesshowhideall' == $flatlist ) {
511
  $catitem .= '<div class="linkcatname cattoggle catactive" data-cat="' . $catname->term_id . '">';
512
  } elseif ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist ) {
513
  $catitem .= '<span class="linkcatname">';
519
  if ( $showcatlinkcount && ( $linkcount != 0 || ( $linkcount == 0 && !$cat_has_children ) ) ) {
520
  $catitem .= '<span class="linkcatcount"> (' . $linkcount . ')</span>';
521
  }
522
+ if ( 'toggles' == $flatlist || 'togglesshowhideall' == $flatlist ) {
523
  $catitem .= '</div>';
524
  } elseif ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist ) {
525
  $catitem .= '</span>';
549
  $catitem .= '<span class="linkcatcount"> (' . $linkcount . ')</span>';
550
  }
551
 
552
+ if ( 'toggles' == $flatlist || 'togglesshowhideall' == $flatlist ) {
553
  $catitem .= '</div>';
554
  } else {
555
  $catitem .= '</span>';
619
  $output .= '</form>';
620
  }
621
 
622
+ if ( 'togglesshowhideall' == $flatlist ) {
623
+ $output .= '<div class="linkcatname cattogglehideall">' . __( 'Hide all', 'link-library' ) . '</div>';
624
+ $output .= '<div class="linkcatname cattoggleshowall">' . __( 'Show all', 'link-library' ) . '</div>';
625
+ }
626
+
627
  $output .= "</div>\n";
628
  } elseif ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist && $link_categories ) {
629
  $output .= '</ul>';
669
  $output .= '<!-- End of Link Library Categories Output -->';
670
  }
671
 
672
+ if ( 'toggles' == $flatlist || 'togglesshowhideall' == $flatlist) {
673
  $output .= '<script type="text/javascript">';
674
  $output .= "jQuery(document).ready(function() {\n";
675
  $output .= "\tjQuery( '.cattoggle' ).click( function() {\n";
686
  $output .= "\t\t\tjQuery( targetLibrary ).removeClass( 'masonry-brick' );\n";
687
  $output .= "\t\t} else {\n";
688
  $output .= "\t\t\tjQuery( targetLibrary ).addClass( 'grid-item' );\n";
689
+ $output .= "\t\t\tjQuery( targetLibrary ).addClass( 'masonry-brick' );\n";
690
  $output .= "\t\t}\n";
691
  $output .= "\t\tjQuery( targetLibrary ).toggle();\n";
692
  $output .= "\t\tjQuery('.grid').masonry('reloadItems');";
693
  $output .= "\t\tjQuery('.grid').masonry('layout');";
694
  $output .= "\t});\n";
695
+
696
+ if ( 'togglesshowhideall' == $flatlist ) {
697
+ $output .= "\tjQuery( '.cattogglehideall' ).click( function() {\n";
698
+ $output .= "\t\tjQuery( '.catactive' ).each( function() {\n";
699
+ $output .= "\t\t\tjQuery(this).removeClass( 'catactive' );";
700
+ $output .= "\t\t\tjQuery(this).addClass( 'catinactive' );";
701
+ $output .= "\t\t\tvar targetLibrary = '.LinkLibraryCat' + jQuery( this ).data( 'cat' );\n";
702
+ $output .= "\t\t\tif ( jQuery( targetLibrary ).hasClass( 'grid-item' ) ) {\n";
703
+ $output .= "\t\t\t\tjQuery( targetLibrary ).removeClass( 'grid-item' );\n";
704
+ $output .= "\t\t\t\tjQuery( targetLibrary ).removeClass( 'masonry-brick' );\n";
705
+ $output .= "\t\t\t}\n";
706
+ $output .= "\t\t\t\tjQuery( targetLibrary ).toggle();\n";
707
+ $output .= "\t\t\tjQuery('.grid').masonry('reloadItems');";
708
+ $output .= "\t\t\tjQuery('.grid').masonry('layout');";
709
+ $output .= "\t\t});\n";
710
+ $output .= "\t});\n";
711
+
712
+ $output .= "\tjQuery( '.cattoggleshowall' ).click( function() {\n";
713
+ $output .= "\t\tjQuery( '.catinactive' ).each( function() {\n";
714
+ $output .= "\t\t\tjQuery(this).removeClass( 'catinactive' );";
715
+ $output .= "\t\t\tjQuery(this).addClass( 'catactive' );";
716
+ $output .= "\t\t\tvar targetLibrary = '.LinkLibraryCat' + jQuery( this ).data( 'cat' );\n";
717
+ $output .= "\t\t\tjQuery( targetLibrary ).addClass( 'grid-item' );\n";
718
+ $output .= "\t\t\tjQuery( targetLibrary ).addClass( 'masonry-brick' );\n";
719
+ $output .= "\t\t\tjQuery( targetLibrary ).toggle();\n";
720
+ $output .= "\t\t\tjQuery('.grid').masonry('reloadItems');";
721
+ $output .= "\t\t\tjQuery('.grid').masonry('layout');";
722
+ $output .= "\t\t});\n";
723
+ $output .= "\t});\n";
724
+ }
725
+
726
  $output .= "});\n";
727
  $output .= '</script>';
728
  }
stylesheettemplate.css CHANGED
@@ -6,14 +6,15 @@
6
  margin: 8px;
7
  }
8
 
9
- .cattoggle {
10
  margin: 10px;
11
  padding: 10px;
12
  float: left;
13
  border-radius: 5px;
 
14
  }
15
 
16
- .catactive {
17
  background-color: #228B22;
18
  color: #FFF;
19
  }
6
  margin: 8px;
7
  }
8
 
9
+ .cattoggle, .cattoggleall {
10
  margin: 10px;
11
  padding: 10px;
12
  float: left;
13
  border-radius: 5px;
14
+ cursor: pointer;
15
  }
16
 
17
+ .catactive, .cattoggleall {
18
  background-color: #228B22;
19
  color: #FFF;
20
  }