Link Library - Version 7.4.1

Version Description

  • Security fixes
  • Added support for WPGraphQL
Download this release

Release Info

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

Code changes from version 7.4 to 7.4.1

Files changed (3) hide show
  1. link-library-admin.php +23 -10
  2. link-library.php +9 -1
  3. readme.txt +6 -2
link-library-admin.php CHANGED
@@ -130,6 +130,19 @@ class link_library_plugin_admin {
130
  );
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  function is_edit_page( $new_edit = null ) {
134
  global $pagenow;
135
  //make sure we are on the backend
@@ -2567,7 +2580,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
2567
  $row ++;
2568
  } else if ( $row == 2 ) {
2569
  for ( $counter = 0; $counter <= count( $data ) - 1; $counter ++ ) {
2570
- $options[$optionnames[$counter]] = $data[$counter];
2571
  }
2572
  $row ++;
2573
  }
@@ -2598,7 +2611,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
2598
  ) as $option_name
2599
  ) {
2600
  if ( isset( $_POST[$option_name] ) ) {
2601
- $genoptions[$option_name] = $_POST[$option_name];
2602
  }
2603
  }
2604
 
@@ -2632,7 +2645,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
2632
 
2633
  update_option( 'LinkLibraryGeneral', $genoptions );
2634
 
2635
- update_option( 'links_updated_date_format', $_POST['links_updated_date_format'] );
2636
  }
2637
 
2638
  global $wp_rewrite;
@@ -2803,7 +2816,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
2803
 
2804
  foreach ( array ( 'stylesheet' ) as $option_name ) {
2805
  if ( isset( $_POST[$option_name] ) ) {
2806
- $options[$option_name] = $_POST[$option_name];
2807
  }
2808
  }
2809
 
@@ -2821,7 +2834,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
2821
  as $option_name
2822
  ) {
2823
  if ( isset( $_POST[$option_name] ) ) {
2824
- $options[$option_name] = str_replace( "\"", "'", strtolower( $_POST[$option_name] ) );
2825
  }
2826
  }
2827
 
@@ -2839,9 +2852,9 @@ wp_editor( $post->post_content, 'content', $editor_config );
2839
  foreach ( array( 'categorylist_cpt', 'excludecategorylist_cpt', 'taglist_cpt', 'excludetaglist_cpt' ) as $option_name ) {
2840
  if ( isset( $_POST[$option_name] ) ) {
2841
  if ( $genoptions['catselectmethod'] == 'commalist' || empty( $genoptions['catselectmethod'] ) ) {
2842
- $options[$option_name] = str_replace( "\"", "'", strtolower( $_POST[$option_name] ) );
2843
  } else if ( $genoptions['catselectmethod'] == 'multiselectlist' ) {
2844
- $options[$option_name] = implode( ',', $_POST[$option_name] );
2845
  }
2846
  } else {
2847
  $options[$option_name] = '';
@@ -2881,7 +2894,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
2881
  ) as $option_name
2882
  ) {
2883
  if ( isset( $_POST[$option_name] ) ) {
2884
- $options[$option_name] = str_replace( "\"", "'", $_POST[$option_name] );
2885
  }
2886
  }
2887
 
@@ -3152,7 +3165,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
3152
  $genoptions = get_option( 'LinkLibraryGeneral' );
3153
  $genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
3154
 
3155
- $genoptions['fullstylesheet'] = $_POST['fullstylesheet'];
3156
 
3157
  update_option( 'LinkLibraryGeneral', $genoptions );
3158
  $message = 1;
@@ -3163,7 +3176,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
3163
  $stylesheetlocation = plugin_dir_path( __FILE__ ) . 'stylesheettemplate.css';
3164
 
3165
  if ( file_exists( $stylesheetlocation ) ) {
3166
- $genoptions['fullstylesheet'] = file_get_contents( $stylesheetlocation );
3167
  }
3168
 
3169
  update_option( 'LinkLibraryGeneral', $genoptions );
130
  );
131
  }
132
 
133
+ function validate_css( $css ) {
134
+ require_once plugin_dir_path( __FILE__ ) . '/csstidy/class.csstidy.php';
135
+
136
+ $csstidy = new csstidy();
137
+ $csstidy->set_cfg( 'optimise_shorthands', 2 );
138
+ $csstidy->set_cfg( 'template', 'low' );
139
+ $csstidy->set_cfg( 'discard_invalid_properties', true );
140
+ $csstidy->set_cfg( 'remove_last_;', false );
141
+ $csstidy->parse( $css );
142
+
143
+ return $csstidy->print->plain();
144
+ }
145
+
146
  function is_edit_page( $new_edit = null ) {
147
  global $pagenow;
148
  //make sure we are on the backend
2580
  $row ++;
2581
  } else if ( $row == 2 ) {
2582
  for ( $counter = 0; $counter <= count( $data ) - 1; $counter ++ ) {
2583
+ $options[$optionnames[$counter]] = sanitize_text_field( $data[$counter] );
2584
  }
2585
  $row ++;
2586
  }
