Contextual Related Posts - Version 2.9.0

Version Description

Release post: https://webberzone.com/blog/contextual-related-posts-v2-9-0/

  • Features:

    • New section under Settings > Related Posts > Tools to export and import settings. Best option if you'd like the same configuration across multiple WordPress sites
    • New shortcode setting include_cat_ids to limit top posts to selected categories/taxonomies. Use a comma separated list of term_taxonomy_id
    • New setting in widget to only include certain categories. Doesn't work with custom taxonomies
  • Enhancements:

    • New function: crp_get_thumb_size() to get the correct size of the thumbnail
    • Only run a get_post query if only the post ID is passed to crp_get_the_post_thumbnail()
    • $match_fields parameter added to crp_posts_match filter
    • Updated WPML functions to use latest filters
    • Admin scripts are no longer loaded into the head - but using a separate JavaScript file
    • Implemented CodeMirror to format custom styles box
    • New filters get_crp_short_circuit and get_crp_posts_id_short_circuit to bypass outputs and queries
    • CRP_MAX_WORDS has been reduced from 500 to 250 to avoid "Too many words" mySQL error
    • The link to the Contextual Related Posts link is no longer a list item but a smaller text paragraph below the items. You can turn this on by enabling Show Credit.
  • Bug fixes:

    • Fixed errors created when trying to fetch a featured image or scanned images with remote links
    • Saving categories fields in the settings page uses str_getcsv and a custom function crp_str_putcsv
Download this release

Release Info

Developer Ajay
Plugin Icon 128x128 Contextual Related Posts
Version 2.9.0
Comparing to
See all releases

Code changes from version 2.8.0 to 2.9.0

