Link Library - Version 7.3.21

Version Description

  • Fix for AJAX category switching when using New editor on some themes
  • Additional fixes for [link-library-cats] shortcode for sites with hierarchical categories
Download this release

Release Info

Developer jackdewey
Plugin Icon 128x128 Link Library
Version 7.3.21
Comparing to
See all releases

Code changes from version 7.3.20 to 7.3.21

link-library-admin.php CHANGED
@@ -4560,7 +4560,7 @@ function general_custom_fields_meta_box( $data ) {
4560
  <div class="ll_preset" id="#preset<?php echo $layout->ID; ?>">
4561
  <strong><?php _e( 'Layout', 'link-library' ); echo ' ' . $layout->ID . ": " . $layout->Desc; ?></strong><br /><br />
4562
  <img style="max-width: 400px; border: 2px solid black;" src="<?php echo plugins_url( "presets/" . $layout->Image, __FILE__ ); ?>"<br /><br /><br />
4563
- <button class="button" type="button" <?php echo "onclick=\"if ( confirm('" . esc_js( sprintf( __( "You are about to change the layout of Library '%s' and reset all its options\n 'Cancel' to stop, 'OK' to modify.", "link-library" ), $settings ) ) . "') ) window.location.href='admin.php?page=link-library-settingssets&amp;settings=" . $settings . "&_wpnonce=" . wp_create_nonce( 'llnewlayout' ). "&newlayout=" . $layout->ID . "'\""; ?>><?php _e( 'Apply Layout', 'link-library' ); ?> <?php echo $layout->ID; ?></button>
4564
  </div>
4565
  <?php } ?>
4566
  </div>
4560
  <div class="ll_preset" id="#preset<?php echo $layout->ID; ?>">
4561
  <strong><?php _e( 'Layout', 'link-library' ); echo ' ' . $layout->ID . ": " . $layout->Desc; ?></strong><br /><br />
4562
  <img style="max-width: 400px; border: 2px solid black;" src="<?php echo plugins_url( "presets/" . $layout->Image, __FILE__ ); ?>"<br /><br /><br />
4563
+ <button class="button" type="button" <?php echo "onclick=\"if ( confirm('" . esc_js( sprintf( __( "WARNING: You are about to change the layout of Library '%s' and reset all its options to their defaults. You should export your settings if you want to be able to roll back. 'Cancel' to stop, 'OK' to modify.", "link-library" ), $settings ) ) . "') ) window.location.href='admin.php?page=link-library-settingssets&amp;settings=" . $settings . "&_wpnonce=" . wp_create_nonce( 'llnewlayout' ). "&newlayout=" . $layout->ID . "'\""; ?>><?php _e( 'Apply Layout', 'link-library' ); ?> <?php echo $layout->ID; ?></button>
4564
  </div>
4565
  <?php } ?>
4566
  </div>
link-library.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Link Library
4
  Plugin URI: http://wordpress.org/extend/plugins/link-library/
5
  Description: Display links on pages with a variety of options
6
- Version: 7.3.20
7
  Author: Yannick Lefebvre
8
  Author URI: http://ylefebvre.github.io/
9
  Text Domain: link-library
@@ -1403,7 +1403,9 @@ class link_library_plugin {
1403
  $timeoutput = "\n<!-- [link-library-cats] shortcode execution time: " . ( microtime( true ) - $mainoutputstarttime ) . "-->\n";
1404
  }
1405
 
1406
- return ( true == $genoptions['debugmode'] ? $timeoutputstart : '' ) . RenderLinkLibraryCategories( $this, $genoptions, $options, $settings, $targetlibrary, $parent_cat_id ) . ( true == $genoptions['debugmode'] ? $timeoutput : '' );
 
 
1407
  }
1408
 
1409
  /********************************************** Function to Process [link-library-search] shortcode *********************************************/
3
  Plugin Name: Link Library
4
  Plugin URI: http://wordpress.org/extend/plugins/link-library/
5
  Description: Display links on pages with a variety of options
6
+ Version: 7.3.21
7
  Author: Yannick Lefebvre
8
  Author URI: http://ylefebvre.github.io/
9
  Text Domain: link-library
1403
  $timeoutput = "\n<!-- [link-library-cats] shortcode execution time: " . ( microtime( true ) - $mainoutputstarttime ) . "-->\n";
1404
  }
1405
 