2611
  ) as $option_name
2612
  ) {
2613
  if ( isset( $_POST[$option_name] ) ) {
2614
+ $genoptions[$option_name] = sanitize_text_field( $_POST[$option_name] );
2615
  }
2616
  }
2617
 
2645
 
2646
  update_option( 'LinkLibraryGeneral', $genoptions );
2647
 
2648
+ update_option( 'links_updated_date_format', sanitize_text_field( $_POST['links_updated_date_format'] ) );
2649
  }
2650
 
2651
  global $wp_rewrite;
2816
 
2817
  foreach ( array ( 'stylesheet' ) as $option_name ) {
2818
  if ( isset( $_POST[$option_name] ) ) {
2819
+ $options[$option_name] = $this->validate_css( $_POST[$option_name] );
2820
  }
2821
  }
2822
 
2834
  as $option_name
2835
  ) {
2836
  if ( isset( $_POST[$option_name] ) ) {
2837
+ $options[$option_name] = sanitize_text_field( str_replace( "\"", "'", strtolower( $_POST[$option_name] ) ) );
2838
  }
2839
  }
2840
 
2852
  foreach ( array( 'categorylist_cpt', 'excludecategorylist_cpt', 'taglist_cpt', 'excludetaglist_cpt' ) as $option_name ) {
2853
  if ( isset( $_POST[$option_name] ) ) {
2854
  if ( $genoptions['catselectmethod'] == 'commalist' || empty( $genoptions['catselectmethod'] ) ) {
2855
+ $options[$option_name] = sanitize_text_field( str_replace( "\"", "'", strtolower( $_POST[$option_name] ) ) );
2856
  } else if ( $genoptions['catselectmethod'] == 'multiselectlist' ) {
2857
+ $options[$option_name] = sanitize_text_field( implode( ',', $_POST[$option_name] ) );
2858
  }
2859
  } else {
2860
  $options[$option_name] = '';
2894
  ) as $option_name
2895
  ) {
2896
  if ( isset( $_POST[$option_name] ) ) {
2897
+ $options[$option_name] = sanitize_text_field( str_replace( "\"", "'", $_POST[$option_name] ) );
2898
  }
2899
  }
2900
 
3165
  $genoptions = get_option( 'LinkLibraryGeneral' );
3166
  $genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
3167
 
3168
+ $genoptions['fullstylesheet'] = $this->validate_css( $_POST['fullstylesheet'] );
3169
 
3170
  update_option( 'LinkLibraryGeneral', $genoptions );
3171
  $message = 1;
3176
  $stylesheetlocation = plugin_dir_path( __FILE__ ) . 'stylesheettemplate.css';
3177
 
3178
  if ( file_exists( $stylesheetlocation ) ) {
3179
+ $genoptions['fullstylesheet'] = $this->validate_css( file_get_contents( $stylesheetlocation ) );
3180
  }
3181
 
3182
  update_option( 'LinkLibraryGeneral', $genoptions );
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.4
7
  Author: Yannick Lefebvre
8
  Author URI: http://ylefebvre.github.io/
9
  Text Domain: link-library
@@ -480,6 +480,14 @@ class link_library_plugin {
480
  'rewrite' => array( 'slug' => $genoptions['cptslug'] . '/%' . $genoptions['cattaxonomy'] . '%' )
481
  );
482
 
 
 
 
 
 
 
 
 
483
  if ( $genoptions['exclude_from_search'] && $genoptions['publicly_queryable'] ) {
484
  unset( $post_type_args['exclude_from_search'] );
485
  unset( $post_type_args['publicly_queryable'] );
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.4.1
7
  Author: Yannick Lefebvre
8
  Author URI: http://ylefebvre.github.io/
9
  Text Domain: link-library
480
  'rewrite' => array( 'slug' => $genoptions['cptslug'] . '/%' . $genoptions['cattaxonomy'] . '%' )
481
  );
482
 
483
+ if ( class_exists( 'WPGraphQL' ) ) {
484
+ $post_type_args['show_in_graphql'] = true;
485
+ $post_type_args['hierarchical'] = true;
486
+ $post_type_args['graphql_single_name'] = 'linklibrary';
487
+ $post_type_args['graphql_plural_name'] = 'linklibrary';
488
+ }
489
+
490
+
491
  if ( $genoptions['exclude_from_search'] && $genoptions['publicly_queryable'] ) {
492
  unset( $post_type_args['exclude_from_search'] );
493
  unset( $post_type_args['publicly_queryable'] );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: jackdewey
3
  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.4
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.4 =
54
  * Corrected PHP warning in render-link-library-addlink-sc.php
55
 
3
  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.1.1
7
+ Stable tag: 7.4.1
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.4.1 =
54
+ * Security fixes
55
+ * Added support for WPGraphQL
56
+
57
  = 7.4 =
58
  * Corrected PHP warning in render-link-library-addlink-sc.php
59