README.md CHANGED
@@ -6,9 +6,9 @@
6
  [![Build Status](https://travis-ci.org/WebberZone/contextual-related-posts.svg?branch=master)](https://travis-ci.org/WebberZone/contextual-related-posts)
7
  [![Code Climate](https://codeclimate.com/github/WebberZone/contextual-related-posts/badges/gpa.svg)](https://codeclimate.com/github/WebberZone/contextual-related-posts)
8
 
9
- __Requires:__ 4.8
10
 
11
- __Tested up to:__ 5.3
12
 
13
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
14
 
6
  [![Build Status](https://travis-ci.org/WebberZone/contextual-related-posts.svg?branch=master)](https://travis-ci.org/WebberZone/contextual-related-posts)
7
  [![Code Climate](https://codeclimate.com/github/WebberZone/contextual-related-posts/badges/gpa.svg)](https://codeclimate.com/github/WebberZone/contextual-related-posts)
8
 
9
+ __Requires:__ 4.9
10
 
11
+ __Tested up to:__ 5.4
12
 
13
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
14
 
contextual-related-posts.php CHANGED
@@ -9,13 +9,13 @@
9
  * @author Ajay D'Souza
10
  * @license GPL-2.0+
11
  * @link https://webberzone.com
12
- * @copyright 2009-2019 Ajay D'Souza
13
  *
14
  * @wordpress-plugin
15
  * Plugin Name: Contextual Related Posts
16
  * Plugin URI: https://webberzone.com/plugins/contextual-related-posts/
17
  * Description: Display a set of related posts on your website or in your feed. Increase reader retention and reduce bounce rates
18
- * Version: 2.8.0
19
  * Author: WebberZone
20
  * Author URI: https://webberzone.com
21
  * License: GPL-2.0+
@@ -72,7 +72,7 @@ if ( ! defined( 'CRP_PLUGIN_URL' ) ) {
72
  * @var int Maximum number of words to match.
73
  */
74
  if ( ! defined( 'CRP_MAX_WORDS' ) ) {
75
- define( 'CRP_MAX_WORDS', 500 );
76
  }
77
 
78
  /*
9
  * @author Ajay D'Souza
10
  * @license GPL-2.0+
11
  * @link https://webberzone.com
12
+ * @copyright 2009-2020 Ajay D'Souza
13
  *
14
  * @wordpress-plugin
15
  * Plugin Name: Contextual Related Posts
16
  * Plugin URI: https://webberzone.com/plugins/contextual-related-posts/
17
  * Description: Display a set of related posts on your website or in your feed. Increase reader retention and reduce bounce rates
18
+ * Version: 2.9.0
19
  * Author: WebberZone
20
  * Author URI: https://webberzone.com
21
  * License: GPL-2.0+
72
  * @var int Maximum number of words to match.
73
  */
74
  if ( ! defined( 'CRP_MAX_WORDS' ) ) {
75
+ define( 'CRP_MAX_WORDS', 250 );
76
  }
77
 
78
  /*
includes/admin/admin.php CHANGED
@@ -35,7 +35,6 @@ function crp_add_admin_pages_links() {
35
  'crp_options_page'
36
  );
37
  add_action( "load-$crp_settings_page", 'crp_settings_help' ); // Load the settings contextual help.
38
- add_action( "admin_head-$crp_settings_page", 'crp_adminhead' ); // Load the admin head.
39
 
40
  $crp_settings_tools_help = add_submenu_page(
41
  $crp_settings_page,
@@ -46,174 +45,11 @@ function crp_add_admin_pages_links() {
46
  'crp_tools_page'
47
  );
48
  add_action( "load-$crp_settings_tools_help", 'crp_settings_tools_help' );
49
- add_action( "admin_head-$crp_settings_tools_help", 'crp_adminhead' );
50
 
51
  }
52
  add_action( 'admin_menu', 'crp_add_admin_pages_links' );
53
 
54
 
55
- /**
56
- * Function to add CSS and JS to the Admin header.
57
- *
58
- * @since 2.6.0
59
- * @return void
60
- */
61
- function crp_adminhead() {
62
- global $crp_settings_page, $crp_settings_tools_help;
63
-
64
- wp_enqueue_script( 'jquery' );
65
- wp_enqueue_script( 'jquery-ui-autocomplete' );
66
- wp_enqueue_script( 'jquery-ui-tabs' );
67
- wp_enqueue_script( 'plugin-install' );
68
- add_thickbox();
69
-
70
- ?>
71
- <script type="text/javascript">
72
- //<![CDATA[
73
- // Function to clear the cache.
74
- function clearCache() {
75
- /**** since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php ****/
76
- jQuery.post(ajaxurl, {
77
- action: 'crp_clear_cache'
78
- }, function (response, textStatus, jqXHR) {
79
- alert(response.message);
80
- }, 'json');
81
- }
82
-
83
- // Function to add auto suggest.
84
- jQuery(document).ready(function($) {
85
- $.fn.crpTagsSuggest = function( options ) {
86
-
87
- var cache;
88
- var last;
89
- var $element = $( this );
90
-
91
- var taxonomy = $element.attr( 'data-wp-taxonomy' ) || 'category';
92
-
93
- function split( val ) {
94
- return val.split( /,\s*/ );
95
- }
96
-
97
- function extractLast( term ) {
98
- return split( term ).pop();
99
- }
100
-
101
- $element.on( "keydown", function( event ) {
102
- // Don't navigate away from the field on tab when selecting an item.
103
- if ( event.keyCode === $.ui.keyCode.TAB &&
104
- $( this ).autocomplete( 'instance' ).menu.active ) {
105
- event.preventDefault();
106
- }
107
- })
108
- .autocomplete({
109
- minLength: 2,
110
- source: function( request, response ) {
111
- var term;
112
-
113
- if ( last === request.term ) {
114
- response( cache );
115
- return;
116
- }
117
-
118
- term = extractLast( request.term );
119
-
120
- if ( last === request.term ) {
121
- response( cache );
122
- return;
123
- }
124
-
125
- $.ajax({
126
- type: 'POST',
127
- dataType: 'json',
128
- url: '<?php echo admin_url( 'admin-ajax.php' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>',
129
- data: {
130
- action: 'crp_tag_search',
131
- tax: taxonomy,
132
- q: term
133
- },
134
- success: function( data ) {
135
- cache = data;
136
-
137
- response( data );
138
- }
139
- });
140
-
141
- last = request.term;
142
-
143
- },
144
- search: function() {
145
- // Custom minLength.
146
- var term = extractLast( this.value );
147
-
148
- if ( term.length < 2 ) {
149
- return false;
150
- }
151
- },
152
- focus: function( event, ui ) {
153
- // Prevent value inserted on focus.
154
- event.preventDefault();
155
- },
156
- select: function( event, ui ) {
157
- var terms = split( this.value );
158
-
159
- // Remove the last user input.
160
- terms.pop();
161
-
162
- // Add the selected item.
163
- terms.push( ui.item.value );
164
-
165
- // Add placeholder to get the comma-and-space at the end.
166
- terms.push( "" );
167
- this.value = terms.join( ", " );
168
- return false;
169
- }
170
- });
171
-
172
- };
173
-
174
- $( '.category_autocomplete' ).each( function ( i, element ) {
175
- $( element ).crpTagsSuggest();
176
- });
177
-
178
- // Prompt the user when they leave the page without saving the form.
179
- formmodified=0;
180
-
181
- $('form *').change(function(){
182
- formmodified=1;
183
- });
184
-
185
- window.onbeforeunload = confirmExit;
186
-
187
- function confirmExit() {
188
- if (formmodified == 1) {
189
- return "<?php esc_html__( 'New information not saved. Do you wish to leave the page?', 'contextual-related-posts' ); ?>";
190
- }
191
- }
192
-
193
- $( "input[name='submit']" ).click( function() {
194
- formmodified = 0;
195
- });
196
-
197
- $( function() {
198
- $( "#post-body-content" ).tabs({
199
- create: function( event, ui ) {
200
- $( ui.tab.find("a") ).addClass( "nav-tab-active" );
201
- },
202
- activate: function( event, ui ) {
203
- $( ui.oldTab.find("a") ).removeClass( "nav-tab-active" );
204
- $( ui.newTab.find("a") ).addClass( "nav-tab-active" );
205
- }
206
- });
207
- });
208
-
209
- });
210
-
211
- //]]>
212
- </script>
213
- <?php
214
- }
215
-
216
-
217
  /**
218
  * Add rating links to the admin dashboard
219
  *
@@ -246,3 +82,79 @@ function crp_admin_footer( $footer_text ) {
246
  }
247
  add_filter( 'admin_footer_text', 'crp_admin_footer' );
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  'crp_options_page'
36
  );
37
  add_action( "load-$crp_settings_page", 'crp_settings_help' ); // Load the settings contextual help.
 
38
 
39
  $crp_settings_tools_help = add_submenu_page(
40
  $crp_settings_page,
45
  'crp_tools_page'
46
  );
47
  add_action( "load-$crp_settings_tools_help", 'crp_settings_tools_help' );
 
48
 
49
  }
50
  add_action( 'admin_menu', 'crp_add_admin_pages_links' );
51
 
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  /**
54
  * Add rating links to the admin dashboard
55
  *
82
  }
83
  add_filter( 'admin_footer_text', 'crp_admin_footer' );
84
 
85
+
86
+ /**
87
+ * Enqueue Admin JS
88
+ *
89
+ * @since 2.9.0
90
+ *
91
+ * @param string $hook The current admin page.
92
+ */
93
+ function crp_load_admin_scripts( $hook ) {
94
+
95
+ global $crp_settings_page, $crp_settings_tools_help;
96
+
97
+ wp_register_script( 'crp-admin-js', CRP_PLUGIN_URL . 'includes/admin/js/admin-scripts.min.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-datepicker' ), '1.0', true );
98
+ wp_register_script( 'crp-suggest-js', CRP_PLUGIN_URL . 'includes/admin/js/crp-suggest.min.js', array( 'jquery', 'jquery-ui-autocomplete' ), '1.0', true );
99
+
100
+ wp_register_style(
101
+ 'crp-admin-customizer-css',
102
+ CRP_PLUGIN_URL . 'includes/admin/css/crp-customizer.min.css',
103
+ false,
104
+ '1.0',
105
+ false
106
+ );
107
+
108
+ if ( in_array( $hook, array( $crp_settings_page, $crp_settings_tools_help ), true ) ) {
109
+
110
+ wp_enqueue_script( 'crp-admin-js' );
111
+ wp_enqueue_script( 'crp-suggest-js' );
112
+ wp_enqueue_script( 'plugin-install' );
113
+ add_thickbox();
114
+
115
+ wp_enqueue_code_editor(
116
+ array(
117
+ 'type' => 'text/html',
118
+ 'codemirror' => array(
119
+ 'indentUnit' => 2,
120
+ 'tabSize' => 2,
121
+ ),
122
+ )
123
+ );
124
+
125
+ }
126
+ }
127
+ add_action( 'admin_enqueue_scripts', 'crp_load_admin_scripts' );
128
+
129
+
130
+ /**
131
+ * This function enqueues scripts and styles in the Customizer.
132
+ *
133
+ * @since 2.9.0
134
+ */
135
+ function crp_customize_controls_enqueue_scripts() {
136
+ wp_enqueue_script( 'customize-controls' );
137
+ wp_enqueue_script( 'crp-suggest-js' );
138
+
139
+ wp_enqueue_style( 'crp-admin-customizer-css' );
140
+
141
+ }
142
+ add_action( 'customize_controls_enqueue_scripts', 'crp_customize_controls_enqueue_scripts', 99 );
143
+
144
+
145
+ /**
146
+ * This function enqueues scripts and styles on widgets.php.
147
+ *
148
+ * @since 2.9.0
149
+ *
150
+ * @param string $hook The current admin page.
151
+ */
152
+ function crp_enqueue_scripts_widgets( $hook ) {
153
+ if ( 'widgets.php' !== $hook ) {
154
+ return;
155
+ }
156
+ wp_enqueue_script( 'crp-suggest-js' );
157
+ wp_enqueue_style( 'crp-admin-customizer-css' );
158
+ }
159
+ add_action( 'admin_enqueue_scripts', 'crp_enqueue_scripts_widgets', 99 );
160
+
includes/admin/css/crp-customizer.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .ui-autocomplete {
2
+ z-index: 9999999999;
3
+ }
includes/admin/css/crp-customizer.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .ui-autocomplete{z-index:9999999999}
includes/admin/css/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
includes/admin/default-settings.php CHANGED
@@ -376,11 +376,12 @@ function crp_settings_list() {
376
  'match_content_words' => array(
377
  'id' => 'match_content_words',
378
  'name' => esc_html__( 'Limit content to be compared', 'contextual-related-posts' ),
379
- 'desc' => esc_html__( 'This sets the maximum words of the content that will be matched. Set to 0 for no limit. Max value: 2,000. Only applies if you activate the above option.', 'contextual-related-posts' ),
 
380
  'type' => 'number',
381
  'options' => '0',
382
  'min' => '0',
383
- 'max' => '2000',
384
  ),
385
  'post_types' => array(
386
  'id' => 'post_types',
@@ -586,12 +587,13 @@ function crp_settings_styles() {
586
  'options' => crp_get_styles(),
587
  ),
588
  'custom_css' => array(
589
- 'id' => 'custom_css',
590
- 'name' => esc_html__( 'Custom CSS', 'contextual-related-posts' ),
591
  /* translators: 1: Opening a tag, 2: Closing a tag, 3: Opening code tage, 4. Closing code tag. */
592
- 'desc' => sprintf( esc_html__( 'Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available CSS classes to style.', 'contextual-related-posts' ), '<a href="' . esc_url( 'http://wordpress.org/plugins/contextual-related-posts/faq/' ) . '" target="_blank">', '</a>', '<code>', '</code>' ),
593
- 'type' => 'css',
594
- 'options' => '',
 
595
  ),
596
  );
597
 
376
  'match_content_words' => array(
377
  'id' => 'match_content_words',
378
  'name' => esc_html__( 'Limit content to be compared', 'contextual-related-posts' ),
379
+ /* translators: 1: Number. */
380
+ 'desc' => sprintf( esc_html__( 'This sets the maximum words of the content that will be matched. Set to 0 for no limit. Max value: %1$s. Only applies if you activate the above option.', 'contextual-related-posts' ), CRP_MAX_WORDS ),
381
  'type' => 'number',
382
  'options' => '0',
383
  'min' => '0',
384
+ 'max' => CRP_MAX_WORDS,
385
  ),
386
  'post_types' => array(
387
  'id' => 'post_types',
587
  'options' => crp_get_styles(),
588
  ),
589
  'custom_css' => array(
590
+ 'id' => 'custom_css',
591
+ 'name' => esc_html__( 'Custom CSS', 'contextual-related-posts' ),
592
  /* translators: 1: Opening a tag, 2: Closing a tag, 3: Opening code tage, 4. Closing code tag. */
593
+ 'desc' => sprintf( esc_html__( 'Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available CSS classes to style.', 'contextual-related-posts' ), '<a href="' . esc_url( 'http://wordpress.org/plugins/contextual-related-posts/faq/' ) . '" target="_blank">', '</a>', '<code>', '</code>' ),
594
+ 'type' => 'css',
595
+ 'options' => '',
596
+ 'field_class' => 'codemirror_css',
597
  ),
598
  );
599
 
includes/admin/index.php CHANGED
File without changes
includes/admin/js/admin-scripts.js ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Function to clear the cache.
2
+ function crpClearCache() {
3
+ /**** since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php ****/
4
+ jQuery.post(ajaxurl, {
5
+ action: 'crp_clear_cache'
6
+ }, function (response, textStatus, jqXHR) {
7
+ alert(response.message);
8
+ }, 'json');
9
+ }
10
+
11
+ jQuery(document).ready(function($) {
12
+ // Prompt the user when they leave the page without saving the form.
13
+ formmodified=0;
14
+
15
+ function confirmFormChange() {
16
+ formmodified=1;
17
+ }
18
+
19
+ function confirmExit() {
20
+ if ( formmodified == 1 ) {
21
+ return true;
22
+ }
23
+ }
24
+
25
+ function formNotModified() {
26
+ formmodified = 0;
27
+ }
28
+
29
+ $('form *').change( confirmFormChange );
30
+
31
+ window.onbeforeunload = confirmExit;
32
+
33
+ $( "input[name='submit']" ).click(formNotModified);
34
+ $( "input[id='search-submit']" ).click(formNotModified);
35
+ $( "input[id='doaction']" ).click(formNotModified);
36
+ $( "input[id='doaction2']" ).click(formNotModified);
37
+ $( "input[name='filter_action']" ).click(formNotModified);
38
+
39
+ $( function() {
40
+ $( "#post-body-content" ).tabs({
41
+ create: function( event, ui ) {
42
+ $( ui.tab.find("a") ).addClass( "nav-tab-active" );
43
+ },
44
+ activate: function( event, ui ) {
45
+ $( ui.oldTab.find("a") ).removeClass( "nav-tab-active" );
46
+ $( ui.newTab.find("a") ).addClass( "nav-tab-active" );
47
+ }
48
+ });
49
+ });
50
+
51
+ // Initialise CodeMirror.
52
+ $( ".codemirror_html" ).each( function( index, element ) {
53
+ if( $( element ).length && typeof wp.codeEditor === 'object' ) {
54
+ var editorSettings = wp.codeEditor.defaultSettings ? _.clone( wp.codeEditor.defaultSettings ) : {};
55
+ editorSettings.codemirror = _.extend(
56
+ {},
57
+ editorSettings.codemirror,
58
+ {
59
+ }
60
+ );
61
+ var editor = wp.codeEditor.initialize( $( element ), editorSettings );
62
+ editor.codemirror.on( 'change', confirmFormChange );
63
+ }
64
+ });
65
+
66
+ $( ".codemirror_js" ).each( function( index, element ) {
67
+ if( $( element ).length && typeof wp.codeEditor === 'object' ) {
68
+ var editorSettings = wp.codeEditor.defaultSettings ? _.clone( wp.codeEditor.defaultSettings ) : {};
69
+ editorSettings.codemirror = _.extend(
70
+ {},
71
+ editorSettings.codemirror,
72
+ {
73
+ mode: 'javascript',
74
+ }
75
+ );
76
+ var editor = wp.codeEditor.initialize( $( element ), editorSettings );
77
+ editor.codemirror.on( 'change', confirmFormChange );
78
+ }
79
+ });
80
+
81
+ $( ".codemirror_css" ).each( function( index, element ) {
82
+ if( $( element ).length && typeof wp.codeEditor === 'object' ) {
83
+ var editorSettings = wp.codeEditor.defaultSettings ? _.clone( wp.codeEditor.defaultSettings ) : {};
84
+ editorSettings.codemirror = _.extend(
85
+ {},
86
+ editorSettings.codemirror,
87
+ {
88
+ mode: 'css',
89
+ }
90
+ );
91
+ var editor = wp.codeEditor.initialize( $( element ), editorSettings );
92
+ editor.codemirror.on( 'change', confirmFormChange );
93
+ }
94
+ });
95
+ });
includes/admin/js/admin-scripts.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function crpClearCache(){jQuery.post(ajaxurl,{action:"crp_clear_cache"},(function(response,textStatus,jqXHR){alert(response.message)}),"json")}jQuery(document).ready((function($){function confirmFormChange(){formmodified=1}function confirmExit(){if(1==formmodified)return!0}function formNotModified(){formmodified=0}formmodified=0,$("form *").change(confirmFormChange),window.onbeforeunload=confirmExit,$("input[name='submit']").click(formNotModified),$("input[id='search-submit']").click(formNotModified),$("input[id='doaction']").click(formNotModified),$("input[id='doaction2']").click(formNotModified),$("input[name='filter_action']").click(formNotModified),$((function(){$("#post-body-content").tabs({create:function(event,ui){$(ui.tab.find("a")).addClass("nav-tab-active")},activate:function(event,ui){$(ui.oldTab.find("a")).removeClass("nav-tab-active"),$(ui.newTab.find("a")).addClass("nav-tab-active")}})})),$(".codemirror_html").each((function(index,element){if($(element).length&&"object"==typeof wp.codeEditor){var editorSettings=wp.codeEditor.defaultSettings?_.clone(wp.codeEditor.defaultSettings):{},editor;editorSettings.codemirror=_.extend({},editorSettings.codemirror,{}),wp.codeEditor.initialize($(element),editorSettings).codemirror.on("change",confirmFormChange)}})),$(".codemirror_js").each((function(index,element){if($(element).length&&"object"==typeof wp.codeEditor){var editorSettings=wp.codeEditor.defaultSettings?_.clone(wp.codeEditor.defaultSettings):{},editor;editorSettings.codemirror=_.extend({},editorSettings.codemirror,{mode:"javascript"}),wp.codeEditor.initialize($(element),editorSettings).codemirror.on("change",confirmFormChange)}})),$(".codemirror_css").each((function(index,element){if($(element).length&&"object"==typeof wp.codeEditor){var editorSettings=wp.codeEditor.defaultSettings?_.clone(wp.codeEditor.defaultSettings):{},editor;editorSettings.codemirror=_.extend({},editorSettings.codemirror,{mode:"css"}),wp.codeEditor.initialize($(element),editorSettings).codemirror.on("change",confirmFormChange)}}))}));
includes/admin/js/crp-suggest.js ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ // Function to add auto suggest.
3
+ $.fn.crpTagsSuggest = function( options ) {
4
+ var cache;
5
+ var last;
6
+ var $element = $( this );
7
+
8
+ options = options || {};
9
+
10
+ var taxonomy = options.taxonomy || $element.attr( 'data-wp-taxonomy' ) || 'category';
11
+ delete( options.taxonomy );
12
+
13
+ function split( val ) {
14
+ return val.split( /,(?=(?:(?:[^"]*"){2})*[^"]*$)/ ); // Split typical CSV format, with commas and double quotes.
15
+ }
16
+
17
+ function extractLast( term ) {
18
+ return split( term ).pop();
19
+ }
20
+
21
+ options = $.extend({
22
+ minLength: 2,
23
+ position: {
24
+ my: 'left top+2',
25
+ at: 'left bottom',
26
+ collision: 'none'
27
+ },
28
+ source: function( request, response ) {
29
+ var term;
30
+
31
+ if ( last === request.term ) {
32
+ response( cache );
33
+ return;
34
+ }
35
+
36
+ term = extractLast( request.term );
37
+
38
+ if ( last === request.term ) {
39
+ response( cache );
40
+ return;
41
+ }
42
+
43
+ $.ajax({
44
+ type: 'POST',
45
+ dataType: 'json',
46
+ url: ajaxurl,
47
+ data: {
48
+ action: 'crp_tag_search',
49
+ tax: taxonomy,
50
+ q: term
51
+ },
52
+ }).done( function( data ) {
53
+ cache = data;
54
+ response( data );
55
+ });
56
+
57
+ last = request.term;
58
+
59
+ },
60
+ search: function() {
61
+ // Custom minLength.
62
+ var term = extractLast( this.value );
63
+
64
+ if ( term.length < 2 ) {
65
+ return false;
66
+ }
67
+ },
68
+ focus: function( event, ui ) {
69
+ // Prevent value inserted on focus.
70
+ event.preventDefault();
71
+ },
72
+ select: function( event, ui ) {
73
+ var terms = split( this.value );
74
+ var val = ui.item.value;
75
+
76
+ if ( val.indexOf(',') !== -1 ) {
77
+ val = '"' + val + '"'
78
+ }
79
+
80
+ // Remove the last user input.
81
+ terms.pop();
82
+
83
+ // Add the selected item.
84
+ terms.push( val );
85
+
86
+ // Add placeholder to get the comma-and-space at the end.
87
+ terms.push( "" );
88
+ this.value = terms.join( ", " );
89
+ return false;
90
+ }
91
+ }, options );
92
+
93
+ $element.on( "keydown", function( event ) {
94
+ // Don't navigate away from the field on tab when selecting an item.
95
+ if ( event.keyCode === $.ui.keyCode.TAB &&
96
+ $( this ).autocomplete( 'instance' ).menu.active ) {
97
+ event.preventDefault();
98
+ }
99
+ })
100
+ .autocomplete( options );
101
+ };
102
+
103
+ $( '.category_autocomplete' ).each( function ( i, element ) {
104
+ $( element ).crpTagsSuggest();
105
+ });
106
+
107
+ $('.widget-liquid-right, #customize-controls').on( 'click', '.category_autocomplete', function() {
108
+ $( '.category_autocomplete' ).crpTagsSuggest();
109
+ });
110
+ });
includes/admin/js/crp-suggest.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready((function($){$.fn.crpTagsSuggest=function(options){var cache,last,$element=$(this),taxonomy=(options=options||{}).taxonomy||$element.attr("data-wp-taxonomy")||"category";function split(val){return val.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/)}function extractLast(term){return split(term).pop()}delete options.taxonomy,options=$.extend({minLength:2,position:{my:"left top+2",at:"left bottom",collision:"none"},source:function(request,response){var term;last!==request.term?(term=extractLast(request.term),last!==request.term?($.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"crp_tag_search",tax:taxonomy,q:term}}).done((function(data){cache=data,response(data)})),last=request.term):response(cache)):response(cache)},search:function(){var term;if(extractLast(this.value).length<2)return!1},focus:function(event,ui){event.preventDefault()},select:function(event,ui){var terms=split(this.value),val=ui.item.value;return-1!==val.indexOf(",")&&(val='"'+val+'"'),terms.pop(),terms.push(val),terms.push(""),this.value=terms.join(", "),!1}},options),$element.on("keydown",(function(event){event.keyCode===$.ui.keyCode.TAB&&$(this).autocomplete("instance").menu.active&&event.preventDefault()})).autocomplete(options)},$(".category_autocomplete").each((function(i,element){$(element).crpTagsSuggest()})),$(".widget-liquid-right, #customize-controls").on("click",".category_autocomplete",(function(){$(".category_autocomplete").crpTagsSuggest()}))}));
includes/admin/js/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
includes/admin/modules/cache.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
includes/admin/modules/loader.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
includes/admin/modules/metabox.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  /**** If this file is called directly, abort. ****/
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  /**** If this file is called directly, abort. ****/
includes/admin/modules/tools.php CHANGED
@@ -43,6 +43,11 @@ function crp_tools_page() {
43
  add_settings_error( 'crp-notices', '', esc_html__( 'Indices have been recreated', 'contextual-related-posts' ), 'updated' );
44
  }
45
 
 
 
 
 
 
46
  ob_start();
47
  ?>
48
  <div class="wrap">
@@ -64,7 +69,7 @@ function crp_tools_page() {
64
 
65
  <h2 style="padding-left:0px"><?php esc_html_e( 'Clear cache', 'contextual-related-posts' ); ?></h2>
66
  <p>
67
- <input type="button" name="cache_clear" id="cache_clear" value="<?php esc_attr_e( 'Clear cache', 'contextual-related-posts' ); ?>" class="button button-secondary" onclick="return clearCache();" />
68
  </p>
69
  <p class="description">
70
  <?php esc_html_e( 'Clear the Contextual Related Posts cache. This will also be cleared automatically when you save the settings page.', 'contextual-related-posts' ); ?>
@@ -81,6 +86,41 @@ function crp_tools_page() {
81
  <code style="display:block;"><?php echo crp_recreate_indices_sql(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></code>
82
  </p>
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  <h2 style="padding-left:0px"><?php esc_html_e( 'Other tools', 'contextual-related-posts' ); ?></h2>
85
  <p>
86
  <input name="crp_delete_old_settings" type="submit" id="crp_delete_old_settings" value="<?php esc_attr_e( 'Delete old settings', 'contextual-related-posts' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'This will delete the settings before v2.6.x. Proceed?', 'contextual-related-posts' ); ?>')) return false;" />
@@ -139,3 +179,88 @@ function crp_recreate_indices_sql() {
139
  */
140
  return apply_filters( 'crp_recreate_indices_sql', $sql );
141
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  add_settings_error( 'crp-notices', '', esc_html__( 'Indices have been recreated', 'contextual-related-posts' ), 'updated' );
44
  }
45
 
46
+ /* Message for successful file import */
47
+ if ( isset( $_GET['settings_import'] ) && 'success' === $_GET['settings_import'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
48
+ add_settings_error( 'crp-notices', '', esc_html__( 'Settings have been imported successfully', 'contextual-related-posts' ), 'updated' );
49
+ }
50
+
51
  ob_start();
52
  ?>
53
  <div class="wrap">
69
 
70
  <h2 style="padding-left:0px"><?php esc_html_e( 'Clear cache', 'contextual-related-posts' ); ?></h2>
71
  <p>
72
+ <input type="button" name="cache_clear" id="cache_clear" value="<?php esc_attr_e( 'Clear cache', 'contextual-related-posts' ); ?>" class="button button-secondary" onclick="return crpClearCache();" />
73
  </p>
74
  <p class="description">
75
  <?php esc_html_e( 'Clear the Contextual Related Posts cache. This will also be cleared automatically when you save the settings page.', 'contextual-related-posts' ); ?>
86
  <code style="display:block;"><?php echo crp_recreate_indices_sql(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></code>
87
  </p>
88
 
89
+ <?php wp_nonce_field( 'crp-tools-settings' ); ?>
90
+ </form>
91
+
92
+ <form method="post">
93
+
94
+ <h2 style="padding-left:0px"><?php esc_html_e( 'Export/Import settings', 'contextual-related-posts' ); ?></h2>
95
+ <p class="description">
96
+ <?php esc_html_e( 'Export the plugin settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'contextual-related-posts' ); ?>
97
+ </p>
98
+ <p><input type="hidden" name="crp_action" value="export_settings" /></p>
99
+ <p>
100
+ <?php submit_button( esc_html__( 'Export Settings', 'contextual-related-posts' ), 'primary', 'crp_export_settings', false ); ?>
101
+ </p>
102
+
103
+ <?php wp_nonce_field( 'crp_export_setting_nonce', 'crp_export_setting_nonce' ); ?>
104
+ </form>
105
+
106
+ <form method="post" enctype="multipart/form-data">
107
+
108
+ <p class="description">
109
+ <?php esc_html_e( 'Import the plugin settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'contextual-related-posts' ); ?>
110
+ </p>
111
+ <p>
112
+ <input type="file" name="import_settings_file" />
113
+ </p>
114
+ <p>
115
+ <?php submit_button( esc_html__( 'Import Settings', 'contextual-related-posts' ), 'primary', 'crp_import_settings', false ); ?>
116
+ </p>
117
+
118
+ <input type="hidden" name="crp_action" value="import_settings" />
119
+ <?php wp_nonce_field( 'crp_import_settings_nonce', 'crp_import_settings_nonce' ); ?>
120
+ </form>
121
+
122
+ <form method="post">
123
+
124
  <h2 style="padding-left:0px"><?php esc_html_e( 'Other tools', 'contextual-related-posts' ); ?></h2>
125
  <p>
126
  <input name="crp_delete_old_settings" type="submit" id="crp_delete_old_settings" value="<?php esc_attr_e( 'Delete old settings', 'contextual-related-posts' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'This will delete the settings before v2.6.x. Proceed?', 'contextual-related-posts' ); ?>')) return false;" />
179
  */
180
  return apply_filters( 'crp_recreate_indices_sql', $sql );
181
  }
182
+
183
+ /**
184
+ * Process a settings export that generates a .json file of the shop settings
185
+ *
186
+ * @since 2.9.0
187
+ */
188
+ function crp_process_settings_export() {
189
+
190
+ if ( empty( $_POST['crp_action'] ) || 'export_settings' !== $_POST['crp_action'] ) {
191
+ return;
192
+ }
193
+
194
+ if ( isset( $_POST['crp_export_settings_nonce'] ) && ! wp_verify_nonce( sanitize_key( $_POST['crp_export_settings_nonce'] ), 'crp_export_settings_nonce' ) ) {
195
+ return;
196
+ }
197
+
198
+ if ( ! current_user_can( 'manage_options' ) ) {
199
+ return;
200
+ }
201
+
202
+ $settings = get_option( 'crp_settings' );
203
+
204
+ ignore_user_abort( true );
205
+
206
+ nocache_headers();
207
+ header( 'Content-Type: application/json; charset=utf-8' );
208
+ header( 'Content-Disposition: attachment; filename=crp-settings-export-' . gmdate( 'm-d-Y' ) . '.json' );
209
+ header( 'Expires: 0' );
210
+
211
+ echo wp_json_encode( $settings );
212
+ exit;
213
+ }
214
+ add_action( 'admin_init', 'crp_process_settings_export' );
215
+
216
+ /**
217
+ * Process a settings import from a json file
218
+ *
219
+ * @since 2.9.0
220
+ */
221
+ function crp_process_settings_import() {
222
+
223
+ if ( empty( $_POST['crp_action'] ) || 'import_settings' !== $_POST['crp_action'] ) {
224
+ return;
225
+ }
226
+
227
+ if ( isset( $_POST['crp_import_settings_nonce'] ) && ! wp_verify_nonce( sanitize_key( $_POST['crp_import_settings_nonce'] ), 'crp_import_settings_nonce' ) ) {
228
+ return;
229
+ }
230
+
231
+ if ( ! current_user_can( 'manage_options' ) ) {
232
+ return;
233
+ }
234
+
235
+ $filename = 'import_settings_file';
236
+ $extension = isset( $_FILES[ $filename ]['name'] ) ? end( explode( '.', sanitize_file_name( wp_unslash( $_FILES[ $filename ]['name'] ) ) ) ) : '';
237
+
238
+ if ( 'json' !== $extension ) {
239
+ wp_die( esc_html__( 'Please upload a valid .json file', 'contextual-related-posts' ) );
240
+ }
241
+
242
+ $import_file = isset( $_FILES[ $filename ]['tmp_name'] ) ? ( wp_unslash( $_FILES[ $filename ]['tmp_name'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
243
+
244
+ if ( empty( $import_file ) ) {
245
+ wp_die( esc_html__( 'Please upload a file to import', 'contextual-related-posts' ) );
246
+ }
247
+
248
+ // Retrieve the settings from the file and convert the json object to an array.
249
+ $settings = (array) json_decode( file_get_contents( $import_file ), true ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
250
+
251
+ update_option( 'crp_settings', $settings );
252
+
253
+ wp_safe_redirect(
254
+ add_query_arg(
255
+ array(
256
+ 'page' => 'crp_tools_page',
257
+ 'settings_import' => 'success',
258
+ ),
259
+ admin_url( 'admin.php' )
260
+ )
261
+ );
262
+ exit;
263
+
264
+ }
265
+ add_action( 'admin_init', 'crp_process_settings_import', 9 );
266
+
includes/admin/save-settings.php CHANGED
@@ -316,7 +316,7 @@ function crp_change_settings_on_save( $settings ) {
316
  // Sanitize exclude_cat_slugs to save a new entry of exclude_categories.
317
  if ( isset( $settings['exclude_cat_slugs'] ) ) {
318
 
319
- $exclude_cat_slugs = array_unique( explode( ',', $settings['exclude_cat_slugs'] ) );
320
 
321
  foreach ( $exclude_cat_slugs as $cat_name ) {
322
  $cat = get_term_by( 'name', $cat_name, 'category' );
@@ -331,8 +331,7 @@ function crp_change_settings_on_save( $settings ) {
331
  }
332
  }
333
  $settings['exclude_categories'] = isset( $exclude_categories ) ? join( ',', $exclude_categories ) : '';
334
- $settings['exclude_cat_slugs'] = isset( $exclude_categories_slugs ) ? join( ',', $exclude_categories_slugs ) : '';
335
-
336
  }
337
 
338
  // Overwrite settings if rounded thumbnail style is selected.
316
  // Sanitize exclude_cat_slugs to save a new entry of exclude_categories.
317
  if ( isset( $settings['exclude_cat_slugs'] ) ) {
318
 
319
+ $exclude_cat_slugs = array_unique( str_getcsv( $settings['exclude_cat_slugs'] ) );
320
 
321
  foreach ( $exclude_cat_slugs as $cat_name ) {
322
  $cat = get_term_by( 'name', $cat_name, 'category' );
331
  }
332
  }
333
  $settings['exclude_categories'] = isset( $exclude_categories ) ? join( ',', $exclude_categories ) : '';
334
+ $settings['exclude_cat_slugs'] = isset( $exclude_categories_slugs ) ? crp_str_putcsv( $exclude_categories_slugs ) : '';
 
335
  }
336
 
337
  // Overwrite settings if rounded thumbnail style is selected.
includes/admin/settings-page.php CHANGED
@@ -272,7 +272,9 @@ function crp_textarea_callback( $args ) {
272
  $value = isset( $args['options'] ) ? $args['options'] : '';
273
  }
274
 
275
- $html = sprintf( '<textarea class="large-text" cols="50" rows="5" id="crp_settings[%1$s]" name="crp_settings[%1$s]">%2$s</textarea>', sanitize_key( $args['id'] ), esc_textarea( stripslashes( $value ) ) );
 
 
276
  $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
277
 
278
  /** This filter has been defined in settings-page.php */
272
  $value = isset( $args['options'] ) ? $args['options'] : '';
273
  }
274
 
275
+ $class = sanitize_html_class( $args['field_class'] );
276
+
277
+ $html = sprintf( '<textarea class="%3$s" cols="50" rows="20" id="ata_settings[%1$s]" name="ata_settings[%1$s]">%2$s</textarea>', sanitize_key( $args['id'] ), esc_textarea( stripslashes( $value ) ), 'large-text ' . $class );
278
  $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
279
 
280
  /** This filter has been defined in settings-page.php */
includes/content.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
includes/header.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
includes/i10n.php CHANGED
@@ -30,7 +30,10 @@ add_action( 'plugins_loaded', 'crp_lang_init' );
30
  */
31
  function crp_object_id_cur_lang( $post_id ) {
32
 
33
- $return_original_if_missing = true;
 
 
 
34
 
35
  /**
36
  * Filter to modify if the original language ID is returned.
@@ -42,14 +45,14 @@ function crp_object_id_cur_lang( $post_id ) {
42
  */
43
  $return_original_if_missing = apply_filters( 'crp_wpml_return_original', $return_original_if_missing, $post_id );
44
 
 
45
  if ( function_exists( 'pll_get_post' ) ) {
46
  $post_id = pll_get_post( $post_id );
47
- } elseif ( function_exists( 'wpml_object_id_filter' ) ) {
48
- $post_id = wpml_object_id_filter( $post_id, 'any', $return_original_if_missing );
49
- } elseif ( function_exists( 'icl_object_id' ) ) {
50
- $post_id = icl_object_id( $post_id, 'any', $return_original_if_missing );
51
  }
52
 
 
 
 
53
  /**
54
  * Filters object ID for current language (WPML).
55
  *
30
  */
31
  function crp_object_id_cur_lang( $post_id ) {
32
 
33
+ $return_original_if_missing = false;
34
+
35
+ $post = get_post( $post_id );
36
+ $current_lang = apply_filters( 'wpml_current_language', null );
37
 
38
  /**
39
  * Filter to modify if the original language ID is returned.
45
  */
46
  $return_original_if_missing = apply_filters( 'crp_wpml_return_original', $return_original_if_missing, $post_id );
47
 
48
+ // Polylang implementation.
49
  if ( function_exists( 'pll_get_post' ) ) {
50
  $post_id = pll_get_post( $post_id );
 
 
 
 
51
  }
52
 
53
+ // WPML implementation.
54
+ $post_id = apply_filters( 'wpml_object_id', $post_id, $post->post_type, $return_original_if_missing, $current_lang );
55
+
56
  /**
57
  * Filters object ID for current language (WPML).
58
  *
includes/main-query.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -45,6 +45,24 @@ function get_crp( $args = array() ) {
45
  // Parse incomming $args into an array and merge it with $defaults.
46
  $args = wp_parse_args( $args, $defaults );
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  // WPML support.
49
  if ( function_exists( 'wpml_object_id_filter' ) || function_exists( 'icl_object_id' ) ) {
50
  $args['strict_limit'] = false;
@@ -71,6 +89,9 @@ function get_crp( $args = array() ) {
71
  }
72
  }
73
 
 
 
 
74
  // Retrieve the list of posts.
75
  $results = get_crp_posts_id(
76
  array_merge(
@@ -193,17 +214,6 @@ function get_crp( $args = array() ) {
193
  }
194
  } // End foreach.
195
 
196
- if ( $args['show_credit'] ) {
197
-
198
- $output .= crp_before_list_item( $args, $result );
199
-
200
- /* translators: Link to plugin home page */
201
- $output .= sprintf( __( 'Powered by <a href="%s" rel="nofollow">Contextual Related Posts</a>', 'contextual-related-posts' ), esc_url( 'https://webberzone.com/plugins/contextual-related-posts/' ) );
202
-
203
- $output .= crp_after_list_item( $args, $result );
204
-
205
- }
206
-
207
  $output .= crp_after_list( $args );
208
 
209
  $clearfix = '<div class="crp_clear"></div>';
@@ -221,6 +231,17 @@ function get_crp( $args = array() ) {
221
  $output .= ( $args['blank_output'] ) ? ' ' : '<p>' . $args['blank_output_text'] . '</p>';
222
  }// End if.
223
 
 
 
 
 
 
 
 
 
 
 
 
224
  // Check if the opening list tag is missing in the output, it means all of our results were eliminated cause of the category filter.
225
  if ( false === ( strpos( $output, $args['before_list_item'] ) ) ) {
226
  $output = '<div id="crp_related">';
@@ -352,7 +373,7 @@ function get_crp_posts_id( $args = array() ) {
352
 
353
  if ( $args['match_content'] ) {
354
  $match_fields[] = 'post_content';
355
- $match_fields_content[] = crp_excerpt( $source_post->ID, $args['match_content_words'], false );
356
  }
357
 
358
  // If keyword is entered, override the matching content.
@@ -414,13 +435,15 @@ function get_crp_posts_id( $args = array() ) {
414
  /**
415
  * Filter the MATCH clause of the query.
416
  *
417
- * @since 2.1.0
 
418
  *
419
- * @param string $match The MATCH section of the WHERE clause of the query
420
- * @param string $stuff String to match fulltext with
421
- * @param int $source_post->ID Post ID
 
422
  */
423
- $match = apply_filters( 'crp_posts_match', $match, $stuff, $source_post->ID );
424
 
425
  // Create the maximum date limit. Show posts before today.
426
  $now_clause = $wpdb->prepare( " AND $wpdb->posts.post_date < %s ", $now );
@@ -480,6 +503,12 @@ function get_crp_posts_id( $args = array() ) {
480
 
481
  $where .= " AND $wpdb->posts.post_type IN ('" . join( "', '", $post_types ) . "') "; // Array of post types.
482
 
 
 
 
 
 
 
483
  // Create the base LIMITS clause.
484
  $limits .= $wpdb->prepare( ' LIMIT %d, %d ', $offset, $limit );
485
 
@@ -567,6 +596,32 @@ function get_crp_posts_id( $args = array() ) {
567
 
568
  $sql = "SELECT DISTINCT $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $having $orderby $limits";
569
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  // Support caching to speed up retrieval.
571
  if ( ! empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
572
 
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
45
  // Parse incomming $args into an array and merge it with $defaults.
46
  $args = wp_parse_args( $args, $defaults );
47
 
48
+ // Short circuit flag.
49
+ $short_circuit = false;
50
+
51
+ /**
52
+ * Allow a short circuit flag to be set to exit at this stage. Set to true to exit.
53
+ *
54
+ * @since 2.9.0
55
+ *
56
+ * @param bool $short_circuit Short circuit filter.
57
+ * @param object $post Current Post object.
58
+ * @param array $args Complete set of arguments.
59
+ */
60
+ $short_circuit = apply_filters( 'get_crp_short_circuit', $short_circuit, $post, $args );
61
+
62
+ if ( $short_circuit ) {
63
+ return false;
64
+ }
65
+
66
  // WPML support.
67
  if ( function_exists( 'wpml_object_id_filter' ) || function_exists( 'icl_object_id' ) ) {
68
  $args['strict_limit'] = false;
89
  }
90
  }
91
 
92
+ // Get thumbnail size.
93
+ list( $args['thumb_width'], $args['thumb_height'] ) = crp_get_thumb_size( $args );
94
+
95
  // Retrieve the list of posts.
96
  $results = get_crp_posts_id(
97
  array_merge(
214
  }
215
  } // End foreach.
216
 
 
 
 
 
 
 
 
 
 
 
 
217
  $output .= crp_after_list( $args );
218
 
219
  $clearfix = '<div class="crp_clear"></div>';
231
  $output .= ( $args['blank_output'] ) ? ' ' : '<p>' . $args['blank_output_text'] . '</p>';
232
  }// End if.
233
 
234
+ if ( $args['show_credit'] ) {
235
+
236
+ $output .= '<p class="crp_class_credit"><small>';
237
+
238
+ /* translators: Link to plugin home page */
239
+ $output .= sprintf( __( 'Powered by <a href="%s" rel="nofollow" style="float:none">Contextual Related Posts</a>', 'contextual-related-posts' ), esc_url( 'https://webberzone.com/plugins/contextual-related-posts/' ) );
240
+
241
+ $output .= '</small></p>';
242
+
243
+ }
244
+
245
  // Check if the opening list tag is missing in the output, it means all of our results were eliminated cause of the category filter.
246
  if ( false === ( strpos( $output, $args['before_list_item'] ) ) ) {
247
  $output = '<div id="crp_related">';
373
 
374
  if ( $args['match_content'] ) {
375
  $match_fields[] = 'post_content';
376
+ $match_fields_content[] = crp_excerpt( $source_post->ID, min( $args['match_content_words'], CRP_MAX_WORDS ), false );
377
  }
378
 
379
  // If keyword is entered, override the matching content.
435
  /**
436
  * Filter the MATCH clause of the query.
437
  *
438
+ * @since 2.1.0
439
+ * @since 2.9.0 $match_fields parameter added.
440
  *
441
+ * @param string $match The MATCH section of the WHERE clause of the query.
442
+ * @param string $stuff String to match fulltext with.
443
+ * @param int $source_post->ID Post ID.
444
+ * @param string $match_fields Fields to match.
445
  */
446
+ $match = apply_filters( 'crp_posts_match', $match, $stuff, $source_post->ID, $match_fields );
447
 
448
  // Create the maximum date limit. Show posts before today.
449
  $now_clause = $wpdb->prepare( " AND $wpdb->posts.post_date < %s ", $now );
503
 
504
  $where .= " AND $wpdb->posts.post_type IN ('" . join( "', '", $post_types ) . "') "; // Array of post types.
505
 
506
+ if ( isset( $args['include_cat_ids'] ) && ! empty( $args['include_cat_ids'] ) ) {
507
+ $include_cat_ids = $args['include_cat_ids'];
508
+
509
+ $where .= " AND $wpdb->posts.ID IN ( SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN ($include_cat_ids) )";
510
+ }
511
+
512
  // Create the base LIMITS clause.
513
  $limits .= $wpdb->prepare( ' LIMIT %d, %d ', $offset, $limit );
514
 
596
 
597
  $sql = "SELECT DISTINCT $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $having $orderby $limits";
598
 
599
+ // Short circuit flag.
600
+ $short_circuit = false;
601
+
602
+ /**
603
+ * Allow a short circuit flag to be set to exit at this stage. Set to true to exit.
604
+ *
605
+ * @since 2.9.0
606
+ *
607
+ * @param bool $short_circuit Short circuit filter.
608
+ * @param object $source_post Current Post object.
609
+ * @param array $args Complete set of arguments.
610
+ * @param string $sql SQL clause.
611
+ * @param string $fields The SELECT clause of the query.
612
+ * @param string $join The JOIN clause of the query.
613
+ * @param string $where The WHERE clause of the query.
614
+ * @param string $groupby The GROUP BY clause of the query.
615
+ * @param string $having The HAVING clause of the query.
616
+ * @param string $orderby The ORDER BY clause of the query.
617
+ * @param string $limits The LIMIT clause of the query.
618
+ */
619
+ $short_circuit = apply_filters( 'get_crp_posts_id_short_circuit', $short_circuit, $source_post, $args, $sql, $fields, $join, $where, $groupby, $having, $orderby, $limits );
620
+
621
+ if ( $short_circuit ) {
622
+ return false;
623
+ }
624
+
625
  // Support caching to speed up retrieval.
626
  if ( ! empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
627
 
includes/media.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -77,11 +77,17 @@ function crp_get_the_post_thumbnail( $args = array() ) {
77
  _deprecated_argument( __FUNCTION__, '2.1', esc_html__( 'filter argument has been deprecated', 'contextual-related-posts' ) );
78
  }
79
 
80
- $result = get_post( $args['postid'] );
81
- $post_title = $result->post_title;
 
 
 
 
 
82
 
83
  $output = '';
84
  $postimage = '';
 
85
 
86
  // Let's start fetching the thumbnail. First place to look is in the post meta defined in the Settings page.
87
  if ( ! $postimage ) {
@@ -90,7 +96,7 @@ function crp_get_the_post_thumbnail( $args = array() ) {
90
  if ( $postimage ) {
91
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
92
 
93
- if ( false != wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
94
  $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
95
  $postimage = $postthumb[0];
96
  }
@@ -104,7 +110,10 @@ function crp_get_the_post_thumbnail( $args = array() ) {
104
  $attachment_id = ( 'attachment' === $result->post_type ) ? $result->ID : get_post_thumbnail_id( $result->ID );
105
 
106
  $postthumb = wp_get_attachment_image_src( $attachment_id, array( $args['thumb_width'], $args['thumb_height'] ) );
107
- $postimage = $postthumb[0];
 
 
 
108
  }
109
  $pick = 'featured';
110
  }
@@ -125,20 +134,19 @@ function crp_get_the_post_thumbnail( $args = array() ) {
125
  $post_content = apply_filters( 'crp_thumb_post_content', $result->post_content, $result );
126
 
127
  preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post_content, $matches );
128
-
129
- if ( isset( $matches[1][0] ) && $matches[1][0] ) {
130
- $postimage = $matches[1][0]; // We need the first one only!
131
  }
 
132
  if ( $postimage ) {
133
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
134
 
135
  if ( false !== wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) {
136
  $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
137
  $postimage = $postthumb[0];
 
138
  }
139
- $pick = 'correct';
140
  }
141
- $pick .= 'first';
142
  }
143
 
144
  // If there is no thumbnail found, fetch the first child image.
@@ -150,13 +158,13 @@ function crp_get_the_post_thumbnail( $args = array() ) {
150
  // If no other thumbnail set, try to get the custom video thumbnail set by the Video Thumbnails plugin.
151
  if ( ! $postimage ) {
152
  $postimage = get_post_meta( $result->ID, '_video_thumbnail', true );
153
- $pick = 'video';
154
  }
155
 
156
  // If no thumb found and settings permit, use default thumb.
157
  if ( ! $postimage && $args['thumb_default_show'] ) {
158
  $postimage = $args['thumb_default'];
159
- $pick = 'default';
160
  }
161
 
162
  // Hopefully, we've found a thumbnail by now. If so, run it through the custom filter, check for SSL and create the image tag.
@@ -455,6 +463,49 @@ function crp_get_attachment_id_from_url( $attachment_url = '' ) {
455
  }
456
 
457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  /**
459
  * Get all image sizes.
460
  *
@@ -509,4 +560,3 @@ function crp_get_all_image_sizes( $size = '' ) {
509
  return apply_filters( 'crp_get_all_image_sizes', $sizes );
510
  }
511
 
512
-
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
77
  _deprecated_argument( __FUNCTION__, '2.1', esc_html__( 'filter argument has been deprecated', 'contextual-related-posts' ) );
78
  }
79
 
80
+ if ( is_int( $args['postid'] ) ) {
81
+ $result = get_post( $args['postid'] );
82
+ } else {
83
+ $result = $args['postid'];
84
+ }
85
+
86
+ $post_title = esc_attr( $result->post_title );
87
 
88
  $output = '';
89
  $postimage = '';
90
+ $pick = '';
91
 
92
  // Let's start fetching the thumbnail. First place to look is in the post meta defined in the Settings page.
93
  if ( ! $postimage ) {
96
  if ( $postimage ) {
97
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
98
 
99
+ if ( false !== wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) {
100
  $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
101
  $postimage = $postthumb[0];
102
  }
110
  $attachment_id = ( 'attachment' === $result->post_type ) ? $result->ID : get_post_thumbnail_id( $result->ID );
111
 
112
  $postthumb = wp_get_attachment_image_src( $attachment_id, array( $args['thumb_width'], $args['thumb_height'] ) );
113
+ if ( false !== $postthumb ) {
114
+ $postimage = $postthumb[0];
115
+ $pick = 'featured';
116
+ }
117
  }
118
  $pick = 'featured';
119
  }
134
  $post_content = apply_filters( 'crp_thumb_post_content', $result->post_content, $result );
135
 
136
  preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post_content, $matches );
137
+ if ( isset( $matches[1][0] ) && $matches[1][0] ) { // any image there?
138
+ $postimage = $matches[1][0]; // we need the first one only!
 
139
  }
140
+ $pick = 'first';
141
  if ( $postimage ) {
142
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
143
 
144
  if ( false !== wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) {
145
  $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
146
  $postimage = $postthumb[0];
147
+ $pick .= 'correct';
148
  }
 
149
  }
 
150
  }
151
 
152
  // If there is no thumbnail found, fetch the first child image.
158
  // If no other thumbnail set, try to get the custom video thumbnail set by the Video Thumbnails plugin.
159
  if ( ! $postimage ) {
160
  $postimage = get_post_meta( $result->ID, '_video_thumbnail', true );
161
+ $pick = 'video_thumb';
162
  }
163
 
164
  // If no thumb found and settings permit, use default thumb.
165
  if ( ! $postimage && $args['thumb_default_show'] ) {
166
  $postimage = $args['thumb_default'];
167
+ $pick = 'default_thumb';
168
  }
169
 
170
  // Hopefully, we've found a thumbnail by now. If so, run it through the custom filter, check for SSL and create the image tag.
463
  }
464
 
465
 
466
+ /**
467
+ * Function to get the correct height and width of the thumbnail.
468
+ *
469
+ * @since 2.9.0
470
+ *
471
+ * @param array $args Array of arguments.
472
+ * @return array Width and height
473
+ */
474
+ function crp_get_thumb_size( $args ) {
475
+
476
+ // Get thumbnail size.
477
+ $crp_thumb_size = crp_get_all_image_sizes( $args['thumb_size'] );
478
+
479
+ if ( isset( $crp_thumb_size['width'] ) ) {
480
+ $thumb_width = $crp_thumb_size['width'];
481
+ $thumb_height = $crp_thumb_size['height'];
482
+ }
483
+
484
+ if ( empty( $thumb_width ) || ( $args['is_widget'] && $thumb_width != $args['thumb_width'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
485
+ $thumb_width = $args['thumb_width'];
486
+ $args['thumb_html'] = 'css';
487
+ }
488
+
489
+ if ( empty( $thumb_height ) || ( $args['is_widget'] && $thumb_height != $args['thumb_height'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
490
+ $thumb_height = $args['thumb_height'];
491
+ $args['thumb_html'] = 'css';
492
+ }
493
+
494
+ $thumb_size = array( $thumb_width, $thumb_height );
495
+
496
+ /**
497
+ * Filter array of thumbnail size.
498
+ *
499
+ * @since 2.9.0
500
+ *
501
+ * @param array $thumb_size Array with width and height of thumbnail
502
+ * @param array $args Array of arguments
503
+ */
504
+ return apply_filters( 'crp_get_thumb_size', $thumb_size, $args );
505
+
506
+ }
507
+
508
+
509
  /**
510
  * Get all image sizes.
511
  *
560
  return apply_filters( 'crp_get_all_image_sizes', $sizes );
561
  }
562
 
 
includes/modules/class-crp-widget.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -45,17 +45,19 @@ class CRP_Widget extends WP_Widget {
45
  * @param array $instance Previously saved values from database.
46
  */
47
  public function form( $instance ) {
48
- $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
49
- $limit = isset( $instance['limit'] ) ? esc_attr( $instance['limit'] ) : '';
50
- $offset = isset( $instance['offset'] ) ? esc_attr( $instance['offset'] ) : '';
51
- $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
52
- $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
53
- $show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
54
- $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : '';
55
- $thumb_height = isset( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : '';
56
- $thumb_width = isset( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : '';
57
- $ordering = isset( $instance['ordering'] ) ? esc_attr( $instance['ordering'] ) : '';
58
- $random_order = isset( $instance['random_order'] ) ? esc_attr( $instance['random_order'] ) : '';
 
 
59
 
60
  // Parse the Post types.
61
  $post_types = array();
@@ -144,6 +146,13 @@ class CRP_Widget extends WP_Widget {
144
  <input id="<?php echo esc_attr( $this->get_field_id( 'random_order' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'random_order' ) ); ?>" type="checkbox" <?php checked( true, $random_order, true ); ?> /> <?php esc_html_e( ' Randomize posts', 'contextual-related-posts' ); ?>
145
  </label>
146
  </p>
 
 
 
 
 
 
 
147
  <p><?php esc_html_e( 'Post types to include', 'contextual-related-posts' ); ?>:<br />
148
 
149
  <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
@@ -206,6 +215,20 @@ class CRP_Widget extends WP_Widget {
206
  $post_types = array_intersect( $wp_post_types, $post_types );
207
  $instance['post_types'] = implode( ',', $post_types );
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  delete_post_meta_by_key( 'crp_related_posts_widget' ); // Delete the cache.
210
 
211
  /**
@@ -274,30 +297,32 @@ class CRP_Widget extends WP_Widget {
274
  }
275
  $offset = isset( $instance['offset'] ) ? $instance['offset'] : 0;
276
 
277
- $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
278
- $thumb_height = isset( $instance['thumb_height'] ) && ! empty( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : crp_get_option( 'thumb_height' );
279
- $thumb_width = isset( $instance['thumb_width'] ) && ! empty( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : crp_get_option( 'thumb_width' );
280
- $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
281
- $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
282
- $show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
283
- $ordering = isset( $instance['ordering'] ) ? esc_attr( $instance['ordering'] ) : '';
284
- $random_order = isset( $instance['random_order'] ) ? esc_attr( $instance['random_order'] ) : '';
285
- $post_types = isset( $instance['post_types'] ) && ! empty( $instance['post_types'] ) ? $instance['post_types'] : crp_get_option( 'post_types' );
 
286
 
287
  $arguments = array(
288
- 'is_widget' => 1,
289
- 'instance_id' => $this->number,
290
- 'limit' => $limit,
291
- 'offset' => $offset,
292
- 'show_excerpt' => $show_excerpt,
293
- 'show_author' => $show_author,
294
- 'show_date' => $show_date,
295
- 'post_thumb_op' => $post_thumb_op,
296
- 'thumb_height' => $thumb_height,
297
- 'thumb_width' => $thumb_width,
298
- 'ordering' => $ordering,
299
- 'random_order' => $random_order,
300
- 'post_types' => $post_types,
 
301
  );
302
 
303
  /**
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
45
  * @param array $instance Previously saved values from database.
46
  */
47
  public function form( $instance ) {
48
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
49
+ $limit = isset( $instance['limit'] ) ? esc_attr( $instance['limit'] ) : '';
50
+ $offset = isset( $instance['offset'] ) ? esc_attr( $instance['offset'] ) : '';
51
+ $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
52
+ $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
53
+ $show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
54
+ $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : '';
55
+ $thumb_height = isset( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : '';
56
+ $thumb_width = isset( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : '';
57
+ $ordering = isset( $instance['ordering'] ) ? esc_attr( $instance['ordering'] ) : '';
58
+ $random_order = isset( $instance['random_order'] ) ? esc_attr( $instance['random_order'] ) : '';
59
+ $include_categories = isset( $instance['include_categories'] ) ? esc_attr( $instance['include_categories'] ) : '';
60
+ $include_cat_ids = isset( $instance['include_cat_ids'] ) ? esc_attr( $instance['include_cat_ids'] ) : '';
61
 
62
  // Parse the Post types.
63
  $post_types = array();
146
  <input id="<?php echo esc_attr( $this->get_field_id( 'random_order' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'random_order' ) ); ?>" type="checkbox" <?php checked( true, $random_order, true ); ?> /> <?php esc_html_e( ' Randomize posts', 'contextual-related-posts' ); ?>
147
  </label>
148
  </p>
149
+ <p>
150
+ <label for="<?php echo esc_attr( $this->get_field_id( 'include_categories' ) ); ?>">
151
+ <?php esc_html_e( 'Only from categories', 'top-10' ); ?>:
152
+ <input class="widefat category_autocomplete" id="<?php echo esc_attr( $this->get_field_id( 'include_categories' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include_categories' ) ); ?>" type="text" value="<?php echo esc_attr( $include_categories ); ?>" />
153
+ </label>
154
+ <input type="hidden" id="<?php echo esc_attr( $this->get_field_id( 'include_cat_ids' ) ); ?>" name="<?php echo esc_attr( $this->get_field_id( 'include_cat_ids' ) ); ?>" value="<?php echo esc_attr( $include_cat_ids ); ?>" />
155
+ </p>
156
  <p><?php esc_html_e( 'Post types to include', 'contextual-related-posts' ); ?>:<br />
157
 
158
  <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
215
  $post_types = array_intersect( $wp_post_types, $post_types );
216
  $instance['post_types'] = implode( ',', $post_types );
217
 
218
+ // Save include_categories.
219
+ $include_categories = array_unique( str_getcsv( $new_instance['include_categories'] ) );
220
+
221
+ foreach ( $include_categories as $cat_name ) {
222
+ $cat = get_term_by( 'name', $cat_name, 'category' );
223
+
224
+ if ( isset( $cat->term_taxonomy_id ) ) {
225
+ $include_cat_ids[] = $cat->term_taxonomy_id;
226
+ $include_cat_names[] = $cat->name;
227
+ }
228
+ }
229
+ $instance['include_cat_ids'] = isset( $include_cat_ids ) ? join( ',', $include_cat_ids ) : '';
230
+ $instance['include_categories'] = isset( $include_cat_names ) ? tptn_str_putcsv( $include_cat_names ) : '';
231
+
232
  delete_post_meta_by_key( 'crp_related_posts_widget' ); // Delete the cache.
233
 
234
  /**
297
  }
298
  $offset = isset( $instance['offset'] ) ? $instance['offset'] : 0;
299
 
300
+ $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
301
+ $thumb_height = isset( $instance['thumb_height'] ) && ! empty( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : crp_get_option( 'thumb_height' );
302
+ $thumb_width = isset( $instance['thumb_width'] ) && ! empty( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : crp_get_option( 'thumb_width' );
303
+ $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
304
+ $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
305
+ $show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
306
+ $ordering = isset( $instance['ordering'] ) ? esc_attr( $instance['ordering'] ) : '';
307
+ $random_order = isset( $instance['random_order'] ) ? esc_attr( $instance['random_order'] ) : '';
308
+ $post_types = isset( $instance['post_types'] ) && ! empty( $instance['post_types'] ) ? $instance['post_types'] : crp_get_option( 'post_types' );
309
+ $include_cat_ids = isset( $instance['include_cat_ids'] ) ? esc_attr( $instance['include_cat_ids'] ) : '';
310
 
311
  $arguments = array(
312
+ 'is_widget' => 1,
313
+ 'instance_id' => $this->number,
314
+ 'limit' => $limit,
315
+ 'offset' => $offset,
316
+ 'show_excerpt' => $show_excerpt,
317
+ 'show_author' => $show_author,
318
+ 'show_date' => $show_date,
319
+ 'post_thumb_op' => $post_thumb_op,
320
+ 'thumb_height' => $thumb_height,
321
+ 'thumb_width' => $thumb_width,
322
+ 'ordering' => $ordering,
323
+ 'random_order' => $random_order,
324
+ 'post_types' => $post_types,
325
+ 'include_cat_ids' => $include_cat_ids,
326
  );
327
 
328
  /**
includes/modules/manual-posts.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author Ajay D'Souza
8
  * @license GPL-2.0+
9
  * @link https://webberzone.com
10
- * @copyright 2009-2019 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
7
  * @author Ajay D'Souza
8
  * @license GPL-2.0+
9
  * @link https://webberzone.com
10
+ * @copyright 2009-2020 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
includes/modules/shortcode.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author Ajay D'Souza
8
  * @license GPL-2.0+
9
  * @link https://webberzone.com
10
- * @copyright 2009-2019 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
7
  * @author Ajay D'Souza
8
  * @license GPL-2.0+
9
  * @link https://webberzone.com
10
+ * @copyright 2009-2020 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
includes/modules/taxonomies.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author Ajay D'Souza
8
  * @license GPL-2.0+
9
  * @link https://webberzone.com
10
- * @copyright 2009-2019 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
7
  * @author Ajay D'Souza
8
  * @license GPL-2.0+
9
  * @link https://webberzone.com
10
+ * @copyright 2009-2020 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
includes/output-generator.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -299,7 +299,7 @@ function crp_list_link( $args, $result ) {
299
  $link = crp_permalink( $args, $result );
300
  $link_attributes = crp_link_attributes( $args );
301
 
302
- $output .= '<a href="' . $link . '" ' . $link_attributes . '>';
303
 
304
  if ( 'after' === $args['post_thumb_op'] ) {
305
  $output .= '<span class="crp_title">' . $title . '</span>'; // Add title when required by settings.
@@ -308,7 +308,7 @@ function crp_list_link( $args, $result ) {
308
  if ( 'inline' === $args['post_thumb_op'] || 'after' === $args['post_thumb_op'] || 'thumbs_only' === $args['post_thumb_op'] ) {
309
  $output .= crp_get_the_post_thumbnail(
310
  array(
311
- 'postid' => $result->ID,
312
  'thumb_height' => $args['thumb_height'],
313
  'thumb_width' => $args['thumb_width'],
314
  'thumb_meta' => $args['thumb_meta'],
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
299
  $link = crp_permalink( $args, $result );
300
  $link_attributes = crp_link_attributes( $args );
301
 
302
+ $output .= '<a href="' . $link . '" ' . $link_attributes . ' class="' . $result->post_type . '-' . $result->ID . '">';
303
 
304
  if ( 'after' === $args['post_thumb_op'] ) {
305
  $output .= '<span class="crp_title">' . $title . '</span>'; // Add title when required by settings.
308
  if ( 'inline' === $args['post_thumb_op'] || 'after' === $args['post_thumb_op'] || 'thumbs_only' === $args['post_thumb_op'] ) {
309
  $output .= crp_get_the_post_thumbnail(
310
  array(
311
+ 'postid' => $result,
312
  'thumb_height' => $args['thumb_height'],
313
  'thumb_width' => $args['thumb_width'],
314
  'thumb_meta' => $args['thumb_meta'],
includes/plugin-activator.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
includes/tools.php CHANGED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -43,13 +43,15 @@ function crp_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
43
  * Filters excerpt generated by CRP before it is trimmed.
44
  *
45
  * @since 2.3.0
 
46
  *
47
- * @param array $output Formatted excerpt
48
  * @param int $id Post ID
49
  * @param int $excerpt_length Length of the excerpt
50
  * @param boolean $use_excerpt Use the excerpt?
 
51
  */
52
- $output = apply_filters( 'crp_excerpt_pre_trim', $output, $id, $excerpt_length, $use_excerpt );
53
 
54
  if ( 0 === (int) $excerpt_length || CRP_MAX_WORDS < (int) $excerpt_length ) {
55
  $excerpt_length = CRP_MAX_WORDS;
@@ -64,7 +66,7 @@ function crp_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
64
  *
65
  * @since 1.9
66
  *
67
- * @param array $output Formatted excerpt
68
  * @param int $id Post ID
69
  * @param int $excerpt_length Length of the excerpt
70
  * @param boolean $use_excerpt Use the excerpt?
@@ -183,3 +185,64 @@ function crp_posts_table_engine() {
183
 
184
  return $engine;
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
+ * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
43
  * Filters excerpt generated by CRP before it is trimmed.
44
  *
45
  * @since 2.3.0
46
+ * @since 2.9.0 Added $content parameter
47
  *
48
+ * @param string $output Formatted excerpt
49
  * @param int $id Post ID
50
  * @param int $excerpt_length Length of the excerpt
51
  * @param boolean $use_excerpt Use the excerpt?
52
+ * @param string $content Content that is used to create the excerpt.
53
  */
54
+ $output = apply_filters( 'crp_excerpt_pre_trim', $output, $id, $excerpt_length, $use_excerpt, $content );
55
 
56
  if ( 0 === (int) $excerpt_length || CRP_MAX_WORDS < (int) $excerpt_length ) {
57
  $excerpt_length = CRP_MAX_WORDS;
66
  *
67
  * @since 1.9
68
  *
69
+ * @param string $output Formatted excerpt
70
  * @param int $id Post ID
71
  * @param int $excerpt_length Length of the excerpt
72
  * @param boolean $use_excerpt Use the excerpt?
185
 
186
  return $engine;
187
  }
188
+
189
+ /**
190
+ * Convert a string to CSV.
191
+ *
192
+ * @since 2.9.0
193
+ *
194
+ * @param string $array Input string.
195
+ * @param string $delimiter Delimiter.
196
+ * @param string $enclosure Enclosure.
197
+ * @param string $terminator Terminating string.
198
+ * @return string CSV string.
199
+ */
200
+ function crp_str_putcsv( $array, $delimiter = ',', $enclosure = '"', $terminator = "\n" ) {
201
+ // First convert associative array to numeric indexed array.
202
+ $work_array = array();
203
+ foreach ( $array as $key => $value ) {
204
+ $work_array[] = $value;
205
+ }
206
+
207
+ $string = '';
208
+ $array_size = count( $work_array );
209
+
210
+ for ( $i = 0; $i < $array_size; $i++ ) {
211
+ // Nested array, process nest item.
212
+ if ( is_array( $work_array[ $i ] ) ) {
213
+ $string .= str_putcsv( $work_array[ $i ], $delimiter, $enclosure, $terminator );
214
+ } else {
215
+ switch ( gettype( $work_array[ $i ] ) ) {
216
+ // Manually set some strings.
217
+ case 'NULL':
218
+ $sp_format = '';
219
+ break;
220
+ case 'boolean':
221
+ $sp_format = ( true === $work_array[ $i ] ) ? 'true' : 'false';
222
+ break;
223
+ // Make sure sprintf has a good datatype to work with.
224
+ case 'integer':
225
+ $sp_format = '%i';
226
+ break;
227
+ case 'double':
228
+ $sp_format = '%0.2f';
229
+ break;
230
+ case 'string':
231
+ $sp_format = '%s';
232
+ $work_array[ $i ] = str_replace( "$enclosure", "$enclosure$enclosure", $work_array[ $i ] );
233
+ break;
234
+ // Unknown or invalid items for a csv - note: the datatype of array is already handled above, assuming the data is nested.
235
+ case 'object':
236
+ case 'resource':
237
+ default:
238
+ $sp_format = '';
239
+ break;
240
+ }
241
+ $string .= sprintf( '%2$s' . $sp_format . '%2$s', $work_array[ $i ], $enclosure );
242
+ $string .= ( $i < ( $array_size - 1 ) ) ? $delimiter : $terminator;
243
+ }
244
+ }
245
+
246
+ return $string;
247
+ }
248
+
languages/contextual-related-posts-en_US.mo CHANGED
Binary file
languages/contextual-related-posts-en_US.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Contextual Related Posts\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2019-12-30 14:25+0530\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
@@ -13,7 +13,7 @@ msgstr ""
13
  "X-Poedit-KeywordsList: __;_e;_c;__ngettext;esc_html__;esc_attr__;esc_html_e;"
14
  "esc_attr_e\n"
15
  "X-Poedit-Basepath: ..\n"
16
- "X-Generator: Poedit 2.2.4\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
  "X-Poedit-SearchPath-0: .\n"
@@ -26,19 +26,15 @@ msgstr ""
26
  msgid "Related Posts"
27
  msgstr ""
28
 
29
- #: includes/admin/admin.php:42 includes/admin/modules/tools.php:49
30
  msgid "Contextual Related Posts Tools"
31
  msgstr ""
32
 
33
- #: includes/admin/admin.php:43
34
  msgid "Tools"
35
  msgstr ""
36
 
37
- #: includes/admin/admin.php:189
38
- msgid "New information not saved. Do you wish to leave the page?"
39
- msgstr ""
40
-
41
- #: includes/admin/admin.php:234
42
  #, php-format
43
  msgid ""
44
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Contextual Related "
@@ -79,13 +75,13 @@ msgstr ""
79
 
80
  #: includes/admin/blocks/related-posts/index.js:146
81
  #: includes/admin/blocks/related-posts/index.min.js:1
82
- #: includes/modules/class-crp-widget.php:88
83
  msgid "No. of posts"
84
  msgstr ""
85
 
86
  #: includes/admin/blocks/related-posts/index.js:157
87
  #: includes/admin/blocks/related-posts/index.min.js:1
88
- #: includes/modules/class-crp-widget.php:93
89
  msgid "Offset"
90
  msgstr ""
91
 
@@ -108,7 +104,7 @@ msgstr ""
108
 
109
  #: includes/admin/blocks/related-posts/index.js:184
110
  #: includes/admin/blocks/related-posts/index.min.js:1
111
- #: includes/modules/class-crp-widget.php:112
112
  msgid "Thumbnail options"
113
  msgstr ""
114
 
@@ -344,7 +340,7 @@ msgid "No related posts found"
344
  msgstr ""
345
 
346
  #: includes/admin/default-settings.php:210
347
- #: includes/admin/default-settings.php:636
348
  msgid "Show post excerpt"
349
  msgstr ""
350
 
@@ -425,7 +421,7 @@ msgid "After each list item"
425
  msgstr ""
426
 
427
  #: includes/admin/default-settings.php:339
428
- #: includes/admin/default-settings.php:627
429
  msgid "Number of posts to display"
430
  msgstr ""
431
 
@@ -447,7 +443,7 @@ msgid ""
447
  msgstr ""
448
 
449
  #: includes/admin/default-settings.php:356
450
- #: includes/modules/class-crp-widget.php:130
451
  msgid "Order posts"
452
  msgstr ""
453
 
@@ -474,71 +470,71 @@ msgstr ""
474
  msgid "Limit content to be compared"
475
  msgstr ""
476
 
477
- #: includes/admin/default-settings.php:379
 
478
  msgid ""
479
  "This sets the maximum words of the content that will be matched. Set to 0 "
480
- "for no limit. Max value: 2,000. Only applies if you activate the above "
481
- "option."
482
  msgstr ""
483
 
484
- #: includes/admin/default-settings.php:387
485
- #: includes/modules/class-crp-widget.php:147
486
  msgid "Post types to include"
487
  msgstr ""
488
 
489
- #: includes/admin/default-settings.php:388
490
  msgid ""
491
  "At least one option should be selected above. Select which post types you "
492
  "want to include in the list of posts. This field can be overridden using a "
493
  "comma separated list of post types when using the manual display."
494
  msgstr ""
495
 
496
- #: includes/admin/default-settings.php:394
497
  msgid "Limit to same post type"
498
  msgstr ""
499
 
500
- #: includes/admin/default-settings.php:395
501
  msgid ""
502
  "If checked, the related posts will only be selected from the same post type "
503
  "of the current post."
504
  msgstr ""
505
 
506
- #: includes/admin/default-settings.php:401
507
  msgid "Limit to same author"
508
  msgstr ""
509
 
510
- #: includes/admin/default-settings.php:402
511
  msgid ""
512
  "If checked, the related posts will only be selected from the same author of "
513
  "the current post."
514
  msgstr ""
515
 
516
- #: includes/admin/default-settings.php:408
517
  msgid "Post/page IDs to exclude"
518
  msgstr ""
519
 
520
- #: includes/admin/default-settings.php:409
521
  msgid ""
522
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
523
  "188,320,500"
524
  msgstr ""
525
 
526
- #: includes/admin/default-settings.php:415
527
  msgid "Exclude Categories"
528
  msgstr ""
529
 
530
- #: includes/admin/default-settings.php:416
531
  msgid ""
532
  "Comma separated list of category slugs. The field above has an autocomplete "
533
  "so simply start typing in the starting letters and it will prompt you with "
534
  "options. Does not support custom taxonomies."
535
  msgstr ""
536
 
537
- #: includes/admin/default-settings.php:427
538
  msgid "Exclude category IDs"
539
  msgstr ""
540
 
541
- #: includes/admin/default-settings.php:428
542
  msgid ""
543
  "This is a readonly field that is automatically populated based on the above "
544
  "input when the settings are saved. These might differ from the IDs visible "
@@ -546,36 +542,36 @@ msgid ""
546
  "the term_taxonomy_id which is unique to this taxonomy."
547
  msgstr ""
548
 
549
- #: includes/admin/default-settings.php:458
550
- #: includes/admin/default-settings.php:643
551
  msgid "Location of the post thumbnail"
552
  msgstr ""
553
 
554
- #: includes/admin/default-settings.php:463
555
- #: includes/admin/default-settings.php:648
556
  msgid "Display thumbnails inline with posts, before title"
557
  msgstr ""
558
 
559
- #: includes/admin/default-settings.php:464
560
- #: includes/admin/default-settings.php:649
561
  msgid "Display thumbnails inline with posts, after title"
562
  msgstr ""
563
 
564
- #: includes/admin/default-settings.php:465
565
- #: includes/admin/default-settings.php:650
566
  msgid "Display only thumbnails, no text"
567
  msgstr ""
568
 
569
- #: includes/admin/default-settings.php:466
570
- #: includes/admin/default-settings.php:651
571
  msgid "Do not display thumbnails, only text"
572
  msgstr ""
573
 
574
- #: includes/admin/default-settings.php:471
575
  msgid "Thumbnail size"
576
  msgstr ""
577
 
578
- #: includes/admin/default-settings.php:472
579
  msgid ""
580
  "You can choose from existing image sizes above or create a custom size. If "
581
  "you have chosen Custom size above, then enter the width, height and crop "
@@ -583,125 +579,125 @@ msgid ""
583
  "width and/or height below, existing images will not be automatically resized."
584
  msgstr ""
585
 
586
- #: includes/admin/default-settings.php:474
587
  #, php-format
588
  msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
589
  msgstr ""
590
 
591
- #: includes/admin/default-settings.php:484
592
- #: includes/admin/default-settings.php:656
593
- #: includes/modules/class-crp-widget.php:127
594
  msgid "Thumbnail width"
595
  msgstr ""
596
 
597
- #: includes/admin/default-settings.php:493
598
- #: includes/admin/default-settings.php:665
599
- #: includes/modules/class-crp-widget.php:122
600
  msgid "Thumbnail height"
601
  msgstr ""
602
 
603
- #: includes/admin/default-settings.php:502
604
  msgid "Hard crop thumbnails"
605
  msgstr ""
606
 
607
- #: includes/admin/default-settings.php:503
608
  msgid ""
609
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
610
  "above vs. maintaining proportions."
611
  msgstr ""
612
 
613
- #: includes/admin/default-settings.php:509
614
  msgid "Generate thumbnail sizes"
615
  msgstr ""
616
 
617
- #: includes/admin/default-settings.php:510
618
  msgid ""
619
  "If you select this option and Custom size is selected above, the plugin will "
620
  "register the image size with WordPress to create new thumbnails. Does not "
621
  "update old images as explained above."
622
  msgstr ""
623
 
624
- #: includes/admin/default-settings.php:516
625
  msgid "Thumbnail size attributes"
626
  msgstr ""
627
 
628
- #: includes/admin/default-settings.php:522
629
  #, php-format
630
  msgid "Use CSS to set the width and height: e.g. %s"
631
  msgstr ""
632
 
633
- #: includes/admin/default-settings.php:524
634
  #, php-format
635
  msgid "Use HTML attributes to set the width and height: e.g. %s"
636
  msgstr ""
637
 
638
- #: includes/admin/default-settings.php:525
639
  msgid ""
640
  "No width or height set. You will need to use external styles to force any "
641
  "width or height of your choice."
642
  msgstr ""
643
 
644
- #: includes/admin/default-settings.php:530
645
  msgid "Thumbnail meta field name"
646
  msgstr ""
647
 
648
- #: includes/admin/default-settings.php:531
649
  msgid ""
650
  "The value of this field should contain the URL of the image and can be set "
651
  "in the metabox in the Edit Post screen"
652
  msgstr ""
653
 
654
- #: includes/admin/default-settings.php:537
655
  msgid "Get first image"
656
  msgstr ""
657
 
658
- #: includes/admin/default-settings.php:538
659
  msgid ""
660
  "The plugin will fetch the first image in the post content if this is "
661
  "enabled. This can slow down the loading of your page if the first image in "
662
  "the followed posts is large in file-size."
663
  msgstr ""
664
 
665
- #: includes/admin/default-settings.php:544
666
  msgid "Use default thumbnail?"
667
  msgstr ""
668
 
669
- #: includes/admin/default-settings.php:545
670
  msgid ""
671
  "If checked, when no thumbnail is found, show a default one from the URL "
672
  "below. If not checked and no thumbnail is found, no image will be shown."
673
  msgstr ""
674
 
675
- #: includes/admin/default-settings.php:551 includes/admin/settings-page.php:746
676
  msgid "Default thumbnail"
677
  msgstr ""
678
 
679
- #: includes/admin/default-settings.php:552
680
  msgid ""
681
  "Enter the full URL of the image that you wish to display if no thumbnail is "
682
  "found. This image will be displayed below."
683
  msgstr ""
684
 
685
- #: includes/admin/default-settings.php:582
686
  msgid "Related Posts style"
687
  msgstr ""
688
 
689
- #: includes/admin/default-settings.php:590
690
  msgid "Custom CSS"
691
  msgstr ""
692
 
693
- #: includes/admin/default-settings.php:592
694
  #, php-format
695
  msgid ""
696
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
697
  "CSS classes to style."
698
  msgstr ""
699
 
700
- #: includes/admin/default-settings.php:621
701
  msgid "About this tab"
702
  msgstr ""
703
 
704
- #: includes/admin/default-settings.php:622
705
  msgid ""
706
  "Below options override the related posts settings for your blog feed. These "
707
  "only apply if you have selected to add related posts to Feeds in the General "
@@ -709,42 +705,42 @@ msgid ""
709
  "way to style the related posts in the feed."
710
  msgstr ""
711
 
712
- #: includes/admin/default-settings.php:742
713
  msgid "No styles"
714
  msgstr ""
715
 
716
- #: includes/admin/default-settings.php:743
717
  msgid "Select this option if you plan to add your own styles"
718
  msgstr ""
719
 
720
- #: includes/admin/default-settings.php:747
721
  msgid "Text only"
722
  msgstr ""
723
 
724
- #: includes/admin/default-settings.php:748
725
  msgid "Disable thumbnails and no longer include the default style sheet"
726
  msgstr ""
727
 
728
- #: includes/admin/default-settings.php:752
729
  msgid "Rounded thumbnails"
730
  msgstr ""
731
 
732
- #: includes/admin/default-settings.php:753
733
  msgid ""
734
  "Enabling this option will turn on the thumbnails and force their width and "
735
  "height. It will also turn off the display of the author, excerpt and date if "
736
  "already enabled. Disabling this option will not revert any settings."
737
  msgstr ""
738
 
739
- #: includes/admin/default-settings.php:776
740
  msgid "By relevance"
741
  msgstr ""
742
 
743
- #: includes/admin/default-settings.php:777
744
  msgid "Randomly"
745
  msgstr ""
746
 
747
- #: includes/admin/default-settings.php:778
748
  msgid "By date"
749
  msgstr ""
750
 
@@ -990,44 +986,72 @@ msgstr ""
990
  msgid "Indices have been recreated"
991
  msgstr ""
992
 
993
- #: includes/admin/modules/tools.php:53
 
 
 
 
994
  msgid "Visit the Settings page"
995
  msgstr ""
996
 
997
- #: includes/admin/modules/tools.php:65 includes/admin/modules/tools.php:67
998
  msgid "Clear cache"
999
  msgstr ""
1000
 
1001
- #: includes/admin/modules/tools.php:70
1002
  msgid ""
1003
  "Clear the Contextual Related Posts cache. This will also be cleared "
1004
  "automatically when you save the settings page."
1005
  msgstr ""
1006
 
1007
- #: includes/admin/modules/tools.php:73 includes/admin/modules/tools.php:75
1008
  msgid "Recreate Indices"
1009
  msgstr ""
1010
 
1011
- #: includes/admin/modules/tools.php:78
1012
  msgid ""
1013
  "Deletes and recreates the FULLTEXT index in the posts table. If the above "
1014
  "function gives an error, then you can run the below code in phpMyAdmin or "
1015
  "Adminer. Remember to backup your database first!"
1016
  msgstr ""
1017
 
1018
- #: includes/admin/modules/tools.php:84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1019
  msgid "Other tools"
1020
  msgstr ""
1021
 
1022
- #: includes/admin/modules/tools.php:86
1023
  msgid "Delete old settings"
1024
  msgstr ""
1025
 
1026
- #: includes/admin/modules/tools.php:86
1027
  msgid "This will delete the settings before v2.6.x. Proceed?"
1028
  msgstr ""
1029
 
1030
- #: includes/admin/modules/tools.php:89
1031
  msgid ""
1032
  "From v2.6.x, Contextual Related Posts stores the settings in a new key in "
1033
  "the database. This will delete the old settings for the current blog. It is "
@@ -1035,6 +1059,14 @@ msgid ""
1035
  "should do this only if you are comfortable with the new settings."
1036
  msgstr ""
1037
 
 
 
 
 
 
 
 
 
1038
  #: includes/admin/save-settings.php:51
1039
  msgid ""
1040
  "Settings have been reset to their default values. Reload this page to view "
@@ -1095,18 +1127,18 @@ msgid ""
1095
  "The callback function used for the <strong>%s</strong> setting is missing."
1096
  msgstr ""
1097
 
1098
- #: includes/admin/settings-page.php:316
1099
  msgid "Modified from default setting"
1100
  msgstr ""
1101
 
1102
- #: includes/admin/settings-page.php:768
1103
  msgid ""
1104
  "This option cannot be changed because of the selected related posts style. "
1105
  "To modify this option, you will need to select No styles or Text only in the "
1106
  "Styles tab"
1107
  msgstr ""
1108
 
1109
- #: includes/admin/settings-page.php:772
1110
  msgid ""
1111
  "This option cannot be changed because of the selected related posts style. "
1112
  "To modify this option, you will need to select No styles in the Styles tab"
@@ -1164,9 +1196,11 @@ msgstr ""
1164
  msgid "<h3>Related Posts:</h3>"
1165
  msgstr ""
1166
 
1167
- #: includes/main-query.php:201
1168
  #, php-format
1169
- msgid "Powered by <a href=\"%s\" rel=\"nofollow\">Contextual Related Posts</a>"
 
 
1170
  msgstr ""
1171
 
1172
  #: includes/media.php:69
@@ -1185,42 +1219,46 @@ msgstr ""
1185
  msgid "Display Related Posts"
1186
  msgstr ""
1187
 
1188
- #: includes/modules/class-crp-widget.php:83
1189
  msgid "Title"
1190
  msgstr ""
1191
 
1192
- #: includes/modules/class-crp-widget.php:98
1193
  msgid " Show excerpt?"
1194
  msgstr ""
1195
 
1196
- #: includes/modules/class-crp-widget.php:103
1197
  msgid " Show author?"
1198
  msgstr ""
1199
 
1200
- #: includes/modules/class-crp-widget.php:108
1201
  msgid " Show date?"
1202
  msgstr ""
1203
 
1204
- #: includes/modules/class-crp-widget.php:114
1205
  msgid "Thumbnails inline, before title"
1206
  msgstr ""
1207
 
1208
- #: includes/modules/class-crp-widget.php:115
1209
  msgid "Thumbnails inline, after title"
1210
  msgstr ""
1211
 
1212
- #: includes/modules/class-crp-widget.php:116
1213
  msgid "Only thumbnails, no text"
1214
  msgstr ""
1215
 
1216
- #: includes/modules/class-crp-widget.php:117
1217
  msgid "No thumbnails, only text."
1218
  msgstr ""
1219
 
1220
- #: includes/modules/class-crp-widget.php:144
1221
  msgid " Randomize posts"
1222
  msgstr ""
1223
 
 
 
 
 
1224
  #: includes/output-generator.php:239
1225
  msgid " by "
1226
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Contextual Related Posts\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2020-04-18 10:45+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
13
  "X-Poedit-KeywordsList: __;_e;_c;__ngettext;esc_html__;esc_attr__;esc_html_e;"
14
  "esc_attr_e\n"
15
  "X-Poedit-Basepath: ..\n"
16
+ "X-Generator: Poedit 2.3\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
  "X-Poedit-SearchPath-0: .\n"
26
  msgid "Related Posts"
27
  msgstr ""
28
 
29
+ #: includes/admin/admin.php:41 includes/admin/modules/tools.php:54
30
  msgid "Contextual Related Posts Tools"
31
  msgstr ""
32
 
33
+ #: includes/admin/admin.php:42
34
  msgid "Tools"
35
  msgstr ""
36
 
37
+ #: includes/admin/admin.php:70
 
 
 
 
38
  #, php-format
39
  msgid ""
40
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Contextual Related "
75
 
76
  #: includes/admin/blocks/related-posts/index.js:146
77
  #: includes/admin/blocks/related-posts/index.min.js:1
78
+ #: includes/modules/class-crp-widget.php:90
79
  msgid "No. of posts"
80
  msgstr ""
81
 
82
  #: includes/admin/blocks/related-posts/index.js:157
83
  #: includes/admin/blocks/related-posts/index.min.js:1
84
+ #: includes/modules/class-crp-widget.php:95
85
  msgid "Offset"
86
  msgstr ""
87
 
104
 
105
  #: includes/admin/blocks/related-posts/index.js:184
106
  #: includes/admin/blocks/related-posts/index.min.js:1
107
+ #: includes/modules/class-crp-widget.php:114
108
  msgid "Thumbnail options"
109
  msgstr ""
110
 
340
  msgstr ""
341
 
342
  #: includes/admin/default-settings.php:210
343
+ #: includes/admin/default-settings.php:638
344
  msgid "Show post excerpt"
345
  msgstr ""
346
 
421
  msgstr ""
422
 
423
  #: includes/admin/default-settings.php:339
424
+ #: includes/admin/default-settings.php:629
425
  msgid "Number of posts to display"
426
  msgstr ""
427
 
443
  msgstr ""
444
 
445
  #: includes/admin/default-settings.php:356
446
+ #: includes/modules/class-crp-widget.php:132
447
  msgid "Order posts"
448
  msgstr ""
449
 
470
  msgid "Limit content to be compared"
471
  msgstr ""
472
 
473
+ #: includes/admin/default-settings.php:380
474
+ #, php-format
475
  msgid ""
476
  "This sets the maximum words of the content that will be matched. Set to 0 "
477
+ "for no limit. Max value: %1$s. Only applies if you activate the above option."
 
478
  msgstr ""
479
 
480
+ #: includes/admin/default-settings.php:388
481
+ #: includes/modules/class-crp-widget.php:156
482
  msgid "Post types to include"
483
  msgstr ""
484
 
485
+ #: includes/admin/default-settings.php:389
486
  msgid ""
487
  "At least one option should be selected above. Select which post types you "
488
  "want to include in the list of posts. This field can be overridden using a "
489
  "comma separated list of post types when using the manual display."
490
  msgstr ""
491
 
492
+ #: includes/admin/default-settings.php:395
493
  msgid "Limit to same post type"
494
  msgstr ""
495
 
496
+ #: includes/admin/default-settings.php:396
497
  msgid ""
498
  "If checked, the related posts will only be selected from the same post type "
499
  "of the current post."
500
  msgstr ""
501
 
502
+ #: includes/admin/default-settings.php:402
503
  msgid "Limit to same author"
504
  msgstr ""
505
 
506
+ #: includes/admin/default-settings.php:403
507
  msgid ""
508
  "If checked, the related posts will only be selected from the same author of "
509
  "the current post."
510
  msgstr ""
511
 
512
+ #: includes/admin/default-settings.php:409
513
  msgid "Post/page IDs to exclude"
514
  msgstr ""
515
 
516
+ #: includes/admin/default-settings.php:410
517
  msgid ""
518
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
519
  "188,320,500"
520
  msgstr ""
521
 
522
+ #: includes/admin/default-settings.php:416
523
  msgid "Exclude Categories"
524
  msgstr ""
525
 
526
+ #: includes/admin/default-settings.php:417
527
  msgid ""
528
  "Comma separated list of category slugs. The field above has an autocomplete "
529
  "so simply start typing in the starting letters and it will prompt you with "
530
  "options. Does not support custom taxonomies."
531
  msgstr ""
532
 
533
+ #: includes/admin/default-settings.php:428
534
  msgid "Exclude category IDs"
535
  msgstr ""
536
 
537
+ #: includes/admin/default-settings.php:429
538
  msgid ""
539
  "This is a readonly field that is automatically populated based on the above "
540
  "input when the settings are saved. These might differ from the IDs visible "
542
  "the term_taxonomy_id which is unique to this taxonomy."
543
  msgstr ""
544
 
545
+ #: includes/admin/default-settings.php:459
546
+ #: includes/admin/default-settings.php:645
547
  msgid "Location of the post thumbnail"
548
  msgstr ""
549
 
550
+ #: includes/admin/default-settings.php:464
551
+ #: includes/admin/default-settings.php:650
552
  msgid "Display thumbnails inline with posts, before title"
553
  msgstr ""
554
 
555
+ #: includes/admin/default-settings.php:465
556
+ #: includes/admin/default-settings.php:651
557
  msgid "Display thumbnails inline with posts, after title"
558
  msgstr ""
559
 
560
+ #: includes/admin/default-settings.php:466
561
+ #: includes/admin/default-settings.php:652
562
  msgid "Display only thumbnails, no text"
563
  msgstr ""
564
 
565
+ #: includes/admin/default-settings.php:467
566
+ #: includes/admin/default-settings.php:653
567
  msgid "Do not display thumbnails, only text"
568
  msgstr ""
569
 
570
+ #: includes/admin/default-settings.php:472
571
  msgid "Thumbnail size"
572
  msgstr ""
573
 
574
+ #: includes/admin/default-settings.php:473
575
  msgid ""
576
  "You can choose from existing image sizes above or create a custom size. If "
577
  "you have chosen Custom size above, then enter the width, height and crop "
579
  "width and/or height below, existing images will not be automatically resized."
580
  msgstr ""
581
 
582
+ #: includes/admin/default-settings.php:475
583
  #, php-format
584
  msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
585
  msgstr ""
586
 
587
+ #: includes/admin/default-settings.php:485
588
+ #: includes/admin/default-settings.php:658
589
+ #: includes/modules/class-crp-widget.php:129
590
  msgid "Thumbnail width"
591
  msgstr ""
592
 
593
+ #: includes/admin/default-settings.php:494
594
+ #: includes/admin/default-settings.php:667
595
+ #: includes/modules/class-crp-widget.php:124
596
  msgid "Thumbnail height"
597
  msgstr ""
598
 
599
+ #: includes/admin/default-settings.php:503
600
  msgid "Hard crop thumbnails"
601
  msgstr ""
602
 
603
+ #: includes/admin/default-settings.php:504
604
  msgid ""
605
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
606
  "above vs. maintaining proportions."
607
  msgstr ""
608
 
609
+ #: includes/admin/default-settings.php:510
610
  msgid "Generate thumbnail sizes"
611
  msgstr ""
612
 
613
+ #: includes/admin/default-settings.php:511
614
  msgid ""
615
  "If you select this option and Custom size is selected above, the plugin will "
616
  "register the image size with WordPress to create new thumbnails. Does not "
617
  "update old images as explained above."
618
  msgstr ""
619
 
620
+ #: includes/admin/default-settings.php:517
621
  msgid "Thumbnail size attributes"
622
  msgstr ""
623
 
624
+ #: includes/admin/default-settings.php:523
625
  #, php-format
626
  msgid "Use CSS to set the width and height: e.g. %s"
627
  msgstr ""
628
 
629
+ #: includes/admin/default-settings.php:525
630
  #, php-format
631
  msgid "Use HTML attributes to set the width and height: e.g. %s"
632
  msgstr ""
633
 
634
+ #: includes/admin/default-settings.php:526
635
  msgid ""
636
  "No width or height set. You will need to use external styles to force any "
637
  "width or height of your choice."
638
  msgstr ""
639
 
640
+ #: includes/admin/default-settings.php:531
641
  msgid "Thumbnail meta field name"
642
  msgstr ""
643
 
644
+ #: includes/admin/default-settings.php:532
645
  msgid ""
646
  "The value of this field should contain the URL of the image and can be set "
647
  "in the metabox in the Edit Post screen"
648
  msgstr ""
649
 
650
+ #: includes/admin/default-settings.php:538
651
  msgid "Get first image"
652
  msgstr ""
653
 
654
+ #: includes/admin/default-settings.php:539
655
  msgid ""
656
  "The plugin will fetch the first image in the post content if this is "
657
  "enabled. This can slow down the loading of your page if the first image in "
658
  "the followed posts is large in file-size."
659
  msgstr ""
660
 
661
+ #: includes/admin/default-settings.php:545
662
  msgid "Use default thumbnail?"
663
  msgstr ""
664
 
665
+ #: includes/admin/default-settings.php:546
666
  msgid ""
667
  "If checked, when no thumbnail is found, show a default one from the URL "
668
  "below. If not checked and no thumbnail is found, no image will be shown."
669
  msgstr ""
670
 
671
+ #: includes/admin/default-settings.php:552 includes/admin/settings-page.php:748
672
  msgid "Default thumbnail"
673
  msgstr ""
674
 
675
+ #: includes/admin/default-settings.php:553
676
  msgid ""
677
  "Enter the full URL of the image that you wish to display if no thumbnail is "
678
  "found. This image will be displayed below."
679
  msgstr ""
680
 
681
+ #: includes/admin/default-settings.php:583
682
  msgid "Related Posts style"
683
  msgstr ""
684
 
685
+ #: includes/admin/default-settings.php:591
686
  msgid "Custom CSS"
687
  msgstr ""
688
 
689
+ #: includes/admin/default-settings.php:593
690
  #, php-format
691
  msgid ""
692
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
693
  "CSS classes to style."
694
  msgstr ""
695
 
696
+ #: includes/admin/default-settings.php:623
697
  msgid "About this tab"
698
  msgstr ""
699
 
700
+ #: includes/admin/default-settings.php:624
701
  msgid ""
702
  "Below options override the related posts settings for your blog feed. These "
703
  "only apply if you have selected to add related posts to Feeds in the General "
705
  "way to style the related posts in the feed."
706
  msgstr ""
707
 
708
+ #: includes/admin/default-settings.php:744
709
  msgid "No styles"
710
  msgstr ""
711
 
712
+ #: includes/admin/default-settings.php:745
713
  msgid "Select this option if you plan to add your own styles"
714
  msgstr ""
715
 
716
+ #: includes/admin/default-settings.php:749
717
  msgid "Text only"
718
  msgstr ""
719
 
720
+ #: includes/admin/default-settings.php:750
721
  msgid "Disable thumbnails and no longer include the default style sheet"
722
  msgstr ""
723
 
724
+ #: includes/admin/default-settings.php:754
725
  msgid "Rounded thumbnails"
726
  msgstr ""
727
 
728
+ #: includes/admin/default-settings.php:755
729
  msgid ""
730
  "Enabling this option will turn on the thumbnails and force their width and "
731
  "height. It will also turn off the display of the author, excerpt and date if "
732
  "already enabled. Disabling this option will not revert any settings."
733
  msgstr ""
734
 
735
+ #: includes/admin/default-settings.php:778
736
  msgid "By relevance"
737
  msgstr ""
738
 
739
+ #: includes/admin/default-settings.php:779
740
  msgid "Randomly"
741
  msgstr ""
742
 
743
+ #: includes/admin/default-settings.php:780
744
  msgid "By date"
745
  msgstr ""
746
 
986
  msgid "Indices have been recreated"
987
  msgstr ""
988
 
989
+ #: includes/admin/modules/tools.php:48
990
+ msgid "Settings have been imported successfully"
991
+ msgstr ""
992
+
993
+ #: includes/admin/modules/tools.php:58
994
  msgid "Visit the Settings page"
995
  msgstr ""
996
 
997
+ #: includes/admin/modules/tools.php:70 includes/admin/modules/tools.php:72
998
  msgid "Clear cache"
999
  msgstr ""
1000
 
1001
+ #: includes/admin/modules/tools.php:75
1002
  msgid ""
1003
  "Clear the Contextual Related Posts cache. This will also be cleared "
1004
  "automatically when you save the settings page."
1005
  msgstr ""
1006
 
1007
+ #: includes/admin/modules/tools.php:78 includes/admin/modules/tools.php:80
1008
  msgid "Recreate Indices"
1009
  msgstr ""
1010
 
1011
+ #: includes/admin/modules/tools.php:83
1012
  msgid ""
1013
  "Deletes and recreates the FULLTEXT index in the posts table. If the above "
1014
  "function gives an error, then you can run the below code in phpMyAdmin or "
1015
  "Adminer. Remember to backup your database first!"
1016
  msgstr ""
1017
 
1018
+ #: includes/admin/modules/tools.php:94
1019
+ msgid "Export/Import settings"
1020
+ msgstr ""
1021
+
1022
+ #: includes/admin/modules/tools.php:96
1023
+ msgid ""
1024
+ "Export the plugin settings for this site as a .json file. This allows you to "
1025
+ "easily import the configuration into another site."
1026
+ msgstr ""
1027
+
1028
+ #: includes/admin/modules/tools.php:100
1029
+ msgid "Export Settings"
1030
+ msgstr ""
1031
+
1032
+ #: includes/admin/modules/tools.php:109
1033
+ msgid ""
1034
+ "Import the plugin settings from a .json file. This file can be obtained by "
1035
+ "exporting the settings on another site using the form above."
1036
+ msgstr ""
1037
+
1038
+ #: includes/admin/modules/tools.php:115
1039
+ msgid "Import Settings"
1040
+ msgstr ""
1041
+
1042
+ #: includes/admin/modules/tools.php:124
1043
  msgid "Other tools"
1044
  msgstr ""
1045
 
1046
+ #: includes/admin/modules/tools.php:126
1047
  msgid "Delete old settings"
1048
  msgstr ""
1049
 
1050
+ #: includes/admin/modules/tools.php:126
1051
  msgid "This will delete the settings before v2.6.x. Proceed?"
1052
  msgstr ""
1053
 
1054
+ #: includes/admin/modules/tools.php:129
1055
  msgid ""
1056
  "From v2.6.x, Contextual Related Posts stores the settings in a new key in "
1057
  "the database. This will delete the old settings for the current blog. It is "
1059
  "should do this only if you are comfortable with the new settings."
1060
  msgstr ""
1061
 
1062
+ #: includes/admin/modules/tools.php:239
1063
+ msgid "Please upload a valid .json file"
1064
+ msgstr ""
1065
+
1066
+ #: includes/admin/modules/tools.php:245
1067
+ msgid "Please upload a file to import"
1068
+ msgstr ""
1069
+
1070
  #: includes/admin/save-settings.php:51
1071
  msgid ""
1072
  "Settings have been reset to their default values. Reload this page to view "
1127
  "The callback function used for the <strong>%s</strong> setting is missing."
1128
  msgstr ""
1129
 
1130
+ #: includes/admin/settings-page.php:318
1131
  msgid "Modified from default setting"
1132
  msgstr ""
1133
 
1134
+ #: includes/admin/settings-page.php:770
1135
  msgid ""
1136
  "This option cannot be changed because of the selected related posts style. "
1137
  "To modify this option, you will need to select No styles or Text only in the "
1138
  "Styles tab"
1139
  msgstr ""
1140
 
1141
+ #: includes/admin/settings-page.php:774
1142
  msgid ""
1143
  "This option cannot be changed because of the selected related posts style. "
1144
  "To modify this option, you will need to select No styles in the Styles tab"
1196
  msgid "<h3>Related Posts:</h3>"
1197
  msgstr ""
1198
 
1199
+ #: includes/main-query.php:239
1200
  #, php-format
1201
+ msgid ""
1202
+ "Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
1203
+ "Related Posts</a>"
1204
  msgstr ""
1205
 
1206
  #: includes/media.php:69
1219
  msgid "Display Related Posts"
1220
  msgstr ""
1221
 
1222
+ #: includes/modules/class-crp-widget.php:85
1223
  msgid "Title"
1224
  msgstr ""
1225
 
1226
+ #: includes/modules/class-crp-widget.php:100
1227
  msgid " Show excerpt?"
1228
  msgstr ""
1229
 
1230
+ #: includes/modules/class-crp-widget.php:105
1231
  msgid " Show author?"
1232
  msgstr ""
1233
 
1234
+ #: includes/modules/class-crp-widget.php:110
1235
  msgid " Show date?"
1236
  msgstr ""
1237
 
1238
+ #: includes/modules/class-crp-widget.php:116
1239
  msgid "Thumbnails inline, before title"
1240
  msgstr ""
1241
 
1242
+ #: includes/modules/class-crp-widget.php:117
1243
  msgid "Thumbnails inline, after title"
1244
  msgstr ""
1245
 
1246
+ #: includes/modules/class-crp-widget.php:118
1247
  msgid "Only thumbnails, no text"
1248
  msgstr ""
1249
 
1250
+ #: includes/modules/class-crp-widget.php:119
1251
  msgid "No thumbnails, only text."
1252
  msgstr ""
1253
 
1254
+ #: includes/modules/class-crp-widget.php:146
1255
  msgid " Randomize posts"
1256
  msgstr ""
1257
 
1258
+ #: includes/modules/class-crp-widget.php:151
1259
+ msgid "Only from categories"
1260
+ msgstr ""
1261
+
1262
  #: includes/output-generator.php:239
1263
  msgid " by "
1264
  msgstr ""
languages/contextual-related-posts-en_US.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Contextual Related Posts\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2019-12-30 14:25+0530\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: plugins@webberzone.com\n"
@@ -14,7 +14,7 @@ msgstr ""
14
  "X-Poedit-KeywordsList: __;_e;_c;__ngettext;esc_html__;esc_html_e;esc_attr__;"
15
  "esc_attr_e\n"
16
  "X-Poedit-Basepath: ..\n"
17
- "X-Generator: Poedit 2.2.4\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
@@ -26,19 +26,15 @@ msgstr ""
26
  msgid "Related Posts"
27
  msgstr ""
28
 
29
- #: includes/admin/admin.php:42 includes/admin/modules/tools.php:49
30
  msgid "Contextual Related Posts Tools"
31
  msgstr ""
32
 
33
- #: includes/admin/admin.php:43
34
  msgid "Tools"
35
  msgstr ""
36
 
37
- #: includes/admin/admin.php:189
38
- msgid "New information not saved. Do you wish to leave the page?"
39
- msgstr ""
40
-
41
- #: includes/admin/admin.php:234
42
  #, php-format
43
  msgid ""
44
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Contextual Related "
@@ -79,13 +75,13 @@ msgstr ""
79
 
80
  #: includes/admin/blocks/related-posts/index.js:146
81
  #: includes/admin/blocks/related-posts/index.min.js:1
82
- #: includes/modules/class-crp-widget.php:88
83
  msgid "No. of posts"
84
  msgstr ""
85
 
86
  #: includes/admin/blocks/related-posts/index.js:157
87
  #: includes/admin/blocks/related-posts/index.min.js:1
88
- #: includes/modules/class-crp-widget.php:93
89
  msgid "Offset"
90
  msgstr ""
91
 
@@ -108,7 +104,7 @@ msgstr ""
108
 
109
  #: includes/admin/blocks/related-posts/index.js:184
110
  #: includes/admin/blocks/related-posts/index.min.js:1
111
- #: includes/modules/class-crp-widget.php:112
112
  msgid "Thumbnail options"
113
  msgstr ""
114
 
@@ -344,7 +340,7 @@ msgid "No related posts found"
344
  msgstr ""
345
 
346
  #: includes/admin/default-settings.php:210
347
- #: includes/admin/default-settings.php:636
348
  msgid "Show post excerpt"
349
  msgstr ""
350
 
@@ -425,7 +421,7 @@ msgid "After each list item"
425
  msgstr ""
426
 
427
  #: includes/admin/default-settings.php:339
428
- #: includes/admin/default-settings.php:627
429
  msgid "Number of posts to display"
430
  msgstr ""
431
 
@@ -447,7 +443,7 @@ msgid ""
447
  msgstr ""
448
 
449
  #: includes/admin/default-settings.php:356
450
- #: includes/modules/class-crp-widget.php:130
451
  msgid "Order posts"
452
  msgstr ""
453
 
@@ -474,71 +470,71 @@ msgstr ""
474
  msgid "Limit content to be compared"
475
  msgstr ""
476
 
477
- #: includes/admin/default-settings.php:379
 
478
  msgid ""
479
  "This sets the maximum words of the content that will be matched. Set to 0 "
480
- "for no limit. Max value: 2,000. Only applies if you activate the above "
481
- "option."
482
  msgstr ""
483
 
484
- #: includes/admin/default-settings.php:387
485
- #: includes/modules/class-crp-widget.php:147
486
  msgid "Post types to include"
487
  msgstr ""
488
 
489
- #: includes/admin/default-settings.php:388
490
  msgid ""
491
  "At least one option should be selected above. Select which post types you "
492
  "want to include in the list of posts. This field can be overridden using a "
493
  "comma separated list of post types when using the manual display."
494
  msgstr ""
495
 
496
- #: includes/admin/default-settings.php:394
497
  msgid "Limit to same post type"
498
  msgstr ""
499
 
500
- #: includes/admin/default-settings.php:395
501
  msgid ""
502
  "If checked, the related posts will only be selected from the same post type "
503
  "of the current post."
504
  msgstr ""
505
 
506
- #: includes/admin/default-settings.php:401
507
  msgid "Limit to same author"
508
  msgstr ""
509
 
510
- #: includes/admin/default-settings.php:402
511
  msgid ""
512
  "If checked, the related posts will only be selected from the same author of "
513
  "the current post."
514
  msgstr ""
515
 
516
- #: includes/admin/default-settings.php:408
517
  msgid "Post/page IDs to exclude"
518
  msgstr ""
519
 
520
- #: includes/admin/default-settings.php:409
521
  msgid ""
522
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
523
  "188,320,500"
524
  msgstr ""
525
 
526
- #: includes/admin/default-settings.php:415
527
  msgid "Exclude Categories"
528
  msgstr ""
529
 
530
- #: includes/admin/default-settings.php:416
531
  msgid ""
532
  "Comma separated list of category slugs. The field above has an autocomplete "
533
  "so simply start typing in the starting letters and it will prompt you with "
534
  "options. Does not support custom taxonomies."
535
  msgstr ""
536
 
537
- #: includes/admin/default-settings.php:427
538
  msgid "Exclude category IDs"
539
  msgstr ""
540
 
541
- #: includes/admin/default-settings.php:428
542
  msgid ""
543
  "This is a readonly field that is automatically populated based on the above "
544
  "input when the settings are saved. These might differ from the IDs visible "
@@ -546,36 +542,36 @@ msgid ""
546
  "the term_taxonomy_id which is unique to this taxonomy."
547
  msgstr ""
548
 
549
- #: includes/admin/default-settings.php:458
550
- #: includes/admin/default-settings.php:643
551
  msgid "Location of the post thumbnail"
552
  msgstr ""
553
 
554
- #: includes/admin/default-settings.php:463
555
- #: includes/admin/default-settings.php:648
556
  msgid "Display thumbnails inline with posts, before title"
557
  msgstr ""
558
 
559
- #: includes/admin/default-settings.php:464
560
- #: includes/admin/default-settings.php:649
561
  msgid "Display thumbnails inline with posts, after title"
562
  msgstr ""
563
 
564
- #: includes/admin/default-settings.php:465
565
- #: includes/admin/default-settings.php:650
566
  msgid "Display only thumbnails, no text"
567
  msgstr ""
568
 
569
- #: includes/admin/default-settings.php:466
570
- #: includes/admin/default-settings.php:651
571
  msgid "Do not display thumbnails, only text"
572
  msgstr ""
573
 
574
- #: includes/admin/default-settings.php:471
575
  msgid "Thumbnail size"
576
  msgstr ""
577
 
578
- #: includes/admin/default-settings.php:472
579
  msgid ""
580
  "You can choose from existing image sizes above or create a custom size. If "
581
  "you have chosen Custom size above, then enter the width, height and crop "
@@ -583,125 +579,125 @@ msgid ""
583
  "width and/or height below, existing images will not be automatically resized."
584
  msgstr ""
585
 
586
- #: includes/admin/default-settings.php:474
587
  #, php-format
588
  msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
589
  msgstr ""
590
 
591
- #: includes/admin/default-settings.php:484
592
- #: includes/admin/default-settings.php:656
593
- #: includes/modules/class-crp-widget.php:127
594
  msgid "Thumbnail width"
595
  msgstr ""
596
 
597
- #: includes/admin/default-settings.php:493
598
- #: includes/admin/default-settings.php:665
599
- #: includes/modules/class-crp-widget.php:122
600
  msgid "Thumbnail height"
601
  msgstr ""
602
 
603
- #: includes/admin/default-settings.php:502
604
  msgid "Hard crop thumbnails"
605
  msgstr ""
606
 
607
- #: includes/admin/default-settings.php:503
608
  msgid ""
609
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
610
  "above vs. maintaining proportions."
611
  msgstr ""
612
 
613
- #: includes/admin/default-settings.php:509
614
  msgid "Generate thumbnail sizes"
615
  msgstr ""
616
 
617
- #: includes/admin/default-settings.php:510
618
  msgid ""
619
  "If you select this option and Custom size is selected above, the plugin will "
620
  "register the image size with WordPress to create new thumbnails. Does not "
621
  "update old images as explained above."
622
  msgstr ""
623
 
624
- #: includes/admin/default-settings.php:516
625
  msgid "Thumbnail size attributes"
626
  msgstr ""
627
 
628
- #: includes/admin/default-settings.php:522
629
  #, php-format
630
  msgid "Use CSS to set the width and height: e.g. %s"
631
  msgstr ""
632
 
633
- #: includes/admin/default-settings.php:524
634
  #, php-format
635
  msgid "Use HTML attributes to set the width and height: e.g. %s"
636
  msgstr ""
637
 
638
- #: includes/admin/default-settings.php:525
639
  msgid ""
640
  "No width or height set. You will need to use external styles to force any "
641
  "width or height of your choice."
642
  msgstr ""
643
 
644
- #: includes/admin/default-settings.php:530
645
  msgid "Thumbnail meta field name"
646
  msgstr ""
647
 
648
- #: includes/admin/default-settings.php:531
649
  msgid ""
650
  "The value of this field should contain the URL of the image and can be set "
651
  "in the metabox in the Edit Post screen"
652
  msgstr ""
653
 
654
- #: includes/admin/default-settings.php:537
655
  msgid "Get first image"
656
  msgstr ""
657
 
658
- #: includes/admin/default-settings.php:538
659
  msgid ""
660
  "The plugin will fetch the first image in the post content if this is "
661
  "enabled. This can slow down the loading of your page if the first image in "
662
  "the followed posts is large in file-size."
663
  msgstr ""
664
 
665
- #: includes/admin/default-settings.php:544
666
  msgid "Use default thumbnail?"
667
  msgstr ""
668
 
669
- #: includes/admin/default-settings.php:545
670
  msgid ""
671
  "If checked, when no thumbnail is found, show a default one from the URL "
672
  "below. If not checked and no thumbnail is found, no image will be shown."
673
  msgstr ""
674
 
675
- #: includes/admin/default-settings.php:551 includes/admin/settings-page.php:746
676
  msgid "Default thumbnail"
677
  msgstr ""
678
 
679
- #: includes/admin/default-settings.php:552
680
  msgid ""
681
  "Enter the full URL of the image that you wish to display if no thumbnail is "
682
  "found. This image will be displayed below."
683
  msgstr ""
684
 
685
- #: includes/admin/default-settings.php:582
686
  msgid "Related Posts style"
687
  msgstr ""
688
 
689
- #: includes/admin/default-settings.php:590
690
  msgid "Custom CSS"
691
  msgstr ""
692
 
693
- #: includes/admin/default-settings.php:592
694
  #, php-format
695
  msgid ""
696
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
697
  "CSS classes to style."
698
  msgstr ""
699
 
700
- #: includes/admin/default-settings.php:621
701
  msgid "About this tab"
702
  msgstr ""
703
 
704
- #: includes/admin/default-settings.php:622
705
  msgid ""
706
  "Below options override the related posts settings for your blog feed. These "
707
  "only apply if you have selected to add related posts to Feeds in the General "
@@ -709,42 +705,42 @@ msgid ""
709
  "way to style the related posts in the feed."
710
  msgstr ""
711
 
712
- #: includes/admin/default-settings.php:742
713
  msgid "No styles"
714
  msgstr ""
715
 
716
- #: includes/admin/default-settings.php:743
717
  msgid "Select this option if you plan to add your own styles"
718
  msgstr ""
719
 
720
- #: includes/admin/default-settings.php:747
721
  msgid "Text only"
722
  msgstr ""
723
 
724
- #: includes/admin/default-settings.php:748
725
  msgid "Disable thumbnails and no longer include the default style sheet"
726
  msgstr ""
727
 
728
- #: includes/admin/default-settings.php:752
729
  msgid "Rounded thumbnails"
730
  msgstr ""
731
 
732
- #: includes/admin/default-settings.php:753
733
  msgid ""
734
  "Enabling this option will turn on the thumbnails and force their width and "
735
  "height. It will also turn off the display of the author, excerpt and date if "
736
  "already enabled. Disabling this option will not revert any settings."
737
  msgstr ""
738
 
739
- #: includes/admin/default-settings.php:776
740
  msgid "By relevance"
741
  msgstr ""
742
 
743
- #: includes/admin/default-settings.php:777
744
  msgid "Randomly"
745
  msgstr ""
746
 
747
- #: includes/admin/default-settings.php:778
748
  msgid "By date"
749
  msgstr ""
750
 
@@ -990,44 +986,72 @@ msgstr ""
990
  msgid "Indices have been recreated"
991
  msgstr ""
992
 
993
- #: includes/admin/modules/tools.php:53
 
 
 
 
994
  msgid "Visit the Settings page"
995
  msgstr ""
996
 
997
- #: includes/admin/modules/tools.php:65 includes/admin/modules/tools.php:67
998
  msgid "Clear cache"
999
  msgstr ""
1000
 
1001
- #: includes/admin/modules/tools.php:70
1002
  msgid ""
1003
  "Clear the Contextual Related Posts cache. This will also be cleared "
1004
  "automatically when you save the settings page."
1005
  msgstr ""
1006
 
1007
- #: includes/admin/modules/tools.php:73 includes/admin/modules/tools.php:75
1008
  msgid "Recreate Indices"
1009
  msgstr ""
1010
 
1011
- #: includes/admin/modules/tools.php:78
1012
  msgid ""
1013
  "Deletes and recreates the FULLTEXT index in the posts table. If the above "
1014
  "function gives an error, then you can run the below code in phpMyAdmin or "
1015
  "Adminer. Remember to backup your database first!"
1016
  msgstr ""
1017
 
1018
- #: includes/admin/modules/tools.php:84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1019
  msgid "Other tools"
1020
  msgstr ""
1021
 
1022
- #: includes/admin/modules/tools.php:86
1023
  msgid "Delete old settings"
1024
  msgstr ""
1025
 
1026
- #: includes/admin/modules/tools.php:86
1027
  msgid "This will delete the settings before v2.6.x. Proceed?"
1028
  msgstr ""
1029
 
1030
- #: includes/admin/modules/tools.php:89
1031
  msgid ""
1032
  "From v2.6.x, Contextual Related Posts stores the settings in a new key in "
1033
  "the database. This will delete the old settings for the current blog. It is "
@@ -1035,6 +1059,14 @@ msgid ""
1035
  "should do this only if you are comfortable with the new settings."
1036
  msgstr ""
1037
 
 
 
 
 
 
 
 
 
1038
  #: includes/admin/save-settings.php:51
1039
  msgid ""
1040
  "Settings have been reset to their default values. Reload this page to view "
@@ -1095,18 +1127,18 @@ msgid ""
1095
  "The callback function used for the <strong>%s</strong> setting is missing."
1096
  msgstr ""
1097
 
1098
- #: includes/admin/settings-page.php:316
1099
  msgid "Modified from default setting"
1100
  msgstr ""
1101
 
1102
- #: includes/admin/settings-page.php:768
1103
  msgid ""
1104
  "This option cannot be changed because of the selected related posts style. "
1105
  "To modify this option, you will need to select No styles or Text only in the "
1106
  "Styles tab"
1107
  msgstr ""
1108
 
1109
- #: includes/admin/settings-page.php:772
1110
  msgid ""
1111
  "This option cannot be changed because of the selected related posts style. "
1112
  "To modify this option, you will need to select No styles in the Styles tab"
@@ -1164,9 +1196,11 @@ msgstr ""
1164
  msgid "<h3>Related Posts:</h3>"
1165
  msgstr ""
1166
 
1167
- #: includes/main-query.php:201
1168
  #, php-format
1169
- msgid "Powered by <a href=\"%s\" rel=\"nofollow\">Contextual Related Posts</a>"
 
 
1170
  msgstr ""
1171
 
1172
  #: includes/media.php:69
@@ -1185,42 +1219,46 @@ msgstr ""
1185
  msgid "Display Related Posts"
1186
  msgstr ""
1187
 
1188
- #: includes/modules/class-crp-widget.php:83
1189
  msgid "Title"
1190
  msgstr ""
1191
 
1192
- #: includes/modules/class-crp-widget.php:98
1193
  msgid " Show excerpt?"
1194
  msgstr ""
1195
 
1196
- #: includes/modules/class-crp-widget.php:103
1197
  msgid " Show author?"
1198
  msgstr ""
1199
 
1200
- #: includes/modules/class-crp-widget.php:108
1201
  msgid " Show date?"
1202
  msgstr ""
1203
 
1204
- #: includes/modules/class-crp-widget.php:114
1205
  msgid "Thumbnails inline, before title"
1206
  msgstr ""
1207
 
1208
- #: includes/modules/class-crp-widget.php:115
1209
  msgid "Thumbnails inline, after title"
1210
  msgstr ""
1211
 
1212
- #: includes/modules/class-crp-widget.php:116
1213
  msgid "Only thumbnails, no text"
1214
  msgstr ""
1215
 
1216
- #: includes/modules/class-crp-widget.php:117
1217
  msgid "No thumbnails, only text."
1218
  msgstr ""
1219
 
1220
- #: includes/modules/class-crp-widget.php:144
1221
  msgid " Randomize posts"
1222
  msgstr ""
1223
 
 
 
 
 
1224
  #: includes/output-generator.php:239
1225
  msgid " by "
1226
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: Contextual Related Posts\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2020-04-18 10:45+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: plugins@webberzone.com\n"
14
  "X-Poedit-KeywordsList: __;_e;_c;__ngettext;esc_html__;esc_html_e;esc_attr__;"
15
  "esc_attr_e\n"
16
  "X-Poedit-Basepath: ..\n"
17
+ "X-Generator: Poedit 2.3\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
26
  msgid "Related Posts"
27
  msgstr ""
28
 
29
+ #: includes/admin/admin.php:41 includes/admin/modules/tools.php:54
30
  msgid "Contextual Related Posts Tools"
31
  msgstr ""
32
 
33
+ #: includes/admin/admin.php:42
34
  msgid "Tools"
35
  msgstr ""
36
 
37
+ #: includes/admin/admin.php:70
 
 
 
 
38
  #, php-format
39
  msgid ""
40
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Contextual Related "
75
 
76
  #: includes/admin/blocks/related-posts/index.js:146
77
  #: includes/admin/blocks/related-posts/index.min.js:1
78
+ #: includes/modules/class-crp-widget.php:90
79
  msgid "No. of posts"
80
  msgstr ""
81
 
82
  #: includes/admin/blocks/related-posts/index.js:157
83
  #: includes/admin/blocks/related-posts/index.min.js:1
84
+ #: includes/modules/class-crp-widget.php:95
85
  msgid "Offset"
86
  msgstr ""
87
 
104
 
105
  #: includes/admin/blocks/related-posts/index.js:184
106
  #: includes/admin/blocks/related-posts/index.min.js:1
107
+ #: includes/modules/class-crp-widget.php:114
108
  msgid "Thumbnail options"
109
  msgstr ""
110
 
340
  msgstr ""
341
 
342
  #: includes/admin/default-settings.php:210
343
+ #: includes/admin/default-settings.php:638
344
  msgid "Show post excerpt"
345
  msgstr ""
346
 
421
  msgstr ""
422
 
423
  #: includes/admin/default-settings.php:339
424
+ #: includes/admin/default-settings.php:629
425
  msgid "Number of posts to display"
426
  msgstr ""
427
 
443
  msgstr ""
444
 
445
  #: includes/admin/default-settings.php:356
446
+ #: includes/modules/class-crp-widget.php:132
447
  msgid "Order posts"
448
  msgstr ""
449
 
470
  msgid "Limit content to be compared"
471
  msgstr ""
472
 
473
+ #: includes/admin/default-settings.php:380
474
+ #, php-format
475
  msgid ""
476
  "This sets the maximum words of the content that will be matched. Set to 0 "
477
+ "for no limit. Max value: %1$s. Only applies if you activate the above option."
 
478
  msgstr ""
479
 
480
+ #: includes/admin/default-settings.php:388
481
+ #: includes/modules/class-crp-widget.php:156
482
  msgid "Post types to include"
483
  msgstr ""
484
 
485
+ #: includes/admin/default-settings.php:389
486
  msgid ""
487
  "At least one option should be selected above. Select which post types you "
488
  "want to include in the list of posts. This field can be overridden using a "
489
  "comma separated list of post types when using the manual display."
490
  msgstr ""
491
 
492
+ #: includes/admin/default-settings.php:395
493
  msgid "Limit to same post type"
494
  msgstr ""
495
 
496
+ #: includes/admin/default-settings.php:396
497
  msgid ""
498
  "If checked, the related posts will only be selected from the same post type "
499
  "of the current post."
500
  msgstr ""
501
 
502
+ #: includes/admin/default-settings.php:402
503
  msgid "Limit to same author"
504
  msgstr ""
505
 
506
+ #: includes/admin/default-settings.php:403
507
  msgid ""
508
  "If checked, the related posts will only be selected from the same author of "
509
  "the current post."
510
  msgstr ""
511
 
512
+ #: includes/admin/default-settings.php:409
513
  msgid "Post/page IDs to exclude"
514
  msgstr ""
515
 
516
+ #: includes/admin/default-settings.php:410
517
  msgid ""
518
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
519
  "188,320,500"
520
  msgstr ""
521
 
522
+ #: includes/admin/default-settings.php:416
523
  msgid "Exclude Categories"
524
  msgstr ""
525
 
526
+ #: includes/admin/default-settings.php:417
527
  msgid ""
528
  "Comma separated list of category slugs. The field above has an autocomplete "
529
  "so simply start typing in the starting letters and it will prompt you with "
530
  "options. Does not support custom taxonomies."
531
  msgstr ""
532
 
533
+ #: includes/admin/default-settings.php:428
534
  msgid "Exclude category IDs"
535
  msgstr ""
536
 
537
+ #: includes/admin/default-settings.php:429
538
  msgid ""
539
  "This is a readonly field that is automatically populated based on the above "
540
  "input when the settings are saved. These might differ from the IDs visible "
542
  "the term_taxonomy_id which is unique to this taxonomy."
543
  msgstr ""
544
 
545
+ #: includes/admin/default-settings.php:459
546
+ #: includes/admin/default-settings.php:645
547
  msgid "Location of the post thumbnail"
548
  msgstr ""
549
 
550
+ #: includes/admin/default-settings.php:464
551
+ #: includes/admin/default-settings.php:650
552
  msgid "Display thumbnails inline with posts, before title"
553
  msgstr ""
554
 
555
+ #: includes/admin/default-settings.php:465
556
+ #: includes/admin/default-settings.php:651
557
  msgid "Display thumbnails inline with posts, after title"
558
  msgstr ""
559
 
560
+ #: includes/admin/default-settings.php:466
561
+ #: includes/admin/default-settings.php:652
562
  msgid "Display only thumbnails, no text"
563
  msgstr ""
564
 
565
+ #: includes/admin/default-settings.php:467
566
+ #: includes/admin/default-settings.php:653
567
  msgid "Do not display thumbnails, only text"
568
  msgstr ""
569
 
570
+ #: includes/admin/default-settings.php:472
571
  msgid "Thumbnail size"
572
  msgstr ""
573
 
574
+ #: includes/admin/default-settings.php:473
575
  msgid ""
576
  "You can choose from existing image sizes above or create a custom size. If "
577
  "you have chosen Custom size above, then enter the width, height and crop "
579
  "width and/or height below, existing images will not be automatically resized."
580
  msgstr ""
581
 
582
+ #: includes/admin/default-settings.php:475
583
  #, php-format
584
  msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
585
  msgstr ""
586
 
587
+ #: includes/admin/default-settings.php:485
588
+ #: includes/admin/default-settings.php:658
589
+ #: includes/modules/class-crp-widget.php:129
590
  msgid "Thumbnail width"
591
  msgstr ""
592
 
593
+ #: includes/admin/default-settings.php:494
594
+ #: includes/admin/default-settings.php:667
595
+ #: includes/modules/class-crp-widget.php:124
596
  msgid "Thumbnail height"
597
  msgstr ""
598
 
599
+ #: includes/admin/default-settings.php:503
600
  msgid "Hard crop thumbnails"
601
  msgstr ""
602
 
603
+ #: includes/admin/default-settings.php:504
604
  msgid ""
605
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
606
  "above vs. maintaining proportions."
607
  msgstr ""
608
 
609
+ #: includes/admin/default-settings.php:510
610
  msgid "Generate thumbnail sizes"
611
  msgstr ""
612
 
613
+ #: includes/admin/default-settings.php:511
614
  msgid ""
615
  "If you select this option and Custom size is selected above, the plugin will "
616
  "register the image size with WordPress to create new thumbnails. Does not "
617
  "update old images as explained above."
618
  msgstr ""
619
 
620
+ #: includes/admin/default-settings.php:517
621
  msgid "Thumbnail size attributes"
622
  msgstr ""
623
 
624
+ #: includes/admin/default-settings.php:523
625
  #, php-format
626
  msgid "Use CSS to set the width and height: e.g. %s"
627
  msgstr ""
628
 
629
+ #: includes/admin/default-settings.php:525
630
  #, php-format
631
  msgid "Use HTML attributes to set the width and height: e.g. %s"
632
  msgstr ""
633
 
634
+ #: includes/admin/default-settings.php:526
635
  msgid ""
636
  "No width or height set. You will need to use external styles to force any "
637
  "width or height of your choice."
638
  msgstr ""
639
 
640
+ #: includes/admin/default-settings.php:531
641
  msgid "Thumbnail meta field name"
642
  msgstr ""
643
 
644
+ #: includes/admin/default-settings.php:532
645
  msgid ""
646
  "The value of this field should contain the URL of the image and can be set "
647
  "in the metabox in the Edit Post screen"
648
  msgstr ""
649
 
650
+ #: includes/admin/default-settings.php:538
651
  msgid "Get first image"
652
  msgstr ""
653
 
654
+ #: includes/admin/default-settings.php:539
655
  msgid ""
656
  "The plugin will fetch the first image in the post content if this is "
657
  "enabled. This can slow down the loading of your page if the first image in "
658
  "the followed posts is large in file-size."
659
  msgstr ""
660
 
661
+ #: includes/admin/default-settings.php:545
662
  msgid "Use default thumbnail?"
663
  msgstr ""
664
 
665
+ #: includes/admin/default-settings.php:546
666
  msgid ""
667
  "If checked, when no thumbnail is found, show a default one from the URL "
668
  "below. If not checked and no thumbnail is found, no image will be shown."
669
  msgstr ""
670
 
671
+ #: includes/admin/default-settings.php:552 includes/admin/settings-page.php:748
672
  msgid "Default thumbnail"
673
  msgstr ""
674
 
675
+ #: includes/admin/default-settings.php:553
676
  msgid ""
677
  "Enter the full URL of the image that you wish to display if no thumbnail is "
678
  "found. This image will be displayed below."
679
  msgstr ""
680
 
681
+ #: includes/admin/default-settings.php:583
682
  msgid "Related Posts style"
683
  msgstr ""
684
 
685
+ #: includes/admin/default-settings.php:591
686
  msgid "Custom CSS"
687
  msgstr ""
688
 
689
+ #: includes/admin/default-settings.php:593
690
  #, php-format
691
  msgid ""
692
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
693
  "CSS classes to style."
694
  msgstr ""
695
 
696
+ #: includes/admin/default-settings.php:623
697
  msgid "About this tab"
698
  msgstr ""
699
 
700
+ #: includes/admin/default-settings.php:624
701
  msgid ""
702
  "Below options override the related posts settings for your blog feed. These "
703
  "only apply if you have selected to add related posts to Feeds in the General "
705
  "way to style the related posts in the feed."
706
  msgstr ""
707
 
708
+ #: includes/admin/default-settings.php:744
709
  msgid "No styles"
710
  msgstr ""
711
 
712
+ #: includes/admin/default-settings.php:745
713
  msgid "Select this option if you plan to add your own styles"
714
  msgstr ""
715
 
716
+ #: includes/admin/default-settings.php:749
717
  msgid "Text only"
718
  msgstr ""
719
 
720
+ #: includes/admin/default-settings.php:750
721
  msgid "Disable thumbnails and no longer include the default style sheet"
722
  msgstr ""
723
 
724
+ #: includes/admin/default-settings.php:754
725
  msgid "Rounded thumbnails"
726
  msgstr ""
727
 
728
+ #: includes/admin/default-settings.php:755
729
  msgid ""
730
  "Enabling this option will turn on the thumbnails and force their width and "
731
  "height. It will also turn off the display of the author, excerpt and date if "
732
  "already enabled. Disabling this option will not revert any settings."
733
  msgstr ""
734
 
735
+ #: includes/admin/default-settings.php:778
736
  msgid "By relevance"
737
  msgstr ""
738
 
739
+ #: includes/admin/default-settings.php:779
740
  msgid "Randomly"
741
  msgstr ""
742
 
743
+ #: includes/admin/default-settings.php:780
744
  msgid "By date"
745
  msgstr ""
746
 
986
  msgid "Indices have been recreated"
987
  msgstr ""
988
 
989
+ #: includes/admin/modules/tools.php:48
990
+ msgid "Settings have been imported successfully"
991
+ msgstr ""
992
+
993
+ #: includes/admin/modules/tools.php:58
994
  msgid "Visit the Settings page"
995
  msgstr ""
996
 
997
+ #: includes/admin/modules/tools.php:70 includes/admin/modules/tools.php:72
998
  msgid "Clear cache"
999
  msgstr ""
1000
 
1001
+ #: includes/admin/modules/tools.php:75
1002
  msgid ""
1003
  "Clear the Contextual Related Posts cache. This will also be cleared "
1004
  "automatically when you save the settings page."
1005
  msgstr ""
1006
 
1007
+ #: includes/admin/modules/tools.php:78 includes/admin/modules/tools.php:80
1008
  msgid "Recreate Indices"
1009
  msgstr ""
1010
 
1011
+ #: includes/admin/modules/tools.php:83
1012
  msgid ""
1013
  "Deletes and recreates the FULLTEXT index in the posts table. If the above "
1014
  "function gives an error, then you can run the below code in phpMyAdmin or "
1015
  "Adminer. Remember to backup your database first!"
1016
  msgstr ""
1017
 
1018
+ #: includes/admin/modules/tools.php:94
1019
+ msgid "Export/Import settings"
1020
+ msgstr ""
1021
+
1022
+ #: includes/admin/modules/tools.php:96
1023
+ msgid ""
1024
+ "Export the plugin settings for this site as a .json file. This allows you to "
1025
+ "easily import the configuration into another site."
1026
+ msgstr ""
1027
+
1028
+ #: includes/admin/modules/tools.php:100
1029
+ msgid "Export Settings"
1030
+ msgstr ""
1031
+
1032
+ #: includes/admin/modules/tools.php:109
1033
+ msgid ""
1034
+ "Import the plugin settings from a .json file. This file can be obtained by "
1035
+ "exporting the settings on another site using the form above."
1036
+ msgstr ""
1037
+
1038
+ #: includes/admin/modules/tools.php:115
1039
+ msgid "Import Settings"
1040
+ msgstr ""
1041
+
1042
+ #: includes/admin/modules/tools.php:124
1043
  msgid "Other tools"
1044
  msgstr ""
1045
 
1046
+ #: includes/admin/modules/tools.php:126
1047
  msgid "Delete old settings"
1048
  msgstr ""
1049
 
1050
+ #: includes/admin/modules/tools.php:126
1051
  msgid "This will delete the settings before v2.6.x. Proceed?"
1052
  msgstr ""
1053
 
1054
+ #: includes/admin/modules/tools.php:129
1055
  msgid ""
1056
  "From v2.6.x, Contextual Related Posts stores the settings in a new key in "
1057
  "the database. This will delete the old settings for the current blog. It is "
1059
  "should do this only if you are comfortable with the new settings."
1060
  msgstr ""
1061
 
1062
+ #: includes/admin/modules/tools.php:239
1063
+ msgid "Please upload a valid .json file"
1064
+ msgstr ""
1065
+
1066
+ #: includes/admin/modules/tools.php:245
1067
+ msgid "Please upload a file to import"
1068
+ msgstr ""
1069
+
1070
  #: includes/admin/save-settings.php:51
1071
  msgid ""
1072
  "Settings have been reset to their default values. Reload this page to view "
1127
  "The callback function used for the <strong>%s</strong> setting is missing."
1128
  msgstr ""
1129
 
1130
+ #: includes/admin/settings-page.php:318
1131
  msgid "Modified from default setting"
1132
  msgstr ""
1133
 
1134
+ #: includes/admin/settings-page.php:770
1135
  msgid ""
1136
  "This option cannot be changed because of the selected related posts style. "
1137
  "To modify this option, you will need to select No styles or Text only in the "
1138
  "Styles tab"
1139
  msgstr ""
1140
 
1141
+ #: includes/admin/settings-page.php:774
1142
  msgid ""
1143
  "This option cannot be changed because of the selected related posts style. "
1144
  "To modify this option, you will need to select No styles in the Styles tab"
1196
  msgid "<h3>Related Posts:</h3>"
1197
  msgstr ""
1198
 
1199
+ #: includes/main-query.php:239
1200
  #, php-format
1201
+ msgid ""
1202
+ "Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
1203
+ "Related Posts</a>"
1204
  msgstr ""
1205
 
1206
  #: includes/media.php:69
1219
  msgid "Display Related Posts"
1220
  msgstr ""
1221
 
1222
+ #: includes/modules/class-crp-widget.php:85
1223
  msgid "Title"
1224
  msgstr ""
1225
 
1226
+ #: includes/modules/class-crp-widget.php:100
1227
  msgid " Show excerpt?"
1228
  msgstr ""
1229
 
1230
+ #: includes/modules/class-crp-widget.php:105
1231
  msgid " Show author?"
1232
  msgstr ""
1233
 
1234
+ #: includes/modules/class-crp-widget.php:110
1235
  msgid " Show date?"
1236
  msgstr ""
1237
 
1238
+ #: includes/modules/class-crp-widget.php:116
1239
  msgid "Thumbnails inline, before title"
1240
  msgstr ""
1241
 
1242
+ #: includes/modules/class-crp-widget.php:117
1243
  msgid "Thumbnails inline, after title"
1244
  msgstr ""
1245
 
1246
+ #: includes/modules/class-crp-widget.php:118
1247
  msgid "Only thumbnails, no text"
1248
  msgstr ""
1249
 
1250
+ #: includes/modules/class-crp-widget.php:119
1251
  msgid "No thumbnails, only text."
1252
  msgstr ""
1253
 
1254
+ #: includes/modules/class-crp-widget.php:146
1255
  msgid " Randomize posts"
1256
  msgstr ""
1257
 
1258
+ #: includes/modules/class-crp-widget.php:151
1259
+ msgid "Only from categories"
1260
+ msgstr ""
1261
+
1262
  #: includes/output-generator.php:239
1263
  msgid " by "
1264
  msgstr ""
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Tags: related posts, related, related articles, contextual related posts, similar posts, related posts widget
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
- Stable tag: trunk
6
- Requires at least: 4.8
7
- Tested up to: 5.3
8
  License: GPLv2 or later
9
 
10
  Add related posts to your WordPress site with inbuilt caching. Supports thumbnails, shortcodes, widgets and custom post types!
@@ -171,6 +171,30 @@ You can insert the related posts anywhere in your post using the `[crp]` shortco
171
 
172
  == Changelog ==
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  = 2.8.0 =
175
 
176
  Release post: [https://webberzone.com/blog/contextual-related-posts-v2-8-0/](https://webberzone.com/blog/contextual-related-posts-v2-8-0/)
@@ -191,11 +215,10 @@ Release post: [https://webberzone.com/blog/contextual-related-posts-v2-8-0/](htt
191
 
192
  = Earlier versions =
193
 
194
- For the changelog of earlier versions, please refer to the separate changelog.txt file.
195
 
196
 
197
  == Upgrade Notice ==
198
 
199
- = 2.8.0 =
200
- New block for Gutenberg. Enhancements to the widget. New Keyword setting.
201
- Check the Changelog for more details or view the release post on [https://webberzone.com](https://webberzone.com)
2
  Tags: related posts, related, related articles, contextual related posts, similar posts, related posts widget
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
+ Stable tag: 2.9.0
6
+ Requires at least: 4.9
7
+ Tested up to: 5.4
8
  License: GPLv2 or later
9
 
10
  Add related posts to your WordPress site with inbuilt caching. Supports thumbnails, shortcodes, widgets and custom post types!
171
 
172
  == Changelog ==
173
 
174
+ = 2.9.0 =
175
+
176
+ Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
177
+
178
+ * Features:
179
+ * New section under Settings > Related Posts > Tools to export and import settings. Best option if you'd like the same configuration across multiple WordPress sites
180
+ * New shortcode setting `include_cat_ids` to limit top posts to selected categories/taxonomies. Use a comma separated list of [term_taxonomy_id](https://codex.wordpress.org/WordPress_Taxonomy#wp_term_taxonomy)
181
+ * New setting in widget to only include certain categories. Doesn't work with custom taxonomies
182
+
183
+ * Enhancements:
184
+ * New function: `crp_get_thumb_size()` to get the correct size of the thumbnail
185
+ * Only run a get_post query if only the post ID is passed to `crp_get_the_post_thumbnail()`
186
+ * `$match_fields` parameter added to `crp_posts_match` filter
187
+ * Updated WPML functions to use latest filters
188
+ * Admin scripts are no longer loaded into the head - but using a separate JavaScript file
189
+ * Implemented CodeMirror to format custom styles box
190
+ * New filters `get_crp_short_circuit` and `get_crp_posts_id_short_circuit` to bypass outputs and queries
191
+ * `CRP_MAX_WORDS` has been reduced from 500 to 250 to avoid "Too many words" mySQL error
192
+ * The link to the Contextual Related Posts link is no longer a list item but a smaller text paragraph below the items. You can turn this on by enabling Show Credit.
193
+
194
+ * Bug fixes:
195
+ * Fixed errors created when trying to fetch a featured image or scanned images with remote links
196
+ * Saving categories fields in the settings page uses `str_getcsv` and a custom function `crp_str_putcsv`
197
+
198
  = 2.8.0 =
199
 
200
  Release post: [https://webberzone.com/blog/contextual-related-posts-v2-8-0/](https://webberzone.com/blog/contextual-related-posts-v2-8-0/)
215
 
216
  = Earlier versions =
217
 
218
+ For the changelog of earlier versions, please refer to the separate changelog.txt file or the [releases page on Github](https://github.com/WebberZone/contextual-related-posts/releases).
219
 
220
 
221
  == Upgrade Notice ==
222
 
223
+ = 2.9.0 =
224
+ New features and bug-fixes. Check the Changelog for more details or view the release post on https://webberzone.com