Link Library - Version 7.3.0.Beta2

Version Description

Download this release

Release Info

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

Code changes from version 7.3.0.Beta1 to 7.3.0.Beta2

link-library-admin.php CHANGED
@@ -2526,7 +2526,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
2526
  'extraprotocols', 'thumbnailsize', 'thumbnailgenerator', 'rsscachedelay', 'single_link_layout', 'rolelevel', 'editlevel', 'cptslug',
2527
  'defaultlinktarget', 'bp_link_page_url', 'bp_link_settings', 'defaultprotocoladmin', 'pagepeekerid', 'pagepeekersize', 'stwthumbnailsize', 'shrinkthewebaccesskey', 'customurl1label', 'customurl2label',
2528
  'customurl3label', 'customurl4label', 'customurl5label', 'customtext1label', 'customtext2label', 'customtext3label', 'customtext4label', 'customtext5label', 'customlist1label', 'customlist2label', 'customlist3label', 'customlist4label', 'customlist5label', 'customlist1values', 'customlist2values', 'customlist3values', 'customlist4values', 'customlist5values',
2529
- 'customlist1html', 'customlist2html', 'customlist3html', 'customlist4html', 'customlist5html', 'global_search_results_layout', 'globalsearchresultstitleprefix', 'cattaxonomy', 'tagtaxonomy'
2530
  ) as $option_name