1406
+
1407
+ $parent_id_array = array();
1408
+ return ( true == $genoptions['debugmode'] ? $timeoutputstart : '' ) . RenderLinkLibraryCategories( $this, $genoptions, $options, $settings, $targetlibrary, $parent_cat_id, 0, $parent_id_array ) . ( true == $genoptions['debugmode'] ? $timeoutput : '' );
1409
  }
1410
 
1411
  /********************************************** Function to Process [link-library-search] shortcode *********************************************/
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://ylefebvre.github.io/wordpress-plugins/link-library/
4
  Tags: link, list, directory, page, library, AJAX, RSS, feeds, inline, search, paging, add, submit, import, batch, pop-up
5
  Requires at least: 4.4
6
  Tested up to: 6.0.1
7
- Stable tag: 7.3.20
8
 
9
  The purpose of this plugin is to add the ability to output a list of link categories and a complete list of links with notes and descriptions.
10
 
@@ -50,6 +50,10 @@ Further configuration is available under the Link Library Settings panel.
50
 
51
  == Changelog ==
52
 
 
 
 
 
53
  = 7.3.20 =
54
  * Fixes for [link-library-cats] shortcode for sites with hierarchical categories
55
 
4
  Tags: link, list, directory, page, library, AJAX, RSS, feeds, inline, search, paging, add, submit, import, batch, pop-up
5
  Requires at least: 4.4
6
  Tested up to: 6.0.1
7
+ Stable tag: 7.3.21
8
 
9
  The purpose of this plugin is to add the ability to output a list of link categories and a complete list of links with notes and descriptions.
10
 
50
 
51
  == Changelog ==
52
 
53
+ = 7.3.21 =
54
+ * Fix for AJAX category switching when using New editor on some themes
55
+ * Additional fixes for [link-library-cats] shortcode for sites with hierarchical categories
56
+
57
  = 7.3.20 =
58
  * Fixes for [link-library-cats] shortcode for sites with hierarchical categories
59
 
render-link-library-cats-sc.php CHANGED
@@ -14,7 +14,7 @@ require_once plugin_dir_path( __FILE__ ) . 'link-library-defaults.php';
14
  * @return List of categories output for browser
15
  */
16
 
17
- function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryoptions, $settings, $targetlibrary, $parent_cat_id, $level = 0 ) {
18
  $generaloptions = wp_parse_args( $generaloptions, ll_reset_gen_settings( 'return' ) );
19
  extract( $generaloptions );
20
 
@@ -135,9 +135,11 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
135
  $link_categories_query_args['include'] = explode( ',', $categorylist_cpt );
136
 
137
  if ( $level != 0 ) {
138
- $pos = array_search( $parent_cat_id, $link_categories_query_args['include'] );
139
- if ($pos !== false) {
140
- unset( $link_categories_query_args['include'][$pos] );
 
 
141
  }
142
  }
143
  }
@@ -145,12 +147,12 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
145
  if ( !empty( $excludecategorylist_cpt ) && empty( $singlelinkid ) ) {
146
  $link_categories_query_args['exclude'] = explode( ',', $excludecategorylist_cpt );
147
 
148
- if ( $level != 0 ) {
149
  $pos = array_search( $parent_cat_id, $link_categories_query_args['exclude'] );
150
  if ($pos !== false) {
151
  unset( $link_categories_query_args['exclude'][$pos] );
152
  }
153
- }
154
  }
155
 
156
  /* if ( isset( $categoryname ) && !empty( $categoryname ) && 'HTMLGETPERM' == $showonecatmode && empty( $singlelinkid ) && $level == 0 ) {
@@ -206,7 +208,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
206
 
207
  if ( $debugmode ) {
208
  $output .= "\n<!-- Category taxonomy: " . print_r( $generaloptions['cattaxonomy'], TRUE ) . " -->\n\n";
209
- $output .= "\n<!-- Parent Cat ID: " . print_r( $parent_cat_id, TRUE ) . " -->\n\n";
210
  $output .= "\n<!-- Category Query: " . print_r( $link_categories_query_args, TRUE ) . " -->\n\n";
211
  $output .= "\n<!-- Category Results: " . print_r( $link_categories, TRUE ) . " -->\n\n";
212
  }
@@ -595,7 +597,8 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
595
  }
596
 
597
  if ( $cat_has_children && ( empty( $catlistchildcatdepthlimit ) || ( !empty( $catlistchildcatdepthlimit ) && intval( $catlistchildcatdepthlimit ) - 1 > $level ) ) ) {
598
- $output .= RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryoptions, $settings, $targetlibrary, $catname->term_id, $level + 1 );
 
599
  }
600
 
601
  $catterminator = '';
@@ -660,7 +663,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
660
  }
661
 
662
  if ( 0 == $level && ( 'dropdown' == $flatlist || 'dropdowndirect' == $flatlist ) ) {
663
- $output .= "<SCRIPT TYPE='text/javascript'>\n";
664
  $output .= "\tfunction showcategory( catidvar ){\n";
665
 
666
  if ( $showonecatonly && ( 'AJAX' == $showonecatmode || empty( $showonecatmode ) ) ) {
@@ -678,7 +681,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
678
  $output .= "\t\tlocation=\n";
679
  $output .= "document.catselect.catdropdown" . $settings . ".options[document.catselect.catdropdown" . $settings . ".selectedIndex].value }\n";
680
  }
681
- $output .= "</SCRIPT>\n";
682
  }
683
  } else {
684
  $output .= '<div>' . __('No categories found', 'link-library') . '.</div>';
14
  * @return List of categories output for browser
15
  */