2531
  ) {
2532
  if ( isset( $_POST[$option_name] ) ) {
@@ -3235,6 +3235,12 @@ wp_editor( $post->post_content, 'content', $editor_config );
3235
  <option value="post_tag" <?php selected( $genoptions['tagtaxonomy'], 'post_tag' ); ?>><?php _e( 'Post Tags', 'link-library' ); ?>
3236
  </select></td>
3237
  </tr>
 
 
 
 
 
 
3238
  <tr>
3239
  <td><?php _e( 'Individual link pages can be seen by visitors', 'link-library' ); ?></td>
3240
  <td><input type="checkbox" id="publicly_queryable" name="publicly_queryable" <?php checked( $genoptions['publicly_queryable'] ); ?>/></td>
2526
  'extraprotocols', 'thumbnailsize', 'thumbnailgenerator', 'rsscachedelay', 'single_link_layout', 'rolelevel', 'editlevel', 'cptslug',
2527
  'defaultlinktarget', 'bp_link_page_url', 'bp_link_settings', 'defaultprotocoladmin', 'pagepeekerid', 'pagepeekersize', 'stwthumbnailsize', 'shrinkthewebaccesskey', 'customurl1label', 'customurl2label',
2528
  'customurl3label', 'customurl4label', 'customurl5label', 'customtext1label', 'customtext2label', 'customtext3label', 'customtext4label', 'customtext5label', 'customlist1label', 'customlist2label', 'customlist3label', 'customlist4label', 'customlist5label', 'customlist1values', 'customlist2values', 'customlist3values', 'customlist4values', 'customlist5values',
2529
+ 'customlist1html', 'customlist2html', 'customlist3html', 'customlist4html', 'customlist5html', 'global_search_results_layout', 'globalsearchresultstitleprefix', 'cattaxonomy', 'tagtaxonomy', 'ignoresortarticles'
2530
  ) as $option_name
2531
  ) {
2532
  if ( isset( $_POST[$option_name] ) ) {
3235
  <option value="post_tag" <?php selected( $genoptions['tagtaxonomy'], 'post_tag' ); ?>><?php _e( 'Post Tags', 'link-library' ); ?>
3236
  </select></td>
3237
  </tr>
3238
+ <tr>
3239
+ <td><?php _e( 'Articles to be ignored when sorting (separate with |)', 'link-library' ); ?></td>
3240
+ <td>
3241
+ <input type="text" id="ignoresortarticles" name="ignoresortarticles" value="<?php echo $genoptions['ignoresortarticles']; ?>" />
3242
+ </td>
3243
+ </tr>
3244
  <tr>
3245
  <td><?php _e( 'Individual link pages can be seen by visitors', 'link-library' ); ?></td>
3246
  <td><input type="checkbox" id="publicly_queryable" name="publicly_queryable" <?php checked( $genoptions['publicly_queryable'] ); ?>/></td>
link-library-defaults.php CHANGED
@@ -567,6 +567,7 @@ function ll_reset_gen_settings( $setoptions = 'return' ) {
567
  $genoptions['rsscheckdays'] = 90;
568
  $genoptions['cattaxonomy'] = 'link_library_category';
569
  $genoptions['tagtaxonomy'] = 'link_library_tags';
 
570
 
571
  if ( 'return_and_set' == $setoptions ) {
572
  $stylesheetlocation = plugins_url( 'stylesheettemplate.css', __FILE__ );
567
  $genoptions['rsscheckdays'] = 90;
568
  $genoptions['cattaxonomy'] = 'link_library_category';
569
  $genoptions['tagtaxonomy'] = 'link_library_tags';
570
+ $genoptions['ignoresortarticles'] = '';
571
 
572
  if ( 'return_and_set' == $setoptions ) {
573
  $stylesheetlocation = plugins_url( 'stylesheettemplate.css', __FILE__ );
link-library.php CHANGED
@@ -317,6 +317,8 @@ class link_library_plugin {
317
 
318
  add_filter( 'posts_where', array( $this, 'll_posts_where' ), 10, 2 );
319
 
 
 
320
  // Load text domain for translation of admin pages and text strings
321
  load_plugin_textdomain( 'link-library', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
322
 
@@ -344,7 +346,6 @@ class link_library_plugin {
344
  }
345
 
346
  function ll_rest_settings_list( WP_REST_Request $request ) {
347
-
348
  $genoptions = get_option( 'LinkLibraryGeneral' );
349
  $genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
350
 
@@ -393,6 +394,32 @@ class link_library_plugin {
393
  return $where;
394
  }
395
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  function link_library_rss_feed_request( $qv ) {
397
 
398
  if ( isset( $qv['feed'] ) && !isset( $qv['post_type'] ) ) {
317
 
318
  add_filter( 'posts_where', array( $this, 'll_posts_where' ), 10, 2 );
319
 
320
+ add_filter( 'posts_orderby', array( $this, 'll_posts_orderby' ), 10, 2 );
321
+
322
  // Load text domain for translation of admin pages and text strings
323
  load_plugin_textdomain( 'link-library', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
324
 
346
  }
347
 
348
  function ll_rest_settings_list( WP_REST_Request $request ) {
 
349
  $genoptions = get_option( 'LinkLibraryGeneral' );
350
  $genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
351
 
394
  return $where;
395
  }
396
 
397
+ function ll_posts_orderby( $orderby, $wp_query ) {
398
+ if ( '_llcustomtitlesort' !== $wp_query->get( 'orderby' ) ) {
399
+ return $orderby;
400
+ }
401
+
402
+ $genoptions = get_option( 'LinkLibraryGeneral' );
403
+ $genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
404
+
405
+ global $wpdb;
406
+
407
+ $matches = $genoptions['ignoresortarticles']; // REGEXP is not case sensitive here
408
+
409
+ // Custom ordering (SQL)
410
+ return sprintf(
411
+ "
412
+ CASE
413
+ WHEN {$wpdb->posts}.post_title REGEXP( '^($matches)[[:space:]]+' )
414
+ THEN TRIM( SUBSTR( {$wpdb->posts}.post_title FROM %d ))
415
+ ELSE {$wpdb->posts}.post_title
416
+ END %s
417
+ ",
418
+ strlen( $matches ) + 1,
419
+ 'ASC' === strtoupper( $wp_query->get( 'order' ) ) ? 'ASC' : 'DESC'
420
+ );
421
+ }
422
+
423
  function link_library_rss_feed_request( $qv ) {
424
 
425
  if ( isset( $qv['feed'] ) && !isset( $qv['post_type'] ) ) {
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 1 =
52
  * Added support to use post categories instead of Link Library categories
53
  * Added support to use post tags instead of Link Library tags
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
+
54
  = 7.3 Beta 1 =
55
  * Added support to use post categories instead of Link Library categories
56
  * Added support to use post tags instead of Link Library tags
render-link-library-sc.php CHANGED
@@ -886,7 +886,8 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
886
  }
887
 
888
  if ( 'name' == $linkorder ) {
889
- $link_query_args['orderby']['title'] = in_array( $linkdirection, $validdirections ) ? $linkdirection : 'ASC';
 
890
  } elseif ( 'id' == $linkorder ) {
891
  $link_query_args['orderby']['ID'] = in_array( $linkdirection, $validdirections ) ? $linkdirection : 'ASC';
892
  } elseif ( 'date' == $linkorder ) {
886
  }
887
 
888
  if ( 'name' == $linkorder ) {
889
+ $link_query_args['orderby'] = '_llcustomtitlesort';
890
+ $link_query_args['order'] = in_array( $linkdirection, $validdirections ) ? $linkdirection : 'ASC';
891
  } elseif ( 'id' == $linkorder ) {
892
  $link_query_args['orderby']['ID'] = in_array( $linkdirection, $validdirections ) ? $linkdirection : 'ASC';
893
  } elseif ( 'date' == $linkorder ) {