16
 
17
+ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryoptions, $settings, $targetlibrary, $parent_cat_id, $level = 0, $parent_id_array ) {
18
  $generaloptions = wp_parse_args( $generaloptions, ll_reset_gen_settings( 'return' ) );
19
  extract( $generaloptions );
20
 
135
  $link_categories_query_args['include'] = explode( ',', $categorylist_cpt );
136
 
137
  if ( $level != 0 ) {
138
+ foreach ( $parent_id_array as $parent_id_search ) {
139
+ $pos = array_search( $parent_id_search, $link_categories_query_args['include'] );
140
+ if ($pos !== false) {
141
+ unset( $link_categories_query_args['include'][$pos] );
142
+ }
143
  }
144
  }
145
  }
147
  if ( !empty( $excludecategorylist_cpt ) && empty( $singlelinkid ) ) {
148
  $link_categories_query_args['exclude'] = explode( ',', $excludecategorylist_cpt );
149
 
150
+ /* if ( $level != 0 ) {
151
  $pos = array_search( $parent_cat_id, $link_categories_query_args['exclude'] );
152
  if ($pos !== false) {
153
  unset( $link_categories_query_args['exclude'][$pos] );
154
  }
155
+ } */
156
  }
157
 
158
  /* if ( isset( $categoryname ) && !empty( $categoryname ) && 'HTMLGETPERM' == $showonecatmode && empty( $singlelinkid ) && $level == 0 ) {
208
 
209
  if ( $debugmode ) {
210
  $output .= "\n<!-- Category taxonomy: " . print_r( $generaloptions['cattaxonomy'], TRUE ) . " -->\n\n";
211
+ $output .= "\n<!-- Parent Cat ID: " . print_r( $parent_id_array, TRUE ) . " -->\n\n";
212
  $output .= "\n<!-- Category Query: " . print_r( $link_categories_query_args, TRUE ) . " -->\n\n";
213
  $output .= "\n<!-- Category Results: " . print_r( $link_categories, TRUE ) . " -->\n\n";
214
  }
597
  }
598
 
599
  if ( $cat_has_children && ( empty( $catlistchildcatdepthlimit ) || ( !empty( $catlistchildcatdepthlimit ) && intval( $catlistchildcatdepthlimit ) - 1 > $level ) ) ) {
600
+ array_push( $parent_id_array, $catname->term_id );
601
+ $output .= RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryoptions, $settings, $targetlibrary, $catname->term_id, $level + 1, $parent_id_array );
602
  }
603
 
604
  $catterminator = '';
663
  }
664
 
665
  if ( 0 == $level && ( 'dropdown' == $flatlist || 'dropdowndirect' == $flatlist ) ) {
666
+ $output .= "<script TYPE='text/javascript'>\n";
667
  $output .= "\tfunction showcategory( catidvar ){\n";
668
 
669
  if ( $showonecatonly && ( 'AJAX' == $showonecatmode || empty( $showonecatmode ) ) ) {
681
  $output .= "\t\tlocation=\n";
682
  $output .= "document.catselect.catdropdown" . $settings . ".options[document.catselect.catdropdown" . $settings . ".selectedIndex].value }\n";
683
  }
684
+ $output .= "</script>\n";
685
  }
686
  } else {
687
  $output .= '<div>' . __('No categories found', 'link-library') . '.</div>';