Contextual Related Posts - Version 2.6.0

Version Description

Release post: https://wzn.io/2JZBZJy

  • Features:

    • Implemented the Settings API for handling plugin settings
    • New Tools page: Recreate the indices, delete the cache and delete old settings
  • Enhancements:

    • widget_title filter includes $instance and id_base variables
  • Bug fixes:

    • Checked for non-zero thumbnail width and height in the widget
    • More checks for PHP errors and notices
Download this release

Release Info

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

Code changes from version 2.5.1 to 2.6.0

Files changed (40) hide show
  1. README.md +2 -2
  2. admin/admin.php +0 -389
  3. admin/main-view.php +0 -867
  4. admin/sidebar-view.php +0 -65
  5. contextual-related-posts.php +57 -175
  6. includes/admin/admin.php +248 -0
  7. includes/admin/default-settings.php +734 -0
  8. includes/admin/help-tab.php +148 -0
  9. {admin → includes/admin}/images/crp-rounded-thumbs.png +0 -0
  10. {admin → includes/admin}/images/fb.png +0 -0
  11. {admin → includes/admin}/images/index.php +0 -0
  12. {admin → includes/admin}/images/twitter.jpg +0 -0
  13. {admin → includes/admin}/index.php +0 -0
  14. {admin → includes/admin/modules}/cache.php +10 -6
  15. {admin → includes/admin/modules}/loader.php +7 -2
  16. {admin → includes/admin/modules}/metabox.php +13 -13
  17. includes/admin/modules/tools.php +141 -0
  18. includes/admin/register-settings.php +321 -0
  19. includes/admin/save-settings.php +356 -0
  20. includes/admin/settings-page.php +752 -0
  21. includes/admin/sidebar.php +101 -0
  22. includes/content.php +30 -28
  23. includes/deprecated.php +147 -0
  24. includes/header.php +24 -22
  25. includes/i10n.php +5 -0
  26. includes/main-query.php +6 -6
  27. includes/media.php +40 -23
  28. includes/modules/class-crp-widget.php +23 -26
  29. includes/modules/exclusions.php +6 -1
  30. includes/modules/manual-posts.php +3 -3
  31. includes/modules/shortcode.php +3 -3
  32. includes/modules/taxonomies.php +1 -1
  33. includes/output-generator.php +1 -1
  34. includes/plugin-activator.php +8 -6
  35. includes/tools.php +20 -15
  36. languages/contextual-related-posts-en_US.mo +0 -0
  37. languages/contextual-related-posts-en_US.po +570 -464
  38. languages/contextual-related-posts-en_US.pot +570 -464
  39. readme.txt +20 -5
  40. uninstall.php +10 -10
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.2
10
 
11
- __Tested up to:__ 5.0
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.7
10
 
11
+ __Tested up to:__ 5.1
12
 
13
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
14
 
admin/admin.php DELETED
@@ -1,389 +0,0 @@
1
- <?php
2
- /**
3
- * Contextual Related Posts Admin interface.
4
- *
5
- * This page is accessible via Settings > Contextual Related Posts
6
- *
7
- * @package Contextual_Related_Posts
8
- * @author Ajay D'Souza
9
- * @license GPL-2.0+
10
- * @link https://webberzone.com
11
- * @copyright 2009-2018 Ajay D'Souza
12
- */
13
-
14
- /**** If this file is called directly, abort. ****/
15
- if ( ! defined( 'WPINC' ) ) {
16
- die;
17
- }
18
-
19
-
20
- /**
21
- * Function generates the plugin settings page.
22
- *
23
- * @since 1.0.1
24
- */
25
- function crp_options() {
26
-
27
- global $wpdb;
28
-
29
- $crp_settings = crp_read_options();
30
-
31
- $wp_post_types = get_post_types(
32
- array(
33
- 'public' => true,
34
- )
35
- );
36
-
37
- // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
38
- if ( ! empty( $crp_settings['post_types'] ) && false === strpos( $crp_settings['post_types'], '=' ) ) {
39
- $post_types = explode( ',', $crp_settings['post_types'] );
40
- } else {
41
- parse_str( $crp_settings['post_types'], $post_types ); // Save post types in $post_types variable.
42
- }
43
-
44
- $posts_types_inc = array_intersect( $wp_post_types, $post_types );
45
-
46
- // If this post type is in the DO NOT DISPLAY list.
47
- if ( ! empty( $crp_settings['exclude_on_post_types'] ) && false === strpos( $crp_settings['exclude_on_post_types'], '=' ) ) {
48
- $exclude_on_post_types = explode( ',', $crp_settings['exclude_on_post_types'] );
49
- } else {
50
- parse_str( $crp_settings['exclude_on_post_types'], $exclude_on_post_types ); // Save post types in $exclude_on_post_types variable.
51
- }
52
-
53
- $posts_types_excl = array_intersect( $wp_post_types, $exclude_on_post_types );
54
-
55
- // Temporary check if default styles are off and rounded thumbnails are selected - will be eventually deprecated.
56
- // This is a mismatch, so we force it to no style.
57
- if ( ( ! $crp_settings['include_default_style'] ) && ( 'rounded_thumbs' === $crp_settings['crp_styles'] ) ) {
58
- $crp_settings['crp_styles'] = 'no_style';
59
- update_option( 'ald_crp_settings', $crp_settings );
60
- }
61
- if ( ( $crp_settings['include_default_style'] ) && ( 'rounded_thumbs' !== $crp_settings['crp_styles'] ) ) {
62
- $crp_settings['crp_styles'] = 'rounded_thumbs';
63
- update_option( 'ald_crp_settings', $crp_settings );
64
- }
65
-
66
- if ( ( isset( $_POST['crp_save'] ) ) && ( check_admin_referer( 'crp-plugin-settings' ) ) ) { // Input var okay.
67
-
68
- /**** General options */
69
- $crp_settings['cache'] = isset( $_POST['cache'] ) ? true : false;
70
- $crp_settings['limit'] = absint( $_POST['limit'] );
71
- $crp_settings['daily_range'] = absint( $_POST['daily_range'] );
72
- $crp_settings['random_order'] = isset( $_POST['random_order'] ) ? true : false;
73
- $crp_settings['match_content'] = isset( $_POST['match_content'] ) ? true : false;
74
- $crp_settings['match_content_words'] = min( CRP_MAX_WORDS, absint( $_POST['match_content_words'] ) );
75
- $crp_settings['same_post_type'] = isset( $_POST['same_post_type'] ) ? true : false;
76
-
77
- $crp_settings['add_to_content'] = ( isset( $_POST['add_to_content'] ) ? true : false );
78
- $crp_settings['add_to_page'] = ( isset( $_POST['add_to_page'] ) ? true : false );
79
- $crp_settings['add_to_feed'] = ( isset( $_POST['add_to_feed'] ) ? true : false );
80
- $crp_settings['add_to_home'] = ( isset( $_POST['add_to_home'] ) ? true : false );
81
- $crp_settings['add_to_category_archives'] = ( isset( $_POST['add_to_category_archives'] ) ? true : false );
82
- $crp_settings['add_to_tag_archives'] = ( isset( $_POST['add_to_tag_archives'] ) ? true : false );
83
- $crp_settings['add_to_archives'] = ( isset( $_POST['add_to_archives'] ) ? true : false );
84
-
85
- $crp_settings['content_filter_priority'] = absint( $_POST['content_filter_priority'] );
86
- $crp_settings['insert_after_paragraph'] = ( -1 === $_POST['insert_after_paragraph'] || '' === $_POST['insert_after_paragraph'] ) ? -1 : intval( $_POST['insert_after_paragraph'] );
87
- $crp_settings['disable_on_mobile'] = ( isset( $_POST['disable_on_mobile'] ) ? true : false );
88
- $crp_settings['disable_on_amp'] = ( isset( $_POST['disable_on_amp'] ) ? true : false );
89
- $crp_settings['show_metabox'] = ( isset( $_POST['show_metabox'] ) ? true : false );
90
- $crp_settings['show_metabox_admins'] = ( isset( $_POST['show_metabox_admins'] ) ? true : false );
91
- $crp_settings['show_credit'] = ( isset( $_POST['show_credit'] ) ? true : false );
92
-
93
- /**** Output options */
94
- $crp_settings['title'] = wp_kses_post( wp_unslash( $_POST['title'] ) );
95
- $crp_settings['blank_output'] = 'blank' === $_POST['blank_output'] ? true : false;
96
- $crp_settings['blank_output_text'] = wp_kses_post( wp_unslash( $_POST['blank_output_text'] ) );
97
-
98
- $crp_settings['show_excerpt'] = ( isset( $_POST['show_excerpt'] ) ? true : false );
99
- $crp_settings['show_date'] = ( isset( $_POST['show_date'] ) ? true : false );
100
- $crp_settings['show_author'] = ( isset( $_POST['show_author'] ) ? true : false );
101
- $crp_settings['excerpt_length'] = absint( $_POST['excerpt_length'] );
102
- $crp_settings['title_length'] = absint( $_POST['title_length'] );
103
-
104
- $crp_settings['link_new_window'] = ( isset( $_POST['link_new_window'] ) ? true : false );
105
- $crp_settings['link_nofollow'] = ( isset( $_POST['link_nofollow'] ) ? true : false );
106
-
107
- $crp_settings['before_list'] = wp_kses_post( wp_unslash( $_POST['before_list'] ) );
108
- $crp_settings['after_list'] = wp_kses_post( wp_unslash( $_POST['after_list'] ) );
109
- $crp_settings['before_list_item'] = wp_kses_post( wp_unslash( $_POST['before_list_item'] ) );
110
- $crp_settings['after_list_item'] = wp_kses_post( wp_unslash( $_POST['after_list_item'] ) );
111
-
112
- $crp_settings['exclude_on_post_ids'] = empty( $_POST['exclude_on_post_ids'] ) ? '' : implode( ',', array_map( 'absint', explode( ',', sanitize_text_field( wp_unslash( $_POST['exclude_on_post_ids'] ) ) ) ) );
113
- $crp_settings['exclude_post_ids'] = empty( $_POST['exclude_post_ids'] ) ? '' : implode( ',', array_map( 'absint', explode( ',', sanitize_text_field( wp_unslash( $_POST['exclude_post_ids'] ) ) ) ) );
114
-
115
- /**** Thumbnail options */
116
- $crp_settings['post_thumb_op'] = sanitize_text_field( wp_unslash( $_POST['post_thumb_op'] ) );
117
-
118
- $crp_settings['thumb_size'] = sanitize_text_field( wp_unslash( $_POST['thumb_size'] ) );
119
-
120
- if ( 'crp_thumbnail' !== $crp_settings['thumb_size'] ) {
121
- $crp_thumb_size = crp_get_all_image_sizes( $crp_settings['thumb_size'] );
122
-
123
- $crp_settings['thumb_height'] = absint( $crp_thumb_size['height'] );
124
- $crp_settings['thumb_width'] = absint( $crp_thumb_size['width'] );
125
- $crp_settings['thumb_crop'] = $crp_thumb_size['crop'];
126
- $crp_settings['thumb_create_sizes'] = ( isset( $_POST['thumb_create_sizes'] ) ? true : false );
127
- } else {
128
- $crp_settings['thumb_height'] = absint( $_POST['thumb_height'] );
129
- $crp_settings['thumb_width'] = absint( $_POST['thumb_width'] );
130
- $crp_settings['thumb_crop'] = ( isset( $_POST['thumb_crop'] ) ? true : false );
131
- $crp_settings['thumb_create_sizes'] = ( isset( $_POST['thumb_create_sizes'] ) ? true : false );
132
- }
133
-
134
- $crp_settings['thumb_html'] = sanitize_text_field( wp_unslash( $_POST['thumb_html'] ) );
135
-
136
- $crp_settings['thumb_meta'] = empty( $_POST['thumb_meta'] ) ? 'post-image' : sanitize_text_field( wp_unslash( $_POST['thumb_meta'] ) );
137
- $crp_settings['scan_images'] = ( isset( $_POST['scan_images'] ) ? true : false );
138
- $crp_settings['thumb_default'] = ( ( '' === esc_url_raw( $_POST['thumb_default'] ) ) || ( '/default.png' === esc_url_raw( $_POST['thumb_default'] ) ) ) ? CRP_PLUGIN_URL . '/default.png' : esc_url_raw( $_POST['thumb_default'] );
139
- $crp_settings['thumb_default_show'] = ( isset( $_POST['thumb_default_show'] ) ? true : false );
140
-
141
- /**** Feed options */
142
- $crp_settings['limit_feed'] = absint( $_POST['limit_feed'] );
143
- $crp_settings['post_thumb_op_feed'] = sanitize_text_field( wp_unslash( $_POST['post_thumb_op_feed'] ) );
144
- $crp_settings['thumb_height_feed'] = absint( $_POST['thumb_height_feed'] );
145
- $crp_settings['thumb_width_feed'] = absint( $_POST['thumb_width_feed'] );
146
- $crp_settings['show_excerpt_feed'] = ( isset( $_POST['show_excerpt_feed'] ) ? true : false );
147
-
148
- /**** Styles */
149
- $crp_settings['custom_CSS'] = wp_kses_post( wp_unslash( $_POST['custom_CSS'] ) );
150
-
151
- $crp_settings['crp_styles'] = sanitize_text_field( wp_unslash( $_POST['crp_styles'] ) );
152
-
153
- if ( 'rounded_thumbs' === $crp_settings['crp_styles'] ) {
154
- $crp_settings['include_default_style'] = true;
155
- $crp_settings['post_thumb_op'] = 'inline';
156
- $crp_settings['show_excerpt'] = false;
157
- $crp_settings['show_author'] = false;
158
- $crp_settings['show_date'] = false;
159
- } elseif ( 'text_only' === $crp_settings['crp_styles'] ) {
160
- $crp_settings['include_default_style'] = false;
161
- $crp_settings['post_thumb_op'] = 'text_only';
162
- } else {
163
- $crp_settings['include_default_style'] = false;
164
- }
165
-
166
- /**** Exclude categories */
167
- $exclude_categories_slugs = array_map( 'trim', explode( ',', sanitize_text_field( wp_unslash( $_POST['exclude_cat_slugs'] ) ) ) );
168
-
169
- foreach ( $exclude_categories_slugs as $exclude_categories_slug ) {
170
- $category_obj = get_term_by( 'name', $exclude_categories_slug, 'category' );
171
-
172
- // Fall back to slugs since that was the default format before v2.4.0.
173
- if ( false === $category_obj ) {
174
- $category_obj = get_term_by( 'slug', $exclude_categories_slug, 'category' );
175
- }
176
- if ( isset( $category_obj->term_taxonomy_id ) ) {
177
- $exclude_categories[] = $category_obj->term_taxonomy_id;
178
- $exclude_cat_slugs[] = $category_obj->name;
179
- }
180
- }
181
- $crp_settings['exclude_categories'] = isset( $exclude_categories ) ? join( ',', $exclude_categories ) : '';
182
- $crp_settings['exclude_cat_slugs'] = isset( $exclude_cat_slugs ) ? join( ',', $exclude_cat_slugs ) : '';
183
-
184
- /**** Post types to include */
185
- $wp_post_types = get_post_types(
186
- array(
187
- 'public' => true,
188
- )
189
- );
190
- $post_types_arr = ( isset( $_POST['post_types'] ) && is_array( $_POST['post_types'] ) ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['post_types'] ) ) : array(
191
- 'post' => 'post',
192
- );
193
- $post_types = array_intersect( $wp_post_types, $post_types_arr );
194
- $crp_settings['post_types'] = implode( ',', $post_types );
195
-
196
- /**** Post types to exclude display on */
197
- $post_types_excl_arr = ( isset( $_POST['exclude_on_post_types'] ) && is_array( $_POST['exclude_on_post_types'] ) ) ? $_POST['exclude_on_post_types'] : array();
198
- $exclude_on_post_types = array_intersect( $wp_post_types, $post_types_excl_arr );
199
- $crp_settings['exclude_on_post_types'] = implode( ',', $exclude_on_post_types );
200
-
201
- /**
202
- * Filters $crp_settings before it is saved into the database
203
- *
204
- * @since 2.0.0
205
- *
206
- * @param array $crp_settings CRP settings
207
- * @param array $_POST POST array that consists of the saved settings
208
- */
209
- $crp_settings = apply_filters( 'crp_save_options', $crp_settings, $_POST );
210
-
211
- /**** Update CRP options into the database */
212
- update_option( 'ald_crp_settings', $crp_settings );
213
- $crp_settings = crp_read_options();
214
-
215
- // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
216
- if ( ! empty( $crp_settings['post_types'] ) && false === strpos( $crp_settings['post_types'], '=' ) ) {
217
- $post_types = explode( ',', $crp_settings['post_types'] );
218
- } else {
219
- parse_str( $crp_settings['post_types'], $post_types ); // Save post types in $post_types variable.
220
- }
221
- $posts_types_inc = array_intersect( $wp_post_types, $post_types );
222
-
223
- if ( ! empty( $crp_settings['exclude_on_post_types'] ) && false === strpos( $crp_settings['exclude_on_post_types'], '=' ) ) {
224
- $exclude_on_post_types = explode( ',', $crp_settings['exclude_on_post_types'] );
225
- } else {
226
- parse_str( $crp_settings['exclude_on_post_types'], $exclude_on_post_types ); // Save post types in $exclude_on_post_types variable.
227
- }
228
- $posts_types_excl = array_intersect( $wp_post_types, $exclude_on_post_types );
229
-
230
- // Delete the cache.
231
- crp_cache_delete();
232
-
233
- /* Echo a success message */
234
- $str = '<div id="message" class="notice is-dismissible updated"><p>' . __( 'Options saved successfully. If enabled, the cache has been cleared.', 'contextual-related-posts' ) . '</p>';
235
-
236
- if ( 'rounded_thumbs' === $crp_settings['crp_styles'] ) {
237
- $str .= '<p>' . __( 'Rounded Thumbnails style selected. Author, Excerpt and Date will not be displayed.', 'contextual-related-posts' ) . '</p>';
238
- }
239
- if ( 'text_only' === $crp_settings['crp_styles'] ) {
240
- $str .= '<p>' . __( 'Text Only style selected. Thumbnails will not be displayed.', 'contextual-related-posts' ) . '</p>';
241
- }
242
- if ( 'crp_thumbnail' !== $crp_settings['thumb_size'] ) {
243
- /* translators: Thumbnail width and height */
244
- $str .= '<p>' . sprintf( __( 'Pre-built thumbnail size selected. Thumbnail set to %1$d x %2$d.', 'contextual-related-posts' ), $crp_settings['thumb_width'], $crp_settings['thumb_height'] ) . '</p>';
245
- }
246
-
247
- $str .= '</div>';
248
-
249
- echo $str; // WPCS: XSS OK.
250
- }// End if().
251
-
252
- if ( ( isset( $_POST['crp_default'] ) ) && ( check_admin_referer( 'crp-plugin-settings' ) ) ) {
253
- delete_option( 'ald_crp_settings' );
254
- $crp_settings = crp_default_options();
255
- update_option( 'ald_crp_settings', $crp_settings );
256
-
257
- $crp_settings = crp_read_options();
258
-
259
- $wp_post_types = get_post_types(
260
- array(
261
- 'public' => true,
262
- )
263
- );
264
- // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
265
- if ( ! empty( $crp_settings['post_types'] ) && false === strpos( $crp_settings['post_types'], '=' ) ) {
266
- $post_types = explode( ',', $crp_settings['post_types'] );
267
- } else {
268
- parse_str( $crp_settings['post_types'], $post_types ); // Save post types in $post_types variable.
269
- }
270
- $posts_types_inc = array_intersect( $wp_post_types, $post_types );
271
-
272
- if ( ! empty( $crp_settings['exclude_on_post_types'] ) && false === strpos( $crp_settings['exclude_on_post_types'], '=' ) ) {
273
- $exclude_on_post_types = explode( ',', $crp_settings['exclude_on_post_types'] );
274
- } else {
275
- parse_str( $crp_settings['exclude_on_post_types'], $exclude_on_post_types ); // Save post types in $exclude_on_post_types variable.
276
- }
277
- $posts_types_excl = array_intersect( $wp_post_types, $exclude_on_post_types );
278
-
279
- $str = '<div id="message" class="updated fade"><p>' . __( 'Options set to Default.', 'contextual-related-posts' ) . '</p></div>';
280
- echo $str; // WPCS: XSS ok.
281
- }
282
-
283
- if ( ( isset( $_POST['crp_recreate'] ) ) && ( check_admin_referer( 'crp-plugin-settings' ) ) ) {
284
-
285
- crp_delete_index();
286
- crp_create_index();
287
-
288
- $str = '<div id="message" class="updated fade"><p>' . __( 'Index recreated', 'contextual-related-posts' ) . '</p></div>';
289
- echo $str; // WPCS: XSS ok.
290
- }
291
-
292
- /**** Include the views page */
293
- include_once 'main-view.php';
294
- }
295
-
296
-
297
- /**
298
- * Add a link under Settings to the plugins settings page.
299
- *
300
- * @version 1.0.1
301
- */
302
- function crp_adminmenu() {
303
- $plugin_page = add_options_page(
304
- 'Contextual Related Posts',
305
- __( 'Related Posts', 'contextual-related-posts' ),
306
- 'manage_options',
307
- 'crp_options',
308
- 'crp_options'
309
- );
310
- add_action( 'admin_head-' . $plugin_page, 'crp_adminhead' );
311
- }
312
- add_action( 'admin_menu', 'crp_adminmenu' );
313
-
314
-
315
- /**
316
- * Function to add CSS and JS to the Admin header.
317
- *
318
- * @since 1.2
319
- */
320
- function crp_adminhead() {
321
-
322
- wp_enqueue_script( 'common' );
323
- wp_enqueue_script( 'wp-lists' );
324
- wp_enqueue_script( 'postbox' );
325
- wp_enqueue_script( 'plugin-install' );
326
- wp_enqueue_script( 'suggest' );
327
-
328
- add_thickbox();
329
-
330
- ?>
331
- <style type="text/css">
332
- .postbox .handlediv:before {
333
- right:12px;
334
- font:400 20px/1 dashicons;
335
- speak:none;
336
- display:inline-block;
337
- top:0;
338
- position:relative;
339
- -webkit-font-smoothing:antialiased;
340
- -moz-osx-font-smoothing:grayscale;
341
- text-decoration:none!important;
342
- content:'\f142';
343
- padding:8px 10px;
344
- }
345
- .postbox.closed .handlediv:before {
346
- content: '\f140';
347
- }
348
- .wrap h1:before {
349
- content: "\f237";
350
- display: inline-block;
351
- -webkit-font-smoothing: antialiased;
352
- font: normal 29px/1 'dashicons';
353
- vertical-align: middle;
354
- margin-right: 0.3em;
355
- }
356
- </style>
357
-
358
- <script type="text/javascript">
359
- //<![CDATA[
360
- jQuery(document).ready( function($) {
361
- /**** close postboxes that should be closed ****/
362
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
363
- /**** postboxes setup ****/
364
- postboxes.add_postbox_toggles('crp_options');
365
- });
366
-
367
- // Function to add auto suggest.
368
- function setSuggest( id, taxonomy ) {
369
- jQuery('#' + id).suggest("<?php echo admin_url( 'admin-ajax.php?action=ajax-tag-search&tax=' ); ?>" + taxonomy, {multiple:true, multipleSep: ","});
370
- }
371
-
372
- function clearCache() {
373
- jQuery.post(ajaxurl, {action: 'crp_clear_cache'}, function(response, textStatus, jqXHR) {
374
- alert( response.message );
375
- }, 'json');
376
- }
377
-
378
- function checkForm() {
379
- answer = true;
380
- if (siw && siw.selectingSomething)
381
- answer = false;
382
- return answer;
383
- }//
384
-
385
- //]]>
386
- </script>
387
- <?php
388
- }
389
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/main-view.php DELETED
@@ -1,867 +0,0 @@
1
- <?php
2
- /**
3
- * Represents the view for the administration dashboard.
4
- *
5
- * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2018 Ajay D'Souza
10
- */
11
-
12
- // If this file is called directly, abort.
13
- if ( ! defined( 'WPINC' ) ) {
14
- die;
15
- }
16
-
17
- ?>
18
-
19
- <div class="wrap">
20
- <h1>Contextual Related Posts</h1>
21
-
22
- <ul class="subsubsub">
23
- <?php
24
- /**
25
- * Fires before the navigation bar in the Settings page
26
- *
27
- * @since 2.0.0
28
- */
29
- do_action( 'crp_admin_nav_bar_before' )
30
- ?>
31
-
32
- <li><a href="#genopdiv"><?php esc_html_e( 'General options', 'contextual-related-posts' ); ?></a> | </li>
33
- <li><a href="#tuneopdiv"><?php esc_html_e( 'List tuning options', 'contextual-related-posts' ); ?></a> | </li>
34
- <li><a href="#outputopdiv"><?php esc_html_e( 'Output options', 'contextual-related-posts' ); ?></a> | </li>
35
- <li><a href="#thumbopdiv"><?php esc_html_e( 'Thumbnail options', 'contextual-related-posts' ); ?></a> | </li>
36
- <li><a href="#customcssdiv"><?php esc_html_e( 'Styles', 'contextual-related-posts' ); ?></a> | </li>
37
- <li><a href="#feedopdiv"><?php esc_html_e( 'Feed options', 'contextual-related-posts' ); ?></a></li>
38
-
39
- <?php
40
- /**
41
- * Fires after the navigation bar in the Settings page
42
- *
43
- * @since 2.0.0
44
- */
45
- do_action( 'crp_admin_nav_bar_after' )
46
- ?>
47
- </ul>
48
-
49
- <div id="poststuff">
50
- <div id="post-body" class="metabox-holder columns-2">
51
- <div id="post-body-content">
52
- <form method="post" id="crp_options" name="crp_options" onsubmit="return checkForm()">
53
-
54
- <div id="genopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
55
- <h3 class='hndle'><span><?php esc_html_e( 'General options', 'contextual-related-posts' ); ?></span></h3>
56
- <div class="inside">
57
-
58
- <table class="form-table">
59
-
60
- <?php
61
- /**
62
- * Fires before General options block.
63
- *
64
- * @since 2.0.0
65
- *
66
- * @param array $crp_settings Contextual Related Posts settings array
67
- */
68
- do_action( 'crp_admin_general_options_before', $crp_settings );
69
- ?>
70
-
71
- <tr><th scope="row"><label for="cache"><?php esc_html_e( 'Cache output?', 'contextual-related-posts' ); ?></label></th>
72
- <td><input type="checkbox" name="cache" id="cache" <?php checked( true, $crp_settings['cache'] ); ?> />
73
- <p class="description"><?php esc_html_e( 'Enabling this option will cache the related posts output when the post is visited the first time. The cache is cleaned when you save this page.', 'contextual-related-posts' ); ?></p>
74
- <p class="description"><?php esc_html_e( 'The CRP cache works independently and in addition to any of your caching plugins like WP Super Cache or W3 Total Cache. It is recommended that you enable this on your blog.', 'contextual-related-posts' ); ?></p>
75
- <p><input type="button" value="<?php esc_html_e( 'Clear cache', 'contextual-related-posts' ); ?>" onclick="return clearCache();" class="button-secondary" /></p>
76
- </td>
77
- </tr>
78
-
79
- <tr><th scope="row"><?php esc_html_e( 'Automatically add related posts to:', 'contextual-related-posts' ); ?></th>
80
- <td>
81
- <label><input type="checkbox" name="add_to_content" id="add_to_content" <?php checked( true, $crp_settings['add_to_content'] ); ?> /> <?php esc_html_e( 'Posts', 'contextual-related-posts' ); ?></label><br />
82
- <label><input type="checkbox" name="add_to_page" id="add_to_page" <?php checked( true, $crp_settings['add_to_page'] ); ?> /> <?php esc_html_e( 'Pages', 'contextual-related-posts' ); ?></label><br />
83
- <label><input type="checkbox" name="add_to_home" id="add_to_home" <?php checked( true, $crp_settings['add_to_home'] ); ?> /> <?php esc_html_e( 'Home page', 'contextual-related-posts' ); ?></label></label><br />
84
- <label><input type="checkbox" name="add_to_feed" id="add_to_feed" <?php checked( true, $crp_settings['add_to_feed'] ); ?> /> <?php esc_html_e( 'Feeds', 'contextual-related-posts' ); ?></label></label><br />
85
- <label><input type="checkbox" name="add_to_category_archives" id="add_to_category_archives" <?php checked( true, $crp_settings['add_to_category_archives'] ); ?> /> <?php esc_html_e( 'Category archives', 'contextual-related-posts' ); ?></label><br />
86
- <label><input type="checkbox" name="add_to_tag_archives" id="add_to_tag_archives" <?php checked( true, $crp_settings['add_to_tag_archives'] ); ?> /> <?php esc_html_e( 'Tag archives', 'contextual-related-posts' ); ?></label></label><br />
87
- <label><input type="checkbox" name="add_to_archives" id="add_to_archives" <?php checked( true, $crp_settings['add_to_archives'] ); ?> /> <?php esc_html_e( 'Other archives', 'contextual-related-posts' ); ?></label></label>
88
- <p class="description"><?php printf( esc_html__( 'If you choose to disable this, please add %1$s to your template file where you want it displayed', 'contextual-related-posts' ), "<code>&lt;?php if ( function_exists( 'echo_ald_crp' ) ) echo_ald_crp(); ?&gt;</code>" ); ?></p>
89
- </td>
90
- </tr>
91
-
92
- <tr><th scope="row"><label for="content_filter_priority"><?php esc_html_e( 'Display location priority:', 'contextual-related-posts' ); ?></label></th>
93
- <td>
94
- <input type="textbox" name="content_filter_priority" id="content_filter_priority" value="<?php echo esc_attr( $crp_settings['content_filter_priority'] ); ?>" />
95
- <p class="description"><?php esc_html_e( 'If you select to automatically add the related posts, CRP will hook into the Content Filter at a priority as specified in this option.', 'contextual-related-posts' ); ?></p>
96
- <p class="description"><?php esc_html_e( 'A higher number will cause the related posts to be processed later and move their display further down after the post content. Any number below 10 is not recommended.', 'contextual-related-posts' ); ?></p>
97
- </td>
98
- </tr>
99
-
100
- <tr><th scope="row"><label for="insert_after_paragraph"><?php esc_html_e( 'Insert after paragraph number', 'contextual-related-posts' ); ?>:</label></th>
101
- <td>
102
- <input type="textbox" name="insert_after_paragraph" id="insert_after_paragraph" value="<?php echo esc_attr( $crp_settings['insert_after_paragraph'] ); ?>" />
103
- <p class="description"><?php esc_html_e( 'Enter 0 to display the related posts before the post content, -1 to display this at the end or a number to insert it after that paragraph number. If your post has less paragraphs, related posts will be displayed at the end.', 'contextual-related-posts' ); ?></p>
104
- </td>
105
- </tr>
106
-
107
- <tr><th scope="row"><label for="disable_on_mobile"><?php esc_html_e( 'Disable on mobile devices:', 'contextual-related-posts' ); ?></label></th>
108
- <td>
109
- <input type="checkbox" name="disable_on_mobile" id="disable_on_mobile" <?php checked( true, $crp_settings['disable_on_mobile'] ); ?> />
110
- <p class="description"><?php esc_html_e( 'Disable display of related posts on mobile devices', 'contextual-related-posts' ); ?></p>
111
- </td>
112
- </tr>
113
-
114
- <tr><th scope="row"><label for="disable_on_amp"><?php esc_html_e( 'Disable on AMP pages:', 'contextual-related-posts' ); ?></label></th>
115
- <td>
116
- <input type="checkbox" name="disable_on_amp" id="disable_on_amp" <?php checked( true, $crp_settings['disable_on_amp'] ); ?> />
117
- <p class="description"><?php esc_html_e( 'Disable display of related posts on AMP pages', 'contextual-related-posts' ); ?></p>
118
- </td>
119
- </tr>
120
-
121
- <tr><th scope="row"><label for="show_metabox"><?php esc_html_e( 'Show metabox:', 'contextual-related-posts' ); ?></label></th>
122
- <td>
123
- <input type="checkbox" name="show_metabox" id="show_metabox" <?php checked( true, $crp_settings['show_metabox'] ); ?> />
124
- <p class="description"><?php esc_html_e( 'This will add the Contextual Related Posts metabox on Edit Posts or Add New Posts screens. Also applies to Pages and Custom Post Types.', 'contextual-related-posts' ); ?></p>
125
- </td>
126
- </tr>
127
-
128
- <tr><th scope="row"><label for="show_metabox_admins"><?php esc_html_e( 'Limit metabox to Admins only:', 'contextual-related-posts' ); ?></label></th>
129
- <td>
130
- <input type="checkbox" name="show_metabox_admins" id="show_metabox_admins" <?php checked( true, $crp_settings['show_metabox_admins'] ); ?> />
131
- <p class="description"><?php esc_html_e( 'If this is selected, the metabox will be hidden from anyone who is not an Admin. Otherwise, by default, Contributors and above will be able to see the metabox. This applies only if the above option is selected.', 'contextual-related-posts' ); ?></p>
132
- </td>
133
- </tr>
134
-
135
- <tr><th scope="row"><label for="show_credit"><?php esc_html_e( "Tell the world you're using Contextual Related Posts:", 'contextual-related-posts' ); ?></label></th>
136
- <td>
137
- <input type="checkbox" name="show_credit" id="show_credit" <?php checked( true, $crp_settings['show_credit'] ); ?> /> <em><?php esc_html_e( 'Optional', 'contextual-related-posts' ); ?></em>
138
- <p class="description"><?php esc_html_e( 'Adds a nofollow link to Contextual Related Posts homepage as the last time in the list.', 'contextual-related-posts' ); ?></p>
139
- </td>
140
- </tr>
141
-
142
- <?php
143
- /**
144
- * Fires after General options block.
145
- *
146
- * @since 2.0.0
147
- *
148
- * @param array $crp_settings Contextual Related Posts settings array
149
- */
150
- do_action( 'crp_admin_general_options_after', $crp_settings );
151
- ?>
152
-
153
- </table>
154
-
155
- <p>
156
- <input type="submit" name="crp_save" id="crp_genop_save" value="<?php esc_attr_e( 'Save Options', 'contextual-related-posts' ); ?>" class="button button-primary" />
157
- </p>
158
-
159
- </div> <!-- // inside -->
160
- </div> <!-- // genopdiv -->
161
-
162
- <div id="tuneopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
163
- <h3 class='hndle'><span><?php esc_html_e( 'List tuning options', 'contextual-related-posts' ); ?></span></h3>
164
- <div class="inside">
165
-
166
- <table class="form-table">
167
-
168
- <?php
169
- /**
170
- * Fires before Tuning options block.
171
- *
172
- * @since 2.1.0
173
- *
174
- * @param array $crp_settings Contextual Related Posts settings array
175
- */
176
- do_action( 'crp_admin_tuning_options_before', $crp_settings );
177
- ?>
178
-
179
- <tr><th scope="row"><label for="limit"><?php esc_html_e( 'Number of related posts to display: ', 'contextual-related-posts' ); ?></label></th>
180
- <td>
181
- <input type="textbox" name="limit" id="limit" value="<?php echo esc_attr( stripslashes( $crp_settings['limit'] ) ); ?>">
182
- <p class="description"><?php esc_html_e( 'Maximum number of posts that will be displayed. The actual number may be smaller if less related posts are found.', 'contextual-related-posts' ); ?></p>
183
- </td>
184
- </tr>
185
-
186
- <tr><th scope="row"><label for="daily_range"><?php esc_html_e( 'Related posts should be newer than:', 'contextual-related-posts' ); ?></label></th>
187
- <td>
188
- <input type="textbox" name="daily_range" id="daily_range" value="<?php echo esc_attr( stripslashes( $crp_settings['daily_range'] ) ); ?>"><?php esc_html_e( 'days', 'contextual-related-posts' ); ?>
189
- <p class="description"><?php esc_html_e( 'This sets the cutoff period for which posts will be displayed. e.g. setting it to 365 will show related posts from the last year only. Set to 0 to disable limiting posts by date.', 'contextual-related-posts' ); ?></p>
190
- </td>
191
- </tr>
192
-
193
- <tr><th scope="row"><label for="random_order"><?php esc_html_e( 'Randomize posts', 'contextual-related-posts' ); ?>:</label></th>
194
- <td><input type="checkbox" name="random_order" id="random_order" <?php checked( $crp_settings['random_order'] ); ?> />
195
- <p class="description"><?php esc_html_e( 'This shuffles the top related posts. Does not work if the cache is enabled.', 'contextual-related-posts' ); ?></p>
196
- </td>
197
- </tr>
198
-
199
- <tr><th scope="row"><label for="match_content"><?php esc_html_e( 'Find related posts based on content as well as title:', 'contextual-related-posts' ); ?></label></th>
200
- <td><input type="checkbox" name="match_content" id="match_content" <?php checked( $crp_settings['match_content'] ); ?> />
201
- <p class="description"><?php esc_html_e( 'If unchecked, only posts titles are used. I recommend using a caching plugin or enabling "Cache output" above if you enable this. Each site is different, so toggle this option to see which setting gives you better quality related posts.', 'contextual-related-posts' ); ?></p>
202
- </td>
203
- </tr>
204
-
205
- <tr><th scope="row"><label for="match_content_words"><?php esc_html_e( 'Limit content to be compared:', 'contextual-related-posts' ); ?></label></th>
206
- <td><input type="textbox" name="match_content_words" id="match_content_words" value="<?php echo esc_attr( stripslashes( $crp_settings['match_content_words'] ) ); ?>">
207
- <p class="description"><?php esc_html_e( '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' ); ?></p>
208
- </td>
209
- </tr>
210
-
211
- <tr><th scope="row"><?php esc_html_e( 'Post types to include in results:', 'contextual-related-posts' ); ?></th>
212
- <td>
213
- <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
214
- <label>
215
- <input type="checkbox" name="post_types[]" value="<?php echo esc_attr( $wp_post_type ); ?>" <?php checked( true, in_array( $wp_post_type, $posts_types_inc, true ) ); ?> /><?php echo esc_attr( $wp_post_type ); ?>
216
- </label>&nbsp;&nbsp;
217
- <?php } ?>
218
- <p class="description"><?php esc_html_e( 'These post types will be displayed in the list. Includes custom post types.', 'contextual-related-posts' ); ?></p>
219
- </td>
220
- </tr>
221
-
222
- <tr><th scope="row"><label for="same_post_type"><?php esc_html_e( 'Limit to same post type', 'contextual-related-posts' ); ?>:</label></th>
223
- <td><input type="checkbox" name="same_post_type" id="same_post_type" <?php checked( $crp_settings['same_post_type'] ); ?> />
224
- <p class="description"><?php esc_html_e( 'If checked, the related posts will only be selected from the same post type of the current post.', 'contextual-related-posts' ); ?></p>
225
- </td>
226
- </tr>
227
-
228
- <tr><th scope="row"><label for="exclude_post_ids"><?php esc_html_e( 'List of post or page IDs to exclude from the results:', 'contextual-related-posts' ); ?></label></th>
229
- <td><input type="textbox" name="exclude_post_ids" id="exclude_post_ids" value="<?php echo esc_attr( stripslashes( $crp_settings['exclude_post_ids'] ) ); ?>" style="width:250px">
230
- <p class="description"><?php esc_html_e( 'Comma separated list of post, page or custom post type IDs. e.g. 188,320,500', 'contextual-related-posts' ); ?></p>
231
- </td>
232
- </tr>
233
-
234
- <tr><th scope="row"><label for="exclude_cat_slugs"><?php esc_html_e( 'Categories to exclude from the results: ', 'contextual-related-posts' ); ?></label></th>
235
- <td>
236
- <label><input type="textbox" name="exclude_cat_slugs" id="exclude_cat_slugs" value="<?php echo esc_attr( $crp_settings['exclude_cat_slugs'] ); ?>" onfocus="setSuggest('exclude_cat_slugs', 'category');" class="widefat"></label>
237
- <p class="description"><?php esc_html_e( 'Comma separated list of category slugs. The field above has an autocomplete so simply start typing in the beginning of your category name and it will prompt you with options.', 'contextual-related-posts' ); ?></p>
238
- <p class="description highlight">
239
- <?php
240
- esc_html_e( 'Excluded category IDs are:', 'contextual-related-posts' );
241
- esc_html_e( ' ' . $crp_settings['exclude_categories'] );
242
- ?>
243
- </p>
244
- <p class="description">
245
- <?php
246
- printf( esc_html__( 'These might differ from the IDs visible in the Categories page which use the %1$s. CRP uses the %2$s which is unique to this taxonomy.', 'contextual-related-posts' ), '<code>term_id</code>', '<code>term_taxonomy_id</code>' );
247
- ?>
248
- </p>
249
- </td>
250
- </tr>
251
-
252
- <?php
253
- /**
254
- * Fires after Tuning options block.
255
- *
256
- * @since 2.1.0
257
- *
258
- * @param array $crp_settings Contextual Related Posts settings array
259
- */
260
- do_action( 'crp_admin_tuning_options_after', $crp_settings );
261
- ?>
262
-
263
- </table>
264
-
265
- <p>
266
- <input type="submit" name="crp_save" id="crp_tuneop_save" value="<?php esc_attr_e( 'Save Options', 'contextual-related-posts' ); ?>" class="button button-primary" />
267
- </p>
268
-
269
- </div> <!-- // inside -->
270
- </div> <!-- // tuneopdiv -->
271
-
272
- <div id="outputopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
273
- <h3 class='hndle'><span><?php esc_html_e( 'Output options', 'contextual-related-posts' ); ?></span></h3>
274
- <div class="inside">
275
-
276
- <table class="form-table">
277
-
278
- <?php
279
- /**
280
- * Fires before output options main block.
281
- *
282
- * @since 2.0.0
283
- *
284
- * @param array $crp_settings Contextual Related Posts settings array
285
- */
286
- do_action( 'crp_admin_output_options_before', $crp_settings );
287
- ?>
288
-
289
- <tr><th scope="row"><label for="title"><?php esc_html_e( 'Title of related posts:', 'contextual-related-posts' ); ?></label></th>
290
- <td>
291
- <input type="textbox" name="title" id="title" value="<?php echo esc_attr( stripslashes( $crp_settings['title'] ) ); ?>" style="width:250px" />
292
- <p class="description"><?php printf( esc_html__( 'This is the main heading of the related posts. You can also display the current post title by using %1$s', 'contextual-related-posts' ), '<code>%postname%</code>' ); ?></p>
293
- </td>
294
- </tr>
295
-
296
- <tr><th scope="row"><label for="blank_output"><?php esc_html_e( 'When there are no posts, what should be shown?', 'contextual-related-posts' ); ?></label></th>
297
- <td>
298
- <label>
299
- <input type="radio" name="blank_output" value="blank" id="blank_output_0" <?php checked( true, $crp_settings['blank_output'] ); ?> />
300
- <?php esc_html_e( 'Blank Output', 'contextual-related-posts' ); ?>
301
- </label>
302
- <br />
303
- <label>
304
- <input type="radio" name="blank_output" value="customs" id="blank_output_1" <?php checked( false, $crp_settings['blank_output'] ); ?> />
305
- <?php esc_html_e( 'Display:', 'contextual-related-posts' ); ?>
306
- </label>
307
- <input type="textbox" name="blank_output_text" id="blank_output_text" value="<?php echo esc_attr( stripslashes( $crp_settings['blank_output_text'] ) ); ?>" style="width:250px" />
308
- </td>
309
- </tr>
310
-
311
- <tr><th scope="row"><label for="show_excerpt"><?php esc_html_e( 'Show post excerpt in list?', 'contextual-related-posts' ); ?></label></th>
312
- <td>
313
- <input type="checkbox" name="show_excerpt" id="show_excerpt" <?php checked( true, $crp_settings['show_excerpt'] ); ?> />
314
- <p class="description"><?php printf( esc_html__( "Displays the excerpt of the post. If you do not provide an explicit excerpt to a post (in the post editor's optional excerpt field), it will display an automatic excerpt which refers to the first %d words of the post's content", 'contextual-related-posts' ), $crp_settings['excerpt_length'] ); ?></p>
315
-
316
- <?php if ( 'rounded_thumbs' === $crp_settings['crp_styles'] ) { ?>
317
- <p style="color: #F00"><?php esc_html_e( 'Rounded Thumbnails style selected under the Custom Styles. Excerpt display is disabled.', 'contextual-related-posts' ); ?></p>
318
- <?php } ?>
319
- </td>
320
- </tr>
321
-
322
- <tr><th scope="row"><label for="excerpt_length"><?php esc_html_e( 'Length of excerpt (in words):', 'contextual-related-posts' ); ?></label></th>
323
- <td>
324
- <input type="textbox" name="excerpt_length" id="excerpt_length" value="<?php echo esc_attr( $crp_settings['excerpt_length'] ); ?>" />
325
- </td>
326
- </tr>
327
-
328
- <tr><th scope="row"><label for="show_author"><?php esc_html_e( 'Show post author in list?', 'contextual-related-posts' ); ?></label></th>
329
- <td>
330
- <input type="checkbox" name="show_author" id="show_author" <?php checked( true, $crp_settings['show_author'] ); ?> />
331
- <p class="description"><?php esc_html_e( 'Displays the author name prefixed with "by". e.g. by John Doe', 'contextual-related-posts' ); ?></p>
332
-
333
- <?php if ( 'rounded_thumbs' === $crp_settings['crp_styles'] ) { ?>
334
- <p style="color: #F00"><?php esc_html_e( 'Rounded Thumbnails style selected under the Custom Styles. Author display is disabled.', 'contextual-related-posts' ); ?></p>
335
- <?php } ?>
336
- </td>
337
- </tr>
338
-
339
- <tr><th scope="row"><label for="show_date"><?php esc_html_e( 'Show post date in list?', 'contextual-related-posts' ); ?></label></th>
340
- <td>
341
- <input type="checkbox" name="show_date" id="show_date" <?php checked( true, $crp_settings['show_date'] ); ?> />
342
- <p class="description"><?php esc_html_e( 'Displays the date of the post. Uses the same date format set in General Options', 'contextual-related-posts' ); ?></p>
343
-
344
- <?php if ( 'rounded_thumbs' === $crp_settings['crp_styles'] ) { ?>
345
- <p style="color: #F00"><?php esc_html_e( 'Rounded Thumbnails style selected under the Custom Styles. Date display is disabled.', 'contextual-related-posts' ); ?></p>
346
- <?php } ?>
347
- </td>
348
- </tr>
349
-
350
- <tr><th scope="row"><label for="title_length"><?php esc_html_e( 'Limit post title length (in characters)', 'contextual-related-posts' ); ?></label></th>
351
- <td>
352
- <input type="textbox" name="title_length" id="title_length" value="<?php echo esc_attr( $crp_settings['title_length'] ); ?>" />
353
- <p class="description"><?php esc_html_e( 'Any title longer than the number of characters set above will be cut and appended with an ellipsis (&hellip;)', 'contextual-related-posts' ); ?></p>
354
- </td>
355
- </tr>
356
-
357
- <tr><th scope="row"><label for="link_new_window"><?php esc_html_e( 'Open links in new window', 'contextual-related-posts' ); ?></label></th>
358
- <td>
359
- <input type="checkbox" name="link_new_window" id="link_new_window" <?php checked( true, $crp_settings['link_new_window'] ); ?> /
360
- ></td>
361
- </tr>
362
-
363
- <tr><th scope="row"><label for="link_nofollow"><?php esc_html_e( 'Add nofollow attribute to links in the list', 'contextual-related-posts' ); ?></label></th>
364
- <td>
365
- <input type="checkbox" name="link_nofollow" id="link_nofollow" <?php checked( true, $crp_settings['link_nofollow'] ); ?> />
366
- </td>
367
- </tr>
368
-
369
- <?php
370
- /**
371
- * Fires after Output options main block.
372
- *
373
- * @since 2.0.0
374
- *
375
- * @param array $crp_settings Contextual Related Posts settings array
376
- */
377
- do_action( 'crp_admin_output_options_after', $crp_settings );
378
- ?>
379
-
380
- </table>
381
- <hr />
382
- <table class="form-table">
383
-
384
- <?php
385
- /**
386
- * Fires before Exclusion options block under Output options.
387
- *
388
- * @since 2.0.0
389
- *
390
- * @param array $crp_settings Contextual Related Posts settings array
391
- */
392
- do_action( 'crp_admin_exclusion_options_before', $crp_settings );
393
- ?>
394
-
395
- <tr>
396
- <th scope="row" colspan="2" style="background: #eee; padding-left: 5px;"><?php esc_html_e( 'Exclusion settings:', 'contextual-related-posts' ); ?></th>
397
- </tr>
398
- <tr><th scope="row"><label for="exclude_on_post_ids"><?php esc_html_e( 'Exclude display of related posts on these posts / pages', 'contextual-related-posts' ); ?></label></th>
399
- <td>
400
- <input type="textbox" name="exclude_on_post_ids" id="exclude_on_post_ids" value="<?php echo esc_attr( $crp_settings['exclude_on_post_ids'] ); ?>" style="width:250px">
401
- <p class="description"><?php esc_html_e( 'Comma separated list of post, page or custom post type IDs. e.g. 188,320,500', 'contextual-related-posts' ); ?></p>
402
- </td>
403
- </tr>
404
- <tr><th scope="row"><?php esc_html_e( 'Exclude display of related posts on these post types.', 'contextual-related-posts' ); ?></th>
405
- <td>
406
- <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
407
- <label>
408
- <input type="checkbox" name="exclude_on_post_types[]" value="<?php echo esc_attr( $wp_post_type ); ?>" <?php checked( true, in_array( $wp_post_type, $posts_types_excl, true ) ); ?> /><?php echo esc_attr( $wp_post_type ); ?>
409
- </label>&nbsp;&nbsp;
410
- <?php } ?>
411
- <p class="description"><?php esc_html_e( 'The related posts will not display on any of the above selected post types', 'contextual-related-posts' ); ?></p>
412
- </td>
413
- </tr>
414
-
415
- <?php
416
- /**
417
- * Fires after Exclusion options block under Output options.
418
- *
419
- * @since 2.0.0
420
- *
421
- * @param array $crp_settings Contextual Related Posts settings array
422
- */
423
- do_action( 'crp_admin_exclusion_options_after', $crp_settings );
424
- ?>
425
-
426
- </table>
427
- <hr />
428
- <table class="form-table">
429
-
430
- <?php
431
- /**
432
- * Fires before Customize options block under Output options.
433
- *
434
- * @since 2.0.0
435
- *
436
- * @param array $crp_settings Contextual Related Posts settings array
437
- */
438
- do_action( 'crp_admin_customize_options_before', $crp_settings );
439
- ?>
440
-
441
- <tr><th scope="row" colspan="2" style="background: #eee; padding-left: 5px;"><?php esc_html_e( 'Customize the output:', 'contextual-related-posts' ); ?></th>
442
- </tr>
443
- <tr><th scope="row"><label for="before_list"><?php esc_html_e( 'HTML to display before the list of posts: ', 'contextual-related-posts' ); ?></label></th>
444
- <td><input type="textbox" name="before_list" id="before_list" value="<?php echo esc_attr( $crp_settings['before_list'] ); ?>" style="width:250px" /></td>
445
- </tr>
446
- <tr><th scope="row"><label for="before_list_item"><?php esc_html_e( 'HTML to display before each list item: ', 'contextual-related-posts' ); ?></label></th>
447
- <td><input type="textbox" name="before_list_item" id="before_list_item" value="<?php echo esc_attr( $crp_settings['before_list_item'] ); ?>" style="width:250px" /></td>
448
- </tr>
449
- <tr><th scope="row"><label for="after_list_item"><?php esc_html_e( 'HTML to display after each list item: ', 'contextual-related-posts' ); ?></label></th>
450
- <td><input type="textbox" name="after_list_item" id="after_list_item" value="<?php echo esc_attr( $crp_settings['after_list_item'] ); ?>" style="width:250px" /></td>
451
- </tr>
452
- <tr><th scope="row"><label for="after_list"><?php esc_html_e( 'HTML to display after the list of posts: ', 'contextual-related-posts' ); ?></label></th>
453
- <td><input type="textbox" name="after_list" id="after_list" value="<?php echo esc_attr( $crp_settings['after_list'] ); ?>" style="width:250px" /></td>
454
- </tr>
455
-
456
- <?php
457
- /**
458
- * Fires after Customize options block under Output options.
459
- *
460
- * @since 2.0.0
461
- *
462
- * @param array $crp_settings Contextual Related Posts settings array
463
- */
464
- do_action( 'crp_admin_customize_options_after', $crp_settings );
465
- ?>
466
-
467
- </table>
468
-
469
- <p>
470
- <input type="submit" name="crp_save" id="crp_outputop_save" value="<?php esc_attr_e( 'Save Options', 'contextual-related-posts' ); ?>" class="button button-primary" />
471
- </p>
472
-
473
- </div> <!-- // inside -->
474
- </div> <!-- // outputopdiv -->
475
-
476
- <div id="thumbopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
477
- <h3 class='hndle'><span><?php esc_html_e( 'Thumbnail options', 'contextual-related-posts' ); ?></span></h3>
478
- <div class="inside">
479
-
480
- <table class="form-table">
481
-
482
- <?php
483
- /**
484
- * Fires before Thumbnail options block under Output options.
485
- *
486
- * @since 2.0.0
487
- *
488
- * @param array $crp_settings Contextual Related Posts settings array
489
- */
490
- do_action( 'crp_admin_thumb_options_before', $crp_settings );
491
- ?>
492
-
493
- <tr><th scope="row"><label for="post_thumb_op"><?php esc_html_e( 'Location of post thumbnail:', 'contextual-related-posts' ); ?></label></th>
494
- <td>
495
- <label>
496
- <input type="radio" name="post_thumb_op" value="inline" id="post_thumb_op_0" <?php checked( 'inline', $crp_settings['post_thumb_op'], true ); ?> />
497
- <?php esc_html_e( 'Display thumbnails inline with posts, before title', 'contextual-related-posts' ); ?>
498
- </label>
499
- <br />
500
- <label>
501
- <input type="radio" name="post_thumb_op" value="after" id="post_thumb_op_1" <?php checked( 'after', $crp_settings['post_thumb_op'], true ); ?> />
502
- <?php esc_html_e( 'Display thumbnails inline with posts, after title', 'contextual-related-posts' ); ?>
503
- </label>
504
- <br />
505
- <label>
506
- <input type="radio" name="post_thumb_op" value="thumbs_only" id="post_thumb_op_2" <?php checked( 'thumbs_only', $crp_settings['post_thumb_op'], true ); ?> />
507
- <?php esc_html_e( 'Display only thumbnails, no text', 'contextual-related-posts' ); ?>
508
- </label>
509
- <br />
510
- <label>
511
- <input type="radio" name="post_thumb_op" value="text_only" id="post_thumb_op_3" <?php checked( 'text_only', $crp_settings['post_thumb_op'], true ); ?> />
512
- <?php esc_html_e( 'Do not display thumbnails, only text.', 'contextual-related-posts' ); ?>
513
- </label>
514
-
515
- <?php if ( 'no_style' !== $crp_settings['crp_styles'] ) { ?>
516
- <p style="color: #F00"><?php printf( esc_html__( 'This setting cannot be changed because an inbuilt style has been selected under the Styles section. If you would like to change this option, please select %1$s under the Styles section.', 'contextual-related-posts' ), '<strong>' . esc_html__( 'No styles', 'contextual-related-posts' ) . '</strong>' ); ?></p>
517
- <?php } ?>
518
- </td>
519
- </tr>
520
- <tr><th scope="row"><?php esc_html_e( 'Thumbnail size:', 'contextual-related-posts' ); ?></th>
521
- <td>
522
- <?php
523
- $crp_get_all_image_sizes = crp_get_all_image_sizes();
524
-
525
- if ( isset( $crp_get_all_image_sizes['crp_thumbnail'] ) ) {
526
- unset( $crp_get_all_image_sizes['crp_thumbnail'] );
527
- }
528
-
529
- foreach ( $crp_get_all_image_sizes as $size ) :
530
- ?>
531
- <label>
532
- <input type="radio" name="thumb_size" value="<?php esc_attr_e( $size['name'] ); ?>" id="<?php esc_attr_e( $size['name'] ); ?>" <?php checked( $crp_settings['thumb_size'], $size['name'] ); ?> />
533
- <?php esc_html_e( $size['name'] ); ?> ( <?php esc_html_e( $size['width'] ); ?>x<?php esc_html_e( $size['height'] ); ?>
534
- <?php
535
- if ( $size['crop'] ) {
536
- echo 'cropped';
537
- }
538
- ?>
539
- )
540
- </label>
541
- <br />
542
- <?php endforeach; ?>
543
-
544
- <label>
545
- <input type="radio" name="thumb_size" value="crp_thumbnail" id="crp_thumbnail" <?php checked( $crp_settings['thumb_size'], 'crp_thumbnail' ); ?> /> <?php esc_html_e( 'Custom size', 'contextual-related-posts' ); ?>
546
- </label>
547
- <p class="description">
548
- <?php esc_html_e( 'You can choose from existing image sizes above or create a custom size.', 'contextual-related-posts' ); ?><br /><br />
549
- <?php esc_html_e( 'If you choose an existing size, then the width, height and crop mode settings in the three options below will be automatically updated to reflect the correct dimensions of the setting.', 'contextual-related-posts' ); ?><br />
550
- <?php esc_html_e( 'If you have chosen Custom size above, then enter the width, height and crop settings below. For best results, use a cropped image with the same width and height. The default setting is 150x150 cropped image.', 'contextual-related-posts' ); ?><br /><br />
551
- <?php esc_html_e( "Any changes to the thumbnail settings doesn't automatically resize existing images.", 'contextual-related-posts' ); ?>
552
- <?php
553
- printf(
554
- esc_html__( 'I recommend using %1$s or %2$s to regenerate all image sizes.', 'contextual-related-posts' ),
555
- '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=otf-regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">OTF Regenerate Thumbnails</a>',
556
- '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">Regenerate Thumbnails</a>'
557
- );
558
- ?>
559
- </p>
560
- </td>
561
- </tr>
562
- <tr><th scope="row"><label for="thumb_width"><?php esc_html_e( 'Width of the thumbnail:', 'contextual-related-posts' ); ?></label></th>
563
- <td><input type="textbox" name="thumb_width" id="thumb_width" value="<?php echo esc_attr( $crp_settings['thumb_width'] ); ?>" style="width:50px" />px</td>
564
- </tr>
565
- <tr><th scope="row"><label for="thumb_height"><?php esc_html_e( 'Height of the thumbnail: ', 'contextual-related-posts' ); ?></label></th>
566
- <td>
567
- <input type="textbox" name="thumb_height" id="thumb_height" value="<?php echo esc_attr( $crp_settings['thumb_height'] ); ?>" style="width:50px" />px
568
- </td>
569
- </tr>
570
- <tr><th scope="row"><label for="thumb_crop"><?php esc_html_e( 'Crop mode:', 'contextual-related-posts' ); ?></label></th>
571
- <td>
572
- <input type="checkbox" name="thumb_crop" id="thumb_crop" <?php checked( true, $crp_settings['thumb_crop'] ); ?> />
573
- <p class="description">
574
- <?php esc_html_e( 'By default, thumbnails will be hard cropped. Uncheck this box to proportionately/soft crop the thumbnails.', 'contextual-related-posts' ); ?>
575
- </p>
576
- </td>
577
- </tr>
578
- <tr><th scope="row"><label for="thumb_create_sizes"><?php esc_html_e( 'Generate thumbnail sizes:', 'contextual-related-posts' ); ?></label></th>
579
- <td>
580
- <input type="checkbox" name="thumb_create_sizes" id="thumb_create_sizes" <?php checked( true, $crp_settings['thumb_create_sizes'] ); ?> />
581
- <p class="description">
582
- <?php esc_html_e( 'If you select this option and Custom size is selected above, the plugin will register the image size with WordPress to create new thumbnails. Does not update old images as explained above.', 'contextual-related-posts' ); ?>
583
- </p>
584
- </td>
585
- </tr>
586
- <tr><th scope="row"><label for="thumb_html"><?php esc_html_e( 'Image size attributes:', 'contextual-related-posts' ); ?></label></th>
587
- <td>
588
- <label>
589
- <input type="radio" name="thumb_html" value="css" id="thumb_html_0" <?php checked( 'css', $crp_settings['thumb_html'], true ); ?> />
590
- <?php
591
- esc_html_e( 'Style attributes. e.g.', 'contextual-related-posts' );
592
- echo ' <code>style="max-width:' . esc_attr( $crp_settings['thumb_width'] ) . 'px;max-height:' . esc_attr( $crp_settings['thumb_height'] ) . 'px;"</code>';
593
- ?>
594
- </label>
595
- <br />
596
- <label>
597
- <input type="radio" name="thumb_html" value="html" id="thumb_html_1" <?php checked( 'html', $crp_settings['thumb_html'], true ); ?> />
598
- <?php
599
- esc_html_e( 'HTML width and height attributes. e.g.', 'contextual-related-posts' );
600
- echo ' <code>width="' . esc_attr( $crp_settings['thumb_width'] ) . '" height="' . esc_attr( $crp_settings['thumb_height'] ) . '"</code>'
601
- ?>
602
- </label>
603
- <br />
604
- <label>
605
- <input type="radio" name="thumb_html" value="none" id="thumb_html_1" <?php checked( 'none', $crp_settings['thumb_html'], true ); ?> />
606
- <?php esc_html_e( 'No HTML or Style attributes', 'contextual-related-posts' ); ?>
607
- </label>
608
- <br />
609
- </td>
610
- </tr>
611
- <tr><th scope="row"><label for="thumb_meta"><?php esc_html_e( 'Post thumbnail meta field name:', 'contextual-related-posts' ); ?></label></th>
612
- <td><input type="textbox" name="thumb_meta" id="thumb_meta" value="<?php echo esc_attr( $crp_settings['thumb_meta'] ); ?>">
613
- <p class="description"><?php printf( esc_html__( 'The value of this field should contain a direct link to the image. This is set in the meta box in the %1$s screen.', 'contextual-related-posts' ), '<strong>' . esc_html__( 'Add New Post', 'contextual-related-posts' ) . '</strong>' ); ?></p>
614
- </td>
615
- </tr>
616
- <tr><th scope="row"><label for="scan_images"><?php esc_html_e( 'Extract the first image from the post?', 'contextual-related-posts' ); ?></label></th>
617
- <td><input type="checkbox" name="scan_images" id="scan_images" <?php checked( true, $crp_settings['scan_images'] ); ?> />
618
- <p class="description"><?php esc_html_e( 'This will only happen if there is no post thumbnail set and no image URL is specified in the meta field.', 'contextual-related-posts' ); ?></p>
619
- </td>
620
- </tr>
621
- <tr><th scope="row"><label for="thumb_default_show"><?php esc_html_e( 'Use default thumbnail?', 'contextual-related-posts' ); ?></label></th>
622
- <td><input type="checkbox" name="thumb_default_show" id="thumb_default_show" <?php checked( true, $crp_settings['thumb_default_show'] ); ?> />
623
- <p class="description"><?php esc_html_e( 'If checked, when no thumbnail is found, show a default one from the URL below. If not checked and no thumbnail is found, no image will be shown.', 'contextual-related-posts' ); ?></p>
624
- </td>
625
- </tr>
626
- <tr><th scope="row"><label for="thumb_default"><?php esc_html_e( 'Default thumbnail:', 'contextual-related-posts' ); ?></label></th>
627
- <td><input type="textbox" name="thumb_default" id="thumb_default" value="<?php echo esc_attr( $crp_settings['thumb_default'] ); ?>" style="width:100%">
628
- <?php
629
- if ( ! empty( $crp_settings['thumb_default'] ) ) {
630
- printf( '<img src="%1$s" style="max-width:200px" />', esc_url( $crp_settings['thumb_default'] ) );
631
- }
632
- ?>
633
- <p class="description"><?php esc_html_e( "The plugin will first check if the post contains a thumbnail. If it doesn't then it will check the meta field. If this is not available, then it will show the default image as specified above.", 'contextual-related-posts' ); ?></p>
634
- </td>
635
- </tr>
636
-
637
- <?php
638
- /**
639
- * Fires after Thumbnail options block under Output options.
640
- *
641
- * @since 2.0.0
642
- *
643
- * @param array $crp_settings Contextual Related Posts settings array
644
- */
645
- do_action( 'crp_admin_thumb_options_after', $crp_settings );
646
- ?>
647
-
648
- </table>
649
-
650
- <p>
651
- <input type="submit" name="crp_save" id="crp_thumbop_save" value="<?php esc_attr_e( 'Save Options', 'contextual-related-posts' ); ?>" class="button button-primary" />
652
- </p>
653
-
654
- </div> <!-- // inside -->
655
- </div> <!-- // outputopdiv -->
656
-
657
- <div id="customcssdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
658
- <h3 class='hndle'><span><?php esc_html_e( 'Styles', 'contextual-related-posts' ); ?></span></h3>
659
- <div class="inside">
660
-
661
- <table class="form-table">
662
-
663
- <?php
664
- /**
665
- * Fires before Custom styles options block.
666
- *
667
- * @since 2.0.0
668
- *
669
- * @param array $crp_settings Contextual Related Posts settings array
670
- */
671
- do_action( 'crp_admin_custom_styles_before', $crp_settings );
672
- ?>
673
-
674
- <tr><th scope="row"><?php esc_html_e( 'Style of the related posts:', 'contextual-related-posts' ); ?></th>
675
- <td>
676
- <label>
677
- <input type="radio" name="crp_styles" value="no_style" id="crp_styles_1" <?php checked( 'no_style', $crp_settings['crp_styles'] ); ?> /> <?php esc_html_e( 'No styles', 'contextual-related-posts' ); ?>
678
- </label>
679
- <p class="description"><?php esc_html_e( 'Select this option if you plan to add your own styles', 'contextual-related-posts' ); ?></p>
680
- <br />
681
-
682
- <label>
683
- <input type="radio" name="crp_styles" value="rounded_thumbs" id="crp_styles_0"
684
- <?php
685
- if ( $crp_settings['include_default_style'] && ( 'rounded_thumbs' === $crp_settings['crp_styles'] ) ) {
686
- echo 'checked="checked"'; }
687
- ?>
688
- /> <?php esc_html_e( 'Rounded Thumbnails', 'contextual-related-posts' ); ?>
689
- </label>
690
- <p class="description"><img src="<?php echo esc_url( plugins_url( 'admin/images/crp-rounded-thumbs.png', CRP_PLUGIN_FILE ) ); ?>" /></p>
691
- <p class="description"><?php esc_html_e( 'Enabling this option will turn on the thumbnails and set their width and height to 150px. It will also turn off the display of the author, excerpt and date if already enabled. Disabling this option will not revert any settings.', 'contextual-related-posts' ); ?></p>
692
- <p class="description">
693
- <?php
694
- printf(
695
- esc_html__( 'You can view the default style at %s', 'contextual-related-posts' ),
696
- '<a href="' . esc_url( 'https://github.com/WebberZone/contextual-related-posts/blob/master/css/default-style.css' ) . '" target="_blank">' . esc_url( 'https://github.com/WebberZone/contextual-related-posts/blob/master/css/default-style.css' ) . '</a>'
697
- );
698
- ?>
699
- </p>
700
- <br />
701
-
702
- <label>
703
- <input type="radio" name="crp_styles" value="text_only" id="crp_styles_1" <?php checked( 'text_only', $crp_settings['crp_styles'] ); ?> /> <?php esc_html_e( 'Text only', 'contextual-related-posts' ); ?>
704
- </label>
705
- <p class="description"><?php esc_html_e( 'Enabling this option will disable thumbnails and no longer include the default style sheet included in the plugin.', 'contextual-related-posts' ); ?></p>
706
-
707
- <?php
708
- /**
709
- * Fires after style checkboxes which allows an addon to add more styles.
710
- *
711
- * @since 2.2.0
712
- *
713
- * @param array $crp_settings Contextual Related Posts settings array
714
- */
715
- do_action( 'crp_admin_crp_styles', $crp_settings );
716
- ?>
717
-
718
- </td>
719
- </tr>
720
- <tr><th scope="row" colspan="2"><?php esc_html_e( 'Custom CSS to add to header:', 'contextual-related-posts' ); ?></th>
721
- </tr>
722
- <tr>
723
- <td scope="row" colspan="2">
724
- <textarea name="custom_CSS" id="custom_CSS" rows="15" cols="80" style="width:100%"><?php esc_html_e( $crp_settings['custom_CSS'] ); ?></textarea>
725
- <p class="description"><?php printf( esc_html__( 'Do not include %1$s tags. Check out the %2$s for available CSS classes to style.', 'contextual-related-posts' ), '<code>style</code>', '<a href="http://wordpress.org/extend/plugins/contextual-related-posts/faq/" target="_blank">FAQ</a>' ); ?></p>
726
- </td>
727
- </tr>
728
-
729
- <?php
730
- /**
731
- * Fires after Custom styles options block.
732
- *
733
- * @since 2.0.0
734
- *
735
- * @param array $crp_settings Contextual Related Posts settings array
736
- */
737
- do_action( 'crp_admin_custom_styles_after', $crp_settings );
738
- ?>
739
-
740
- </table>
741
-
742
- <p>
743
- <input type="submit" name="crp_save" id="crp_customcss_save" value="<?php esc_attr_e( 'Save Options', 'contextual-related-posts' ); ?>" class="button button-primary" />
744
- </p>
745
-
746
- </div> <!-- // inside -->
747
- </div> <!-- // customcssdiv -->
748
-
749
- <div id="feedopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
750
- <h3 class='hndle'><span><?php esc_html_e( 'Feed options', 'contextual-related-posts' ); ?></span></h3>
751
- <div class="inside">
752
-
753
- <table class="form-table">
754
-
755
- <?php
756
- /**
757
- * Fires before Feed options block.
758
- *
759
- * @since 2.0.0
760
- *
761
- * @param array $crp_settings Contextual Related Posts settings array
762
- */
763
- do_action( 'crp_admin_feed_options_before', $crp_settings );
764
- ?>
765
-
766
- <tr><th scope="row" colspan="2"><?php esc_html_e( 'Below options override the related posts settings for your blog feed. These only apply if you have selected to add related posts to Feeds in the General Options tab.', 'contextual-related-posts' ); ?></th>
767
- </tr>
768
- <tr><th scope="row"><label for="limit_feed"><?php esc_html_e( 'Number of related posts to display: ', 'contextual-related-posts' ); ?></label></th>
769
- <td><input type="textbox" name="limit_feed" id="limit_feed" value="<?php echo esc_attr( $crp_settings['limit_feed'] ); ?>"></td>
770
- </tr>
771
- <tr><th scope="row"><label for="show_excerpt_feed"><?php esc_html_e( 'Show post excerpt in list?', 'contextual-related-posts' ); ?></label></th>
772
- <td><input type="checkbox" name="show_excerpt_feed" id="show_excerpt_feed" <?php checked( true, $crp_settings['show_excerpt_feed'] ); ?> /></td>
773
- </tr>
774
- <tr><th scope="row"><label for="post_thumb_op_feed"><?php esc_html_e( 'Location of post thumbnail:', 'contextual-related-posts' ); ?></label></th>
775
- <td>
776
- <label>
777
- <input type="radio" name="post_thumb_op_feed" value="inline" id="post_thumb_op_feed_0" <?php checked( 'inline', $crp_settings['post_thumb_op_feed'] ); ?> />
778
- <?php esc_html_e( 'Display thumbnails inline with posts, before title', 'contextual-related-posts' ); ?></label>
779
- <br />
780
- <label>
781
- <input type="radio" name="post_thumb_op_feed" value="after" id="post_thumb_op_feed_1" <?php checked( 'after', $crp_settings['post_thumb_op_feed'] ); ?> />
782
- <?php esc_html_e( 'Display thumbnails inline with posts, after title', 'contextual-related-posts' ); ?></label>
783
- <br />
784
- <label>
785
- <input type="radio" name="post_thumb_op_feed" value="thumbs_only" id="post_thumb_op_feed_2" <?php checked( 'thumbs_only', $crp_settings['post_thumb_op_feed'] ); ?> />
786
- <?php esc_html_e( 'Display only thumbnails, no text', 'contextual-related-posts' ); ?></label>
787
- <br />
788
- <label>
789
- <input type="radio" name="post_thumb_op_feed" value="text_only" id="post_thumb_op_feed_3" <?php checked( 'text_only', $crp_settings['post_thumb_op_feed'] ); ?> />
790
- <?php esc_html_e( 'Do not display thumbnails, only text.', 'contextual-related-posts' ); ?></label>
791
- <br />
792
- </td>
793
- </tr>
794
- <tr><th scope="row"><label for="thumb_width_feed"><?php esc_html_e( 'Maximum width of the thumbnail: ', 'contextual-related-posts' ); ?></label></th>
795
- <td><input type="textbox" name="thumb_width_feed" id="thumb_width_feed" value="<?php echo esc_attr( $crp_settings['thumb_width_feed'] ); ?>" style="width:50px" />px</td>
796
- </tr>
797
- <tr><th scope="row"><label for="thumb_height_feed"><?php esc_html_e( 'Maximum height of the thumbnail: ', 'contextual-related-posts' ); ?></label></th>
798
- <td><input type="textbox" name="thumb_height_feed" id="thumb_height_feed" value="<?php echo esc_attr( $crp_settings['thumb_height_feed'] ); ?>" style="width:50px" />px</td>
799
- </tr>
800
-
801
- <?php
802
- /**
803
- * Fires after Feed options block.
804
- *
805
- * @since 2.0.0
806
- *
807
- * @param array $crp_settings Contextual Related Posts settings array
808
- */
809
- do_action( 'crp_admin_feed_options_after', $crp_settings );
810
- ?>
811
-
812
- </table>
813
-
814
- <p>
815
- <input type="submit" name="crp_save" id="crp_feedop_save" value="<?php esc_attr_e( 'Save Options', 'contextual-related-posts' ); ?>" class="button button-primary" />
816
- </p>
817
-
818
- </div> <!-- // inside -->
819
- </div> <!-- // feedopdiv -->
820
-
821
- <?php
822
- /**
823
- * Fires after all the options are displayed. Allows a custom function to add a new option block.
824
- *
825
- * @since 2.0.0
826
- */
827
- do_action( 'crp_admin_more_options' )
828
- ?>
829
-
830
- <p>
831
- <input type="submit" name="crp_save" id="crp_save" value="<?php esc_attr_e( 'Save Options', 'contextual-related-posts' ); ?>" class="button button-primary" />
832
- <input name="crp_default" type="submit" id="crp_default" value="<?php esc_attr_e( 'Default Options', 'contextual-related-posts' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'Do you want to set options to Default?', 'contextual-related-posts' ); ?>')) return false;" />
833
- <input name="crp_recreate" type="submit" id="crp_recreate" value="<?php esc_attr_e( 'Recreate Index', 'contextual-related-posts' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'Are you sure you want to recreate the index?', 'contextual-related-posts' ); ?>')) return false;" />
834
- </p>
835
-
836
- <?php if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related'" ) || ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_title'" ) || ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_content'" ) ) { ?>
837
- <div class="notice error">
838
- <?php printf( esc_html__( 'One or more FULLTEXT indices are missing. Please hit the %1$s at the bottom of the page to fix this.', 'contextual-related-posts' ), '<a href="#crp_recreate">' . esc_html__( 'Recreate Index button', 'contextual-related-posts' ) . '</a>' ); ?>
839
- </div>
840
- <?php } ?>
841
-
842
- <div class="inside">
843
- <p><?php esc_html_e( 'If the Recreate Index button fails, please run the following queries in phpMyAdmin or Adminer', 'contextual-related-posts' ); ?></p>
844
- <p>
845
- <code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> DROP INDEX crp_related;</code><br />
846
- <code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> DROP INDEX crp_related_title;</code><br />
847
- <code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> DROP INDEX crp_related_content;</code><br />
848
- <code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> ADD FULLTEXT crp_related (post_title, post_content);</code><br />
849
- <code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> ADD FULLTEXT crp_related_title (post_title);</code><br />
850
- <code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> ADD FULLTEXT crp_related_content (post_content);</code><br />
851
- </p>
852
- </div>
853
-
854
- <?php wp_nonce_field( 'crp-plugin-settings' ); ?>
855
- </form>
856
- </div><!-- /post-body-content -->
857
- <div id="postbox-container-1" class="postbox-container">
858
- <div id="side-sortables" class="meta-box-sortables ui-sortable">
859
-
860
- <?php require_once 'sidebar-view.php'; ?>
861
-
862
- </div><!-- /side-sortables -->
863
- </div><!-- /postbox-container-1 -->
864
- </div><!-- /post-body -->
865
- <br class="clear" />
866
- </div><!-- /poststuff -->
867
- </div><!-- /wrap -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/sidebar-view.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
- /**
3
- * Represents the sidebar view for the administration dashboard.
4
- *
5
- * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2018 Ajay D'Souza
10
- */
11
-
12
- // If this file is called directly, abort.
13
- if ( ! defined( 'WPINC' ) ) {
14
- die;
15
- }
16
-
17
- ?>
18
-
19
- <div id="donatediv" class="postbox"><div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
20
- <h3 class='hndle'><span><?php esc_html_e( 'Support the development', 'contextual-related-posts' ); ?></span></h3>
21
- <div class="inside">
22
- <div id="donate-form">
23
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
24
- <input type="hidden" name="cmd" value="_xclick">
25
- <input type="hidden" name="business" value="donate@ajaydsouza.com">
26
- <input type="hidden" name="lc" value="IN">
27
- <input type="hidden" name="item_name" value="<?php esc_attr_e( 'Donation for Contextual Related Posts', 'contextual-related-posts' ); ?>">
28
- <input type="hidden" name="item_number" value="crp_plugin_settings">
29
- <strong><?php esc_html_e( 'Enter amount in USD:', 'contextual-related-posts' ); ?></strong> <input name="amount" value="10.00" size="6" type="text"><br />
30
- <input type="hidden" name="currency_code" value="USD">
31
- <input type="hidden" name="button_subtype" value="services">
32
- <input type="hidden" name="bn" value="PP-BuyNowBF:btn_donate_LG.gif:NonHosted">
33
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="<?php esc_attr_e( 'Send your donation to the author of', 'contextual-related-posts' ); ?> Contextual Related Posts?">
34
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
35
- </form>
36
- </div>
37
- </div>
38
- </div>
39
-
40
- <div id="qlinksdiv" class="postbox"><div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
41
- <h3 class='hndle'><span><?php esc_html_e( 'Quick links', 'contextual-related-posts' ); ?></span></h3>
42
- <div class="inside">
43
- <div id="quick-links">
44
- <ul>
45
- <li><a href="https://webberzone.com/"><?php esc_html_e( 'WebberZone', 'contextual-related-posts' ); ?></a></li>
46
- <li><a href="https://webberzone.com/plugins/contextual-related-posts/"><?php esc_html_e( 'Plugin homepage', 'contextual-related-posts' ); ?></a></li>
47
- <li><a href="https://wordpress.org/plugins/contextual-related-posts/faq/"><?php esc_html_e( 'FAQ', 'contextual-related-posts' ); ?></a></li>
48
- <li><a href="http://wordpress.org/support/plugin/contextual-related-posts"><?php esc_html_e( 'Support', 'contextual-related-posts' ); ?></a></li>
49
- <li><a href="https://wordpress.org/support/view/plugin-reviews/contextual-related-posts"><?php esc_html_e( 'Reviews', 'contextual-related-posts' ); ?></a></li>
50
- <li><a href="https://github.com/WebberZone/contextual-related-posts"><?php esc_html_e( 'Github repository', 'contextual-related-posts' ); ?></a></li>
51
- <li><a href="https://webberzone.com/plugins/"><?php esc_html_e( 'Other plugins', 'contextual-related-posts' ); ?></a></li>
52
- <li><a href="https://webberzone.com/"><?php esc_html_e( "Ajay's blog", 'contextual-related-posts' ); ?></a></li>
53
- </ul>
54
- </div>
55
- </div>
56
- </div>
57
-
58
- <div id="followdiv" class="postbox"><div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'contextual-related-posts' ); ?>"><br /></div>
59
- <h3 class='hndle'><span><?php esc_html_e( 'Follow us', 'contextual-related-posts' ); ?></span></h3>
60
- <div class="inside">
61
- <a href="https://facebook.com/webberzone/" target="_blank"><img src="<?php echo esc_url( CRP_PLUGIN_URL . '/admin/images/fb.png' ); ?>" width="100" height="100" /></a>
62
- <a href="https://twitter.com/webberzonewp/" target="_blank"><img src="<?php echo esc_url( CRP_PLUGIN_URL . '/admin/images/twitter.jpg' ); ?>" width="100" height="100" /></a>
63
- </div>
64
- </div>
65
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-2018 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.5.1
19
  * Author: WebberZone
20
  * Author URI: https://webberzone.com
21
  * License: GPL-2.0+
@@ -30,27 +30,27 @@ if ( ! defined( 'WPINC' ) ) {
30
  die;
31
  }
32
 
33
-
34
  /**
35
  * Holds the filesystem directory path (with trailing slash) for Contextual Related Posts.
36
  *
37
  * @since 2.3.0
38
  *
39
- * @var string Plugin folder path
40
  */
41
- if ( ! defined( 'CRP_PLUGIN_DIR' ) ) {
42
- define( 'CRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  }
44
 
 
45
  /**
46
  * Holds the filesystem directory path (with trailing slash) for Contextual Related Posts.
47
  *
48
  * @since 2.3.0
49
  *
50
- * @var string Plugin folder URL
51
  */
52
- if ( ! defined( 'CRP_PLUGIN_URL' ) ) {
53
- define( 'CRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
54
  }
55
 
56
  /**
@@ -58,13 +58,12 @@ if ( ! defined( 'CRP_PLUGIN_URL' ) ) {
58
  *
59
  * @since 2.3.0
60
  *
61
- * @var string Plugin Root File
62
  */
63
- if ( ! defined( 'CRP_PLUGIN_FILE' ) ) {
64
- define( 'CRP_PLUGIN_FILE', __FILE__ );
65
  }
66
 
67
-
68
  /**
69
  * Maximum words to match in the content.
70
  *
@@ -76,170 +75,14 @@ if ( ! defined( 'CRP_MAX_WORDS' ) ) {
76
  define( 'CRP_MAX_WORDS', 500 );
77
  }
78
 
79
-
80
- /**
81
- * Global variable holding the current settings for Contextual Related Posts
82
- *
83
- * @since 1.8.10
84
- *
85
- * @var array
86
- */
87
- global $crp_settings;
88
- $crp_settings = crp_read_options();
89
-
90
-
91
- /**
92
- * Default options.
93
- *
94
- * @since 1.0.1
95
- *
96
- * @return array Default options
97
- */
98
- function crp_default_options() {
99
-
100
- $title = __( '<h3>Related Posts:</h3>', 'contextual-related-posts' );
101
-
102
- $blank_output_text = __( 'No related posts found', 'contextual-related-posts' );
103
-
104
- $thumb_default = plugins_url( 'default.png', __FILE__ );
105
-
106
- $crp_settings = array(
107
- // General options.
108
- 'cache' => false, // Cache output for faster page load.
109
-
110
- 'add_to_content' => true, // Add related posts to content (only on single posts).
111
- 'add_to_page' => true, // Add related posts to content (only on single pages).
112
- 'add_to_feed' => false, // Add related posts to feed (full).
113
- 'add_to_home' => false, // Add related posts to home page.
114
- 'add_to_category_archives' => false, // Add related posts to category archives.
115
- 'add_to_tag_archives' => false, // Add related posts to tag archives.
116
- 'add_to_archives' => false, // Add related posts to other archives.
117
-
118
- 'content_filter_priority' => 10, // Content priority.
119
- 'insert_after_paragraph' => -1, // Insert after paragraph number.
120
- 'disable_on_mobile' => false, // Disable on mobile.
121
- 'disable_on_amp' => false, // Disable on AMP.
122
- 'show_metabox' => true, // Show metabox to admins.
123
- 'show_metabox_admins' => false, // Limit to admins as well.
124
-
125
- 'show_credit' => false, // Link to this plugin's page?
126
-
127
- // List tuning options.
128
- 'limit' => '6', // How many posts to display?
129
- 'daily_range' => '1095', // How old posts should be displayed?
130
- 'random_order' => false, // Randomise posts.
131
-
132
- 'match_content' => true, // Match against post content as well as title.
133
- 'match_content_words' => '0', // How many characters of content should be matched? 0 for all chars.
134
-
135
- 'post_types' => 'post,page', // WordPress custom post types.
136
- 'same_post_type' => false, // Limit to the same post type.
137
-
138
- 'exclude_categories' => '', // Exclude these categories.
139
- 'exclude_cat_slugs' => '', // Exclude these categories (slugs).
140
- 'exclude_post_ids' => '', // Comma separated list of page / post IDs that are to be excluded in the results.
141
-
142
- // Output options.
143
- 'title' => $title, // Add before the content.
144
- 'blank_output' => true, // Blank output?
145
- 'blank_output_text' => $blank_output_text, // Blank output text.
146
-
147
- 'show_excerpt' => false, // Show post excerpt in list item.
148
- 'show_date' => false, // Show date in list item.
149
- 'show_author' => false, // Show author in list item.
150
- 'excerpt_length' => '10', // Length of characters.
151
- 'title_length' => '60', // Limit length of post title.
152
-
153
- 'link_new_window' => false, // Open link in new window.
154
- 'link_nofollow' => false, // Includes rel nofollow to links.
155
-
156
- 'before_list' => '<ul>', // Before the entire list.
157
- 'after_list' => '</ul>', // After the entire list.
158
- 'before_list_item' => '<li>', // Before each list item.
159
- 'after_list_item' => '</li>', // After each list item.
160
-
161
- 'exclude_on_post_ids' => '', // Comma separate list of page/post IDs to not display related posts on.
162
- 'exclude_on_post_types' => '', // WordPress custom post types.
163
-
164
- // Thumbnail options.
165
- 'post_thumb_op' => 'inline', // Default option to display text and no thumbnails in posts.
166
- 'thumb_size' => 'thumbnail', // Default thumbnail size.
167
- 'thumb_height' => '150', // Height of thumbnails.
168
- 'thumb_width' => '150', // Width of thumbnails.
169
- 'thumb_crop' => true, // Crop mode. default is hard crop.
170
- 'thumb_create_sizes' => true, // Create thumbnail sizes.
171
- 'thumb_html' => 'html', // Use HTML or CSS for width and height of the thumbnail?
172
- 'thumb_meta' => 'post-image', // Meta field that is used to store the location of default thumbnail image.
173
- 'scan_images' => true, // Scan post for images.
174
- 'thumb_default' => $thumb_default, // Default thumbnail image.
175
- 'thumb_default_show' => true, // Show default thumb if none found (if false, don't show thumb at all).
176
-
177
- // Feed options.
178
- 'limit_feed' => '5', // How many posts to display in feeds.
179
- 'post_thumb_op_feed' => 'text_only', // Default option to display text and no thumbnails in Feeds.
180
- 'thumb_height_feed' => '50', // Height of thumbnails in feed.
181
- 'thumb_width_feed' => '50', // Width of thumbnails in feed.
182
- 'show_excerpt_feed' => false, // Show description in list item in feed.
183
-
184
- // Custom styles.
185
- 'custom_CSS' => '', // Custom CSS to style the output.
186
- 'include_default_style' => true, // Include default style - Will be DEPRECATED in the next version.
187
- 'crp_styles' => 'rounded_thumbs', // Defaault style is rounded thubnails.
188
- );
189
-
190
- /**
191
- * Filters the default options array.
192
- *
193
- * @since 1.9.1
194
- *
195
- * @param array $crp_settings Default options.
196
- */
197
- return apply_filters( 'crp_default_options', $crp_settings );
198
- }
199
-
200
-
201
- /**
202
- * Function to read options from the database.
203
- *
204
- * @since 1.0.1
205
- *
206
- * @return array Contextual Related Posts options
207
- */
208
- function crp_read_options() {
209
- $crp_settings_changed = false;
210
-
211
- $defaults = crp_default_options();
212
-
213
- $crp_settings = array_map( 'stripslashes', (array) get_option( 'ald_crp_settings' ) );
214
- unset( $crp_settings[0] ); // Produced by the (array) casting when there's nothing in the DB.
215
-
216
- foreach ( $defaults as $k => $v ) {
217
- if ( ! isset( $crp_settings[ $k ] ) ) {
218
- $crp_settings[ $k ] = $v;
219
- }
220
- $crp_settings_changed = true;
221
- }
222
- if ( true === $crp_settings_changed ) {
223
- update_option( 'ald_crp_settings', $crp_settings );
224
- }
225
-
226
- /**
227
- * Filters the options array.
228
- *
229
- * @since 1.9.1
230
- *
231
- * @param array $crp_settings Options read from the database
232
- */
233
- return apply_filters( 'crp_read_options', $crp_settings );
234
- }
235
-
236
-
237
  /*
238
  *----------------------------------------------------------------------------
239
  * CRP modules & includes
240
  *----------------------------------------------------------------------------
241
  */
242
 
 
 
243
  require_once CRP_PLUGIN_DIR . 'includes/plugin-activator.php';
244
  require_once CRP_PLUGIN_DIR . 'includes/i10n.php';
245
  require_once CRP_PLUGIN_DIR . 'includes/output-generator.php';
@@ -263,10 +106,14 @@ require_once CRP_PLUGIN_DIR . 'includes/modules/class-crp-widget.php';
263
 
264
  if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
265
 
266
- require_once CRP_PLUGIN_DIR . 'admin/admin.php';
267
- require_once CRP_PLUGIN_DIR . 'admin/loader.php';
268
- require_once CRP_PLUGIN_DIR . 'admin/metabox.php';
269
- require_once CRP_PLUGIN_DIR . 'admin/cache.php';
 
 
 
 
270
 
271
  } // End if.
272
 
@@ -279,3 +126,38 @@ if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
279
 
280
  require_once CRP_PLUGIN_DIR . 'includes/deprecated.php';
281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.6.0
19
  * Author: WebberZone
20
  * Author URI: https://webberzone.com
21
  * License: GPL-2.0+
30
  die;
31
  }
32
 
 
33
  /**
34
  * Holds the filesystem directory path (with trailing slash) for Contextual Related Posts.
35
  *
36
  * @since 2.3.0
37
  *
38
+ * @var string Plugin Root File
39
  */
40
+ if ( ! defined( 'CRP_PLUGIN_FILE' ) ) {
41
+ define( 'CRP_PLUGIN_FILE', __FILE__ );
42
  }
43
 
44
+
45
  /**
46
  * Holds the filesystem directory path (with trailing slash) for Contextual Related Posts.
47
  *
48
  * @since 2.3.0
49
  *
50
+ * @var string Plugin folder path
51
  */
52
+ if ( ! defined( 'CRP_PLUGIN_DIR' ) ) {
53
+ define( 'CRP_PLUGIN_DIR', plugin_dir_path( CRP_PLUGIN_FILE ) );
54
  }
55
 
56
  /**
58
  *
59
  * @since 2.3.0
60
  *
61
+ * @var string Plugin folder URL
62
  */
63
+ if ( ! defined( 'CRP_PLUGIN_URL' ) ) {
64
+ define( 'CRP_PLUGIN_URL', plugin_dir_url( CRP_PLUGIN_FILE ) );
65
  }
66
 
 
67
  /**
68
  * Maximum words to match in the content.
69
  *
75
  define( 'CRP_MAX_WORDS', 500 );
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  /*
79
  *----------------------------------------------------------------------------
80
  * CRP modules & includes
81
  *----------------------------------------------------------------------------
82
  */
83
 
84
+ require_once CRP_PLUGIN_DIR . 'includes/admin/default-settings.php';
85
+ require_once CRP_PLUGIN_DIR . 'includes/admin/register-settings.php';
86
  require_once CRP_PLUGIN_DIR . 'includes/plugin-activator.php';
87
  require_once CRP_PLUGIN_DIR . 'includes/i10n.php';
88
  require_once CRP_PLUGIN_DIR . 'includes/output-generator.php';
106
 
107
  if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
108
 
109
+ require_once CRP_PLUGIN_DIR . 'includes/admin/admin.php';
110
+ require_once CRP_PLUGIN_DIR . 'includes/admin/settings-page.php';
111
+ require_once CRP_PLUGIN_DIR . 'includes/admin/save-settings.php';
112
+ require_once CRP_PLUGIN_DIR . 'includes/admin/help-tab.php';
113
+ require_once CRP_PLUGIN_DIR . 'includes/admin/modules/tools.php';
114
+ require_once CRP_PLUGIN_DIR . 'includes/admin/modules/loader.php';
115
+ require_once CRP_PLUGIN_DIR . 'includes/admin/modules/metabox.php';
116
+ require_once CRP_PLUGIN_DIR . 'includes/admin/modules/cache.php';
117
 
118
  } // End if.
119
 
126
 
127
  require_once CRP_PLUGIN_DIR . 'includes/deprecated.php';
128
 
129
+
130
+ /**
131
+ * Global variable holding the current settings for Contextual Related Posts
132
+ *
133
+ * @since 1.8.10
134
+ *
135
+ * @var array
136
+ */
137
+ global $crp_settings;
138
+ $crp_settings = crp_get_settings();
139
+
140
+
141
+ /**
142
+ * Get Settings.
143
+ *
144
+ * Retrieves all plugin settings
145
+ *
146
+ * @since 2.6.0
147
+ * @return array Contextual Related Posts settings
148
+ */
149
+ function crp_get_settings() {
150
+
151
+ $settings = get_option( 'crp_settings' );
152
+
153
+ /**
154
+ * Settings array
155
+ *
156
+ * Retrieves all plugin settings
157
+ *
158
+ * @since 2.0.0
159
+ * @param array $settings Settings array
160
+ */
161
+ return apply_filters( 'crp_get_settings', $settings );
162
+ }
163
+
includes/admin/admin.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The admin-specific functionality of the plugin.
4
+ *
5
+ * @link https://webberzone.com
6
+ * @since 2.6.0
7
+ *
8
+ * @package Contextual Related Posts
9
+ * @subpackage Admin
10
+ */
11
+
12
+ // If this file is called directly, abort.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
+
18
+ /**
19
+ * Creates the admin submenu pages under the Downloads menu and assigns their
20
+ * links to global variables
21
+ *
22
+ * @since 2.6.0
23
+ *
24
+ * @global $crp_settings_page, $crp_settings_tools_help
25
+ * @return void
26
+ */
27
+ function crp_add_admin_pages_links() {
28
+ global $crp_settings_page, $crp_settings_tools_help;
29
+
30
+ $crp_settings_page = add_options_page(
31
+ esc_html__( 'Contextual Related Posts', 'contextual-related-posts' ),
32
+ esc_html__( 'Related Posts', 'contextual-related-posts' ),
33
+ 'manage_options',
34
+ 'crp_options_page',
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,
42
+ esc_html__( 'Contextual Related Posts Tools', 'contextual-related-posts' ),
43
+ esc_html__( 'Tools', 'contextual-related-posts' ),
44
+ 'manage_options',
45
+ 'crp_tools_page',
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
+ *
220
+ * @since 2.6.0
221
+ *
222
+ * @param string $footer_text The existing footer text.
223
+ * @return string Updated Footer text
224
+ */
225
+ function crp_admin_footer( $footer_text ) {
226
+ global $crp_settings_page, $crp_settings_tools_help;
227
+
228
+ $current_screen = get_current_screen();
229
+
230
+ if ( $current_screen->id === $crp_settings_page || $current_screen->id === $crp_settings_tools_help ) {
231
+
232
+ $text = sprintf(
233
+ /* translators: 1: Contextual Related Posts website, 2: Plugin reviews link. */
234
+ __( 'Thank you for using <a href="%1$s" target="_blank">Contextual Related Posts</a>! Please <a href="%2$s" target="_blank">rate us</a> on <a href="%2$s" target="_blank">WordPress.org</a>', 'contextual-related-posts' ),
235
+ 'https://webberzone.com/contextual-related-posts',
236
+ 'https://wordpress.org/support/plugin/contextual-related-posts/reviews/#new-post'
237
+ );
238
+
239
+ return str_replace( '</span>', '', $footer_text ) . ' | ' . $text . '</span>';
240
+
241
+ } else {
242
+
243
+ return $footer_text;
244
+
245
+ }
246
+ }
247
+ add_filter( 'admin_footer_text', 'crp_admin_footer' );
248
+
includes/admin/default-settings.php ADDED
@@ -0,0 +1,734 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Default settings.
4
+ *
5
+ * Functions to register the default settings of the plugin.
6
+ *
7
+ * @link https://webberzone.com
8
+ * @since 2.6.0
9
+ *
10
+ * @package Contextual_Related_Posts
11
+ * @subpackage Admin/Register_Settings
12
+ */
13
+
14
+ // If this file is called directly, abort.
15
+ if ( ! defined( 'WPINC' ) ) {
16
+ die;
17
+ }
18
+
19
+
20
+ /**
21
+ * Retrieve the array of plugin settings
22
+ *
23
+ * @since 2.6.0
24
+ *
25
+ * @return array Settings array
26
+ */
27
+ function crp_get_registered_settings() {
28
+
29
+ $crp_settings = array(
30
+ 'general' => crp_settings_general(),
31
+ 'list' => crp_settings_list(),
32
+ 'output' => crp_settings_output(),
33
+ 'thumbnail' => crp_settings_thumbnail(),
34
+ 'styles' => crp_settings_styles(),
35
+ 'feed' => crp_settings_feed(),
36
+ );
37
+
38
+ /**
39
+ * Filters the settings array
40
+ *
41
+ * @since 2.6.0
42
+ *
43
+ * @param array $crp_settings Settings array
44
+ */
45
+ return apply_filters( 'crp_registered_settings', $crp_settings );
46
+
47
+ }
48
+
49
+
50
+ /**
51
+ * Retrieve the array of General settings
52
+ *
53
+ * @since 2.6.0
54
+ *
55
+ * @return array General settings array
56
+ */
57
+ function crp_settings_general() {
58
+
59
+ $settings = array(
60
+ 'cache' => array(
61
+ 'id' => 'cache',
62
+ 'name' => esc_html__( 'Enable cache', 'contextual-related-posts' ),
63
+ 'desc' => esc_html__( 'Enabling this option will cache the related posts output when the post is visited the first time. The cache is cleaned when you save this page.', 'contextual-related-posts' ),
64
+ 'type' => 'checkbox',
65
+ 'options' => false,
66
+ ),
67
+ 'add_to' => array(
68
+ 'id' => 'add_to',
69
+ 'name' => esc_html__( 'Automatically add related posts to', 'contextual-related-posts' ) . ':',
70
+ /* translators: 1: Code. */
71
+ 'desc' => sprintf( esc_html__( 'If you choose to disable this, please add %1$s to your template file where you want it displayed', 'contextual-related-posts' ), "<code>&lt;?php if ( function_exists( 'echo_crp' ) ) { echo_crp(); } ?&gt;</code>" ),
72
+ 'type' => 'multicheck',
73
+ 'default' => array(
74
+ 'single' => 'single',
75
+ 'page' => 'page',
76
+ ),
77
+ 'options' => array(
78
+ 'single' => esc_html__( 'Posts', 'contextual-related-posts' ),
79
+ 'page' => esc_html__( 'Pages', 'contextual-related-posts' ),
80
+ 'home' => esc_html__( 'Home page', 'contextual-related-posts' ),
81
+ 'feed' => esc_html__( 'Feeds', 'contextual-related-posts' ),
82
+ 'category_archives' => esc_html__( 'Category archives', 'contextual-related-posts' ),
83
+ 'tag_archives' => esc_html__( 'Tag archives', 'contextual-related-posts' ),
84
+ 'other_archives' => esc_html__( 'Other archives', 'contextual-related-posts' ),
85
+ ),
86
+ ),
87
+ 'content_filter_priority' => array(
88
+ 'id' => 'content_filter_priority',
89
+ 'name' => esc_html__( 'Display location priority', 'contextual-related-posts' ),
90
+ 'desc' => esc_html__( 'Select the relative position of the related posts in the post content. A higher number pushes the related posts later in the content. Any number below 10 is not recommended.', 'contextual-related-posts' ),
91
+ 'type' => 'number',
92
+ 'options' => '999',
93
+ ),
94
+ 'insert_after_paragraph' => array(
95
+ 'id' => 'insert_after_paragraph',
96
+ 'name' => esc_html__( 'Insert after paragraph number', 'contextual-related-posts' ),
97
+ 'desc' => esc_html__( 'Enter 0 to display the related posts before the post content, -1 to display this at the end or a number to insert it after that paragraph number. If your post has less paragraphs, related posts will be displayed at the end.', 'contextual-related-posts' ),
98
+ 'type' => 'number',
99
+ 'options' => '-1',
100
+ 'min' => '-1',
101
+ ),
102
+ 'disable_on_mobile' => array(
103
+ 'id' => 'disable_on_mobile',
104
+ 'name' => esc_html__( 'Disable on mobile devices', 'contextual-related-posts' ),
105
+ 'desc' => esc_html__( 'Disable display of related posts on mobile devices. Might not always work with caching plugins.', 'contextual-related-posts' ),
106
+ 'type' => 'checkbox',
107
+ 'options' => false,
108
+ ),
109
+ 'disable_on_amp' => array(
110
+ 'id' => 'disable_on_amp',
111
+ 'name' => esc_html__( 'Disable on AMP pages', 'contextual-related-posts' ),
112
+ 'desc' => esc_html__( 'Disable display of related posts on AMP pages.', 'contextual-related-posts' ),
113
+ 'type' => 'checkbox',
114
+ 'options' => false,
115
+ ),
116
+ 'uninstall_clean_options' => array(
117
+ 'id' => 'uninstall_clean_options',
118
+ 'name' => esc_html__( 'Delete options on uninstall', 'contextual-related-posts' ),
119
+ 'desc' => esc_html__( 'If this is checked, all settings related to Contextual Related Posts are removed from the database if you choose to uninstall/delete the plugin.', 'contextual-related-posts' ),
120
+ 'type' => 'checkbox',
121
+ 'options' => true,
122
+ ),
123
+ 'show_metabox' => array(
124
+ 'id' => 'show_metabox',
125
+ 'name' => esc_html__( 'Show metabox', 'contextual-related-posts' ),
126
+ 'desc' => esc_html__( 'This will add the Contextual Related Posts metabox on Edit Posts or Add New Posts screens. Also applies to Pages and Custom Post Types.', 'contextual-related-posts' ),
127
+ 'type' => 'checkbox',
128
+ 'options' => true,
129
+ ),
130
+ 'show_metabox_admins' => array(
131
+ 'id' => 'show_metabox_admins',
132
+ 'name' => esc_html__( 'Limit meta box to Admins only', 'contextual-related-posts' ),
133
+ 'desc' => esc_html__( 'If selected, the meta box will be hidden from anyone who is not an Admin. By default, Contributors and above will be able to see the meta box. Applies only if the above option is selected.', 'contextual-related-posts' ),
134
+ 'type' => 'checkbox',
135
+ 'options' => false,
136
+ ),
137
+ 'show_credit' => array(
138
+ 'id' => 'show_credit',
139
+ 'name' => esc_html__( 'Link to Contextual Related Posts plugin page', 'contextual-related-posts' ),
140
+ 'desc' => esc_html__( 'A no-follow link to the plugin homepage will be added as the last item of the related posts.', 'contextual-related-posts' ),
141
+ 'type' => 'checkbox',
142
+ 'options' => false,
143
+ ),
144
+ );
145
+
146
+ /**
147
+ * Filters the General settings array
148
+ *
149
+ * @since 2.6.0
150
+ *
151
+ * @param array $settings General settings array
152
+ */
153
+ return apply_filters( 'crp_settings_general', $settings );
154
+ }
155
+
156
+
157
+ /**
158
+ * Retrieve the array of Output settings
159
+ *
160
+ * @since 2.6.0
161
+ *
162
+ * @return array Output settings array
163
+ */
164
+ function crp_settings_output() {
165
+
166
+ $settings = array(
167
+ 'title' => array(
168
+ 'id' => 'title',
169
+ 'name' => esc_html__( 'Heading of posts', 'contextual-related-posts' ),
170
+ 'desc' => esc_html__( 'Displayed before the list of the posts as a master heading', 'contextual-related-posts' ),
171
+ 'type' => 'text',
172
+ 'options' => '<h3>' . esc_html__( 'Related Posts', 'contextual-related-posts' ) . ':</h3>',
173
+ 'size' => 'large',
174
+ ),
175
+ 'blank_output' => array(
176
+ 'id' => 'blank_output',
177
+ 'name' => esc_html__( 'Show when no posts are found', 'contextual-related-posts' ),
178
+ /* translators: 1: Code. */
179
+ 'desc' => '',
180
+ 'type' => 'radio',
181
+ 'default' => 'blank',
182
+ 'options' => array(
183
+ 'blank' => esc_html__( 'Blank output', 'contextual-related-posts' ),
184
+ 'custom_text' => esc_html__( 'Display custom text', 'contextual-related-posts' ),
185
+ ),
186
+ ),
187
+ 'blank_output_text' => array(
188
+ 'id' => 'blank_output_text',
189
+ 'name' => esc_html__( 'Custom text', 'contextual-related-posts' ),
190
+ 'desc' => esc_html__( 'Enter the custom text that will be displayed if the second option is selected above.', 'contextual-related-posts' ),
191
+ 'type' => 'textarea',
192
+ 'options' => esc_html__( 'No related posts found', 'contextual-related-posts' ),
193
+ ),
194
+ 'show_excerpt' => array(
195
+ 'id' => 'show_excerpt',
196
+ 'name' => esc_html__( 'Show post excerpt', 'contextual-related-posts' ),
197
+ 'desc' => esc_html__( 'If the post does not have an excerpt, the plugin will automatically create one containing the number of words specified in the next option.', 'contextual-related-posts' ),
198
+ 'type' => 'checkbox',
199
+ 'options' => false,
200
+ ),
201
+ 'excerpt_length' => array(
202
+ 'id' => 'excerpt_length',
203
+ 'name' => esc_html__( 'Length of excerpt (in words)', 'contextual-related-posts' ),
204
+ 'desc' => '',
205
+ 'type' => 'number',
206
+ 'options' => '10',
207
+ 'min' => '0',
208
+ 'size' => 'small',
209
+ ),
210
+ 'show_date' => array(
211
+ 'id' => 'show_date',
212
+ 'name' => esc_html__( 'Show date', 'contextual-related-posts' ),
213
+ 'desc' => esc_html__( 'Displays the date of the post. Uses the same date format set in General Options.', 'contextual-related-posts' ),
214
+ 'type' => 'checkbox',
215
+ 'options' => false,
216
+ ),
217
+ 'show_author' => array(
218
+ 'id' => 'show_author',
219
+ 'name' => esc_html__( 'Show author', 'contextual-related-posts' ),
220
+ 'desc' => '',
221
+ 'type' => 'checkbox',
222
+ 'options' => false,
223
+ ),
224
+ 'title_length' => array(
225
+ 'id' => 'title_length',
226
+ 'name' => esc_html__( 'Limit post title length (in characters)', 'contextual-related-posts' ),
227
+ 'desc' => esc_html__( 'Any title longer than the number of characters set above will be cut and appended with an ellipsis (&hellip;)', 'contextual-related-posts' ),
228
+ 'type' => 'number',
229
+ 'options' => '60',
230
+ 'size' => 'small',
231
+ ),
232
+ 'link_new_window' => array(
233
+ 'id' => 'link_new_window',
234
+ 'name' => esc_html__( 'Open links in new window', 'contextual-related-posts' ),
235
+ 'desc' => '',
236
+ 'type' => 'checkbox',
237
+ 'options' => false,
238
+ ),
239
+ 'link_nofollow' => array(
240
+ 'id' => 'link_nofollow',
241
+ 'name' => esc_html__( 'Add nofollow to links', 'contextual-related-posts' ),
242
+ 'desc' => '',
243
+ 'type' => 'checkbox',
244
+ 'options' => false,
245
+ ),
246
+ 'exclude_output_header' => array(
247
+ 'id' => 'exclude_output_header',
248
+ 'name' => '<h3>' . esc_html__( 'Exclusion settings', 'contextual-related-posts' ) . '</h3>',
249
+ 'desc' => '',
250
+ 'type' => 'header',
251
+ ),
252
+ 'exclude_on_post_ids' => array(
253
+ 'id' => 'exclude_on_post_ids',
254
+ 'name' => esc_html__( 'Exclude display on these posts', 'contextual-related-posts' ),
255
+ 'desc' => esc_html__( 'Comma separated list of post, page or custom post type IDs. e.g. 188,320,500', 'contextual-related-posts' ),
256
+ 'type' => 'numbercsv',
257
+ 'options' => '',
258
+ ),
259
+ 'exclude_on_post_types' => array(
260
+ 'id' => 'exclude_on_post_types',
261
+ 'name' => esc_html__( 'Exclude display on these post types', 'contextual-related-posts' ),
262
+ 'desc' => esc_html__( 'The related posts will not display on any of the above selected post types.', 'contextual-related-posts' ),
263
+ 'type' => 'posttypes',
264
+ 'options' => '',
265
+ ),
266
+ 'html_wrapper_header' => array(
267
+ 'id' => 'html_wrapper_header',
268
+ 'name' => '<h3>' . esc_html__( 'HTML to display', 'contextual-related-posts' ) . '</h3>',
269
+ 'desc' => '',
270
+ 'type' => 'header',
271
+ ),
272
+ 'before_list' => array(
273
+ 'id' => 'before_list',
274
+ 'name' => esc_html__( 'Before the list of posts', 'contextual-related-posts' ),
275
+ 'desc' => '',
276
+ 'type' => 'text',
277
+ 'options' => '<ul>',
278
+ ),
279
+ 'after_list' => array(
280
+ 'id' => 'after_list',
281
+ 'name' => esc_html__( 'After the list of posts', 'contextual-related-posts' ),
282
+ 'desc' => '',
283
+ 'type' => 'text',
284
+ 'options' => '</ul>',
285
+ ),
286
+ 'before_list_item' => array(
287
+ 'id' => 'before_list_item',
288
+ 'name' => esc_html__( 'Before each list item', 'contextual-related-posts' ),
289
+ 'desc' => '',
290
+ 'type' => 'text',
291
+ 'options' => '<li>',
292
+ ),
293
+ 'after_list_item' => array(
294
+ 'id' => 'after_list_item',
295
+ 'name' => esc_html__( 'After each list item', 'contextual-related-posts' ),
296
+ 'desc' => '',
297
+ 'type' => 'text',
298
+ 'options' => '</li>',
299
+ ),
300
+ );
301
+
302
+ /**
303
+ * Filters the Output settings array
304
+ *
305
+ * @since 2.6.0
306
+ *
307
+ * @param array $settings Output settings array
308
+ */
309
+ return apply_filters( 'crp_settings_output', $settings );
310
+ }
311
+
312
+
313
+ /**
314
+ * Retrieve the array of List settings
315
+ *
316
+ * @since 2.6.0
317
+ *
318
+ * @return array List settings array
319
+ */
320
+ function crp_settings_list() {
321
+
322
+ $settings = array(
323
+ 'limit' => array(
324
+ 'id' => 'limit',
325
+ 'name' => esc_html__( 'Number of posts to display', 'contextual-related-posts' ),
326
+ 'desc' => esc_html__( 'Maximum number of posts that will be displayed in the list. This option is used if you don not specify the number of posts in the widget or shortcodes', 'contextual-related-posts' ),
327
+ 'type' => 'number',
328
+ 'options' => '6',
329
+ 'min' => '0',
330
+ 'size' => 'small',
331
+ ),
332
+ 'daily_range' => array(
333
+ 'id' => 'daily_range',
334
+ 'name' => esc_html__( 'Related posts should be newer than', 'contextual-related-posts' ),
335
+ 'desc' => esc_html__( 'This sets the cut-off period for which posts will be displayed. e.g. setting it to 365 will show related posts from the last year only. Set to 0 to disable limiting posts by date.', 'contextual-related-posts' ),
336
+ 'type' => 'number',
337
+ 'options' => '1095',
338
+ 'min' => '0',
339
+ ),
340
+ 'random_order' => array(
341
+ 'id' => 'random_order',
342
+ 'name' => esc_html__( 'Randomize posts', 'contextual-related-posts' ),
343
+ 'desc' => esc_html__( 'This shuffles the top related posts. Does not work if the cache is enabled.', 'contextual-related-posts' ),
344
+ 'type' => 'checkbox',
345
+ 'options' => false,
346
+ ),
347
+ 'match_content' => array(
348
+ 'id' => 'match_content',
349
+ 'name' => esc_html__( 'Related posts based on title and content', 'contextual-related-posts' ),
350
+ 'desc' => esc_html__( 'If unchecked, only posts titles are used. Enable the cache if enabling this option for better performance. Each site is different, so toggle this option to see which setting gives you better quality related posts.', 'contextual-related-posts' ),
351
+ 'type' => 'checkbox',
352
+ 'options' => false,
353
+ ),
354
+ 'match_content_words' => array(
355
+ 'id' => 'match_content_words',
356
+ 'name' => esc_html__( 'Limit content to be compared', 'contextual-related-posts' ),
357
+ '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' ),
358
+ 'type' => 'number',
359
+ 'options' => '0',
360
+ 'min' => '0',
361
+ 'max' => '2000',
362
+ ),
363
+ 'post_types' => array(
364
+ 'id' => 'post_types',
365
+ 'name' => esc_html__( 'Post types to include', 'contextual-related-posts' ),
366
+ 'desc' => esc_html__( 'At least one option should be selected above. Select which post types you want to include in the list of posts. This field can be overridden using a comma separated list of post types when using the manual display.', 'contextual-related-posts' ),
367
+ 'type' => 'posttypes',
368
+ 'options' => 'post,page',
369
+ ),
370
+ 'same_post_type' => array(
371
+ 'id' => 'same_post_type',
372
+ 'name' => esc_html__( 'Limit to same post type', 'contextual-related-posts' ),
373
+ 'desc' => esc_html__( 'If checked, the related posts will only be selected from the same post type of the current post.', 'contextual-related-posts' ),
374
+ 'type' => 'checkbox',
375
+ 'options' => false,
376
+ ),
377
+ 'exclude_post_ids' => array(
378
+ 'id' => 'exclude_post_ids',
379
+ 'name' => esc_html__( 'Post/page IDs to exclude', 'contextual-related-posts' ),
380
+ 'desc' => esc_html__( 'Comma-separated list of post or page IDs to exclude from the list. e.g. 188,320,500', 'contextual-related-posts' ),
381
+ 'type' => 'numbercsv',
382
+ 'options' => '',
383
+ ),
384
+ 'exclude_cat_slugs' => array(
385
+ 'id' => 'exclude_cat_slugs',
386
+ 'name' => esc_html__( 'Exclude Categories', 'contextual-related-posts' ),
387
+ 'desc' => esc_html__( 'Comma separated list of category slugs. The field above has an autocomplete so simply start typing in the starting letters and it will prompt you with options. Does not support custom taxonomies.', 'contextual-related-posts' ),
388
+ 'type' => 'csv',
389
+ 'options' => '',
390
+ 'size' => 'large',
391
+ 'field_class' => 'category_autocomplete',
392
+ 'field_attributes' => array(
393
+ 'data-wp-taxonomy' => 'category',
394
+ ),
395
+ ),
396
+ 'exclude_categories' => array(
397
+ 'id' => 'exclude_categories',
398
+ 'name' => esc_html__( 'Exclude category IDs', 'contextual-related-posts' ),
399
+ 'desc' => esc_html__( 'This is a readonly field that is automatically populated based on the above input when the settings are saved. These might differ from the IDs visible in the Categories page which use the term_id. Contextual Related Posts uses the term_taxonomy_id which is unique to this taxonomy.', 'contextual-related-posts' ),
400
+ 'type' => 'text',
401
+ 'options' => '',
402
+ 'readonly' => true,
403
+ ),
404
+ );
405
+
406
+ /**
407
+ * Filters the List settings array
408
+ *
409
+ * @since 2.6.0
410
+ *
411
+ * @param array $settings List settings array
412
+ */
413
+ return apply_filters( 'crp_settings_list', $settings );
414
+ }
415
+
416
+
417
+ /**
418
+ * Retrieve the array of Thumbnail settings
419
+ *
420
+ * @since 2.6.0
421
+ *
422
+ * @return array Thumbnail settings array
423
+ */
424
+ function crp_settings_thumbnail() {
425
+
426
+ $settings = array(
427
+ 'post_thumb_op' => array(
428
+ 'id' => 'post_thumb_op',
429
+ 'name' => esc_html__( 'Location of the post thumbnail', 'contextual-related-posts' ),
430
+ 'desc' => '',
431
+ 'type' => 'radio',
432
+ 'default' => 'text_only',
433
+ 'options' => array(
434
+ 'inline' => esc_html__( 'Display thumbnails inline with posts, before title', 'contextual-related-posts' ),
435
+ 'after' => esc_html__( 'Display thumbnails inline with posts, after title', 'contextual-related-posts' ),
436
+ 'thumbs_only' => esc_html__( 'Display only thumbnails, no text', 'contextual-related-posts' ),
437
+ 'text_only' => esc_html__( 'Do not display thumbnails, only text', 'contextual-related-posts' ),
438
+ ),
439
+ ),
440
+ 'thumb_size' => array(
441
+ 'id' => 'thumb_size',
442
+ 'name' => esc_html__( 'Thumbnail size', 'contextual-related-posts' ),
443
+ 'desc' => esc_html__( 'You can choose from existing image sizes above or create a custom size. If you have chosen Custom size above, then enter the width, height and crop settings below. For best results, use a cropped image. If you change the width and/or height below, existing images will not be automatically resized.' ) . '<br />' . sprintf(
444
+ /* translators: 1: OTF Regenerate plugin link, 2: Force regenerate plugin link. */
445
+ esc_html__( 'I recommend using %1$s or %2$s to regenerate all image sizes.', 'contextual-related-posts' ),
446
+ '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=otf-regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">OTF Regenerate Thumbnails</a>',
447
+ '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">Regenerate Thumbnails</a>'
448
+ ),
449
+ 'type' => 'thumbsizes',
450
+ 'default' => 'crp_thumbnail',
451
+ 'options' => crp_get_all_image_sizes(),
452
+ ),
453
+ 'thumb_width' => array(
454
+ 'id' => 'thumb_width',
455
+ 'name' => esc_html__( 'Thumbnail width', 'contextual-related-posts' ),
456
+ 'desc' => '',
457
+ 'type' => 'number',
458
+ 'options' => '250',
459
+ 'min' => '0',
460
+ 'size' => 'small',
461
+ ),
462
+ 'thumb_height' => array(
463
+ 'id' => 'thumb_height',
464
+ 'name' => esc_html__( 'Thumbnail height', 'contextual-related-posts' ),
465
+ 'desc' => '',
466
+ 'type' => 'number',
467
+ 'options' => '250',
468
+ 'min' => '0',
469
+ 'size' => 'small',
470
+ ),
471
+ 'thumb_crop' => array(
472
+ 'id' => 'thumb_crop',
473
+ 'name' => esc_html__( 'Hard crop thumbnails', 'contextual-related-posts' ),
474
+ 'desc' => esc_html__( 'Check this box to hard crop the thumbnails. i.e. force the width and height above vs. maintaining proportions.', 'contextual-related-posts' ),
475
+ 'type' => 'checkbox',
476
+ 'options' => true,
477
+ ),
478
+ 'thumb_create_sizes' => array(
479
+ 'id' => 'thumb_create_sizes',
480
+ 'name' => esc_html__( 'Generate thumbnail sizes', 'contextual-related-posts' ),
481
+ 'desc' => esc_html__( 'If you select this option and Custom size is selected above, the plugin will register the image size with WordPress to create new thumbnails. Does not update old images as explained above.', 'contextual-related-posts' ),
482
+ 'type' => 'checkbox',
483
+ 'options' => true,
484
+ ),
485
+ 'thumb_html' => array(
486
+ 'id' => 'thumb_html',
487
+ 'name' => esc_html__( 'Thumbnail size attributes', 'contextual-related-posts' ),
488
+ 'desc' => '',
489
+ 'type' => 'radio',
490
+ 'default' => 'html',
491
+ 'options' => array(
492
+ /* translators: %s: Code. */
493
+ 'css' => sprintf( esc_html__( 'Use CSS to set the width and height: e.g. %s', 'contextual-related-posts' ), '<code>style="max-width:250px;max-height:250px"</code>' ),
494
+ /* translators: %s: Code. */
495
+ 'html' => sprintf( esc_html__( 'Use HTML attributes to set the width and height: e.g. %s', 'contextual-related-posts' ), '<code>width="250" height="250"</code>' ),
496
+ 'none' => esc_html__( 'No width or height set. You will need to use external styles to force any width or height of your choice.', 'contextual-related-posts' ),
497
+ ),
498
+ ),
499
+ 'thumb_meta' => array(
500
+ 'id' => 'thumb_meta',
501
+ 'name' => esc_html__( 'Thumbnail meta field name', 'contextual-related-posts' ),
502
+ 'desc' => esc_html__( 'The value of this field should contain the URL of the image and can be set in the metabox in the Edit Post screen', 'contextual-related-posts' ),
503
+ 'type' => 'text',
504
+ 'options' => 'post-image',
505
+ ),
506
+ 'scan_images' => array(
507
+ 'id' => 'scan_images',
508
+ 'name' => esc_html__( 'Get first image', 'contextual-related-posts' ),
509
+ 'desc' => esc_html__( 'The plugin will fetch the first image in the post content if this is enabled. This can slow down the loading of your page if the first image in the followed posts is large in file-size.', 'contextual-related-posts' ),
510
+ 'type' => 'checkbox',
511
+ 'options' => true,
512
+ ),
513
+ 'thumb_default_show' => array(
514
+ 'id' => 'thumb_default_show',
515
+ 'name' => esc_html__( 'Use default thumbnail?', 'contextual-related-posts' ),
516
+ 'desc' => esc_html__( 'If checked, when no thumbnail is found, show a default one from the URL below. If not checked and no thumbnail is found, no image will be shown.', 'contextual-related-posts' ),
517
+ 'type' => 'checkbox',
518
+ 'options' => true,
519
+ ),
520
+ 'thumb_default' => array(
521
+ 'id' => 'thumb_default',
522
+ 'name' => esc_html__( 'Default thumbnail', 'contextual-related-posts' ),
523
+ 'desc' => esc_html__( 'Enter the full URL of the image that you wish to display if no thumbnail is found. This image will be displayed below.', 'contextual-related-posts' ),
524
+ 'type' => 'text',
525
+ 'options' => CRP_PLUGIN_URL . 'default.png',
526
+ 'size' => 'large',
527
+ ),
528
+ );
529
+
530
+ /**
531
+ * Filters the Thumbnail settings array
532
+ *
533
+ * @since 2.6.0
534
+ *
535
+ * @param array $settings Thumbnail settings array
536
+ */
537
+ return apply_filters( 'crp_settings_thumbnail', $settings );
538
+ }
539
+
540
+
541
+ /**
542
+ * Retrieve the array of Styles settings
543
+ *
544
+ * @since 2.6.0
545
+ *
546
+ * @return array Styles settings array
547
+ */
548
+ function crp_settings_styles() {
549
+
550
+ $settings = array(
551
+ 'crp_styles' => array(
552
+ 'id' => 'crp_styles',
553
+ 'name' => esc_html__( 'Related Posts style', 'contextual-related-posts' ),
554
+ 'desc' => '',
555
+ 'type' => 'radiodesc',
556
+ 'default' => 'rounded_thumbs',
557
+ 'options' => crp_get_styles(),
558
+ ),
559
+ 'custom_css' => array(
560
+ 'id' => 'custom_css',
561
+ 'name' => esc_html__( 'Custom CSS', 'contextual-related-posts' ),
562
+ /* translators: 1: Opening a tag, 2: Closing a tag, 3: Opening code tage, 4. Closing code tag. */
563
+ '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>' ),
564
+ 'type' => 'css',
565
+ 'options' => '',
566
+ ),
567
+ );
568
+
569
+ /**
570
+ * Filters the Styles settings array
571
+ *
572
+ * @since 2.6.0
573
+ *
574
+ * @param array $settings Styles settings array
575
+ */
576
+ return apply_filters( 'crp_settings_styles', $settings );
577
+ }
578
+
579
+
580
+ /**
581
+ * Retrieve the array of Feed settings
582
+ *
583
+ * @since 2.6.0
584
+ *
585
+ * @return array Feed settings array
586
+ */
587
+ function crp_settings_feed() {
588
+
589
+ $settings = array(
590
+ 'feed_options_desc' => array(
591
+ 'id' => 'feed_options_desc',
592
+ 'name' => '<strong>' . esc_html__( 'About this tab', 'contextual-related-posts' ) . '</strong>',
593
+ 'desc' => esc_html__( 'Below options override the related posts settings for your blog feed. These only apply if you have selected to add related posts to Feeds in the General Options tab. It is recommended to not display thumbnails as there is no easy way to style the related posts in the feed.', 'contextual-related-posts' ),
594
+ 'type' => 'descriptive_text',
595
+ ),
596
+ 'limit_feed' => array(
597
+ 'id' => 'limit_feed',
598
+ 'name' => esc_html__( 'Number of posts to display', 'contextual-related-posts' ),
599
+ 'desc' => '',
600
+ 'type' => 'number',
601
+ 'options' => '5',
602
+ 'min' => '0',
603
+ 'size' => 'small',
604
+ ),
605
+ 'show_excerpt_feed' => array(
606
+ 'id' => 'show_excerpt_feed',
607
+ 'name' => esc_html__( 'Show post excerpt', 'contextual-related-posts' ),
608
+ 'desc' => '',
609
+ 'type' => 'checkbox',
610
+ 'options' => false,
611
+ ),
612
+ 'post_thumb_op_feed' => array(
613
+ 'id' => 'post_thumb_op_feed',
614
+ 'name' => esc_html__( 'Location of the post thumbnail', 'contextual-related-posts' ),
615
+ 'desc' => '',
616
+ 'type' => 'radio',
617
+ 'default' => 'text_only',
618
+ 'options' => array(
619
+ 'inline' => esc_html__( 'Display thumbnails inline with posts, before title', 'contextual-related-posts' ),
620
+ 'after' => esc_html__( 'Display thumbnails inline with posts, after title', 'contextual-related-posts' ),
621
+ 'thumbs_only' => esc_html__( 'Display only thumbnails, no text', 'contextual-related-posts' ),
622
+ 'text_only' => esc_html__( 'Do not display thumbnails, only text', 'contextual-related-posts' ),
623
+ ),
624
+ ),
625
+ 'thumb_width_feed' => array(
626
+ 'id' => 'thumb_width_feed',
627
+ 'name' => esc_html__( 'Thumbnail width', 'contextual-related-posts' ),
628
+ 'desc' => '',
629
+ 'type' => 'number',
630
+ 'options' => '250',
631
+ 'min' => '0',
632
+ 'size' => 'small',
633
+ ),
634
+ 'thumb_height_feed' => array(
635
+ 'id' => 'thumb_height_feed',
636
+ 'name' => esc_html__( 'Thumbnail height', 'contextual-related-posts' ),
637
+ 'desc' => '',
638
+ 'type' => 'number',
639
+ 'options' => '250',
640
+ 'min' => '0',
641
+ 'size' => 'small',
642
+ ),
643
+ );
644
+
645
+ /**
646
+ * Filters the Feed settings array
647
+ *
648
+ * @since 2.6.0
649
+ *
650
+ * @param array $settings Feed settings array
651
+ */
652
+ return apply_filters( 'crp_settings_feed', $settings );
653
+ }
654
+
655
+
656
+ /**
657
+ * Upgrade pre v2.5.0 settings.
658
+ *
659
+ * @since 2.6.0
660
+ * @return array Settings array
661
+ */
662
+ function crp_upgrade_settings() {
663
+ $old_settings = get_option( 'ald_crp_settings' );
664
+
665
+ if ( empty( $old_settings ) ) {
666
+ return false;
667
+ }
668
+
669
+ // Start will assigning all the old settings to the new settings and we will unset later on.
670
+ $settings = $old_settings;
671
+
672
+ // Convert the add_to_{x} to the new settings format.
673
+ $add_to = array(
674
+ 'single' => 'add_to_content',
675
+ 'page' => 'add_to_page',
676
+ 'feed' => 'add_to_feed',
677
+ 'home' => 'add_to_home',
678
+ 'category_archives' => 'add_to_category_archives',
679
+ 'tag_archives' => 'add_to_tag_archives',
680
+ 'other_archives' => 'add_to_archives',
681
+ );
682
+
683
+ foreach ( $add_to as $newkey => $oldkey ) {
684
+ if ( $old_settings[ $oldkey ] ) {
685
+ $settings['add_to'][ $newkey ] = $newkey;
686
+ }
687
+ unset( $settings[ $oldkey ] );
688
+ }
689
+
690
+ // Convert 'blank_output' to the new format: true = 'blank' and false = 'custom_text'.
691
+ $settings['blank_output'] = ! empty( $old_settings['blank_output'] ) ? 'blank' : 'custom_text';
692
+
693
+ $settings['custom_css'] = $old_settings['custom_CSS'];
694
+
695
+ return $settings;
696
+
697
+ }
698
+
699
+
700
+ /**
701
+ * Get the various styles.
702
+ *
703
+ * @since 2.6.0
704
+ * @return array Style options.
705
+ */
706
+ function crp_get_styles() {
707
+
708
+ $styles = array(
709
+ array(
710
+ 'id' => 'no_style',
711
+ 'name' => esc_html__( 'No styles', 'contextual-related-posts' ),
712
+ 'description' => esc_html__( 'Select this option if you plan to add your own styles', 'contextual-related-posts' ) . '<br />',
713
+ ),
714
+ array(
715
+ 'id' => 'text_only',
716
+ 'name' => esc_html__( 'Text only', 'contextual-related-posts' ),
717
+ 'description' => esc_html__( 'Disable thumbnails and no longer include the default style sheet', 'contextual-related-posts' ) . '<br />',
718
+ ),
719
+ array(
720
+ 'id' => 'rounded_thumbs',
721
+ 'name' => esc_html__( 'Rounded thumbnails', 'contextual-related-posts' ),
722
+ 'description' => '<br /><img src="' . esc_url( plugins_url( 'includes/admin/images/crp-rounded-thumbs.png', CRP_PLUGIN_FILE ) ) . '" width="350" /> <br />' . esc_html__( 'Enabling this option will turn on the thumbnails and force their width and height. It will also turn off the display of the author, excerpt and date if already enabled. Disabling this option will not revert any settings.', 'contextual-related-posts' ),
723
+ ),
724
+ );
725
+
726
+ /**
727
+ * Filter the array containing the types of trackers to add your own.
728
+ *
729
+ * @since 2.6.0
730
+ *
731
+ * @param string $trackers Different trackers.
732
+ */
733
+ return apply_filters( 'crp_get_styles', $styles );
734
+ }
includes/admin/help-tab.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Help tab.
4
+ *
5
+ * Functions to generated the help tab on the Settings page.
6
+ *
7
+ * @link https://webberzone.com
8
+ * @since 2.6.0
9
+ *
10
+ * @package Contextual_Related_Posts
11
+ * @subpackage Admin/Help
12
+ */
13
+
14
+ // If this file is called directly, abort.
15
+ if ( ! defined( 'WPINC' ) ) {
16
+ die;
17
+ }
18
+
19
+ /**
20
+ * Generates the settings help page.
21
+ *
22
+ * @since 2.6.0
23
+ */
24
+ function crp_settings_help() {
25
+ global $crp_settings_page;
26
+
27
+ $screen = get_current_screen();
28
+
29
+ if ( $screen->id !== $crp_settings_page ) {
30
+ return;
31
+ }
32
+
33
+ $screen->set_help_sidebar(
34
+ /* translators: 1: Support link. */
35
+ '<p>' . sprintf( __( 'For more information or how to get support visit the <a href="%1$s">WebberZone support site</a>.', 'contextual-related-posts' ), esc_url( 'https://webberzone.com/support/' ) ) . '</p>' .
36
+ /* translators: 1: Forum link. */
37
+ '<p>' . sprintf( __( 'Support queries should be posted in the <a href="%1$s">WordPress.org support forums</a>.', 'contextual-related-posts' ), esc_url( 'https://wordpress.org/support/plugin/contextual-related-posts' ) ) . '</p>' .
38
+ '<p>' . sprintf(
39
+ /* translators: 1: Github Issues link, 2: Github page. */
40
+ __( '<a href="%1$s">Post an issue</a> on <a href="%2$s">GitHub</a> (bug reports only).', 'contextual-related-posts' ),
41
+ esc_url( 'https://github.com/WebberZone/contextual-related-posts/issues' ),
42
+ esc_url( 'https://github.com/WebberZone/contextual-related-posts' )
43
+ ) . '</p>'
44
+ );
45
+
46
+ $screen->add_help_tab(
47
+ array(
48
+ 'id' => 'crp-settings-general',
49
+ 'title' => __( 'General', 'contextual-related-posts' ),
50
+ 'content' =>
51
+ '<p>' . __( 'This screen provides the basic settings for configuring Contextual Related Posts.', 'contextual-related-posts' ) . '</p>' .
52
+ '<p>' . __( 'Enable the trackers and cache, configure basic tracker settings and uninstall settings.', 'contextual-related-posts' ) . '</p>',
53
+ )
54
+ );
55
+
56
+ $screen->add_help_tab(
57
+ array(
58
+ 'id' => 'crp-settings-counter',
59
+ 'title' => __( 'Counter/Tracker', 'contextual-related-posts' ),
60
+ 'content' =>
61
+ '<p>' . __( 'This screen provides settings to tweak the display counter and the tracker.', 'contextual-related-posts' ) . '</p>' .
62
+ '<p>' . __( 'Choose where to display the counter and customize the text. Select the type of tracker and which user groups to track.', 'contextual-related-posts' ) . '</p>',
63
+ )
64
+ );
65
+
66
+ $screen->add_help_tab(
67
+ array(
68
+ 'id' => 'crp-settings-list',
69
+ 'title' => __( 'Posts list', 'contextual-related-posts' ),
70
+ 'content' =>
71
+ '<p>' . __( 'This screen provides settings to tweak the output of the list of related posts.', 'contextual-related-posts' ) . '</p>' .
72
+ '<p>' . __( 'Set the number of posts, which categories or posts to exclude, customize what to display and specific basic HTML markup used to create the posts.', 'contextual-related-posts' ) . '</p>',
73
+ )
74
+ );
75
+
76
+ $screen->add_help_tab(
77
+ array(
78
+ 'id' => 'crp-settings-thumbnail',
79
+ 'title' => __( 'Thumbnail', 'contextual-related-posts' ),
80
+ 'content' =>
81
+ '<p>' . __( 'This screen provides settings to tweak the thumbnail that can be displayed for each post in the list.', 'contextual-related-posts' ) . '</p>' .
82
+ '<p>' . __( 'Set the location and size of the thumbnail. Additionally, you can choose additional sources for the thumbnail i.e. a meta field, first image or a default thumbnail when nothing is available.', 'contextual-related-posts' ) . '</p>',
83
+ )
84
+ );
85
+
86
+ $screen->add_help_tab(
87
+ array(
88
+ 'id' => 'crp-settings-styles',
89
+ 'title' => __( 'Styles', 'contextual-related-posts' ),
90
+ 'content' =>
91
+ '<p>' . __( 'This screen provides options to control the look and feel of the related posts list.', 'contextual-related-posts' ) . '</p>' .
92
+ '<p>' . __( 'Choose for default set of styles or add your own custom CSS to tweak the display of the posts.', 'contextual-related-posts' ) . '</p>',
93
+ )
94
+ );
95
+
96
+ $screen->add_help_tab(
97
+ array(
98
+ 'id' => 'crp-settings-maintenance',
99
+ 'title' => __( 'Maintenance', 'contextual-related-posts' ),
100
+ 'content' =>
101
+ '<p>' . __( 'This screen provides options to control the maintenance cron.', 'contextual-related-posts' ) . '</p>' .
102
+ '<p>' . __( 'Choose how often to run maintenance and at what time of the day.', 'contextual-related-posts' ) . '</p>',
103
+ )
104
+ );
105
+
106
+ do_action( 'crp_settings_help', $screen );
107
+
108
+ }
109
+
110
+ /**
111
+ * Generates the Tools help page.
112
+ *
113
+ * @since 2.6.0
114
+ */
115
+ function crp_settings_tools_help() {
116
+ global $crp_settings_tools_help;
117
+
118
+ $screen = get_current_screen();
119
+
120
+ if ( $screen->id !== $crp_settings_tools_help ) {
121
+ return;
122
+ }
123
+
124
+ $screen->set_help_sidebar(
125
+ /* translators: 1: Support link. */
126
+ '<p>' . sprintf( __( 'For more information or how to get support visit the <a href="%1$s">WebberZone support site</a>.', 'contextual-related-posts' ), esc_url( 'https://webberzone.com/support/' ) ) . '</p>' .
127
+ /* translators: 1: Forum link. */
128
+ '<p>' . sprintf( __( 'Support queries should be posted in the <a href="%1$s">WordPress.org support forums</a>.', 'contextual-related-posts' ), esc_url( 'https://wordpress.org/support/plugin/contextual-related-posts' ) ) . '</p>' .
129
+ '<p>' . sprintf(
130
+ /* translators: 1: Github Issues link, 2: Github page. */
131
+ __( '<a href="%1$s">Post an issue</a> on <a href="%2$s">GitHub</a> (bug reports only).', 'contextual-related-posts' ),
132
+ esc_url( 'https://github.com/WebberZone/contextual-related-posts/issues' ),
133
+ esc_url( 'https://github.com/WebberZone/contextual-related-posts' )
134
+ ) . '</p>'
135
+ );
136
+
137
+ $screen->add_help_tab(
138
+ array(
139
+ 'id' => 'crp-settings-general',
140
+ 'title' => __( 'General', 'contextual-related-posts' ),
141
+ 'content' =>
142
+ '<p>' . __( 'This screen provides some tools that help maintain certain features of Contextual Related Posts.', 'contextual-related-posts' ) . '</p>' .
143
+ '<p>' . __( 'Clear the cache, reset the related posts tables plus some miscellaneous fixes for older versions of Contextual Related Posts.', 'contextual-related-posts' ) . '</p>',
144
+ )
145
+ );
146
+
147
+ do_action( 'crp_settings_tools_help', $screen );
148
+ }
{admin → includes/admin}/images/crp-rounded-thumbs.png RENAMED
File without changes
{admin → includes/admin}/images/fb.png RENAMED
File without changes
{admin → includes/admin}/images/index.php RENAMED
File without changes
{admin → includes/admin}/images/twitter.jpg RENAMED
File without changes
{admin → includes/admin}/index.php RENAMED
File without changes
{admin → includes/admin/modules}/cache.php RENAMED
@@ -6,9 +6,14 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2018 Ajay D'Souza
10
  */
11
 
 
 
 
 
 
12
  /**
13
  * Function to clear the CRP Cache with Ajax.
14
  *
@@ -23,12 +28,12 @@ function crp_ajax_clearcache() {
23
 
24
  foreach ( $meta_keys as $meta_key ) {
25
 
26
- $count = $wpdb->query(
27
  $wpdb->prepare(
28
  "
29
- DELETE FROM {$wpdb->postmeta}
30
- WHERE meta_key = %s
31
- ",
32
  $meta_key
33
  )
34
  );
@@ -121,7 +126,6 @@ function crp_cache_get_keys() {
121
  * @param mixed $post_id Post ID.
122
  */
123
  function crp_delete_cache_post_save( $post_id ) {
124
- global $crp_settings;
125
 
126
  // Bail if we're doing an auto save.
127
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
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.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
  /**
18
  * Function to clear the CRP Cache with Ajax.
19
  *
28
 
29
  foreach ( $meta_keys as $meta_key ) {
30
 
31
+ $count = $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
32
  $wpdb->prepare(
33
  "
34
+ DELETE FROM {$wpdb->postmeta}
35
+ WHERE meta_key = %s
36
+ ",
37
  $meta_key
38
  )
39
  );
126
  * @param mixed $post_id Post ID.
127
  */
128
  function crp_delete_cache_post_save( $post_id ) {
 
129
 
130
  // Bail if we're doing an auto save.
131
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
{admin → includes/admin/modules}/loader.php RENAMED
@@ -6,9 +6,14 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2018 Ajay D'Souza
10
  */
11
 
 
 
 
 
 
12
  /**
13
  * Add link to WordPress plugin action links.
14
  *
@@ -21,7 +26,7 @@ function crp_plugin_actions_links( $links ) {
21
 
22
  return array_merge(
23
  array(
24
- 'settings' => '<a href="' . admin_url( 'options-general.php?page=crp_options' ) . '">' . esc_html__( 'Settings', 'contextual-related-posts' ) . '</a>',
25
  ),
26
  $links
27
  );
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.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
  /**
18
  * Add link to WordPress plugin action links.
19
  *
26
 
27
  return array_merge(
28
  array(
29
+ 'settings' => '<a href="' . admin_url( 'options-general.php?page=crp_options_page' ) . '">' . esc_html__( 'Settings', 'contextual-related-posts' ) . '</a>',
30
  ),
31
  $links
32
  );
{admin → includes/admin/modules}/metabox.php RENAMED
@@ -6,7 +6,7 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2018 Ajay D'Souza
10
  */
11
 
12
  /**** If this file is called directly, abort. ****/
@@ -23,15 +23,16 @@ if ( ! defined( 'WPINC' ) ) {
23
  * @param object $post Post object.
24
  */
25
  function crp_add_meta_box( $post_type, $post ) {
26
- global $crp_settings;
27
 
28
  // If metaboxes are disabled, then exit.
29
- if ( ! $crp_settings['show_metabox'] ) {
30
- return; }
 
31
 
32
  // If current user isn't an admin and we're restricting metaboxes to admins only, then exit.
33
- if ( ! current_user_can( 'manage_options' ) && $crp_settings['show_metabox_admins'] ) {
34
- return; }
 
35
 
36
  $args = array(
37
  'public' => true,
@@ -69,13 +70,13 @@ add_action( 'add_meta_boxes', 'crp_add_meta_box', 10, 2 );
69
  * @since 1.9.1
70
  */
71
  function crp_call_meta_box() {
72
- global $post, $crp_settings;
73
 
74
  /**** Add an nonce field so we can check for it later. */
75
  wp_nonce_field( 'crp_meta_box', 'crp_meta_box_nonce' );
76
 
77
  // Get the thumbnail settings. The name of the meta key is defined in thumb_meta parameter of the CRP Settings array.
78
- $crp_thumb_meta = get_post_meta( $post->ID, $crp_settings['thumb_meta'], true );
79
  $value = ( $crp_thumb_meta ) ? $crp_thumb_meta : '';
80
 
81
  // Get related posts specific meta.
@@ -151,7 +152,7 @@ function crp_call_meta_box() {
151
  <label for="crp_thumb_meta"><strong><?php esc_html_e( 'Location of thumbnail', 'contextual-related-posts' ); ?>:</strong></label>
152
  <input type="text" id="crp_thumb_meta" name="crp_thumb_meta" value="<?php echo esc_attr( $value ); ?>" style="width:100%" />
153
  <em><?php esc_html_e( "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This image will be used for the post. It will be resized to the thumbnail size set under Settings &raquo; Related Posts &raquo; Output Options", 'contextual-related-posts' ); ?></em>
154
- <em><?php esc_html_e( 'The URL above is saved in the meta field:', 'contextual-related-posts' ); ?></em> <strong><?php echo esc_html( $crp_settings['thumb_meta'] ); ?></strong>
155
  </p>
156
 
157
  <p>
@@ -186,7 +187,6 @@ function crp_call_meta_box() {
186
  * @param mixed $post_id Post ID.
187
  */
188
  function crp_save_meta_box( $post_id ) {
189
- global $crp_settings;
190
 
191
  $crp_post_meta = array();
192
 
@@ -211,9 +211,9 @@ function crp_save_meta_box( $post_id ) {
211
  }
212
 
213
  if ( ! empty( $thumb_meta ) ) {
214
- update_post_meta( $post_id, $crp_settings['thumb_meta'], $thumb_meta );
215
  } else {
216
- delete_post_meta( $post_id, $crp_settings['thumb_meta'] );
217
  }
218
 
219
  // Disable posts.
@@ -232,7 +232,7 @@ function crp_save_meta_box( $post_id ) {
232
  // Save Manual related posts.
233
  if ( isset( $_POST['manual_related'] ) ) {
234
 
235
- $manual_related_array = array_map( 'absint', explode( ',', $_POST['manual_related'] ) );
236
 
237
  foreach ( $manual_related_array as $key => $value ) {
238
  if ( 'publish' !== get_post_status( $value ) ) {
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. ****/
23
  * @param object $post Post object.
24
  */
25
  function crp_add_meta_box( $post_type, $post ) {
 
26
 
27
  // If metaboxes are disabled, then exit.
28
+ if ( ! crp_get_option( 'show_metabox' ) ) {
29
+ return;
30
+ }
31
 
32
  // If current user isn't an admin and we're restricting metaboxes to admins only, then exit.
33
+ if ( ! current_user_can( 'manage_options' ) && crp_get_option( 'show_metabox_admins' ) ) {
34
+ return;
35
+ }
36
 
37
  $args = array(
38
  'public' => true,
70
  * @since 1.9.1
71
  */
72
  function crp_call_meta_box() {
73
+ global $post;
74
 
75
  /**** Add an nonce field so we can check for it later. */
76
  wp_nonce_field( 'crp_meta_box', 'crp_meta_box_nonce' );
77
 
78
  // Get the thumbnail settings. The name of the meta key is defined in thumb_meta parameter of the CRP Settings array.
79
+ $crp_thumb_meta = get_post_meta( $post->ID, crp_get_option( 'thumb_meta' ), true );
80
  $value = ( $crp_thumb_meta ) ? $crp_thumb_meta : '';
81
 
82
  // Get related posts specific meta.
152
  <label for="crp_thumb_meta"><strong><?php esc_html_e( 'Location of thumbnail', 'contextual-related-posts' ); ?>:</strong></label>
153
  <input type="text" id="crp_thumb_meta" name="crp_thumb_meta" value="<?php echo esc_attr( $value ); ?>" style="width:100%" />
154
  <em><?php esc_html_e( "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This image will be used for the post. It will be resized to the thumbnail size set under Settings &raquo; Related Posts &raquo; Output Options", 'contextual-related-posts' ); ?></em>
155
+ <em><?php esc_html_e( 'The URL above is saved in the meta field:', 'contextual-related-posts' ); ?></em> <strong><?php echo esc_html( crp_get_option( 'thumb_meta' ) ); ?></strong>
156
  </p>
157
 
158
  <p>
187
  * @param mixed $post_id Post ID.
188
  */
189
  function crp_save_meta_box( $post_id ) {
 
190
 
191
  $crp_post_meta = array();
192
 
211
  }
212
 
213
  if ( ! empty( $thumb_meta ) ) {
214
+ update_post_meta( $post_id, crp_get_option( 'thumb_meta' ), $thumb_meta );
215
  } else {
216
+ delete_post_meta( $post_id, crp_get_option( 'thumb_meta' ) );
217
  }
218
 
219
  // Disable posts.
232
  // Save Manual related posts.
233
  if ( isset( $_POST['manual_related'] ) ) {
234
 
235
+ $manual_related_array = array_map( 'absint', explode( ',', sanitize_text_field( wp_unslash( $_POST['manual_related'] ) ) ) );
236
 
237
  foreach ( $manual_related_array as $key => $value ) {
238
  if ( 'publish' !== get_post_status( $value ) ) {
includes/admin/modules/tools.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The admin-specific functionality of the plugin.
4
+ *
5
+ * @link https://webberzone.com
6
+ * @since 2.6.0
7
+ *
8
+ * @package Contextual Related Posts
9
+ * @subpackage Admin/Tools
10
+ */
11
+
12
+ // If this file is called directly, abort.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
+
18
+ /**
19
+ * Render the tools settings page.
20
+ *
21
+ * @since 2.6.0
22
+ *
23
+ * @return void
24
+ */
25
+ function crp_tools_page() {
26
+
27
+ /* Delete old settings */
28
+ if ( ( isset( $_POST['crp_delete_old_settings'] ) ) && ( check_admin_referer( 'crp-tools-settings' ) ) ) {
29
+ $old_settings = get_option( 'ald_crp_settings' );
30
+
31
+ if ( empty( $old_settings ) ) {
32
+ add_settings_error( 'crp-notices', '', esc_html__( 'Old settings key does not exist', 'autoclose' ), 'error' );
33
+ } else {
34
+ delete_option( 'ald_crp_settings' );
35
+ add_settings_error( 'crp-notices', '', esc_html__( 'Old settings key has been deleted', 'autoclose' ), 'updated' );
36
+ }
37
+ }
38
+
39
+ /* Recreate indices */
40
+ if ( ( isset( $_POST['crp_recreate_indices'] ) ) && ( check_admin_referer( 'crp-tools-settings' ) ) ) {
41
+ crp_delete_index();
42
+ crp_create_index();
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">
49
+ <h1><?php esc_html_e( 'Contextual Related Posts Tools', 'contextual-related-posts' ); ?></h1>
50
+
51
+ <p>
52
+ <a href="<?php echo admin_url( 'options-general.php?page=crp_options_page' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
53
+ <?php esc_html_e( 'Visit the Settings page', 'autoclose' ); ?>
54
+ </a>
55
+ <p>
56
+
57
+ <?php settings_errors(); ?>
58
+
59
+ <div id="poststuff">
60
+ <div id="post-body" class="metabox-holder columns-2">
61
+ <div id="post-body-content">
62
+
63
+ <form method="post" >
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' ); ?>
71
+ </p>
72
+
73
+ <h2 style="padding-left:0px"><?php esc_html_e( 'Recreate Indices', 'contextual-related-posts' ); ?></h2>
74
+ <p>
75
+ <input name="crp_recreate_indices" type="submit" id="crp_recreate_indices" value="<?php esc_attr_e( 'Recreate Indices', 'contextual-related-posts' ); ?>" class="button button-secondary" />
76
+ </p>
77
+ <p class="description">
78
+ <?php esc_html_e( 'Deletes and recreates the FULLTEXT index in the posts table. If the above function gives an error, then you can run the below code in phpMyAdmin or Adminer. Remember to backup your database first!', 'contextual-related-posts' ); ?>
79
+ </p>
80
+ <p>
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;" />
87
+ </p>
88
+ <p class="description">
89
+ <?php esc_html_e( 'From v2.6.x, Contextual Related Posts stores the settings in a new key in the database. This will delete the old settings for the current blog. It is recommended that you do this at the earliest after upgrade. However, you should do this only if you are comfortable with the new settings.', 'contextual-related-posts' ); ?>
90
+ </p>
91
+
92
+ <?php wp_nonce_field( 'crp-tools-settings' ); ?>
93
+ </form>
94
+
95
+ </div><!-- /#post-body-content -->
96
+
97
+ <div id="postbox-container-1" class="postbox-container">
98
+
99
+ <div id="side-sortables" class="meta-box-sortables ui-sortable">
100
+ <?php include_once CRP_PLUGIN_DIR . 'includes/admin/sidebar.php'; ?>
101
+ </div><!-- /#side-sortables -->
102
+
103
+ </div><!-- /#postbox-container-1 -->
104
+ </div><!-- /#post-body -->
105
+ <br class="clear" />
106
+ </div><!-- /#poststuff -->
107
+
108
+ </div><!-- /.wrap -->
109
+
110
+ <?php
111
+ echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
112
+ }
113
+
114
+ /**
115
+ * Retrieves the SQL code to recreate the PRIMARY KEY.
116
+ *
117
+ * @since 2.6.0
118
+ */
119
+ function crp_recreate_indices_sql() {
120
+ global $wpdb;
121
+
122
+ $sql = "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related;";
123
+ $sql .= '<br />';
124
+ $sql .= "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title;";
125
+ $sql .= '<br />';
126
+ $sql .= "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_content;";
127
+ $sql .= '<br />';
128
+ $sql .= "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related (post_title, post_content);";
129
+ $sql .= '<br />';
130
+ $sql .= "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_title (post_title);";
131
+ $sql .= '<br />';
132
+ $sql .= "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_content (post_content);";
133
+
134
+ /**
135
+ * Filters the SQL code to recreate the PRIMARY KEY.
136
+ *
137
+ * @since 2.6.0
138
+ * @param string $sql SQL code to recreate PRIMARY KEY.
139
+ */
140
+ return apply_filters( 'crp_recreate_indices_sql', $sql );
141
+ }
includes/admin/register-settings.php ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Register settings.
4
+ *
5
+ * Functions to register, read, write and update settings.
6
+ * Portions of this code have been inspired by Easy Digital Downloads, WordPress Settings Sandbox, etc.
7
+ *
8
+ * @link https://webberzone.com
9
+ * @since 2.6.0
10
+ *
11
+ * @package Contextual_Related_Posts
12
+ * @subpackage Admin/Register_Settings
13
+ */
14
+
15
+ // If this file is called directly, abort.
16
+ if ( ! defined( 'WPINC' ) ) {
17
+ die;
18
+ }
19
+
20
+
21
+ /**
22
+ * Get an option
23
+ *
24
+ * Looks to see if the specified setting exists, returns default if not
25
+ *
26
+ * @since 2.6.0
27
+ *
28
+ * @param string $key Key of the option to fetch.
29
+ * @param mixed $default Default value to fetch if option is missing.
30
+ * @return mixed
31
+ */
32
+ function crp_get_option( $key = '', $default = null ) {
33
+
34
+ global $crp_settings;
35
+
36
+ if ( is_null( $default ) ) {
37
+ $default = crp_get_default_option( $key );
38
+ }
39
+
40
+ $value = isset( $crp_settings[ $key ] ) ? $crp_settings[ $key ] : $default;
41
+
42
+ /**
43
+ * Filter the value for the option being fetched.
44
+ *
45
+ * @since 2.6.0
46
+ *
47
+ * @param mixed $value Value of the option
48
+ * @param mixed $key Name of the option
49
+ * @param mixed $default Default value
50
+ */
51
+ $value = apply_filters( 'crp_get_option', $value, $key, $default );
52
+
53
+ /**
54
+ * Key specific filter for the value of the option being fetched.
55
+ *
56
+ * @since 2.6.0
57
+ *
58
+ * @param mixed $value Value of the option
59
+ * @param mixed $key Name of the option
60
+ * @param mixed $default Default value
61
+ */
62
+ return apply_filters( 'crp_get_option_' . $key, $value, $key, $default );
63
+ }
64
+
65
+
66
+ /**
67
+ * Update an option
68
+ *
69
+ * Updates an crp setting value in both the db and the global variable.
70
+ * Warning: Passing in a null value will remove
71
+ * the key from the crp_options array.
72
+ *
73
+ * @since 2.6.0
74
+ *
75
+ * @param string $key The Key to update.
76
+ * @param string|bool|int $value The value to set the key to.
77
+ * @return boolean True if updated, false if not.
78
+ */
79
+ function crp_update_option( $key = '', $value = null ) {
80
+
81
+ // If no key, exit.
82
+ if ( empty( $key ) ) {
83
+ return false;
84
+ }
85
+
86
+ // If null value, delete.
87
+ if ( is_null( $value ) ) {
88
+ $remove_option = crp_delete_option( $key );
89
+ return $remove_option;
90
+ }
91
+
92
+ // First let's grab the current settings.
93
+ $options = get_option( 'crp_settings' );
94
+
95
+ /**
96
+ * Filters the value before it is updated
97
+ *
98
+ * @since 2.6.0
99
+ *
100
+ * @param string|bool|int $value The value to set the key to
101
+ * @param string $key The Key to update
102
+ */
103
+ $value = apply_filters( 'crp_update_option', $value, $key );
104
+
105
+ // Next let's try to update the value.
106
+ $options[ $key ] = $value;
107
+ $did_update = update_option( 'crp_settings', $options );
108
+
109
+ // If it updated, let's update the global variable.
110
+ if ( $did_update ) {
111
+ global $crp_settings;
112
+ $crp_settings[ $key ] = $value;
113
+ }
114
+ return $did_update;
115
+ }
116
+
117
+
118
+ /**
119
+ * Remove an option
120
+ *
121
+ * Removes an crp setting value in both the db and the global variable.
122
+ *
123
+ * @since 2.6.0
124
+ *
125
+ * @param string $key The Key to update.
126
+ * @return boolean True if updated, false if not.
127
+ */
128
+ function crp_delete_option( $key = '' ) {
129
+
130
+ // If no key, exit.
131
+ if ( empty( $key ) ) {
132
+ return false;
133
+ }
134
+
135
+ // First let's grab the current settings.
136
+ $options = get_option( 'crp_settings' );
137
+
138
+ // Next let's try to update the value.
139
+ if ( isset( $options[ $key ] ) ) {
140
+ unset( $options[ $key ] );
141
+ }
142
+
143
+ $did_update = update_option( 'crp_settings', $options );
144
+
145
+ // If it updated, let's update the global variable.
146
+ if ( $did_update ) {
147
+ global $crp_settings;
148
+ $crp_settings = $options;
149
+ }
150
+ return $did_update;
151
+ }
152
+
153
+
154
+ /**
155
+ * Register settings function
156
+ *
157
+ * @since 2.6.0
158
+ *
159
+ * @return void
160
+ */
161
+ function crp_register_settings() {
162
+
163
+ if ( false === get_option( 'crp_settings' ) ) {
164
+ add_option( 'crp_settings', crp_settings_defaults() );
165
+ }
166
+
167
+ foreach ( crp_get_registered_settings() as $section => $settings ) {
168
+
169
+ add_settings_section(
170
+ 'crp_settings_' . $section, // ID used to identify this section and with which to register options, e.g. crp_settings_general.
171
+ __return_null(), // No title, we will handle this via a separate function.
172
+ '__return_false', // No callback function needed. We'll process this separately.
173
+ 'crp_settings_' . $section // Page on which these options will be added.
174
+ );
175
+
176
+ foreach ( $settings as $setting ) {
177
+
178
+ $args = wp_parse_args(
179
+ $setting,
180
+ array(
181
+ 'section' => $section,
182
+ 'id' => null,
183
+ 'name' => '',
184
+ 'desc' => '',
185
+ 'type' => null,
186
+ 'options' => '',
187
+ 'max' => null,
188
+ 'min' => null,
189
+ 'step' => null,
190
+ 'size' => null,
191
+ 'field_class' => '',
192
+ 'field_attributes' => '',
193
+ 'placeholder' => '',
194
+ )
195
+ );
196
+
197
+ add_settings_field(
198
+ 'crp_settings[' . $args['id'] . ']', // ID of the settings field. We save it within the crp_settings array.
199
+ $args['name'], // Label of the setting.
200
+ function_exists( 'crp_' . $args['type'] . '_callback' ) ? 'crp_' . $args['type'] . '_callback' : 'crp_missing_callback', // Function to handle the setting.
201
+ 'crp_settings_' . $section, // Page to display the setting. In our case it is the section as defined above.
202
+ 'crp_settings_' . $section, // Name of the section.
203
+ $args
204
+ );
205
+ }
206
+ }
207
+
208
+ // Register the settings into the options table.
209
+ register_setting( 'crp_settings', 'crp_settings', 'crp_settings_sanitize' );
210
+ }
211
+ add_action( 'admin_init', 'crp_register_settings' );
212
+
213
+
214
+ /**
215
+ * Flattens crp_get_registered_settings() into $setting[id] => $setting[type] format.
216
+ *
217
+ * @since 2.6.0
218
+ *
219
+ * @return array Default settings
220
+ */
221
+ function crp_get_registered_settings_types() {
222
+
223
+ $options = array();
224
+
225
+ // Populate some default values.
226
+ foreach ( crp_get_registered_settings() as $tab => $settings ) {
227
+ foreach ( $settings as $option ) {
228
+ $options[ $option['id'] ] = $option['type'];
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Filters the settings array.
234
+ *
235
+ * @since 2.6.0
236
+ *
237
+ * @param array $options Default settings.
238
+ */
239
+ return apply_filters( 'crp_get_settings_types', $options );
240
+ }
241
+
242
+
243
+ /**
244
+ * Default settings.
245
+ *
246
+ * @since 2.6.0
247
+ *
248
+ * @return array Default settings
249
+ */
250
+ function crp_settings_defaults() {
251
+
252
+ $options = array();
253
+
254
+ // Populate some default values.
255
+ foreach ( crp_get_registered_settings() as $tab => $settings ) {
256
+ foreach ( $settings as $option ) {
257
+ // When checkbox is set to true, set this to 1.
258
+ if ( 'checkbox' === $option['type'] && ! empty( $option['options'] ) ) {
259
+ $options[ $option['id'] ] = 1;
260
+ } else {
261
+ $options[ $option['id'] ] = 0;
262
+ }
263
+ // If an option is set.
264
+ if ( in_array( $option['type'], array( 'textarea', 'text', 'csv', 'numbercsv', 'posttypes', 'number' ), true ) && isset( $option['options'] ) ) {
265
+ $options[ $option['id'] ] = $option['options'];
266
+ }
267
+ if ( in_array( $option['type'], array( 'multicheck', 'radio', 'select', 'radiodesc', 'thumbsizes' ), true ) && isset( $option['default'] ) ) {
268
+ $options[ $option['id'] ] = $option['default'];
269
+ }
270
+ }
271
+ }
272
+
273
+ $upgraded_settings = crp_upgrade_settings();
274
+
275
+ if ( false !== $upgraded_settings ) {
276
+ $options = array_merge( $options, $upgraded_settings );
277
+ }
278
+
279
+ /**
280
+ * Filters the default settings array.
281
+ *
282
+ * @since 2.6.0
283
+ *
284
+ * @param array $options Default settings.
285
+ */
286
+ return apply_filters( 'crp_settings_defaults', $options );
287
+ }
288
+
289
+
290
+ /**
291
+ * Get the default option for a specific key
292
+ *
293
+ * @since 2.6.0
294
+ *
295
+ * @param string $key Key of the option to fetch.
296
+ * @return mixed
297
+ */
298
+ function crp_get_default_option( $key = '' ) {
299
+
300
+ $default_settings = crp_settings_defaults();
301
+
302
+ if ( array_key_exists( $key, $default_settings ) ) {
303
+ return $default_settings[ $key ];
304
+ } else {
305
+ return false;
306
+ }
307
+
308
+ }
309
+
310
+
311
+ /**
312
+ * Reset settings.
313
+ *
314
+ * @since 2.6.0
315
+ *
316
+ * @return void
317
+ */
318
+ function crp_settings_reset() {
319
+ delete_option( 'crp_settings' );
320
+ }
321
+
includes/admin/save-settings.php ADDED
@@ -0,0 +1,356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Save settings.
4
+ *
5
+ * Functions to register, read, write and update settings.
6
+ * Portions of this code have been inspired by Easy Digital Downloads, WordPress Settings Sandbox, etc.
7
+ *
8
+ * @link https://webberzone.com
9
+ * @since 2.6.0
10
+ *
11
+ * @package Contextual Related Posts
12
+ * @subpackage Admin/Save_Settings
13
+ */
14
+
15
+ // If this file is called directly, abort.
16
+ if ( ! defined( 'WPINC' ) ) {
17
+ die;
18
+ }
19
+
20
+
21
+ /**
22
+ * Sanitize the form data being submitted.
23
+ *
24
+ * @since 2.6.0
25
+ * @param array $input Input unclean array.
26
+ * @return array Sanitized array
27
+ */
28
+ function crp_settings_sanitize( $input = array() ) {
29
+
30
+ // First, we read the options collection.
31
+ global $crp_settings;
32
+
33
+ // This should be set if a form is submitted, so let's save it in the $referrer variable.
34
+ if ( empty( $_POST['_wp_http_referer'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
35
+ return $input;
36
+ }
37
+
38
+ parse_str( sanitize_text_field( wp_unslash( $_POST['_wp_http_referer'] ) ), $referrer ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
39
+
40
+ // Get the various settings we've registered.
41
+ $settings = crp_get_registered_settings();
42
+ $settings_types = crp_get_registered_settings_types();
43
+
44
+ // Check if we need to set to defaults.
45
+ $reset = isset( $_POST['settings_reset'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
46
+
47
+ if ( $reset ) {
48
+ crp_settings_reset();
49
+ $crp_settings = crp_get_settings();
50
+
51
+ add_settings_error( 'crp-notices', 'crp_reset', __( 'Settings have been reset to their default values. Reload this page to view the updated settings', 'contextual-related-posts' ), 'error' );
52
+
53
+ return $crp_settings;
54
+ }
55
+
56
+ // Get the tab. This is also our settings' section.
57
+ $tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
58
+
59
+ $input = $input ? $input : array();
60
+
61
+ /**
62
+ * Filter the settings for the tab. e.g. crp_settings_general_sanitize.
63
+ *
64
+ * @since 2.6.0
65
+ * @param array $input Input unclean array
66
+ */
67
+ $input = apply_filters( 'crp_settings_' . $tab . '_sanitize', $input );
68
+
69
+ // Create out output array by merging the existing settings with the ones submitted.
70
+ $output = array_merge( $crp_settings, $input );
71
+
72
+ // Loop through each setting being saved and pass it through a sanitization filter.
73
+ foreach ( $settings_types as $key => $type ) {
74
+
75
+ /**
76
+ * Skip settings that are not really settings.
77
+ *
78
+ * @since 2.6.0
79
+ * @param array $non_setting_types Array of types which are not settings.
80
+ */
81
+ $non_setting_types = apply_filters( 'crp_non_setting_types', array( 'header', 'descriptive_text' ) );
82
+
83
+ if ( in_array( $type, $non_setting_types, true ) ) {
84
+ continue;
85
+ }
86
+
87
+ if ( array_key_exists( $key, $output ) ) {
88
+
89
+ /**
90
+ * Field type filter.
91
+ *
92
+ * @since 2.6.0
93
+ * @param array $output[$key] Setting value.
94
+ * @param array $key Setting key.
95
+ */
96
+ $output[ $key ] = apply_filters( 'crp_settings_sanitize_' . $type, $output[ $key ], $key );
97
+ }
98
+
99
+ /**
100
+ * Field type filter for a specific key.
101
+ *
102
+ * @since 2.6.0
103
+ * @param array $output[$key] Setting value.
104
+ * @param array $key Setting key.
105
+ */
106
+ $output[ $key ] = apply_filters( 'crp_settings_sanitize' . $key, $output[ $key ], $key );
107
+
108
+ // Delete any key that is not present when we submit the input array.
109
+ if ( ! isset( $input[ $key ] ) ) {
110
+ unset( $output[ $key ] );
111
+ }
112
+ }
113
+
114
+ // Delete any settings that are no longer part of our registered settings.
115
+ if ( array_key_exists( $key, $output ) && ! array_key_exists( $key, $settings_types ) ) {
116
+ unset( $output[ $key ] );
117
+ }
118
+
119
+ add_settings_error( 'crp-notices', 'crp-updated', __( 'Settings updated.', 'contextual-related-posts' ), 'updated' );
120
+
121
+ // Overwrite settings if rounded thumbnail style is selected.
122
+ if ( 'rounded_thumbs' === $output['crp_styles'] ) {
123
+ add_settings_error( 'crp-notices', 'crp-styles', __( 'Post author, excerpt and date disabled. Thumbnail location set to inline before text.', 'contextual-related-posts' ), 'updated' );
124
+ }
125
+ // Overwrite settings if text_only thumbnail style is selected.
126
+ if ( 'text_only' === $output['crp_styles'] ) {
127
+ add_settings_error( 'crp-notices', 'crp-styles', __( 'Thumbnail location set to text only.', 'contextual-related-posts' ), 'updated' );
128
+ }
129
+
130
+ /**
131
+ * Filter the settings array before it is returned.
132
+ *
133
+ * @since 2.6.0
134
+ * @param array $output Settings array.
135
+ * @param array $input Input settings array.
136
+ */
137
+ return apply_filters( 'crp_settings_sanitize', $output, $input );
138
+
139
+ }
140
+
141
+
142
+ /**
143
+ * Sanitize text fields
144
+ *
145
+ * @since 2.6.0
146
+ *
147
+ * @param array $value The field value.
148
+ * @return string $value Sanitized value
149
+ */
150
+ function crp_sanitize_text_field( $value ) {
151
+ return crp_sanitize_textarea_field( $value );
152
+ }
153
+ add_filter( 'crp_settings_sanitize_text', 'crp_sanitize_text_field' );
154
+
155
+
156
+ /**
157
+ * Sanitize number fields
158
+ *
159
+ * @since 2.6.0
160
+ *
161
+ * @param array $value The field value.
162
+ * @return string $value Sanitized value
163
+ */
164
+ function crp_sanitize_number_field( $value ) {
165
+ return filter_var( $value, FILTER_SANITIZE_NUMBER_INT );
166
+ }
167
+ add_filter( 'crp_settings_sanitize_number', 'crp_sanitize_number_field' );
168
+
169
+
170
+ /**
171
+ * Sanitize CSV fields
172
+ *
173
+ * @since 2.6.0
174
+ *
175
+ * @param array $value The field value.
176
+ * @return string $value Sanitized value
177
+ */
178
+ function crp_sanitize_csv_field( $value ) {
179
+
180
+ return implode( ',', array_map( 'trim', explode( ',', sanitize_text_field( wp_unslash( $value ) ) ) ) );
181
+ }
182
+ add_filter( 'crp_settings_sanitize_csv', 'crp_sanitize_csv_field' );
183
+
184
+
185
+ /**
186
+ * Sanitize CSV fields which hold numbers e.g. IDs
187
+ *
188
+ * @since 2.6.0
189
+ *
190
+ * @param array $value The field value.
191
+ * @return string $value Sanitized value
192
+ */
193
+ function crp_sanitize_numbercsv_field( $value ) {
194
+
195
+ return implode( ',', array_filter( array_map( 'absint', explode( ',', sanitize_text_field( wp_unslash( $value ) ) ) ) ) );
196
+ }
197
+ add_filter( 'crp_settings_sanitize_numbercsv', 'crp_sanitize_numbercsv_field' );
198
+
199
+
200
+ /**
201
+ * Sanitize textarea fields
202
+ *
203
+ * @since 2.6.0
204
+ *
205
+ * @param array $value The field value.
206
+ * @return string $value Sanitized value
207
+ */
208
+ function crp_sanitize_textarea_field( $value ) {
209
+
210
+ global $allowedposttags;
211
+
212
+ // We need more tags to allow for script and style.
213
+ $moretags = array(
214
+ 'script' => array(
215
+ 'type' => true,
216
+ 'src' => true,
217
+ 'async' => true,
218
+ 'defer' => true,
219
+ 'charset' => true,
220
+ 'lang' => true,
221
+ ),
222
+ 'style' => array(
223
+ 'type' => true,
224
+ 'media' => true,
225
+ 'scoped' => true,
226
+ 'lang' => true,
227
+ ),
228
+ 'link' => array(
229
+ 'rel' => true,
230
+ 'type' => true,
231
+ 'href' => true,
232
+ 'media' => true,
233
+ 'sizes' => true,
234
+ 'hreflang' => true,
235
+ ),
236
+ );
237
+
238
+ $allowedtags = array_merge( $allowedposttags, $moretags );
239
+
240
+ /**
241
+ * Filter allowed tags allowed when sanitizing text and textarea fields.
242
+ *
243
+ * @since 2.6.0
244
+ *
245
+ * @param array $allowedtags Allowed tags array.
246
+ * @param array $value The field value.
247
+ */
248
+ $allowedtags = apply_filters( 'crp_sanitize_allowed_tags', $allowedtags, $value );
249
+
250
+ return wp_kses( wp_unslash( $value ), $allowedtags );
251
+
252
+ }
253
+ add_filter( 'crp_settings_sanitize_textarea', 'crp_sanitize_textarea_field' );
254
+
255
+
256
+ /**
257
+ * Sanitize checkbox fields
258
+ *
259
+ * @since 2.6.0
260
+ *
261
+ * @param array $value The field value.
262
+ * @return string|int $value Sanitized value
263
+ */
264
+ function crp_sanitize_checkbox_field( $value ) {
265
+
266
+ $value = ( -1 === (int) $value ) ? 0 : 1;
267
+
268
+ return $value;
269
+ }
270
+ add_filter( 'crp_settings_sanitize_checkbox', 'crp_sanitize_checkbox_field' );
271
+
272
+
273
+ /**
274
+ * Sanitize post_types fields
275
+ *
276
+ * @since 2.6.0
277
+ *
278
+ * @param array $value The field value.
279
+ * @return string $value Sanitized value
280
+ */
281
+ function crp_sanitize_posttypes_field( $value ) {
282
+
283
+ $post_types = is_array( $value ) ? array_map( 'sanitize_text_field', wp_unslash( $value ) ) : array();
284
+
285
+ return implode( ',', $post_types );
286
+ }
287
+ add_filter( 'crp_settings_sanitize_posttypes', 'crp_sanitize_posttypes_field' );
288
+
289
+
290
+ /**
291
+ * Sanitize taxonomies fields
292
+ *
293
+ * @since 2.6.0
294
+ *
295
+ * @param array $value The field value.
296
+ * @return string $value Sanitized value
297
+ */
298
+ function crp_sanitize_taxonomies_field( $value ) {
299
+
300
+ $taxonomies = is_array( $value ) ? array_map( 'sanitize_text_field', wp_unslash( $value ) ) : array();
301
+
302
+ return implode( ',', $taxonomies );
303
+ }
304
+ add_filter( 'crp_settings_sanitize_taxonomies', 'crp_sanitize_taxonomies_field' );
305
+
306
+
307
+ /**
308
+ * Modify settings when they are being saved.
309
+ *
310
+ * @since 2.6.0
311
+ *
312
+ * @param array $settings Settings array.
313
+ * @return string $settings Sanitized settings array.
314
+ */
315
+ function crp_change_settings_on_save( $settings ) {
316
+
317
+ // Sanitize exclude_cat_slugs to save a new entry of exclude_categories.
318
+ if ( ! empty( $settings['exclude_cat_slugs'] ) ) {
319
+
320
+ $exclude_cat_slugs = explode( ',', $settings['exclude_cat_slugs'] );
321
+
322
+ foreach ( $exclude_cat_slugs as $cat_name ) {
323
+ $cat = get_term_by( 'name', $cat_name, 'category' );
324
+
325
+ // Fall back to slugs since that was the default format before v2.4.0.
326
+ if ( false === $cat ) {
327
+ $cat = get_term_by( 'slug', $cat_name, 'category' );
328
+ }
329
+ if ( isset( $cat->term_taxonomy_id ) ) {
330
+ $exclude_categories[] = $cat->term_taxonomy_id;
331
+ $exclude_categories_slugs[] = $cat->name;
332
+ }
333
+ }
334
+ $settings['exclude_categories'] = isset( $exclude_categories ) ? join( ',', $exclude_categories ) : '';
335
+ $settings['exclude_cat_slugs'] = isset( $exclude_categories_slugs ) ? join( ',', $exclude_categories_slugs ) : '';
336
+
337
+ }
338
+
339
+ // Overwrite settings if rounded thumbnail style is selected.
340
+ if ( 'rounded_thumbs' === $settings['crp_styles'] ) {
341
+ $settings['show_excerpt'] = 0;
342
+ $settings['show_author'] = 0;
343
+ $settings['show_date'] = 0;
344
+ $settings['post_thumb_op'] = 'inline';
345
+ }
346
+ // Overwrite settings if text_only thumbnail style is selected.
347
+ if ( 'text_only' === $settings['crp_styles'] ) {
348
+ $settings['post_thumb_op'] = 'text_only';
349
+ }
350
+
351
+ // Delete the cache.
352
+ crp_cache_delete();
353
+
354
+ return $settings;
355
+ }
356
+ add_filter( 'crp_settings_sanitize', 'crp_change_settings_on_save' );
includes/admin/settings-page.php ADDED
@@ -0,0 +1,752 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Renders the settings page.
4
+ * Portions of this code have been inspired by Easy Digital Downloads, WordPress Settings Sandbox, etc.
5
+ *
6
+ * @link https://webberzone.com
7
+ * @since 2.6.0
8
+ *
9
+ * @package Contextual_Related_Posts
10
+ * @subpackage Admin/Settings
11
+ */
12
+
13
+ // If this file is called directly, abort.
14
+ if ( ! defined( 'WPINC' ) ) {
15
+ die;
16
+ }
17
+
18
+
19
+ /**
20
+ * Render the settings page.
21
+ *
22
+ * @since 2.6.0
23
+ *
24
+ * @return void
25
+ */
26
+ function crp_options_page() {
27
+ $active_tab = isset( $_GET['tab'] ) && array_key_exists( sanitize_key( wp_unslash( $_GET['tab'] ) ), crp_get_settings_sections() ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'general'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
28
+
29
+ ob_start();
30
+ ?>
31
+ <div class="wrap">
32
+ <h1><?php esc_html_e( 'Contextual Related Posts Settings', 'contextual-related-posts' ); ?></h1>
33
+
34
+ <p>
35
+ <a href="<?php echo admin_url( 'admin.php?page=crp_tools_page' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
36
+ <?php esc_html_e( 'Visit the Tools page', 'autoclose' ); ?>
37
+ </a>
38
+ <p>
39
+
40
+ <div id="poststuff">
41
+ <div id="post-body" class="metabox-holder columns-2">
42
+ <div id="post-body-content">
43
+
44
+ <ul class="nav-tab-wrapper" style="padding:0">
45
+ <?php
46
+ foreach ( crp_get_settings_sections() as $tab_id => $tab_name ) {
47
+
48
+ $active = $active_tab === $tab_id ? ' ' : '';
49
+
50
+ echo '<li><a href="#' . esc_attr( $tab_id ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab ' . sanitize_html_class( $active ) . '">';
51
+ echo esc_html( $tab_name );
52
+ echo '</a></li>';
53
+
54
+ }
55
+ ?>
56
+ </ul>
57
+
58
+ <form method="post" action="options.php">
59
+
60
+ <?php settings_fields( 'crp_settings' ); ?>
61
+
62
+ <?php foreach ( crp_get_settings_sections() as $tab_id => $tab_name ) : ?>
63
+
64
+ <div id="<?php echo esc_attr( $tab_id ); ?>">
65
+ <table class="form-table">
66
+ <?php
67
+ do_settings_fields( 'crp_settings_' . $tab_id, 'crp_settings_' . $tab_id );
68
+ ?>
69
+ </table>
70
+ <p>
71
+ <?php
72
+ // Default submit button.
73
+ submit_button(
74
+ __( 'Save Changes', 'contextual-related-posts' ),
75
+ 'primary',
76
+ 'submit',
77
+ false
78
+ );
79
+
80
+ echo '&nbsp;&nbsp;';
81
+
82
+ // Reset button.
83
+ $confirm = esc_js( __( 'Do you really want to reset all these settings to their default values?', 'contextual-related-posts' ) );
84
+ submit_button(
85
+ __( 'Reset all settings', 'contextual-related-posts' ),
86
+ 'secondary',
87
+ 'settings_reset',
88
+ false,
89
+ array(
90
+ 'onclick' => "return confirm('{$confirm}');",
91
+ )
92
+ );
93
+ ?>
94
+ </p>
95
+ </div><!-- /#tab_id-->
96
+
97
+ <?php endforeach; ?>
98
+
99
+ </form>
100
+
101
+ </div><!-- /#post-body-content -->
102
+
103
+ <div id="postbox-container-1" class="postbox-container">
104
+
105
+ <div id="side-sortables" class="meta-box-sortables ui-sortable">
106
+ <?php include_once 'sidebar.php'; ?>
107
+ </div><!-- /#side-sortables -->
108
+
109
+ </div><!-- /#postbox-container-1 -->
110
+ </div><!-- /#post-body -->
111
+ <br class="clear" />
112
+ </div><!-- /#poststuff -->
113
+
114
+ </div><!-- /.wrap -->
115
+
116
+ <?php
117
+ echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
118
+ }
119
+
120
+ /**
121
+ * Array containing the settings' sections.
122
+ *
123
+ * @since 2.6.0
124
+ *
125
+ * @return array Settings array
126
+ */
127
+ function crp_get_settings_sections() {
128
+ $crp_settings_sections = array(
129
+ 'general' => __( 'General', 'contextual-related-posts' ),
130
+ 'list' => __( 'List tuning', 'contextual-related-posts' ),
131
+ 'output' => __( 'Output', 'contextual-related-posts' ),
132
+ 'thumbnail' => __( 'Thumbnail', 'contextual-related-posts' ),
133
+ 'styles' => __( 'Styles', 'contextual-related-posts' ),
134
+ 'feed' => __( 'Feed', 'contextual-related-posts' ),
135
+ );
136
+
137
+ /**
138
+ * Filter the array containing the settings' sections.
139
+ *
140
+ * @since 2.6.0
141
+ *
142
+ * @param array $crp_settings_sections Settings array
143
+ */
144
+ return apply_filters( 'crp_settings_sections', $crp_settings_sections );
145
+
146
+ }
147
+
148
+
149
+ /**
150
+ * Miscellaneous callback funcion
151
+ *
152
+ * @since 2.6.0
153
+ *
154
+ * @param array $args Arguments passed by the setting.
155
+ * @return void
156
+ */
157
+ function crp_missing_callback( $args ) {
158
+ /* translators: %s: Setting ID. */
159
+ printf( esc_html__( 'The callback function used for the <strong>%s</strong> setting is missing.', 'contextual-related-posts' ), esc_html( $args['id'] ) );
160
+ }
161
+
162
+
163
+ /**
164
+ * Header Callback
165
+ *
166
+ * Renders the header.
167
+ *
168
+ * @since 2.6.0
169
+ *
170
+ * @param array $args Arguments passed by the setting.
171
+ * @return void
172
+ */
173
+ function crp_header_callback( $args ) {
174
+
175
+ $html = '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
176
+
177
+ /**
178
+ * After Settings Output filter
179
+ *
180
+ * @since 2.6.0
181
+ * @param string $html HTML string.
182
+ * @param array $args Arguments array.
183
+ */
184
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
185
+ }
186
+
187
+
188
+ /**
189
+ * Display text fields.
190
+ *
191
+ * @since 2.6.0
192
+ *
193
+ * @param array $args Array of arguments.
194
+ * @return void
195
+ */
196
+ function crp_text_callback( $args ) {
197
+
198
+ // First, we read the options collection.
199
+ global $crp_settings;
200
+
201
+ if ( isset( $crp_settings[ $args['id'] ] ) ) {
202
+ $value = $crp_settings[ $args['id'] ];
203
+ } else {
204
+ $value = isset( $args['options'] ) ? $args['options'] : '';
205
+ }
206
+
207
+ $size = sanitize_html_class( ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular' );
208
+
209
+ $class = sanitize_html_class( $args['field_class'] );
210
+
211
+ $disabled = ! empty( $args['disabled'] ) ? ' disabled="disabled"' : '';
212
+ $readonly = ( isset( $args['readonly'] ) && true === $args['readonly'] ) ? ' readonly="readonly"' : '';
213
+
214
+ $attributes = $disabled . $readonly;
215
+
216
+ foreach ( (array) $args['field_attributes'] as $attribute => $val ) {
217
+ $attributes .= sprintf( ' %1$s="%2$s"', $attribute, esc_attr( $val ) );
218
+ }
219
+
220
+ $html = sprintf( '<input type="text" id="crp_settings[%1$s]" name="crp_settings[%1$s]" class="%2$s" value="%3$s" %4$s />', sanitize_key( $args['id'] ), $class . ' ' . $size . '-text', esc_attr( stripslashes( $value ) ), $attributes );
221
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
222
+
223
+ /** This filter has been defined in settings-page.php */
224
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
225
+ }
226
+
227
+
228
+ /**
229
+ * Display csv fields.
230
+ *
231
+ * @since 2.6.0
232
+ *
233
+ * @param array $args Array of arguments.
234
+ * @return void
235
+ */
236
+ function crp_csv_callback( $args ) {
237
+
238
+ crp_text_callback( $args );
239
+ }
240
+
241
+
242
+ /**
243
+ * Display CSV fields of numbers.
244
+ *
245
+ * @since 2.6.0
246
+ *
247
+ * @param array $args Array of arguments.
248
+ * @return void
249
+ */
250
+ function crp_numbercsv_callback( $args ) {
251
+
252
+ crp_csv_callback( $args );
253
+ }
254
+
255
+
256
+ /**
257
+ * Display textarea.
258
+ *
259
+ * @since 2.6.0
260
+ *
261
+ * @param array $args Array of arguments.
262
+ * @return void
263
+ */
264
+ function crp_textarea_callback( $args ) {
265
+
266
+ // First, we read the options collection.
267
+ global $crp_settings;
268
+
269
+ if ( isset( $crp_settings[ $args['id'] ] ) ) {
270
+ $value = $crp_settings[ $args['id'] ];
271
+ } else {
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 */
279
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
280
+ }
281
+
282
+
283
+ /**
284
+ * Display CSS fields.
285
+ *
286
+ * @since 2.6.0
287
+ *
288
+ * @param array $args Array of arguments.
289
+ * @return void
290
+ */
291
+ function crp_css_callback( $args ) {
292
+
293
+ crp_textarea_callback( $args );
294
+ }
295
+
296
+
297
+ /**
298
+ * Display checboxes.
299
+ *
300
+ * @since 2.6.0
301
+ *
302
+ * @param array $args Array of arguments.
303
+ * @return void
304
+ */
305
+ function crp_checkbox_callback( $args ) {
306
+
307
+ // First, we read the options collection.
308
+ global $crp_settings;
309
+
310
+ $default = isset( $args['options'] ) ? $args['options'] : '';
311
+ $set = isset( $crp_settings[ $args['id'] ] ) ? $crp_settings[ $args['id'] ] : crp_get_default_option( $args['id'] );
312
+ $checked = ! empty( $set ) ? checked( 1, (int) $set, false ) : '';
313
+
314
+ $html = sprintf( '<input type="hidden" name="crp_settings[%1$s]" value="-1" />', sanitize_key( $args['id'] ) );
315
+ $html .= sprintf( '<input type="checkbox" id="crp_settings[%1$s]" name="crp_settings[%1$s]" value="1" %2$s />', sanitize_key( $args['id'] ), $checked );
316
+ $html .= ( $set <> $default ) ? '<em style="color:orange"> ' . esc_html__( 'Modified from default setting', 'contextual-related-posts' ) . '</em>' : ''; // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
317
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
318
+
319
+ /** This filter has been defined in settings-page.php */
320
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
321
+ }
322
+
323
+
324
+ /**
325
+ * Multicheck Callback
326
+ *
327
+ * Renders multiple checkboxes.
328
+ *
329
+ * @since 2.6.0
330
+ *
331
+ * @param array $args Array of arguments.
332
+ * @return void
333
+ */
334
+ function crp_multicheck_callback( $args ) {
335
+ global $crp_settings;
336
+ $html = '';
337
+
338
+ if ( ! empty( $args['options'] ) ) {
339
+ $html .= sprintf( '<input type="hidden" name="crp_settings[%1$s]" value="-1" />', sanitize_key( $args['id'] ) );
340
+
341
+ foreach ( $args['options'] as $key => $option ) {
342
+ if ( isset( $crp_settings[ $args['id'] ][ $key ] ) ) {
343
+ $enabled = $key;
344
+ } else {
345
+ $enabled = null;
346
+ }
347
+
348
+ $html .= sprintf( '<input name="crp_settings[%1$s][%2$s]" id="crp_settings[%1$s][%2$s]" type="checkbox" value="%3$s" %4$s /> ', sanitize_key( $args['id'] ), sanitize_key( $key ), esc_attr( $key ), checked( $key, $enabled, false ) );
349
+ $html .= sprintf( '<label for="crp_settings[%1$s][%2$s]">%3$s</label> <br />', sanitize_key( $args['id'] ), sanitize_key( $key ), $option );
350
+ }
351
+
352
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
353
+ }
354
+
355
+ /** This filter has been defined in settings-page.php */
356
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
357
+ }
358
+
359
+
360
+ /**
361
+ * Radio Callback
362
+ *
363
+ * Renders radio boxes.
364
+ *
365
+ * @since 2.6.0
366
+ *
367
+ * @param array $args Array of arguments.
368
+ * @return void
369
+ */
370
+ function crp_radio_callback( $args ) {
371
+ global $crp_settings;
372
+ $html = '';
373
+
374
+ foreach ( $args['options'] as $key => $option ) {
375
+ $checked = false;
376
+
377
+ if ( isset( $crp_settings[ $args['id'] ] ) && $crp_settings[ $args['id'] ] === $key ) {
378
+ $checked = true;
379
+ } elseif ( isset( $args['default'] ) && $args['default'] === $key && ! isset( $crp_settings[ $args['id'] ] ) ) {
380
+ $checked = true;
381
+ }
382
+
383
+ $html .= sprintf( '<input name="crp_settings[%1$s]" id="crp_settings[%1$s][%2$s]" type="radio" value="%2$s" %3$s /> ', sanitize_key( $args['id'] ), $key, checked( true, $checked, false ) );
384
+ $html .= sprintf( '<label for="crp_settings[%1$s][%2$s]">%3$s</label> <br />', sanitize_key( $args['id'] ), $key, $option );
385
+ }
386
+
387
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
388
+
389
+ /** This filter has been defined in settings-page.php */
390
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
391
+ }
392
+
393
+
394
+ /**
395
+ * Radio callback with description.
396
+ *
397
+ * Renders radio boxes with each item having it separate description.
398
+ *
399
+ * @since 2.6.0
400
+ *
401
+ * @param array $args Array of arguments.
402
+ * @return void
403
+ */
404
+ function crp_radiodesc_callback( $args ) {
405
+ global $crp_settings;
406
+ $html = '';
407
+
408
+ foreach ( $args['options'] as $option ) {
409
+ $checked = false;
410
+
411
+ if ( isset( $crp_settings[ $args['id'] ] ) && $crp_settings[ $args['id'] ] === $option['id'] ) {
412
+ $checked = true;
413
+ } elseif ( isset( $args['default'] ) && $args['default'] === $option['id'] && ! isset( $crp_settings[ $args['id'] ] ) ) {
414
+ $checked = true;
415
+ }
416
+
417
+ $html .= sprintf( '<input name="crp_settings[%1$s]" id="crp_settings[%1$s][%2$s]" type="radio" value="%2$s" %3$s /> ', sanitize_key( $args['id'] ), $option['id'], checked( true, $checked, false ) );
418
+ $html .= sprintf( '<label for="crp_settings[%1$s][%2$s]">%3$s</label>', sanitize_key( $args['id'] ), $option['id'], $option['name'] );
419
+ $html .= ': <em>' . wp_kses_post( $option['description'] ) . '</em> <br />';
420
+ }
421
+
422
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
423
+
424
+ /** This filter has been defined in settings-page.php */
425
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
426
+ }
427
+
428
+
429
+ /**
430
+ * Callback for thumbnail sizes
431
+ *
432
+ * Renders list of radio boxes with various thumbnail sizes.
433
+ *
434
+ * @since 2.6.0
435
+ *
436
+ * @param array $args Array of arguments.
437
+ * @return void
438
+ */
439
+ function crp_thumbsizes_callback( $args ) {
440
+ global $crp_settings;
441
+ $html = '';
442
+
443
+ if ( ! isset( $args['options']['crp_thumbnail'] ) ) {
444
+ $args['options']['crp_thumbnail'] = array(
445
+ 'name' => 'crp_thumbnail',
446
+ 'width' => crp_get_option( 'thumb_width', 150 ),
447
+ 'height' => crp_get_option( 'thumb_height', 150 ),
448
+ 'crop' => crp_get_option( 'thumb_crop', true ),
449
+ );
450
+ }
451
+
452
+ foreach ( $args['options'] as $option ) {
453
+ $checked = false;
454
+
455
+ if ( isset( $crp_settings[ $args['id'] ] ) && $crp_settings[ $args['id'] ] === $option['name'] ) {
456
+ $checked = true;
457
+ } elseif ( isset( $args['default'] ) && $args['default'] === $option['name'] && ! isset( $crp_settings[ $args['id'] ] ) ) {
458
+ $checked = true;
459
+ }
460
+
461
+ $html .= sprintf( '<input name="crp_settings[%1$s]" id="crp_settings[%1$s][%2$s]" type="radio" value="%2$s" %3$s /> ', sanitize_key( $args['id'] ), $option['name'], checked( true, $checked, false ) );
462
+ $html .= sprintf( '<label for="crp_settings[%1$s][%2$s]">%3$s</label> <br />', sanitize_key( $args['id'] ), $option['name'], $option['name'] . ' (' . $option['width'] . 'x' . $option['height'] . ')' );
463
+ }
464
+
465
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
466
+
467
+ /** This filter has been defined in settings-page.php */
468
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
469
+ }
470
+
471
+
472
+ /**
473
+ * Number Callback
474
+ *
475
+ * Renders number fields.
476
+ *
477
+ * @since 2.6.0
478
+ *
479
+ * @param array $args Array of arguments.
480
+ * @return void
481
+ */
482
+ function crp_number_callback( $args ) {
483
+ global $crp_settings;
484
+
485
+ if ( isset( $crp_settings[ $args['id'] ] ) ) {
486
+ $value = $crp_settings[ $args['id'] ];
487
+ } else {
488
+ $value = isset( $args['options'] ) ? $args['options'] : '';
489
+ }
490
+
491
+ $max = isset( $args['max'] ) ? $args['max'] : 999999;
492
+ $min = isset( $args['min'] ) ? $args['min'] : 0;
493
+ $step = isset( $args['step'] ) ? $args['step'] : 1;
494
+
495
+ $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
496
+
497
+ $html = sprintf( '<input type="number" step="%1$s" max="%2$s" min="%3$s" class="%4$s" id="crp_settings[%5$s]" name="crp_settings[%5$s]" value="%6$s"/>', esc_attr( $step ), esc_attr( $max ), esc_attr( $min ), sanitize_html_class( $size ) . '-text', sanitize_key( $args['id'] ), esc_attr( stripslashes( $value ) ) );
498
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
499
+
500
+ /** This filter has been defined in settings-page.php */
501
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
502
+ }
503
+
504
+
505
+ /**
506
+ * Select Callback
507
+ *
508
+ * Renders select fields.
509
+ *
510
+ * @since 2.6.0
511
+ *
512
+ * @param array $args Array of arguments.
513
+ * @return void
514
+ */
515
+ function crp_select_callback( $args ) {
516
+ global $crp_settings;
517
+
518
+ if ( isset( $crp_settings[ $args['id'] ] ) ) {
519
+ $value = $crp_settings[ $args['id'] ];
520
+ } else {
521
+ $value = isset( $args['default'] ) ? $args['default'] : '';
522
+ }
523
+
524
+ if ( isset( $args['chosen'] ) ) {
525
+ $chosen = 'class="crp-chosen"';
526
+ } else {
527
+ $chosen = '';
528
+ }
529
+
530
+ $html = sprintf( '<select id="crp_settings[%1$s]" name="crp_settings[%1$s]" %2$s />', sanitize_key( $args['id'] ), $chosen );
531
+
532
+ foreach ( $args['options'] as $option => $name ) {
533
+ $html .= sprintf( '<option value="%1$s" %2$s>%3$s</option>', sanitize_key( $option ), selected( $option, $value, false ), $name );
534
+ }
535
+
536
+ $html .= '</select>';
537
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
538
+
539
+ /** This filter has been defined in settings-page.php */
540
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
541
+ }
542
+
543
+
544
+ /**
545
+ * Descriptive text callback.
546
+ *
547
+ * Renders descriptive text onto the settings field.
548
+ *
549
+ * @since 2.6.0
550
+ *
551
+ * @param array $args Array of arguments.
552
+ * @return void
553
+ */
554
+ function crp_descriptive_text_callback( $args ) {
555
+ $html = '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
556
+
557
+ /** This filter has been defined in settings-page.php */
558
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
559
+ }
560
+
561
+
562
+ /**
563
+ * Display post types fields.
564
+ *
565
+ * @since 2.6.0
566
+ *
567
+ * @param array $args Array of arguments.
568
+ * @return void
569
+ */
570
+ function crp_posttypes_callback( $args ) {
571
+
572
+ global $crp_settings;
573
+ $html = '';
574
+
575
+ if ( isset( $crp_settings[ $args['id'] ] ) ) {
576
+ $options = $crp_settings[ $args['id'] ];
577
+ } else {
578
+ $options = isset( $args['options'] ) ? $args['options'] : '';
579
+ }
580
+
581
+ // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
582
+ if ( is_array( $options ) ) {
583
+ $post_types = $options;
584
+ } elseif ( ! is_array( $options ) && false === strpos( $options, '=' ) ) {
585
+ $post_types = explode( ',', $options );
586
+ } else {
587
+ parse_str( $options, $post_types );
588
+ }
589
+
590
+ $wp_post_types = get_post_types(
591
+ array(
592
+ 'public' => true,
593
+ )
594
+ );
595
+ $posts_types_inc = array_intersect( $wp_post_types, $post_types );
596
+
597
+ $html .= sprintf( '<input type="hidden" name="crp_settings[%1$s]" value="-1" />', sanitize_key( $args['id'] ) );
598
+
599
+ foreach ( $wp_post_types as $wp_post_type ) {
600
+
601
+ $html .= sprintf( '<input name="crp_settings[%1$s][%2$s]" id="crp_settings[%1$s][%2$s]" type="checkbox" value="%2$s" %3$s /> ', sanitize_key( $args['id'] ), esc_attr( $wp_post_type ), checked( true, in_array( $wp_post_type, $posts_types_inc, true ), false ) );
602
+ $html .= sprintf( '<label for="crp_settings[%1$s][%2$s]">%2$s</label> <br />', sanitize_key( $args['id'] ), $wp_post_type );
603
+
604
+ }
605
+
606
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
607
+
608
+ /** This filter has been defined in settings-page.php */
609
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
610
+ }
611
+
612
+
613
+ /**
614
+ * Display csv fields.
615
+ *
616
+ * @since 2.6.0
617
+ *
618
+ * @param array $args Array of arguments.
619
+ * @return void
620
+ */
621
+ function crp_taxonomies_callback( $args ) {
622
+
623
+ global $crp_settings;
624
+ $html = '';
625
+
626
+ if ( isset( $crp_settings[ $args['id'] ] ) ) {
627
+ $options = $crp_settings[ $args['id'] ];
628
+ } else {
629
+ $options = isset( $args['options'] ) ? $args['options'] : '';
630
+ }
631
+
632
+ // If taxonomies is empty or contains a query string then use parse_str else consider it comma-separated.
633
+ if ( is_array( $options ) ) {
634
+ $taxonomies = $options;
635
+ } elseif ( ! is_array( $options ) && false === strpos( $options, '=' ) ) {
636
+ $taxonomies = explode( ',', $options );
637
+ } else {
638
+ parse_str( $options, $taxonomies );
639
+ }
640
+
641
+ /* Fetch taxonomies */
642
+ $argsc = array(
643
+ 'public' => true,
644
+ '_builtin' => true,
645
+ );
646
+ $output = 'objects';
647
+ $operator = 'and';
648
+ $wp_taxonomies = get_taxonomies( $argsc, $output, $operator );
649
+
650
+ $taxonomies_inc = array_intersect( wp_list_pluck( (array) $wp_taxonomies, 'name' ), $taxonomies );
651
+
652
+ $html .= sprintf( '<input type="hidden" name="crp_settings[%1$s]" value="-1" />', sanitize_key( $args['id'] ) );
653
+
654
+ foreach ( $wp_taxonomies as $wp_taxonomy ) {
655
+
656
+ $html .= sprintf( '<input name="crp_settings[%1$s][%2$s]" id="crp_settings[%1$s][%2$s]" type="checkbox" value="%2$s" %3$s /> ', sanitize_key( $args['id'] ), esc_attr( $wp_taxonomy->name ), checked( true, in_array( $wp_taxonomy->name, $taxonomies_inc, true ), false ) );
657
+ $html .= sprintf( '<label for="crp_settings[%1$s][%2$s]">%3$s</label> <br />', sanitize_key( $args['id'] ), esc_attr( $wp_taxonomy->name ), $wp_taxonomy->labels->name );
658
+
659
+ }
660
+
661
+ $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
662
+
663
+ /** This filter has been defined in settings-page.php */
664
+ echo apply_filters( 'crp_after_setting_output', $html, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
665
+ }
666
+
667
+
668
+ /**
669
+ * Function to add an action to search for tags using Ajax.
670
+ *
671
+ * @since 2.6.0
672
+ *
673
+ * @return void
674
+ */
675
+ function crp_tags_search() {
676
+
677
+ if ( ! isset( $_REQUEST['tax'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
678
+ wp_die( 0 );
679
+ }
680
+
681
+ $taxonomy = sanitize_key( $_REQUEST['tax'] );
682
+ $tax = get_taxonomy( $taxonomy );
683
+ if ( ! $tax ) {
684
+ wp_die( 0 );
685
+ }
686
+
687
+ if ( ! current_user_can( $tax->cap->assign_terms ) ) {
688
+ wp_die( -1 );
689
+ }
690
+
691
+ $s = isset( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
692
+
693
+ $comma = _x( ',', 'tag delimiter' );
694
+ if ( ',' !== $comma ) {
695
+ $s = str_replace( $comma, ',', $s );
696
+ }
697
+ if ( false !== strpos( $s, ',' ) ) {
698
+ $s = explode( ',', $s );
699
+ $s = $s[ count( $s ) - 1 ];
700
+ }
701
+ $s = trim( $s );
702
+
703
+ /** This filter has been defined in /wp-admin/includes/ajax-actions.php */
704
+ $term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $s );
705
+
706
+ /*
707
+ * Require $term_search_min_chars chars for matching (default: 2)
708
+ * ensure it's a non-negative, non-zero integer.
709
+ */
710
+ if ( ( 0 === $term_search_min_chars ) || ( strlen( $s ) < $term_search_min_chars ) ) {
711
+ wp_die();
712
+ }
713
+
714
+ $results = get_terms(
715
+ $taxonomy,
716
+ array(
717
+ 'name__like' => $s,
718
+ 'fields' => 'names',
719
+ 'hide_empty' => false,
720
+ )
721
+ );
722
+
723
+ echo wp_json_encode( $results );
724
+ wp_die();
725
+
726
+ }
727
+ add_action( 'wp_ajax_nopriv_crp_tag_search', 'crp_tags_search' );
728
+ add_action( 'wp_ajax_crp_tag_search', 'crp_tags_search' );
729
+
730
+
731
+ /**
732
+ * Display the default thumbnail below the setting.
733
+ *
734
+ * @since 2.6.0
735
+ *
736
+ * @param string $html Current HTML.
737
+ * @param array $args Argument array of the setting.
738
+ * @return string
739
+ */
740
+ function crp_admin_thumbnail( $html, $args ) {
741
+
742
+ $thumb_default = crp_get_option( 'thumb_default' );
743
+
744
+ if ( 'thumb_default' === $args['id'] && '' !== $thumb_default ) {
745
+ $html .= '<br />';
746
+ $html .= sprintf( '<img src="%1$s" style="max-width:200px" title="%2$s" alt="%2$s" />', esc_attr( $thumb_default ), esc_html__( 'Default thumbnail', 'contextual-related-posts' ) );
747
+ }
748
+
749
+ return $html;
750
+ }
751
+ add_filter( 'crp_after_setting_output', 'crp_admin_thumbnail', 10, 2 );
752
+
includes/admin/sidebar.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sidebar
4
+ *
5
+ * @link https://webberzone.com
6
+ * @since 2.6.0
7
+ *
8
+ * @package Contextual Related Posts
9
+ * @subpackage Admin/Footer
10
+ */
11
+
12
+ // If this file is called directly, abort.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
+ ?>
18
+ <div class="postbox-container">
19
+ <div id="donatediv" class="postbox meta-box-sortables">
20
+ <h2 class='hndle'><span><?php esc_html_e( 'Support the development', 'contextual-related-posts' ); ?></span></h3>
21
+ <div class="inside" style="text-align: center">
22
+ <div id="donate-form">
23
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
24
+ <input type="hidden" name="cmd" value="_xclick">
25
+ <input type="hidden" name="business" value="donate@ajaydsouza.com">
26
+ <input type="hidden" name="lc" value="IN">
27
+ <input type="hidden" name="item_name" value="<?php esc_html_e( 'Donation for Contextual Related Posts', 'contextual-related-posts' ); ?>">
28
+ <input type="hidden" name="item_number" value="crp_plugin_settings">
29
+ <strong><?php esc_html_e( 'Enter amount in USD', 'contextual-related-posts' ); ?></strong>: <input name="amount" value="15.00" size="6" type="text"><br />
30
+ <input type="hidden" name="currency_code" value="USD">
31
+ <input type="hidden" name="button_subtype" value="services">
32
+ <input type="hidden" name="bn" value="PP-BuyNowBF:btn_donate_LG.gif:NonHosted">
33
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="<?php esc_html_e( 'Send your donation to the author of', 'contextual-related-posts' ); ?> Contextual Related Posts">
34
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
35
+ </form>
36
+ </div>
37
+ <!-- /#donate-form -->
38
+ </div>
39
+ <!-- /.inside -->
40
+ </div>
41
+ <!-- /.postbox -->
42
+
43
+ <div id="qlinksdiv" class="postbox meta-box-sortables">
44
+ <h2 class='hndle metabox-holder'><span><?php esc_html_e( 'Quick links', 'contextual-related-posts' ); ?></span></h3>
45
+ <div class="inside">
46
+ <div id="quick-links">
47
+ <ul>
48
+ <li>
49
+ <a href="https://webberzone.com/plugins/contextual-related-posts/">
50
+ <?php esc_html_e( 'Contextual Related Posts plugin homepage', 'contextual-related-posts' ); ?>
51
+ </a>
52
+ </li>
53
+ <li>
54
+ <a href="https://wordpress.org/plugins/contextual-related-posts/faq/">
55
+ <?php esc_html_e( 'FAQ', 'contextual-related-posts' ); ?>
56
+ </a>
57
+ </li>
58
+ <li>
59
+ <a href="http://wordpress.org/support/plugin/contextual-related-posts">
60
+ <?php esc_html_e( 'Support', 'contextual-related-posts' ); ?>
61
+ </a>
62
+ </li>
63
+ <li>
64
+ <a href="https://wordpress.org/support/view/plugin-reviews/contextual-related-posts">
65
+ <?php esc_html_e( 'Reviews', 'contextual-related-posts' ); ?>
66
+ </a>
67
+ </li>
68
+ <li>
69
+ <a href="https://github.com/WebberZone/contextual-related-posts">
70
+ <?php esc_html_e( 'Github repository', 'contextual-related-posts' ); ?>
71
+ </a>
72
+ </li>
73
+ <li>
74
+ <a href="https://webberzone.com/plugins/">
75
+ <?php esc_html_e( 'Other plugins', 'contextual-related-posts' ); ?>
76
+ </a>
77
+ </li>
78
+ <li>
79
+ <a href="https://ajaydsouza.com/">
80
+ <?php esc_html_e( "Ajay's blog", 'contextual-related-posts' ); ?>
81
+ </a>
82
+ </li>
83
+ </ul>
84
+ </div>
85
+ </div>
86
+ <!-- /.inside -->
87
+ </div>
88
+ <!-- /.postbox -->
89
+ </div>
90
+
91
+ <div class="postbox-container">
92
+ <div id="followdiv" class="postbox meta-box-sortables">
93
+ <h2 class='hndle'><span><?php esc_html_e( 'Follow me', 'add-to-all' ); ?></span></h3>
94
+ <div class="inside" style="text-align: center">
95
+ <a href="https://facebook.com/webberzone/" target="_blank"><img src="<?php echo esc_url( CRP_PLUGIN_URL . 'includes/admin/images/fb.png' ); ?>" width="100" height="100" /></a>
96
+ <a href="https://twitter.com/webberzonewp/" target="_blank"><img src="<?php echo esc_url( CRP_PLUGIN_URL . 'includes/admin/images/twitter.jpg' ); ?>" width="100" height="100" /></a>
97
+ </div>
98
+ <!-- /.inside -->
99
+ </div>
100
+ <!-- /.postbox -->
101
+ </div>
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-2018 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -20,9 +20,8 @@ if ( ! defined( 'WPINC' ) ) {
20
  * @since 1.9
21
  */
22
  function crp_content_prepare_filter() {
23
- global $crp_settings;
24
 
25
- $priority = isset( $crp_settings['content_filter_priority'] ) ? $crp_settings['content_filter_priority'] : 10;
26
 
27
  add_filter( 'the_content', 'crp_content_filter', $priority );
28
  }
@@ -39,7 +38,7 @@ add_action( 'template_redirect', 'crp_content_prepare_filter' );
39
  */
40
  function crp_content_filter( $content ) {
41
 
42
- global $post, $crp_settings;
43
 
44
  // Return if it's not in the loop or in the main query.
45
  if ( ! in_the_loop() && ! is_main_query() ) {
@@ -47,27 +46,27 @@ function crp_content_filter( $content ) {
47
  }
48
 
49
  // Return if this is a mobile device and disable on mobile option is enabled.
50
- if ( wp_is_mobile() && $crp_settings['disable_on_mobile'] ) {
51
  return $content;
52
  }
53
 
54
  // Return if this is an amp page and disable on amp option is enabled.
55
- if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() && $crp_settings['disable_on_amp'] ) {
56
  return $content;
57
  }
58
 
59
  // If this post ID is in the DO NOT DISPLAY list.
60
- $exclude_on_post_ids = explode( ',', $crp_settings['exclude_on_post_ids'] );
61
- if ( in_array( $post->ID, $exclude_on_post_ids ) ) {
62
  return $content; // Exit without adding related posts.
63
  }
64
 
65
  // If this post type is in the DO NOT DISPLAY list.
66
  // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
67
- if ( ! empty( $crp_settings['exclude_on_post_types'] ) && false === strpos( $crp_settings['exclude_on_post_types'], '=' ) ) {
68
- $exclude_on_post_types = explode( ',', $crp_settings['exclude_on_post_types'] );
69
  } else {
70
- parse_str( $crp_settings['exclude_on_post_types'], $exclude_on_post_types ); // Save post types in $exclude_on_post_types variable.
71
  }
72
 
73
  if ( in_array( $post->post_type, $exclude_on_post_types, true ) ) {
@@ -86,13 +85,15 @@ function crp_content_filter( $content ) {
86
  return $content;
87
  }
88
 
 
 
89
  // Else add the content.
90
- if ( ( ( is_single() ) && ( $crp_settings['add_to_content'] ) ) ||
91
- ( ( is_page() ) && ( $crp_settings['add_to_page'] ) ) ||
92
- ( ( is_home() ) && ( $crp_settings['add_to_home'] ) ) ||
93
- ( ( is_category() ) && ( $crp_settings['add_to_category_archives'] ) ) ||
94
- ( ( is_tag() ) && ( $crp_settings['add_to_tag_archives'] ) ) ||
95
- ( ( ( is_tax() ) || ( is_author() ) || ( is_date() ) ) && ( $crp_settings['add_to_archives'] ) ) ) {
96
 
97
  $crp_code = get_crp( 'is_widget=0' );
98
 
@@ -114,14 +115,15 @@ function crp_content_filter( $content ) {
114
  * @return string After the filter has been processed
115
  */
116
  function crp_generate_content( $content, $crp_code ) {
117
- global $crp_settings;
118
 
119
- if ( -1 === (int) $crp_settings['insert_after_paragraph'] || ! is_numeric( $crp_settings['insert_after_paragraph'] ) ) {
 
 
120
  return $content . $crp_code;
121
- } elseif ( 0 === (int) $crp_settings['insert_after_paragraph'] ) {
122
  return $crp_code . $content;
123
  } else {
124
- return crp_insert_after_paragraph( $content, $crp_code, $crp_settings['insert_after_paragraph'] );
125
  }
126
 
127
  }
@@ -167,13 +169,14 @@ function crp_insert_after_paragraph( $content, $crp_code, $paragraph_id ) {
167
  * @return string Formatted content
168
  */
169
  function crp_rss_filter( $content ) {
170
- global $crp_settings;
171
 
172
- $limit_feed = $crp_settings['limit_feed'];
173
- $show_excerpt_feed = $crp_settings['show_excerpt_feed'];
174
- $post_thumb_op_feed = $crp_settings['post_thumb_op_feed'];
175
 
176
- if ( $crp_settings['add_to_feed'] ) {
 
 
 
 
177
  $output = $content;
178
  $output .= get_crp( 'is_widget=0&limit=' . $limit_feed . '&show_excerpt=' . $show_excerpt_feed . '&post_thumb_op=' . $post_thumb_op_feed );
179
  return $output;
@@ -201,7 +204,6 @@ function echo_crp( $args = array() ) {
201
  // Parse incomming $args into an array and merge it with $defaults.
202
  $args = wp_parse_args( $args, $defaults );
203
 
204
- echo get_crp( $args ); // WPCS: XSS ok.
205
  }
206
 
207
-
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.
20
  * @since 1.9
21
  */
22
  function crp_content_prepare_filter() {
 
23
 
24
+ $priority = crp_get_option( 'content_filter_priority' );
25
 
26
  add_filter( 'the_content', 'crp_content_filter', $priority );
27
  }
38
  */
39
  function crp_content_filter( $content ) {
40
 
41
+ global $post;
42
 
43
  // Return if it's not in the loop or in the main query.
44
  if ( ! in_the_loop() && ! is_main_query() ) {
46
  }
47
 
48
  // Return if this is a mobile device and disable on mobile option is enabled.
49
+ if ( wp_is_mobile() && crp_get_option( 'disable_on_mobile' ) ) {
50
  return $content;
51
  }
52
 
53
  // Return if this is an amp page and disable on amp option is enabled.
54
+ if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() && crp_get_option( 'disable_on_amp' ) ) {
55
  return $content;
56
  }
57
 
58
  // If this post ID is in the DO NOT DISPLAY list.
59
+ $exclude_on_post_ids = explode( ',', crp_get_option( 'exclude_on_post_ids' ) );
60
+ if ( in_array( $post->ID, $exclude_on_post_ids ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
61
  return $content; // Exit without adding related posts.
62
  }
63
 
64
  // If this post type is in the DO NOT DISPLAY list.
65
  // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
66
+ if ( ! empty( crp_get_option( 'exclude_on_post_types' ) ) && false === strpos( crp_get_option( 'exclude_on_post_types' ), '=' ) ) {
67
+ $exclude_on_post_types = explode( ',', crp_get_option( 'exclude_on_post_types' ) );
68
  } else {
69
+ parse_str( crp_get_option( 'exclude_on_post_types' ), $exclude_on_post_types ); // Save post types in $exclude_on_post_types variable.
70
  }
71
 
72
  if ( in_array( $post->post_type, $exclude_on_post_types, true ) ) {
85
  return $content;
86
  }
87
 
88
+ $add_to = crp_get_option( 'add_to', false );
89
+
90
  // Else add the content.
91
+ if ( ( ( is_single() ) && ! empty( $add_to['single'] ) ) ||
92
+ ( ( is_page() ) && ! empty( $add_to['page'] ) ) ||
93
+ ( ( is_home() ) && ! empty( $add_to['home'] ) ) ||
94
+ ( ( is_category() ) && ! empty( $add_to['category_archives'] ) ) ||
95
+ ( ( is_tag() ) && ! empty( $add_to['tag_archives'] ) ) ||
96
+ ( ( ( is_tax() ) || ( is_author() ) || ( is_date() ) ) && ! empty( $add_to['other_archives'] ) ) ) {
97
 
98
  $crp_code = get_crp( 'is_widget=0' );
99
 
115
  * @return string After the filter has been processed
116
  */
117
  function crp_generate_content( $content, $crp_code ) {
 
118
 
119
+ $insert_after_paragraph = crp_get_option( 'insert_after_paragraph' );
120
+
121
+ if ( -1 === (int) $insert_after_paragraph || ! is_numeric( $insert_after_paragraph ) ) {
122
  return $content . $crp_code;
123
+ } elseif ( 0 === (int) $insert_after_paragraph ) {
124
  return $crp_code . $content;
125
  } else {
126
+ return crp_insert_after_paragraph( $content, $crp_code, $insert_after_paragraph );
127
  }
128
 
129
  }
169
  * @return string Formatted content
170
  */
171
  function crp_rss_filter( $content ) {
 
172
 
173
+ $add_to = crp_get_option( 'add_to', false );
 
 
174
 
175
+ $limit_feed = crp_get_option( 'limit_feed' );
176
+ $show_excerpt_feed = crp_get_option( 'show_excerpt_feed' );
177
+ $post_thumb_op_feed = crp_get_option( 'post_thumb_op_feed' );
178
+
179
+ if ( $add_to['feed'] ) {
180
  $output = $content;
181
  $output .= get_crp( 'is_widget=0&limit=' . $limit_feed . '&show_excerpt=' . $show_excerpt_feed . '&post_thumb_op=' . $post_thumb_op_feed );
182
  return $output;
204
  // Parse incomming $args into an array and merge it with $defaults.
205
  $args = wp_parse_args( $args, $defaults );
206
 
207
+ echo get_crp( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
208
  }
209
 
 
includes/deprecated.php CHANGED
@@ -7,6 +7,11 @@
7
  * @package Contextual_Related_Posts
8
  */
9
 
 
 
 
 
 
10
  /**
11
  * Holds the URL for CRP
12
  *
@@ -73,6 +78,7 @@ function ald_crp( $args = array() ) {
73
  * Filter the output
74
  *
75
  * @since 1.9.1
 
76
  *
77
  * @param string $output Formatted list of related posts
78
  * @param array $args Complete set of arguments
@@ -153,6 +159,7 @@ function crp_max_formatted_content( $content, $no_of_char = -1 ) {
153
  * Filters formatted content after cropping.
154
  *
155
  * @since 1.9
 
156
  *
157
  * @param string $content Formatted content
158
  * @param int $no_of_char Maximum length of excerpt in characters
@@ -160,3 +167,143 @@ function crp_max_formatted_content( $content, $no_of_char = -1 ) {
160
  return apply_filters( 'crp_max_formatted_content', $content, $no_of_char );
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  * @package Contextual_Related_Posts
8
  */
9
 
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
  /**
16
  * Holds the URL for CRP
17
  *
78
  * Filter the output
79
  *
80
  * @since 1.9.1
81
+ * @deprecated 2.2.0
82
  *
83
  * @param string $output Formatted list of related posts
84
  * @param array $args Complete set of arguments
159
  * Filters formatted content after cropping.
160
  *
161
  * @since 1.9
162
+ * @deprecated 2.4.0
163
  *
164
  * @param string $content Formatted content
165
  * @param int $no_of_char Maximum length of excerpt in characters
167
  return apply_filters( 'crp_max_formatted_content', $content, $no_of_char );
168
  }
169
 
170
+
171
+ /**
172
+ * Default options.
173
+ *
174
+ * @since 1.0.1
175
+ * @deprecated 2.6.0
176
+ *
177
+ * @return array Default options
178
+ */
179
+ function crp_default_options() {
180
+
181
+ _deprecated_function( __FUNCTION__, '2.6.0' );
182
+
183
+ $title = __( '<h3>Related Posts:</h3>', 'contextual-related-posts' );
184
+
185
+ $blank_output_text = __( 'No related posts found', 'contextual-related-posts' );
186
+
187
+ $thumb_default = plugins_url( 'default.png', __FILE__ );
188
+
189
+ $crp_settings = array(
190
+ // General options.
191
+ 'cache' => false, // Cache output for faster page load.
192
+
193
+ 'add_to_content' => true, // Add related posts to content (only on single posts).
194
+ 'add_to_page' => true, // Add related posts to content (only on single pages).
195
+ 'add_to_feed' => false, // Add related posts to feed (full).
196
+ 'add_to_home' => false, // Add related posts to home page.
197
+ 'add_to_category_archives' => false, // Add related posts to category archives.
198
+ 'add_to_tag_archives' => false, // Add related posts to tag archives.
199
+ 'add_to_archives' => false, // Add related posts to other archives.
200
+
201
+ 'content_filter_priority' => 10, // Content priority.
202
+ 'insert_after_paragraph' => -1, // Insert after paragraph number.
203
+ 'disable_on_mobile' => false, // Disable on mobile.
204
+ 'disable_on_amp' => false, // Disable on AMP.
205
+ 'show_metabox' => true, // Show metabox to admins.
206
+ 'show_metabox_admins' => false, // Limit to admins as well.
207
+
208
+ 'show_credit' => false, // Link to this plugin's page?
209
+
210
+ // List tuning options.
211
+ 'limit' => '6', // How many posts to display?
212
+ 'daily_range' => '1095', // How old posts should be displayed?
213
+ 'random_order' => false, // Randomise posts.
214
+
215
+ 'match_content' => true, // Match against post content as well as title.
216
+ 'match_content_words' => '0', // How many characters of content should be matched? 0 for all chars.
217
+
218
+ 'post_types' => 'post,page', // WordPress custom post types.
219
+ 'same_post_type' => false, // Limit to the same post type.
220
+
221
+ 'exclude_categories' => '', // Exclude these categories.
222
+ 'exclude_cat_slugs' => '', // Exclude these categories (slugs).
223
+ 'exclude_post_ids' => '', // Comma separated list of page / post IDs that are to be excluded in the results.
224
+
225
+ // Output options.
226
+ 'title' => $title, // Add before the content.
227
+ 'blank_output' => true, // Blank output?
228
+ 'blank_output_text' => $blank_output_text, // Blank output text.
229
+
230
+ 'show_excerpt' => false, // Show post excerpt in list item.
231
+ 'show_date' => false, // Show date in list item.
232
+ 'show_author' => false, // Show author in list item.
233
+ 'excerpt_length' => '10', // Length of characters.
234
+ 'title_length' => '60', // Limit length of post title.
235
+
236
+ 'link_new_window' => false, // Open link in new window.
237
+ 'link_nofollow' => false, // Includes rel nofollow to links.
238
+
239
+ 'before_list' => '<ul>', // Before the entire list.
240
+ 'after_list' => '</ul>', // After the entire list.
241
+ 'before_list_item' => '<li>', // Before each list item.
242
+ 'after_list_item' => '</li>', // After each list item.
243
+
244
+ 'exclude_on_post_ids' => '', // Comma separate list of page/post IDs to not display related posts on.
245
+ 'exclude_on_post_types' => '', // WordPress custom post types.
246
+
247
+ // Thumbnail options.
248
+ 'post_thumb_op' => 'inline', // Default option to display text and no thumbnails in posts.
249
+ 'thumb_size' => 'thumbnail', // Default thumbnail size.
250
+ 'thumb_height' => '150', // Height of thumbnails.
251
+ 'thumb_width' => '150', // Width of thumbnails.
252
+ 'thumb_crop' => true, // Crop mode. default is hard crop.
253
+ 'thumb_create_sizes' => true, // Create thumbnail sizes.
254
+ 'thumb_html' => 'html', // Use HTML or CSS for width and height of the thumbnail?
255
+ 'thumb_meta' => 'post-image', // Meta field that is used to store the location of default thumbnail image.
256
+ 'scan_images' => true, // Scan post for images.
257
+ 'thumb_default' => $thumb_default, // Default thumbnail image.
258
+ 'thumb_default_show' => true, // Show default thumb if none found (if false, don't show thumb at all).
259
+
260
+ // Feed options.
261
+ 'limit_feed' => '5', // How many posts to display in feeds.
262
+ 'post_thumb_op_feed' => 'text_only', // Default option to display text and no thumbnails in Feeds.
263
+ 'thumb_height_feed' => '50', // Height of thumbnails in feed.
264
+ 'thumb_width_feed' => '50', // Width of thumbnails in feed.
265
+ 'show_excerpt_feed' => false, // Show description in list item in feed.
266
+
267
+ // Custom styles.
268
+ 'custom_CSS' => '', // Custom CSS to style the output.
269
+ 'include_default_style' => true, // Include default style - Will be DEPRECATED in the next version.
270
+ 'crp_styles' => 'rounded_thumbs', // Defaault style is rounded thubnails.
271
+ );
272
+
273
+ /**
274
+ * Filters the default options array.
275
+ *
276
+ * @since 1.9.1
277
+ * @deprecated 2.6.0
278
+ *
279
+ * @param array $crp_settings Default options.
280
+ */
281
+ return apply_filters( 'crp_default_options', $crp_settings );
282
+ }
283
+
284
+
285
+ /**
286
+ * Function to read options from the database.
287
+ *
288
+ * @since 1.0.1
289
+ * @deprecated 2.6.0
290
+ *
291
+ * @return array Contextual Related Posts options
292
+ */
293
+ function crp_read_options() {
294
+
295
+ _deprecated_function( __FUNCTION__, '2.6.0', 'crp_get_settings()' );
296
+
297
+ $crp_settings = crp_get_settings();
298
+
299
+ /**
300
+ * Filters the options array.
301
+ *
302
+ * @since 1.9.1
303
+ * @deprecated 2.6.0
304
+ *
305
+ * @param array $crp_settings Options read from the database
306
+ */
307
+ return apply_filters( 'crp_read_options', $crp_settings );
308
+ }
309
+
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-2018 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -20,26 +20,26 @@ if ( ! defined( 'WPINC' ) ) {
20
  * @since 1.8.4
21
  */
22
  function crp_header() {
23
- global $crp_settings;
24
 
25
- $custom_css = stripslashes( $crp_settings['custom_CSS'] );
 
26
 
27
  // Add CSS to header.
28
- if ( '' != $custom_css ) {
29
- if ( ( is_single() ) ) {
30
- echo '<style type="text/css">' . $custom_css . '</style>'; // WPCS: XSS ok.
31
- } elseif ( ( is_page() ) ) {
32
- echo '<style type="text/css">' . $custom_css . '</style>'; // WPCS: XSS ok.
33
- } elseif ( ( is_home() ) && ( $crp_settings['add_to_home'] ) ) {
34
- echo '<style type="text/css">' . $custom_css . '</style>'; // WPCS: XSS ok.
35
- } elseif ( ( is_category() ) && ( $crp_settings['add_to_category_archives'] ) ) {
36
- echo '<style type="text/css">' . $custom_css . '</style>'; // WPCS: XSS ok.
37
- } elseif ( ( is_tag() ) && ( $crp_settings['add_to_tag_archives'] ) ) {
38
- echo '<style type="text/css">' . $custom_css . '</style>'; // WPCS: XSS ok.
39
- } elseif ( ( ( is_tax() ) || ( is_author() ) || ( is_date() ) ) && ( $crp_settings['add_to_archives'] ) ) {
40
- echo '<style type="text/css">' . $custom_css . '</style>'; // WPCS: XSS ok.
41
  } elseif ( is_active_widget( false, false, 'CRP_Widget', true ) ) {
42
- echo '<style type="text/css">' . $custom_css . '</style>'; // WPCS: XSS ok.
43
  }
44
  }
45
  }
@@ -52,20 +52,22 @@ add_action( 'wp_head', 'crp_header' );
52
  * @since 1.9
53
  */
54
  function crp_heading_styles() {
55
- global $crp_settings;
56
 
57
- if ( 'rounded_thumbs' === $crp_settings['crp_styles'] ) {
 
 
 
58
  wp_register_style( 'crp-style-rounded-thumbs', plugins_url( 'css/default-style.css', CRP_PLUGIN_FILE ), array(), '1.0' );
59
  wp_enqueue_style( 'crp-style-rounded-thumbs' );
60
 
61
  $custom_css = "
62
  .crp_related a {
63
- width: {$crp_settings['thumb_width']}px;
64
- height: {$crp_settings['thumb_height']}px;
65
  text-decoration: none;
66
  }
67
  .crp_related img {
68
- max-width: {$crp_settings['thumb_width']}px;
69
  margin: auto;
70
  }
71
  .crp_related .crp_title {
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.
20
  * @since 1.8.4
21
  */
22
  function crp_header() {
 
23
 
24
+ $add_to = crp_get_option( 'add_to', false );
25
+ $custom_css = stripslashes( crp_get_option( 'custom_CSS' ) );
26
 
27
  // Add CSS to header.
28
+ if ( '' != $custom_css ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
29
+ if ( ( is_single() ) && ! empty( $add_to['single'] ) ) {
30
+ echo '<style type="text/css">' . $custom_css . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
31
+ } elseif ( ( is_page() ) && ! empty( $add_to['page'] ) ) {
32
+ echo '<style type="text/css">' . $custom_css . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
33
+ } elseif ( ( is_home() ) && ! empty( $add_to['home'] ) ) {
34
+ echo '<style type="text/css">' . $custom_css . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
35
+ } elseif ( ( is_category() ) && ! empty( $add_to['category_archives'] ) ) {
36
+ echo '<style type="text/css">' . $custom_css . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
37
+ } elseif ( ( is_tag() ) && ! empty( $add_to['tag_archives'] ) ) {
38
+ echo '<style type="text/css">' . $custom_css . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
39
+ } elseif ( ( ( is_tax() ) || ( is_author() ) || ( is_date() ) ) && ! empty( $add_to['other_archives'] ) ) {
40
+ echo '<style type="text/css">' . $custom_css . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
41
  } elseif ( is_active_widget( false, false, 'CRP_Widget', true ) ) {
42
+ echo '<style type="text/css">' . $custom_css . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
43
  }
44
  }
45
  }
52
  * @since 1.9
53
  */
54
  function crp_heading_styles() {
 
55
 
56
+ $thumb_width = crp_get_option( 'thumb_width' );
57
+ $thumb_height = crp_get_option( 'thumb_height' );
58
+
59
+ if ( 'rounded_thumbs' === crp_get_option( 'crp_styles' ) ) {
60
  wp_register_style( 'crp-style-rounded-thumbs', plugins_url( 'css/default-style.css', CRP_PLUGIN_FILE ), array(), '1.0' );
61
  wp_enqueue_style( 'crp-style-rounded-thumbs' );
62
 
63
  $custom_css = "
64
  .crp_related a {
65
+ width: {$thumb_width}px;
66
+ height: {$thumb_height}px;
67
  text-decoration: none;
68
  }
69
  .crp_related img {
70
+ max-width: {$thumb_width}px;
71
  margin: auto;
72
  }
73
  .crp_related .crp_title {
includes/i10n.php CHANGED
@@ -5,6 +5,11 @@
5
  * @package Contextual_Related_Posts
6
  */
7
 
 
 
 
 
 
8
  /**
9
  * Initialises text domain for l10n.
10
  *
5
  * @package Contextual_Related_Posts
6
  */
7
 
8
+ // If this file is called directly, abort.
9
+ if ( ! defined( 'WPINC' ) ) {
10
+ die;
11
+ }
12
+
13
  /**
14
  * Initialises text domain for l10n.
15
  *
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-2018 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -26,7 +26,7 @@ function get_crp( $args = array() ) {
26
  global $post, $crp_settings;
27
 
28
  // If set, save $exclude_categories.
29
- if ( isset( $args['exclude_categories'] ) && '' != $args['exclude_categories'] ) {
30
  $exclude_categories = explode( ',', $args['exclude_categories'] );
31
  $args['strict_limit'] = false;
32
  }
@@ -127,7 +127,7 @@ function get_crp( $args = array() ) {
127
  $resultid = crp_object_id_cur_lang( $result->ID );
128
 
129
  // If this is NULL or already processed ID or matches current post then skip processing this loop.
130
- if ( ! $resultid || in_array( $resultid, $processed_results ) || intval( $resultid ) === intval( $post->ID ) ) {
131
  continue;
132
  }
133
 
@@ -382,7 +382,7 @@ function get_crp_posts_id( $args = array() ) {
382
  $fields = " $wpdb->posts.ID ";
383
 
384
  // Create the base MATCH clause.
385
- $match = $wpdb->prepare( ' AND MATCH (' . $match_fields . ') AGAINST (%s) ', $stuff ); // WPCS: unprepared SQL ok.
386
 
387
  /**
388
  * Filter the MATCH clause of the query.
@@ -443,7 +443,7 @@ function get_crp_posts_id( $args = array() ) {
443
  // Convert it back to string.
444
  $exclude_post_ids = implode( ',', array_filter( $exclude_post_ids ) );
445
 
446
- if ( '' != $exclude_post_ids ) {
447
  $where .= " AND $wpdb->posts.ID NOT IN ({$exclude_post_ids}) ";
448
  }
449
 
@@ -536,7 +536,7 @@ function get_crp_posts_id( $args = array() ) {
536
 
537
  $sql = "SELECT DISTINCT $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $having $orderby $limits";
538
 
539
- $results = $wpdb->get_results( $sql ); // WPCS: unprepared SQL ok.
540
 
541
  if ( $args['random_order'] ) {
542
  $results_array = (array) $results;
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.
26
  global $post, $crp_settings;
27
 
28
  // If set, save $exclude_categories.
29
+ if ( isset( $args['exclude_categories'] ) && '' != $args['exclude_categories'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
30
  $exclude_categories = explode( ',', $args['exclude_categories'] );
31
  $args['strict_limit'] = false;
32
  }
127
  $resultid = crp_object_id_cur_lang( $result->ID );
128
 
129
  // If this is NULL or already processed ID or matches current post then skip processing this loop.
130
+ if ( ! $resultid || in_array( $resultid, $processed_results ) || intval( $resultid ) === intval( $post->ID ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
131
  continue;
132
  }
133
 
382
  $fields = " $wpdb->posts.ID ";
383
 
384
  // Create the base MATCH clause.
385
+ $match = $wpdb->prepare( ' AND MATCH (' . $match_fields . ') AGAINST (%s) ', $stuff ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
386
 
387
  /**
388
  * Filter the MATCH clause of the query.
443
  // Convert it back to string.
444
  $exclude_post_ids = implode( ',', array_filter( $exclude_post_ids ) );
445
 
446
+ if ( '' != $exclude_post_ids ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
447
  $where .= " AND $wpdb->posts.ID NOT IN ({$exclude_post_ids}) ";
448
  }
449
 
536
 
537
  $sql = "SELECT DISTINCT $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $having $orderby $limits";
538
 
539
+ $results = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
540
 
541
  if ( $args['random_order'] ) {
542
  $results_array = (array) $results;
includes/media.php CHANGED
@@ -6,26 +6,32 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2018 Ajay D'Souza
10
  */
11
 
 
 
 
 
 
12
  /**
13
  * Add custom image size of thumbnail. Filters `init`.
14
  *
15
  * @since 2.0.0
16
  */
17
  function crp_add_image_sizes() {
18
- global $crp_settings;
19
 
20
- if ( ! in_array( $crp_settings['thumb_size'], get_intermediate_image_sizes(), true ) ) {
21
- $crp_settings['thumb_size'] = 'crp_thumbnail';
 
 
22
  }
23
 
24
  // Add image sizes if 'crp_thumbnail' is selected or the selected thumbnail size is no longer valid.
25
- if ( 'crp_thumbnail' === $crp_settings['thumb_size'] && $crp_settings['thumb_create_sizes'] ) {
26
- $width = empty( $crp_settings['thumb_width'] ) ? 150 : $crp_settings['thumb_width'];
27
- $height = empty( $crp_settings['thumb_height'] ) ? 150 : $crp_settings['thumb_height'];
28
- $crop = isset( $crp_settings['thumb_crop'] ) ? $crp_settings['thumb_crop'] : true;
29
 
30
  add_image_size( 'crp_thumbnail', $width, $height, $crop );
31
  }
@@ -43,8 +49,6 @@ add_action( 'init', 'crp_add_image_sizes' );
43
  */
44
  function crp_get_the_post_thumbnail( $args = array() ) {
45
 
46
- global $crp_settings;
47
-
48
  $defaults = array(
49
  'postid' => '',
50
  'thumb_height' => '150', // Max height of thumbnails.
@@ -93,12 +97,21 @@ function crp_get_the_post_thumbnail( $args = array() ) {
93
  if ( ! $postimage ) {
94
  $postimage = get_post_meta( $result->ID, $args['thumb_meta'], true );
95
  $pick = 'meta';
 
 
 
 
 
 
 
 
 
96
  }
97
 
98
  // If there is no thumbnail found, check the post thumbnail.
99
  if ( ! $postimage ) {
100
  if ( false !== get_post_thumbnail_id( $result->ID ) ) {
101
- $postthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $result->ID ), $crp_settings['thumb_size'] );
102
  $postimage = $postthumb[0];
103
  }
104
  $pick = 'featured';
@@ -127,8 +140,8 @@ function crp_get_the_post_thumbnail( $args = array() ) {
127
  if ( $postimage ) {
128
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
129
 
130
- if ( false !== wp_get_attachment_image_src( $postimage_id, $crp_settings['thumb_size'] ) ) {
131
- $postthumb = wp_get_attachment_image_src( $postimage_id, $crp_settings['thumb_size'] );
132
  $postimage = $postthumb[0];
133
  }
134
  $pick = 'correct';
@@ -138,7 +151,7 @@ function crp_get_the_post_thumbnail( $args = array() ) {
138
 
139
  // If there is no thumbnail found, fetch the first child image.
140
  if ( ! $postimage ) {
141
- $postimage = crp_get_first_image( $result->ID );
142
  $pick = 'firstchild';
143
  }
144
 
@@ -268,12 +281,14 @@ function crp_get_the_post_thumbnail( $args = array() ) {
268
  * Get the first child image in the post.
269
  *
270
  * @since 1.8.9
 
271
  *
272
- * @param mixed $post_id Post ID.
 
 
273
  * @return string
274
  */
275
- function crp_get_first_image( $post_id ) {
276
- global $crp_settings;
277
 
278
  $args = array(
279
  'numberposts' => 1,
@@ -288,17 +303,19 @@ function crp_get_first_image( $post_id ) {
288
 
289
  if ( $attachments ) {
290
  foreach ( $attachments as $attachment ) {
291
- $image_attributes = wp_get_attachment_image_src( $attachment->ID, $crp_settings['thumb_size'] ) ? wp_get_attachment_image_src( $attachment->ID, $crp_settings['thumb_size'] ) : wp_get_attachment_image_src( $attachment->ID, 'full' );
292
 
293
  /**
294
  * Filters first child image from the post.
295
  *
296
- * @since 2.0.0
297
  *
298
- * @param array $image_attributes[0] URL of the image
299
- * @param int $post_id Post ID
 
 
300
  */
301
- return apply_filters( 'crp_get_first_image', $image_attributes[0], $post_id );
302
  }
303
  } else {
304
  return false;
@@ -337,7 +354,7 @@ function crp_get_attachment_id_from_url( $attachment_url = '' ) {
337
  $attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url );
338
 
339
  // Finally, run a custom database query to get the attachment ID from the modified attachment URL.
340
- $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = %s AND wposts.post_type = 'attachment'", $attachment_url ) );
341
 
342
  }
343
 
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.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
  /**
18
  * Add custom image size of thumbnail. Filters `init`.
19
  *
20
  * @since 2.0.0
21
  */
22
  function crp_add_image_sizes() {
 
23
 
24
+ $thumb_size = crp_get_option( 'thumb_size' );
25
+
26
+ if ( ! in_array( $thumb_size, get_intermediate_image_sizes() ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
27
+ $thumb_size = 'crp_thumbnail';
28
  }
29
 
30
  // Add image sizes if 'crp_thumbnail' is selected or the selected thumbnail size is no longer valid.
31
+ if ( 'crp_thumbnail' === $thumb_size && crp_get_option( 'thumb_create_sizes' ) ) {
32
+ $width = crp_get_option( 'thumb_width', 150 );
33
+ $height = crp_get_option( 'thumb_height', 150 );
34
+ $crop = crp_get_option( 'thumb_crop', true );
35
 
36
  add_image_size( 'crp_thumbnail', $width, $height, $crop );
37
  }
49
  */
50
  function crp_get_the_post_thumbnail( $args = array() ) {
51
 
 
 
52
  $defaults = array(
53
  'postid' => '',
54
  'thumb_height' => '150', // Max height of thumbnails.
97
  if ( ! $postimage ) {
98
  $postimage = get_post_meta( $result->ID, $args['thumb_meta'], true );
99
  $pick = 'meta';
100
+ if ( $postimage ) {
101
+ $postimage_id = crp_get_attachment_id_from_url( $postimage );
102
+
103
+ if ( false != wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
104
+ $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
105
+ $postimage = $postthumb[0];
106
+ }
107
+ $pick .= 'correct';
108
+ }
109
  }
110
 
111
  // If there is no thumbnail found, check the post thumbnail.
112
  if ( ! $postimage ) {
113
  if ( false !== get_post_thumbnail_id( $result->ID ) ) {
114
+ $postthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $result->ID ), array( $args['thumb_width'], $args['thumb_height'] ) );
115
  $postimage = $postthumb[0];
116
  }
117
  $pick = 'featured';
140
  if ( $postimage ) {
141
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
142
 
143
+ if ( false !== wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) {
144
+ $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
145
  $postimage = $postthumb[0];
146
  }
147
  $pick = 'correct';
151
 
152
  // If there is no thumbnail found, fetch the first child image.
153
  if ( ! $postimage ) {
154
+ $postimage = crp_get_first_image( $result->ID, $args['thumb_width'], $args['thumb_height'] );
155
  $pick = 'firstchild';
156
  }
157
 
281
  * Get the first child image in the post.
282
  *
283
  * @since 1.8.9
284
+ * @since 2.6.0 Added $thumb_width, $thumb_height
285
  *
286
+ * @param mixed $post_id Post ID.
287
+ * @param int $thumb_width Thumb width.
288
+ * @param int $thumb_height Thumb height.
289
  * @return string
290
  */
291
+ function crp_get_first_image( $post_id, $thumb_width, $thumb_height ) {
 
292
 
293
  $args = array(
294
  'numberposts' => 1,
303
 
304
  if ( $attachments ) {
305
  foreach ( $attachments as $attachment ) {
306
+ $image_attributes = wp_get_attachment_image_src( $attachment->ID, array( $thumb_width, $thumb_height ) ) ? wp_get_attachment_image_src( $attachment->ID, array( $thumb_width, $thumb_height ) ) : wp_get_attachment_image_src( $attachment->ID, 'full' );
307
 
308
  /**
309
  * Filters first child image from the post.
310
  *
311
+ * @since 2.0.0
312
  *
313
+ * @param array $image_attributes[0] URL of the image
314
+ * @param int $post_id Post ID
315
+ * @param int $thumb_width Thumb width
316
+ * @param int $thumb_height Thumb height
317
  */
318
+ return apply_filters( 'crp_get_first_image', $image_attributes[0], $post_id, $thumb_width, $thumb_height );
319
  }
320
  } else {
321
  return false;
354
  $attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url );
355
 
356
  // Finally, run a custom database query to get the attachment ID from the modified attachment URL.
357
+ $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = %s AND wposts.post_type = 'attachment'", $attachment_url ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
358
 
359
  }
360
 
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-2018 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -90,32 +90,17 @@ class CRP_Widget extends WP_Widget {
90
  </p>
91
  <p>
92
  <label for="<?php echo esc_attr( $this->get_field_id( 'show_excerpt' ) ); ?>">
93
- <input id="<?php echo esc_attr( $this->get_field_id( 'show_excerpt' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_excerpt' ) ); ?>" type="checkbox"
94
- <?php
95
- if ( $show_excerpt ) {
96
- echo 'checked="checked"'; }
97
- ?>
98
- /> <?php esc_html_e( ' Show excerpt?', 'contextual-related-posts' ); ?>
99
  </label>
100
  </p>
101
  <p>
102
  <label for="<?php echo esc_attr( $this->get_field_id( 'show_author' ) ); ?>">
103
- <input id="<?php echo esc_attr( $this->get_field_id( 'show_author' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_author' ) ); ?>" type="checkbox"
104
- <?php
105
- if ( $show_author ) {
106
- echo 'checked="checked"'; }
107
- ?>
108
- /> <?php esc_html_e( ' Show author?', 'contextual-related-posts' ); ?>
109
  </label>
110
  </p>
111
  <p>
112
  <label for="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>">
113
- <input id="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_date' ) ); ?>" type="checkbox"
114
- <?php
115
- if ( $show_date ) {
116
- echo 'checked="checked"'; }
117
- ?>
118
- /> <?php esc_html_e( ' Show date?', 'contextual-related-posts' ); ?>
119
  </label>
120
  </p>
121
  <p>
@@ -247,7 +232,18 @@ class CRP_Widget extends WP_Widget {
247
 
248
  if ( ( ( is_single() ) && ( ! is_single( $exclude_on_post_ids ) ) ) || ( ( is_page() ) && ( ! is_page( $exclude_on_post_ids ) ) ) ) {
249
 
250
- $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? strip_tags( str_replace( '%postname%', $post->post_title, $crp_settings['title'] ) ) : $instance['title'] );
 
 
 
 
 
 
 
 
 
 
 
251
 
252
  $limit = isset( $instance['limit'] ) ? $instance['limit'] : $crp_settings['limit'];
253
  if ( empty( $limit ) ) {
@@ -256,8 +252,8 @@ class CRP_Widget extends WP_Widget {
256
  $offset = isset( $instance['offset'] ) ? $instance['offset'] : 0;
257
 
258
  $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
259
- $thumb_height = isset( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : $crp_settings['thumb_height'];
260
- $thumb_width = isset( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : $crp_settings['thumb_width'];
261
  $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
262
  $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
263
  $show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
@@ -281,11 +277,12 @@ class CRP_Widget extends WP_Widget {
281
  *
282
  * @since 2.0.0
283
  *
284
- * @param array $arguments Widget options array.
285
- * @param array $args Widget arguments.
286
- * @param array $instance Saved values from database.
 
287
  */
288
- $arguments = apply_filters( 'crp_widget_options', $arguments, $args, $instance );
289
 
290
  $output = $args['before_widget'];
291
  $output .= $args['before_title'] . $title . $args['after_title'];
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.
90
  </p>
91
  <p>
92
  <label for="<?php echo esc_attr( $this->get_field_id( 'show_excerpt' ) ); ?>">
93
+ <input id="<?php echo esc_attr( $this->get_field_id( 'show_excerpt' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_excerpt' ) ); ?>" type="checkbox" <?php checked( true, $show_excerpt, true ); ?> /> <?php esc_html_e( ' Show excerpt?', 'contextual-related-posts' ); ?>
 
 
 
 
 
94
  </label>
95
  </p>
96
  <p>
97
  <label for="<?php echo esc_attr( $this->get_field_id( 'show_author' ) ); ?>">
98
+ <input id="<?php echo esc_attr( $this->get_field_id( 'show_author' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_author' ) ); ?>" type="checkbox" <?php checked( true, $show_author, true ); ?> /> <?php esc_html_e( ' Show author?', 'contextual-related-posts' ); ?>
 
 
 
 
 
99
  </label>
100
  </p>
101
  <p>
102
  <label for="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>">
103
+ <input id="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_date' ) ); ?>" type="checkbox" <?php checked( true, $show_date, true ); ?> /> <?php esc_html_e( ' Show date?', 'contextual-related-posts' ); ?>
 
 
 
 
 
104
  </label>
105
  </p>
106
  <p>
232
 
233
  if ( ( ( is_single() ) && ( ! is_single( $exclude_on_post_ids ) ) ) || ( ( is_page() ) && ( ! is_page( $exclude_on_post_ids ) ) ) ) {
234
 
235
+ $title = empty( $instance['title'] ) ? wp_strip_all_tags( str_replace( '%postname%', $post->post_title, $crp_settings['title'] ) ) : $instance['title'];
236
+
237
+ /**
238
+ * Filters the widget title.
239
+ *
240
+ * @since 2.6.0
241
+ *
242
+ * @param string $title The widget title. Default 'Pages'.
243
+ * @param array $instance Array of settings for the current widget.
244
+ * @param mixed $id_base The widget ID.
245
+ */
246
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
247
 
248
  $limit = isset( $instance['limit'] ) ? $instance['limit'] : $crp_settings['limit'];
249
  if ( empty( $limit ) ) {
252
  $offset = isset( $instance['offset'] ) ? $instance['offset'] : 0;
253
 
254
  $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
255
+ $thumb_height = isset( $instance['thumb_height'] ) && ! empty( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : $crp_settings['thumb_height'];
256
+ $thumb_width = isset( $instance['thumb_width'] ) && ! empty( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : $crp_settings['thumb_width'];
257
  $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
258
  $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
259
  $show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
277
  *
278
  * @since 2.0.0
279
  *
280
+ * @param array $arguments CRP widget options array.
281
+ * @param array $args Widget arguments.
282
+ * @param array $instance Saved values from database.
283
+ * @param mixed $id_base The widget ID.
284
  */
285
+ $arguments = apply_filters( 'crp_widget_options', $arguments, $args, $instance, $this->id_base );
286
 
287
  $output = $args['before_widget'];
288
  $output .= $args['before_title'] . $title . $args['after_title'];
includes/modules/exclusions.php CHANGED
@@ -5,6 +5,11 @@
5
  * @package Contextual_Related_Posts
6
  */
7
 
 
 
 
 
 
8
  /**
9
  * Function to filter exclude post IDs.
10
  *
@@ -18,7 +23,7 @@ function crp_exclude_post_ids( $exclude_post_ids ) {
18
 
19
  $exclude_post_ids = (array) $exclude_post_ids;
20
 
21
- $crp_post_metas = $wpdb->get_results( "SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE `meta_key` = 'crp_post_meta'", ARRAY_A );
22
 
23
  foreach ( $crp_post_metas as $crp_post_meta ) {
24
  $meta_value = maybe_unserialize( $crp_post_meta['meta_value'] );
5
  * @package Contextual_Related_Posts
6
  */
7
 
8
+ // If this file is called directly, abort.
9
+ if ( ! defined( 'WPINC' ) ) {
10
+ die;
11
+ }
12
+
13
  /**
14
  * Function to filter exclude post IDs.
15
  *
23
 
24
  $exclude_post_ids = (array) $exclude_post_ids;
25
 
26
+ $crp_post_metas = $wpdb->get_results( "SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE `meta_key` = 'crp_post_meta'", ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
27
 
28
  foreach ( $crp_post_metas as $crp_post_meta ) {
29
  $meta_value = maybe_unserialize( $crp_post_meta['meta_value'] );
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-2018 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
@@ -28,7 +28,7 @@ function crp_manual_posts( $results ) {
28
 
29
  $crp_post_meta = get_post_meta( $post->ID, 'crp_post_meta', true );
30
 
31
- if ( isset( $crp_post_meta['manual_related'] ) && ( '' != $crp_post_meta['manual_related'] ) ) {
32
 
33
  // Fields to return.
34
  $fields = " $wpdb->posts.ID ";
@@ -43,7 +43,7 @@ function crp_manual_posts( $results ) {
43
  AND {$wpdb->posts}.ID IN ({$crp_post_meta['manual_related']})
44
  ORDER BY FIELD({$wpdb->posts}.ID,{$crp_post_meta['manual_related']})";
45
 
46
- $results1 = $wpdb->get_results( $sql );
47
 
48
  $results = (object) array_merge( (array) $results1, (array) $results );
49
 
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.
28
 
29
  $crp_post_meta = get_post_meta( $post->ID, 'crp_post_meta', true );
30
 
31
+ if ( isset( $crp_post_meta['manual_related'] ) && ( '' != $crp_post_meta['manual_related'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
32
 
33
  // Fields to return.
34
  $fields = " $wpdb->posts.ID ";
43
  AND {$wpdb->posts}.ID IN ({$crp_post_meta['manual_related']})
44
  ORDER BY FIELD({$wpdb->posts}.ID,{$crp_post_meta['manual_related']})";
45
 
46
+ $results1 = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
47
 
48
  $results = (object) array_merge( (array) $results1, (array) $results );
49
 
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-2018 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
@@ -22,9 +22,9 @@ if ( ! defined( 'WPINC' ) ) {
22
  *
23
  * @param array $atts Shortcode attributes.
24
  * @param string $content Post content.
25
- * @return Related Posts
26
  */
27
- function crp_shortcode( $atts, $content = null ) {
28
  global $crp_settings;
29
 
30
  $atts = shortcode_atts(
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.
22
  *
23
  * @param array $atts Shortcode attributes.
24
  * @param string $content Post content.
25
+ * @return string Related Posts
26
  */
27
+ function crp_shortcode( $atts, $content = null ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
28
  global $crp_settings;
29
 
30
  $atts = shortcode_atts(
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-2018 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-2019 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-2018 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-2019 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
includes/plugin-activator.php CHANGED
@@ -6,9 +6,14 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2018 Ajay D'Souza
10
  */
11
 
 
 
 
 
 
12
  /**
13
  * Fired for each blog when the plugin is activated.
14
  *
@@ -25,11 +30,11 @@ function crp_activate( $network_wide ) {
25
  if ( is_multisite() && $network_wide ) {
26
 
27
  // Get all blogs in the network and activate plugin on each one.
28
- $blog_ids = $wpdb->get_col(
29
  "
30
  SELECT blog_id FROM $wpdb->blogs
31
  WHERE archived = '0' AND spam = '0' AND deleted = '0'
32
- "
33
  );
34
  foreach ( $blog_ids as $blog_id ) {
35
  switch_to_blog( $blog_id );
@@ -54,8 +59,6 @@ register_activation_hook( CRP_PLUGIN_FILE, 'crp_activate' );
54
  function crp_single_activate() {
55
  global $wpdb;
56
 
57
- crp_read_options();
58
-
59
  $wpdb->hide_errors();
60
 
61
  crp_create_index();
@@ -85,4 +88,3 @@ function crp_activate_new_site( $blog_id ) {
85
  }
86
  add_action( 'wpmu_new_blog', 'crp_activate_new_site' );
87
 
88
-
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.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
  /**
18
  * Fired for each blog when the plugin is activated.
19
  *
30
  if ( is_multisite() && $network_wide ) {
31
 
32
  // Get all blogs in the network and activate plugin on each one.
33
+ $blog_ids = $wpdb->get_col( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
34
  "
35
  SELECT blog_id FROM $wpdb->blogs
36
  WHERE archived = '0' AND spam = '0' AND deleted = '0'
37
+ "
38
  );
39
  foreach ( $blog_ids as $blog_id ) {
40
  switch_to_blog( $blog_id );
59
  function crp_single_activate() {
60
  global $wpdb;
61
 
 
 
62
  $wpdb->hide_errors();
63
 
64
  crp_create_index();
88
  }
89
  add_action( 'wpmu_new_blog', 'crp_activate_new_site' );
90
 
 
includes/tools.php CHANGED
@@ -6,9 +6,14 @@
6
  * @author Ajay D'Souza
7
  * @license GPL-2.0+
8
  * @link https://webberzone.com
9
- * @copyright 2009-2018 Ajay D'Souza
10
  */
11
 
 
 
 
 
 
12
  /**
13
  * Function to create an excerpt for the post.
14
  *
@@ -120,14 +125,14 @@ function crp_create_index() {
120
 
121
  $wpdb->hide_errors();
122
 
123
- if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related'" ) ) {
124
- $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related (post_title, post_content);" );
125
  }
126
- if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_title'" ) ) {
127
- $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_title (post_title);" );
128
  }
129
- if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_content'" ) ) {
130
- $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_content (post_content);" );
131
  }
132
 
133
  $wpdb->show_errors();
@@ -145,14 +150,14 @@ function crp_delete_index() {
145
 
146
  $wpdb->hide_errors();
147
 
148
- if ( $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related'" ) ) {
149
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related" );
150
  }
151
- if ( $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_title'" ) ) {
152
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title" );
153
  }
154
- if ( $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_content'" ) ) {
155
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_content" );
156
  }
157
 
158
  $wpdb->show_errors();
@@ -168,12 +173,12 @@ function crp_delete_index() {
168
  function crp_posts_table_engine() {
169
  global $wpdb;
170
 
171
- $engine = $wpdb->get_row(
172
  "
173
  SELECT engine FROM INFORMATION_SCHEMA.TABLES
174
  WHERE table_schema=DATABASE()
175
  AND table_name = '{$wpdb->posts}'
176
- "
177
  );
178
 
179
  return $engine;
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.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
  /**
18
  * Function to create an excerpt for the post.
19
  *
125
 
126
  $wpdb->hide_errors();
127
 
128
+ if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
129
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related (post_title, post_content);" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
130
  }
131
+ if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_title'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
132
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_title (post_title);" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
133
  }
134
+ if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_content'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
135
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_content (post_content);" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
136
  }
137
 
138
  $wpdb->show_errors();
150
 
151
  $wpdb->hide_errors();
152
 
153
+ if ( $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
154
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
155
  }
156
+ if ( $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_title'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
157
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
158
  }
159
+ if ( $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_content'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
160
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_content" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
161
  }
162
 
163
  $wpdb->show_errors();
173
  function crp_posts_table_engine() {
174
  global $wpdb;
175
 
176
+ $engine = $wpdb->get_row( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
177
  "
178
  SELECT engine FROM INFORMATION_SCHEMA.TABLES
179
  WHERE table_schema=DATABASE()
180
  AND table_name = '{$wpdb->posts}'
181
+ "
182
  );
183
 
184
  return $engine;
languages/contextual-related-posts-en_US.mo CHANGED
Binary file
languages/contextual-related-posts-en_US.po CHANGED
@@ -2,9 +2,9 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Contextual Related Posts\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2019-01-23 00:17+0000\n"
6
  "PO-Revision-Date: \n"
7
- "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
9
  "Language: en_US\n"
10
  "MIME-Version: 1.0\n"
@@ -18,874 +18,988 @@ msgstr ""
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
- #: admin/admin.php:234
22
- msgid "Options saved successfully. If enabled, the cache has been cleared."
23
  msgstr ""
24
 
25
- #: admin/admin.php:237
26
- msgid ""
27
- "Rounded Thumbnails style selected. Author, Excerpt and Date will not be "
28
- "displayed."
29
  msgstr ""
30
 
31
- #: admin/admin.php:240
32
- msgid "Text Only style selected. Thumbnails will not be displayed."
33
  msgstr ""
34
 
35
- #: admin/admin.php:244
 
 
 
 
 
 
 
 
36
  #, php-format
37
- msgid "Pre-built thumbnail size selected. Thumbnail set to %1$d x %2$d."
 
 
 
38
  msgstr ""
39
 
40
- #: admin/admin.php:279
41
- msgid "Options set to Default."
42
  msgstr ""
43
 
44
- #: admin/admin.php:288
45
- msgid "Index recreated"
 
 
46
  msgstr ""
47
 
48
- #: admin/admin.php:305
49
- msgid "Related Posts"
50
  msgstr ""
51
 
52
- #: admin/cache.php:49
 
53
  msgid ""
54
- "An error occurred clearing the cache. Please contact your site administrator."
55
- "\\n\\nError message:\\n"
56
  msgstr ""
57
 
58
- #: admin/cache.php:58
59
- msgid " cached row(s) cleared"
60
  msgstr ""
61
 
62
- #: admin/loader.php:24
63
- msgid "Settings"
64
  msgstr ""
65
 
66
- #: admin/loader.php:47 admin/sidebar-view.php:48
67
- msgid "Support"
68
  msgstr ""
69
 
70
- #: admin/loader.php:48
71
- msgid "Donate"
72
  msgstr ""
73
 
74
- #: admin/loader.php:49
75
- msgid "Contribute"
76
  msgstr ""
77
 
78
- #: admin/main-view.php:32 admin/main-view.php:55
79
- msgid "General options"
80
  msgstr ""
81
 
82
- #: admin/main-view.php:33 admin/main-view.php:163
83
- msgid "List tuning options"
84
  msgstr ""
85
 
86
- #: admin/main-view.php:34 admin/main-view.php:273
87
- msgid "Output options"
88
  msgstr ""
89
 
90
- #: admin/main-view.php:35 admin/main-view.php:477
91
- #: includes/modules/class-crp-widget.php:122
92
- msgid "Thumbnail options"
 
 
93
  msgstr ""
94
 
95
- #: admin/main-view.php:36 admin/main-view.php:658
96
- msgid "Styles"
97
  msgstr ""
98
 
99
- #: admin/main-view.php:37 admin/main-view.php:750
100
- msgid "Feed options"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  msgstr ""
102
 
103
- #: admin/main-view.php:54 admin/main-view.php:162 admin/main-view.php:272
104
- #: admin/main-view.php:476 admin/main-view.php:657 admin/main-view.php:749
105
- #: admin/sidebar-view.php:19 admin/sidebar-view.php:40
106
- #: admin/sidebar-view.php:58
107
- msgid "Click to toggle"
108
  msgstr ""
109
 
110
- #: admin/main-view.php:71
111
- msgid "Cache output?"
112
  msgstr ""
113
 
114
- #: admin/main-view.php:73
115
  msgid ""
116
- "Enabling this option will cache the related posts output when the post is "
117
- "visited the first time. The cache is cleaned when you save this page."
 
 
 
 
118
  msgstr ""
119
 
120
- #: admin/main-view.php:74
121
  msgid ""
122
- "The CRP cache works independently and in addition to any of your caching "
123
- "plugins like WP Super Cache or W3 Total Cache. It is recommended that you "
124
- "enable this on your blog."
125
  msgstr ""
126
 
127
- #: admin/main-view.php:75
128
- msgid "Clear cache"
 
 
 
 
 
 
 
129
  msgstr ""
130
 
131
- #: admin/main-view.php:79
132
- msgid "Automatically add related posts to:"
133
  msgstr ""
134
 
135
- #: admin/main-view.php:81
136
- msgid "Posts"
 
 
137
  msgstr ""
138
 
139
- #: admin/main-view.php:82
140
- msgid "Pages"
141
  msgstr ""
142
 
143
- #: admin/main-view.php:83
144
- msgid "Home page"
145
  msgstr ""
146
 
147
- #: admin/main-view.php:84
148
- msgid "Feeds"
149
  msgstr ""
150
 
151
- #: admin/main-view.php:85
152
- msgid "Category archives"
153
  msgstr ""
154
 
155
- #: admin/main-view.php:86
156
- msgid "Tag archives"
157
  msgstr ""
158
 
159
- #: admin/main-view.php:87
160
- msgid "Other archives"
161
  msgstr ""
162
 
163
- #: admin/main-view.php:88
164
- #, php-format
165
  msgid ""
166
- "If you choose to disable this, please add %1$s to your template file where "
167
- "you want it displayed"
168
  msgstr ""
169
 
170
- #: admin/main-view.php:92
171
- msgid "Display location priority:"
172
  msgstr ""
173
 
174
- #: admin/main-view.php:95
175
- msgid ""
176
- "If you select to automatically add the related posts, CRP will hook into the "
177
- "Content Filter at a priority as specified in this option."
178
  msgstr ""
179
 
180
- #: admin/main-view.php:96
181
  msgid ""
182
- "A higher number will cause the related posts to be processed later and move "
183
- "their display further down after the post content. Any number below 10 is "
184
- "not recommended."
185
  msgstr ""
186
 
187
- #: admin/main-view.php:100
188
- msgid "Insert after paragraph number"
 
 
 
 
189
  msgstr ""
190
 
191
- #: admin/main-view.php:103
192
  msgid ""
193
- "Enter 0 to display the related posts before the post content, -1 to display "
194
- "this at the end or a number to insert it after that paragraph number. If "
195
- "your post has less paragraphs, related posts will be displayed at the end."
 
 
 
 
 
 
 
196
  msgstr ""
197
 
198
- #: admin/main-view.php:107
199
- msgid "Disable on mobile devices:"
 
 
200
  msgstr ""
201
 
202
- #: admin/main-view.php:110
203
- msgid "Disable display of related posts on mobile devices"
204
  msgstr ""
205
 
206
- #: admin/main-view.php:114
207
- msgid "Disable on AMP pages:"
208
  msgstr ""
209
 
210
- #: admin/main-view.php:117
211
- msgid "Disable display of related posts on AMP pages"
212
  msgstr ""
213
 
214
- #: admin/main-view.php:121
215
- msgid "Show metabox:"
216
  msgstr ""
217
 
218
- #: admin/main-view.php:124
219
  msgid ""
220
- "This will add the Contextual Related Posts metabox on Edit Posts or Add New "
221
- "Posts screens. Also applies to Pages and Custom Post Types."
222
  msgstr ""
223
 
224
- #: admin/main-view.php:128
225
- msgid "Limit metabox to Admins only:"
226
  msgstr ""
227
 
228
- #: admin/main-view.php:131
229
  msgid ""
230
- "If this is selected, the metabox will be hidden from anyone who is not an "
231
- "Admin. Otherwise, by default, Contributors and above will be able to see the "
232
- "metabox. This applies only if the above option is selected."
233
  msgstr ""
234
 
235
- #: admin/main-view.php:135
236
- msgid "Tell the world you're using Contextual Related Posts:"
237
  msgstr ""
238
 
239
- #: admin/main-view.php:137
240
- msgid "Optional"
241
  msgstr ""
242
 
243
- #: admin/main-view.php:138
244
- msgid ""
245
- "Adds a nofollow link to Contextual Related Posts homepage as the last time "
246
- "in the list."
247
  msgstr ""
248
 
249
- #: admin/main-view.php:156 admin/main-view.php:266 admin/main-view.php:470
250
- #: admin/main-view.php:651 admin/main-view.php:743 admin/main-view.php:815
251
- #: admin/main-view.php:831
252
- msgid "Save Options"
253
  msgstr ""
254
 
255
- #: admin/main-view.php:179 admin/main-view.php:768
256
- msgid "Number of related posts to display: "
257
  msgstr ""
258
 
259
- #: admin/main-view.php:182
260
- msgid ""
261
- "Maximum number of posts that will be displayed. The actual number may be "
262
- "smaller if less related posts are found."
263
  msgstr ""
264
 
265
- #: admin/main-view.php:186
266
- msgid "Related posts should be newer than:"
 
 
267
  msgstr ""
268
 
269
- #: admin/main-view.php:188
270
- msgid "days"
271
  msgstr ""
272
 
273
- #: admin/main-view.php:189
274
  msgid ""
275
- "This sets the cutoff period for which posts will be displayed. e.g. setting "
276
  "it to 365 will show related posts from the last year only. Set to 0 to "
277
  "disable limiting posts by date."
278
  msgstr ""
279
 
280
- #: admin/main-view.php:193
281
  msgid "Randomize posts"
282
  msgstr ""
283
 
284
- #: admin/main-view.php:195
285
  msgid ""
286
  "This shuffles the top related posts. Does not work if the cache is enabled."
287
  msgstr ""
288
 
289
- #: admin/main-view.php:199
290
- msgid "Find related posts based on content as well as title:"
291
  msgstr ""
292
 
293
- #: admin/main-view.php:201
294
  msgid ""
295
- "If unchecked, only posts titles are used. I recommend using a caching plugin "
296
- "or enabling \"Cache output\" above if you enable this. Each site is "
297
- "different, so toggle this option to see which setting gives you better "
298
- "quality related posts."
299
  msgstr ""
300
 
301
- #: admin/main-view.php:205
302
- msgid "Limit content to be compared:"
303
  msgstr ""
304
 
305
- #: admin/main-view.php:207
306
  msgid ""
307
  "This sets the maximum words of the content that will be matched. Set to 0 "
308
  "for no limit. Max value: 2,000. Only applies if you activate the above "
309
  "option."
310
  msgstr ""
311
 
312
- #: admin/main-view.php:211
313
- msgid "Post types to include in results:"
 
314
  msgstr ""
315
 
316
- #: admin/main-view.php:218
317
  msgid ""
318
- "These post types will be displayed in the list. Includes custom post types."
 
 
319
  msgstr ""
320
 
321
- #: admin/main-view.php:222
322
  msgid "Limit to same post type"
323
  msgstr ""
324
 
325
- #: admin/main-view.php:224
326
  msgid ""
327
  "If checked, the related posts will only be selected from the same post type "
328
  "of the current post."
329
  msgstr ""
330
 
331
- #: admin/main-view.php:228
332
- msgid "List of post or page IDs to exclude from the results:"
333
  msgstr ""
334
 
335
- #: admin/main-view.php:230 admin/main-view.php:401
336
  msgid ""
337
- "Comma separated list of post, page or custom post type IDs. e.g. 188,320,500"
 
338
  msgstr ""
339
 
340
- #: admin/main-view.php:234
341
- msgid "Categories to exclude from the results: "
342
  msgstr ""
343
 
344
- #: admin/main-view.php:237
345
  msgid ""
346
  "Comma separated list of category slugs. The field above has an autocomplete "
347
- "so simply start typing in the beginning of your category name and it will "
348
- "prompt you with options."
349
  msgstr ""
350
 
351
- #: admin/main-view.php:240
352
- msgid "Excluded category IDs are:"
353
  msgstr ""
354
 
355
- #: admin/main-view.php:241
356
- msgid " "
357
- msgstr ""
358
-
359
- #: admin/main-view.php:246
360
- #, php-format
361
  msgid ""
362
- "These might differ from the IDs visible in the Categories page which use the "
363
- "%1$s. CRP uses the %2$s which is unique to this taxonomy."
 
 
364
  msgstr ""
365
 
366
- #: admin/main-view.php:289
367
- msgid "Title of related posts:"
 
368
  msgstr ""
369
 
370
- #: admin/main-view.php:292
371
- #, php-format
372
- msgid ""
373
- "This is the main heading of the related posts. You can also display the "
374
- "current post title by using %1$s"
375
  msgstr ""
376
 
377
- #: admin/main-view.php:296
378
- msgid "When there are no posts, what should be shown?"
 
379
  msgstr ""
380
 
381
- #: admin/main-view.php:300
382
- msgid "Blank Output"
 
383
  msgstr ""
384
 
385
- #: admin/main-view.php:305
386
- msgid "Display:"
 
387
  msgstr ""
388
 
389
- #: admin/main-view.php:311 admin/main-view.php:771
390
- msgid "Show post excerpt in list?"
391
  msgstr ""
392
 
393
- #: admin/main-view.php:314
394
- #, php-format
395
  msgid ""
396
- "Displays the excerpt of the post. If you do not provide an explicit excerpt "
397
- "to a post (in the post editor's optional excerpt field), it will display an "
398
- "automatic excerpt which refers to the first %d words of the post's content"
 
399
  msgstr ""
400
 
401
- #: admin/main-view.php:317
402
- msgid ""
403
- "Rounded Thumbnails style selected under the Custom Styles. Excerpt display "
404
- "is disabled."
405
  msgstr ""
406
 
407
- #: admin/main-view.php:322
408
- msgid "Length of excerpt (in words):"
 
 
409
  msgstr ""
410
 
411
- #: admin/main-view.php:328
412
- msgid "Show post author in list?"
 
 
413
  msgstr ""
414
 
415
- #: admin/main-view.php:331
416
- msgid "Displays the author name prefixed with \"by\". e.g. by John Doe"
417
  msgstr ""
418
 
419
- #: admin/main-view.php:334
420
  msgid ""
421
- "Rounded Thumbnails style selected under the Custom Styles. Author display is "
422
- "disabled."
423
  msgstr ""
424
 
425
- #: admin/main-view.php:339
426
- msgid "Show post date in list?"
427
  msgstr ""
428
 
429
- #: admin/main-view.php:342
430
  msgid ""
431
- "Displays the date of the post. Uses the same date format set in General "
432
- "Options"
 
 
 
 
 
433
  msgstr ""
434
 
435
- #: admin/main-view.php:345
 
 
 
 
 
 
 
 
 
 
436
  msgid ""
437
- "Rounded Thumbnails style selected under the Custom Styles. Date display is "
438
- "disabled."
439
  msgstr ""
440
 
441
- #: admin/main-view.php:350
442
- msgid "Limit post title length (in characters)"
443
  msgstr ""
444
 
445
- #: admin/main-view.php:353
446
  msgid ""
447
- "Any title longer than the number of characters set above will be cut and "
448
- "appended with an ellipsis (&hellip;)"
449
  msgstr ""
450
 
451
- #: admin/main-view.php:357
452
- msgid "Open links in new window"
453
  msgstr ""
454
 
455
- #: admin/main-view.php:363
456
- msgid "Add nofollow attribute to links in the list"
 
 
 
457
  msgstr ""
458
 
459
- #: admin/main-view.php:396
460
- msgid "Exclusion settings:"
461
  msgstr ""
462
 
463
- #: admin/main-view.php:398
464
- msgid "Exclude display of related posts on these posts / pages"
 
 
465
  msgstr ""
466
 
467
- #: admin/main-view.php:404
468
- msgid "Exclude display of related posts on these post types."
469
  msgstr ""
470
 
471
- #: admin/main-view.php:411
472
  msgid ""
473
- "The related posts will not display on any of the above selected post types"
 
474
  msgstr ""
475
 
476
- #: admin/main-view.php:441
477
- msgid "Customize the output:"
478
  msgstr ""
479
 
480
- #: admin/main-view.php:443
481
- msgid "HTML to display before the list of posts: "
482
  msgstr ""
483
 
484
- #: admin/main-view.php:446
485
- msgid "HTML to display before each list item: "
 
 
 
486
  msgstr ""
487
 
488
- #: admin/main-view.php:449
489
- msgid "HTML to display after each list item: "
490
  msgstr ""
491
 
492
- #: admin/main-view.php:452
493
- msgid "HTML to display after the list of posts: "
 
 
 
 
494
  msgstr ""
495
 
496
- #: admin/main-view.php:493 admin/main-view.php:774
497
- msgid "Location of post thumbnail:"
498
  msgstr ""
499
 
500
- #: admin/main-view.php:497 admin/main-view.php:778
501
- msgid "Display thumbnails inline with posts, before title"
502
  msgstr ""
503
 
504
- #: admin/main-view.php:502 admin/main-view.php:782
505
- msgid "Display thumbnails inline with posts, after title"
506
  msgstr ""
507
 
508
- #: admin/main-view.php:507 admin/main-view.php:786
509
- msgid "Display only thumbnails, no text"
510
  msgstr ""
511
 
512
- #: admin/main-view.php:512 admin/main-view.php:790
513
- msgid "Do not display thumbnails, only text."
514
  msgstr ""
515
 
516
- #: admin/main-view.php:516
 
 
 
 
 
 
 
517
  #, php-format
518
  msgid ""
519
- "This setting cannot be changed because an inbuilt style has been selected "
520
- "under the Styles section. If you would like to change this option, please "
521
- "select %1$s under the Styles section."
522
  msgstr ""
523
 
524
- #: admin/main-view.php:516 admin/main-view.php:677
525
- msgid "No styles"
 
 
 
526
  msgstr ""
527
 
528
- #: admin/main-view.php:520
529
- msgid "Thumbnail size:"
 
 
 
530
  msgstr ""
531
 
532
- #: admin/main-view.php:545
533
- msgid "Custom size"
 
534
  msgstr ""
535
 
536
- #: admin/main-view.php:548
537
- msgid "You can choose from existing image sizes above or create a custom size."
 
 
538
  msgstr ""
539
 
540
- #: admin/main-view.php:549
541
  msgid ""
542
- "If you choose an existing size, then the width, height and crop mode "
543
- "settings in the three options below will be automatically updated to reflect "
544
- "the correct dimensions of the setting."
 
 
 
545
  msgstr ""
546
 
547
- #: admin/main-view.php:550
548
  msgid ""
549
- "If you have chosen Custom size above, then enter the width, height and crop "
550
- "settings below. For best results, use a cropped image with the same width "
551
- "and height. The default setting is 150x150 cropped image."
552
  msgstr ""
553
 
554
- #: admin/main-view.php:551
555
  msgid ""
556
- "Any changes to the thumbnail settings doesn't automatically resize existing "
557
- "images."
558
  msgstr ""
559
 
560
- #: admin/main-view.php:554
561
- #, php-format
562
- msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
563
  msgstr ""
564
 
565
- #: admin/main-view.php:562
566
- msgid "Width of the thumbnail:"
 
 
567
  msgstr ""
568
 
569
- #: admin/main-view.php:565
570
- msgid "Height of the thumbnail: "
 
 
571
  msgstr ""
572
 
573
- #: admin/main-view.php:570
574
- msgid "Crop mode:"
575
  msgstr ""
576
 
577
- #: admin/main-view.php:574
578
  msgid ""
579
- "By default, thumbnails will be hard cropped. Uncheck this box to "
580
- "proportionately/soft crop the thumbnails."
581
  msgstr ""
582
 
583
- #: admin/main-view.php:578
584
- msgid "Generate thumbnail sizes:"
 
 
 
585
  msgstr ""
586
 
587
- #: admin/main-view.php:582
 
 
 
 
588
  msgid ""
589
- "If you select this option and Custom size is selected above, the plugin will "
590
- "register the image size with WordPress to create new thumbnails. Does not "
591
- "update old images as explained above."
592
  msgstr ""
593
 
594
- #: admin/main-view.php:586
595
- msgid "Image size attributes:"
 
 
596
  msgstr ""
597
 
598
- #: admin/main-view.php:591
599
- msgid "Style attributes. e.g."
600
  msgstr ""
601
 
602
- #: admin/main-view.php:599
603
- msgid "HTML width and height attributes. e.g."
604
  msgstr ""
605
 
606
- #: admin/main-view.php:606
607
- msgid "No HTML or Style attributes"
608
  msgstr ""
609
 
610
- #: admin/main-view.php:611
611
- msgid "Post thumbnail meta field name:"
 
 
612
  msgstr ""
613
 
614
- #: admin/main-view.php:613
615
- #, php-format
616
  msgid ""
617
- "The value of this field should contain a direct link to the image. This is "
618
- "set in the meta box in the %1$s screen."
619
  msgstr ""
620
 
621
- #: admin/main-view.php:613
622
- msgid "Add New Post"
 
 
623
  msgstr ""
624
 
625
- #: admin/main-view.php:616
626
- msgid "Extract the first image from the post?"
627
  msgstr ""
628
 
629
- #: admin/main-view.php:618
630
- msgid ""
631
- "This will only happen if there is no post thumbnail set and no image URL is "
632
- "specified in the meta field."
633
  msgstr ""
634
 
635
- #: admin/main-view.php:621
636
- msgid "Use default thumbnail?"
637
  msgstr ""
638
 
639
- #: admin/main-view.php:623
640
- msgid ""
641
- "If checked, when no thumbnail is found, show a default one from the URL "
642
- "below. If not checked and no thumbnail is found, no image will be shown."
643
  msgstr ""
644
 
645
- #: admin/main-view.php:626
646
- msgid "Default thumbnail:"
647
  msgstr ""
648
 
649
- #: admin/main-view.php:633
 
 
 
 
650
  msgid ""
651
- "The plugin will first check if the post contains a thumbnail. If it doesn't "
652
- "then it will check the meta field. If this is not available, then it will "
653
- "show the default image as specified above."
654
  msgstr ""
655
 
656
- #: admin/main-view.php:674
657
- msgid "Style of the related posts:"
658
  msgstr ""
659
 
660
- #: admin/main-view.php:679
661
- msgid "Select this option if you plan to add your own styles"
 
 
 
 
 
 
 
662
  msgstr ""
663
 
664
- #: admin/main-view.php:688
665
- msgid "Rounded Thumbnails"
 
 
 
666
  msgstr ""
667
 
668
- #: admin/main-view.php:691
669
  msgid ""
670
- "Enabling this option will turn on the thumbnails and set their width and "
671
- "height to 150px. It will also turn off the display of the author, excerpt "
672
- "and date if already enabled. Disabling this option will not revert any "
673
- "settings."
674
  msgstr ""
675
 
676
- #: admin/main-view.php:695
677
  #, php-format
678
- msgid "You can view the default style at %s"
679
  msgstr ""
680
 
681
- #: admin/main-view.php:703
682
- msgid "Text only"
683
  msgstr ""
684
 
685
- #: admin/main-view.php:705
686
  msgid ""
687
- "Enabling this option will disable thumbnails and no longer include the "
688
- "default style sheet included in the plugin."
 
689
  msgstr ""
690
 
691
- #: admin/main-view.php:720
692
- msgid "Custom CSS to add to header:"
693
  msgstr ""
694
 
695
- #: admin/main-view.php:725
696
- #, php-format
697
  msgid ""
698
- "Do not include %1$s tags. Check out the %2$s for available CSS classes to "
699
- "style."
 
700
  msgstr ""
701
 
702
- #: admin/main-view.php:766
703
- msgid ""
704
- "Below options override the related posts settings for your blog feed. These "
705
- "only apply if you have selected to add related posts to Feeds in the General "
706
- "Options tab."
707
  msgstr ""
708
 
709
- #: admin/main-view.php:794
710
- msgid "Maximum width of the thumbnail: "
711
  msgstr ""
712
 
713
- #: admin/main-view.php:797
714
- msgid "Maximum height of the thumbnail: "
715
  msgstr ""
716
 
717
- #: admin/main-view.php:832
718
- msgid "Default Options"
719
  msgstr ""
720
 
721
- #: admin/main-view.php:832
722
- msgid "Do you want to set options to Default?"
723
  msgstr ""
724
 
725
- #: admin/main-view.php:833
726
- msgid "Recreate Index"
 
 
727
  msgstr ""
728
 
729
- #: admin/main-view.php:833
730
- msgid "Are you sure you want to recreate the index?"
731
  msgstr ""
732
 
733
- #: admin/main-view.php:838
734
- #, php-format
735
  msgid ""
736
- "One or more FULLTEXT indices are missing. Please hit the %1$s at the bottom "
737
- "of the page to fix this."
 
738
  msgstr ""
739
 
740
- #: admin/main-view.php:838
741
- msgid "Recreate Index button"
742
  msgstr ""
743
 
744
- #: admin/main-view.php:843
745
- msgid ""
746
- "If the Recreate Index button fails, please run the following queries in "
747
- "phpMyAdmin or Adminer"
748
  msgstr ""
749
 
750
- #: admin/metabox.php:107
751
- msgid "Disable Related Posts display:"
752
  msgstr ""
753
 
754
- #: admin/metabox.php:110
755
  msgid ""
756
- "If this is checked, then Contextual Related Posts will not automatically "
757
- "insert the related posts at the end of post content."
 
 
758
  msgstr ""
759
 
760
- #: admin/metabox.php:114
761
- msgid "Exclude this post from the related posts list:"
 
 
762
  msgstr ""
763
 
764
- #: admin/metabox.php:117
 
 
 
 
765
  msgid ""
766
- "If this is checked, then this post will be excluded from the popular posts "
767
- "list."
768
  msgstr ""
769
 
770
- #: admin/metabox.php:121 admin/metabox.php:129
771
- msgid "Manual related posts:"
772
  msgstr ""
773
 
774
- #: admin/metabox.php:123
775
- msgid ""
776
- "Comma separated list of post, page or custom post type IDs. e.g. "
777
- "188,320,500. These will be given preference over the related posts generated "
778
- "by the plugin."
779
  msgstr ""
780
 
781
- #: admin/metabox.php:124
782
- msgid ""
783
- "Once you enter the list above and save this page, the plugin will display "
784
- "the titles of the posts below for your reference. Only IDs corresponding to "
785
- "published posts or custom post types will be retained."
786
  msgstr ""
787
 
788
- #: admin/metabox.php:140
789
- #, php-format
790
- msgid "This post type is: %s"
791
  msgstr ""
792
 
793
- #: admin/metabox.php:151
794
- msgid "Location of thumbnail"
795
  msgstr ""
796
 
797
- #: admin/metabox.php:153
798
- msgid ""
799
- "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
800
- "image will be used for the post. It will be resized to the thumbnail size "
801
- "set under Settings &raquo; Related Posts &raquo; Output Options"
802
  msgstr ""
803
 
804
- #: admin/metabox.php:154
805
- msgid "The URL above is saved in the meta field:"
806
  msgstr ""
807
 
808
- #: admin/metabox.php:159
 
 
 
 
 
 
 
 
 
809
  msgid ""
810
- "You have Top 10 WordPress Plugin installed. If you are trying to modify the "
811
- "thumbnail, then you'll need to make the same change in the Top 10 meta box "
812
- "on this page."
813
  msgstr ""
814
 
815
- #: admin/sidebar-view.php:20
 
 
 
 
816
  msgid "Support the development"
817
  msgstr ""
818
 
819
- #: admin/sidebar-view.php:27
820
  msgid "Donation for Contextual Related Posts"
821
  msgstr ""
822
 
823
- #: admin/sidebar-view.php:29
824
- msgid "Enter amount in USD:"
825
  msgstr ""
826
 
827
- #: admin/sidebar-view.php:33
828
  msgid "Send your donation to the author of"
829
  msgstr ""
830
 
831
- #: admin/sidebar-view.php:41
832
  msgid "Quick links"
833
  msgstr ""
834
 
835
- #: admin/sidebar-view.php:45
836
- msgid "WebberZone"
837
- msgstr ""
838
-
839
- #: admin/sidebar-view.php:46
840
- msgid "Plugin homepage"
841
  msgstr ""
842
 
843
- #: admin/sidebar-view.php:47
844
  msgid "FAQ"
845
  msgstr ""
846
 
847
- #: admin/sidebar-view.php:49
848
  msgid "Reviews"
849
  msgstr ""
850
 
851
- #: admin/sidebar-view.php:50
852
  msgid "Github repository"
853
  msgstr ""
854
 
855
- #: admin/sidebar-view.php:51
856
  msgid "Other plugins"
857
  msgstr ""
858
 
859
- #: admin/sidebar-view.php:52
860
  msgid "Ajay's blog"
861
  msgstr ""
862
 
863
- #: admin/sidebar-view.php:59
864
- msgid "Follow us"
865
  msgstr ""
866
 
867
- #: contextual-related-posts.php:100
868
  msgid "<h3>Related Posts:</h3>"
869
  msgstr ""
870
 
871
- #: contextual-related-posts.php:102
872
- msgid "No related posts found"
873
- msgstr ""
874
-
875
  #: includes/main-query.php:195
876
  #, php-format
877
  msgid "Powered by <a href=\"%s\" rel=\"nofollow\">Contextual Related Posts</a>"
878
  msgstr ""
879
 
880
- #: includes/media.php:65
881
  msgid "thumb_timthumb argument has been deprecated"
882
  msgstr ""
883
 
884
- #: includes/media.php:69
885
  msgid "thumb_timthumb_q argument has been deprecated"
886
  msgstr ""
887
 
888
- #: includes/media.php:73
889
  msgid "filter argument has been deprecated"
890
  msgstr ""
891
 
@@ -909,46 +1023,38 @@ msgstr ""
909
  msgid "Offset"
910
  msgstr ""
911
 
912
- #: includes/modules/class-crp-widget.php:98
913
  msgid " Show excerpt?"
914
  msgstr ""
915
 
916
- #: includes/modules/class-crp-widget.php:108
917
  msgid " Show author?"
918
  msgstr ""
919
 
920
- #: includes/modules/class-crp-widget.php:118
921
  msgid " Show date?"
922
  msgstr ""
923
 
924
- #: includes/modules/class-crp-widget.php:124
 
 
 
 
925
  msgid "Thumbnails inline, before title"
926
  msgstr ""
927
 
928
- #: includes/modules/class-crp-widget.php:125
929
  msgid "Thumbnails inline, after title"
930
  msgstr ""
931
 
932
- #: includes/modules/class-crp-widget.php:126
933
  msgid "Only thumbnails, no text"
934
  msgstr ""
935
 
936
- #: includes/modules/class-crp-widget.php:127
937
  msgid "No thumbnails, only text."
938
  msgstr ""
939
 
940
- #: includes/modules/class-crp-widget.php:132
941
- msgid "Thumbnail height"
942
- msgstr ""
943
-
944
- #: includes/modules/class-crp-widget.php:137
945
- msgid "Thumbnail width"
946
- msgstr ""
947
-
948
- #: includes/modules/class-crp-widget.php:141
949
- msgid "Post types to include"
950
- msgstr ""
951
-
952
  #: includes/output-generator.php:239
953
  msgid " by "
954
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Contextual Related Posts\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2019-04-02 15:14+0100\n"
6
  "PO-Revision-Date: \n"
7
+ "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
9
  "Language: en_US\n"
10
  "MIME-Version: 1.0\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
+ #: includes/admin/admin.php:31
22
+ msgid "Contextual Related Posts"
23
  msgstr ""
24
 
25
+ #: includes/admin/admin.php:32 includes/admin/default-settings.php:172
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 "
45
+ "Posts</a>! Please <a href=\"%2$s\" target=\"_blank\">rate us</a> on <a href="
46
+ "\"%2$s\" target=\"_blank\">WordPress.org</a>"
47
  msgstr ""
48
 
49
+ #: includes/admin/default-settings.php:62
50
+ msgid "Enable cache"
51
  msgstr ""
52
 
53
+ #: includes/admin/default-settings.php:63
54
+ msgid ""
55
+ "Enabling this option will cache the related posts output when the post is "
56
+ "visited the first time. The cache is cleaned when you save this page."
57
  msgstr ""
58
 
59
+ #: includes/admin/default-settings.php:69
60
+ msgid "Automatically add related posts to"
61
  msgstr ""
62
 
63
+ #: includes/admin/default-settings.php:71
64
+ #, php-format
65
  msgid ""
66
+ "If you choose to disable this, please add %1$s to your template file where "
67
+ "you want it displayed"
68
  msgstr ""
69
 
70
+ #: includes/admin/default-settings.php:78
71
+ msgid "Posts"
72
  msgstr ""
73
 
74
+ #: includes/admin/default-settings.php:79
75
+ msgid "Pages"
76
  msgstr ""
77
 
78
+ #: includes/admin/default-settings.php:80
79
+ msgid "Home page"
80
  msgstr ""
81
 
82
+ #: includes/admin/default-settings.php:81
83
+ msgid "Feeds"
84
  msgstr ""
85
 
86
+ #: includes/admin/default-settings.php:82
87
+ msgid "Category archives"
88
  msgstr ""
89
 
90
+ #: includes/admin/default-settings.php:83
91
+ msgid "Tag archives"
92
  msgstr ""
93
 
94
+ #: includes/admin/default-settings.php:84
95
+ msgid "Other archives"
96
  msgstr ""
97
 
98
+ #: includes/admin/default-settings.php:89
99
+ msgid "Display location priority"
100
  msgstr ""
101
 
102
+ #: includes/admin/default-settings.php:90
103
+ msgid ""
104
+ "Select the relative position of the related posts in the post content. A "
105
+ "higher number pushes the related posts later in the content. Any number "
106
+ "below 10 is not recommended."
107
  msgstr ""
108
 
109
+ #: includes/admin/default-settings.php:96
110
+ msgid "Insert after paragraph number"
111
  msgstr ""
112
 
113
+ #: includes/admin/default-settings.php:97
114
+ msgid ""
115
+ "Enter 0 to display the related posts before the post content, -1 to display "
116
+ "this at the end or a number to insert it after that paragraph number. If "
117
+ "your post has less paragraphs, related posts will be displayed at the end."
118
+ msgstr ""
119
+
120
+ #: includes/admin/default-settings.php:104
121
+ msgid "Disable on mobile devices"
122
+ msgstr ""
123
+
124
+ #: includes/admin/default-settings.php:105
125
+ msgid ""
126
+ "Disable display of related posts on mobile devices. Might not always work "
127
+ "with caching plugins."
128
+ msgstr ""
129
+
130
+ #: includes/admin/default-settings.php:111
131
+ msgid "Disable on AMP pages"
132
  msgstr ""
133
 
134
+ #: includes/admin/default-settings.php:112
135
+ msgid "Disable display of related posts on AMP pages."
 
 
 
136
  msgstr ""
137
 
138
+ #: includes/admin/default-settings.php:118
139
+ msgid "Delete options on uninstall"
140
  msgstr ""
141
 
142
+ #: includes/admin/default-settings.php:119
143
  msgid ""
144
+ "If this is checked, all settings related to Contextual Related Posts are "
145
+ "removed from the database if you choose to uninstall/delete the plugin."
146
+ msgstr ""
147
+
148
+ #: includes/admin/default-settings.php:125
149
+ msgid "Show metabox"
150
  msgstr ""
151
 
152
+ #: includes/admin/default-settings.php:126
153
  msgid ""
154
+ "This will add the Contextual Related Posts metabox on Edit Posts or Add New "
155
+ "Posts screens. Also applies to Pages and Custom Post Types."
 
156
  msgstr ""
157
 
158
+ #: includes/admin/default-settings.php:132
159
+ msgid "Limit meta box to Admins only"
160
+ msgstr ""
161
+
162
+ #: includes/admin/default-settings.php:133
163
+ msgid ""
164
+ "If selected, the meta box will be hidden from anyone who is not an Admin. By "
165
+ "default, Contributors and above will be able to see the meta box. Applies "
166
+ "only if the above option is selected."
167
  msgstr ""
168
 
169
+ #: includes/admin/default-settings.php:139
170
+ msgid "Link to Contextual Related Posts plugin page"
171
  msgstr ""
172
 
173
+ #: includes/admin/default-settings.php:140
174
+ msgid ""
175
+ "A no-follow link to the plugin homepage will be added as the last item of "
176
+ "the related posts."
177
  msgstr ""
178
 
179
+ #: includes/admin/default-settings.php:169
180
+ msgid "Heading of posts"
181
  msgstr ""
182
 
183
+ #: includes/admin/default-settings.php:170
184
+ msgid "Displayed before the list of the posts as a master heading"
185
  msgstr ""
186
 
187
+ #: includes/admin/default-settings.php:177
188
+ msgid "Show when no posts are found"
189
  msgstr ""
190
 
191
+ #: includes/admin/default-settings.php:183
192
+ msgid "Blank output"
193
  msgstr ""
194
 
195
+ #: includes/admin/default-settings.php:184
196
+ msgid "Display custom text"
197
  msgstr ""
198
 
199
+ #: includes/admin/default-settings.php:189
200
+ msgid "Custom text"
201
  msgstr ""
202
 
203
+ #: includes/admin/default-settings.php:190
 
204
  msgid ""
205
+ "Enter the custom text that will be displayed if the second option is "
206
+ "selected above."
207
  msgstr ""
208
 
209
+ #: includes/admin/default-settings.php:192 includes/deprecated.php:185
210
+ msgid "No related posts found"
211
  msgstr ""
212
 
213
+ #: includes/admin/default-settings.php:196
214
+ #: includes/admin/default-settings.php:607
215
+ msgid "Show post excerpt"
 
216
  msgstr ""
217
 
218
+ #: includes/admin/default-settings.php:197
219
  msgid ""
220
+ "If the post does not have an excerpt, the plugin will automatically create "
221
+ "one containing the number of words specified in the next option."
 
222
  msgstr ""
223
 
224
+ #: includes/admin/default-settings.php:203
225
+ msgid "Length of excerpt (in words)"
226
+ msgstr ""
227
+
228
+ #: includes/admin/default-settings.php:212
229
+ msgid "Show date"
230
  msgstr ""
231
 
232
+ #: includes/admin/default-settings.php:213
233
  msgid ""
234
+ "Displays the date of the post. Uses the same date format set in General "
235
+ "Options."
236
+ msgstr ""
237
+
238
+ #: includes/admin/default-settings.php:219
239
+ msgid "Show author"
240
+ msgstr ""
241
+
242
+ #: includes/admin/default-settings.php:226
243
+ msgid "Limit post title length (in characters)"
244
  msgstr ""
245
 
246
+ #: includes/admin/default-settings.php:227
247
+ msgid ""
248
+ "Any title longer than the number of characters set above will be cut and "
249
+ "appended with an ellipsis (&hellip;)"
250
  msgstr ""
251
 
252
+ #: includes/admin/default-settings.php:234
253
+ msgid "Open links in new window"
254
  msgstr ""
255
 
256
+ #: includes/admin/default-settings.php:241
257
+ msgid "Add nofollow to links"
258
  msgstr ""
259
 
260
+ #: includes/admin/default-settings.php:248
261
+ msgid "Exclusion settings"
262
  msgstr ""
263
 
264
+ #: includes/admin/default-settings.php:254
265
+ msgid "Exclude display on these posts"
266
  msgstr ""
267
 
268
+ #: includes/admin/default-settings.php:255
269
  msgid ""
270
+ "Comma separated list of post, page or custom post type IDs. e.g. 188,320,500"
 
271
  msgstr ""
272
 
273
+ #: includes/admin/default-settings.php:261
274
+ msgid "Exclude display on these post types"
275
  msgstr ""
276
 
277
+ #: includes/admin/default-settings.php:262
278
  msgid ""
279
+ "The related posts will not display on any of the above selected post types."
 
 
280
  msgstr ""
281
 
282
+ #: includes/admin/default-settings.php:268
283
+ msgid "HTML to display"
284
  msgstr ""
285
 
286
+ #: includes/admin/default-settings.php:274
287
+ msgid "Before the list of posts"
288
  msgstr ""
289
 
290
+ #: includes/admin/default-settings.php:281
291
+ msgid "After the list of posts"
 
 
292
  msgstr ""
293
 
294
+ #: includes/admin/default-settings.php:288
295
+ msgid "Before each list item"
 
 
296
  msgstr ""
297
 
298
+ #: includes/admin/default-settings.php:295
299
+ msgid "After each list item"
300
  msgstr ""
301
 
302
+ #: includes/admin/default-settings.php:325
303
+ #: includes/admin/default-settings.php:598
304
+ msgid "Number of posts to display"
 
305
  msgstr ""
306
 
307
+ #: includes/admin/default-settings.php:326
308
+ msgid ""
309
+ "Maximum number of posts that will be displayed in the list. This option is "
310
+ "used if you don not specify the number of posts in the widget or shortcodes"
311
  msgstr ""
312
 
313
+ #: includes/admin/default-settings.php:334
314
+ msgid "Related posts should be newer than"
315
  msgstr ""
316
 
317
+ #: includes/admin/default-settings.php:335
318
  msgid ""
319
+ "This sets the cut-off period for which posts will be displayed. e.g. setting "
320
  "it to 365 will show related posts from the last year only. Set to 0 to "
321
  "disable limiting posts by date."
322
  msgstr ""
323
 
324
+ #: includes/admin/default-settings.php:342
325
  msgid "Randomize posts"
326
  msgstr ""
327
 
328
+ #: includes/admin/default-settings.php:343
329
  msgid ""
330
  "This shuffles the top related posts. Does not work if the cache is enabled."
331
  msgstr ""
332
 
333
+ #: includes/admin/default-settings.php:349
334
+ msgid "Related posts based on title and content"
335
  msgstr ""
336
 
337
+ #: includes/admin/default-settings.php:350
338
  msgid ""
339
+ "If unchecked, only posts titles are used. Enable the cache if enabling this "
340
+ "option for better performance. Each site is different, so toggle this option "
341
+ "to see which setting gives you better quality related posts."
 
342
  msgstr ""
343
 
344
+ #: includes/admin/default-settings.php:356
345
+ msgid "Limit content to be compared"
346
  msgstr ""
347
 
348
+ #: includes/admin/default-settings.php:357
349
  msgid ""
350
  "This sets the maximum words of the content that will be matched. Set to 0 "
351
  "for no limit. Max value: 2,000. Only applies if you activate the above "
352
  "option."
353
  msgstr ""
354
 
355
+ #: includes/admin/default-settings.php:365
356
+ #: includes/modules/class-crp-widget.php:126
357
+ msgid "Post types to include"
358
  msgstr ""
359
 
360
+ #: includes/admin/default-settings.php:366
361
  msgid ""
362
+ "At least one option should be selected above. Select which post types you "
363
+ "want to include in the list of posts. This field can be overridden using a "
364
+ "comma separated list of post types when using the manual display."
365
  msgstr ""
366
 
367
+ #: includes/admin/default-settings.php:372
368
  msgid "Limit to same post type"
369
  msgstr ""
370
 
371
+ #: includes/admin/default-settings.php:373
372
  msgid ""
373
  "If checked, the related posts will only be selected from the same post type "
374
  "of the current post."
375
  msgstr ""
376
 
377
+ #: includes/admin/default-settings.php:379
378
+ msgid "Post/page IDs to exclude"
379
  msgstr ""
380
 
381
+ #: includes/admin/default-settings.php:380
382
  msgid ""
383
+ "Comma-separated list of post or page IDs to exclude from the list. e.g. "
384
+ "188,320,500"
385
  msgstr ""
386
 
387
+ #: includes/admin/default-settings.php:386
388
+ msgid "Exclude Categories"
389
  msgstr ""
390
 
391
+ #: includes/admin/default-settings.php:387
392
  msgid ""
393
  "Comma separated list of category slugs. The field above has an autocomplete "
394
+ "so simply start typing in the starting letters and it will prompt you with "
395
+ "options. Does not support custom taxonomies."
396
  msgstr ""
397
 
398
+ #: includes/admin/default-settings.php:398
399
+ msgid "Exclude category IDs"
400
  msgstr ""
401
 
402
+ #: includes/admin/default-settings.php:399
 
 
 
 
 
403
  msgid ""
404
+ "This is a readonly field that is automatically populated based on the above "
405
+ "input when the settings are saved. These might differ from the IDs visible "
406
+ "in the Categories page which use the term_id. Contextual Related Posts uses "
407
+ "the term_taxonomy_id which is unique to this taxonomy."
408
  msgstr ""
409
 
410
+ #: includes/admin/default-settings.php:429
411
+ #: includes/admin/default-settings.php:614
412
+ msgid "Location of the post thumbnail"
413
  msgstr ""
414
 
415
+ #: includes/admin/default-settings.php:434
416
+ #: includes/admin/default-settings.php:619
417
+ msgid "Display thumbnails inline with posts, before title"
 
 
418
  msgstr ""
419
 
420
+ #: includes/admin/default-settings.php:435
421
+ #: includes/admin/default-settings.php:620
422
+ msgid "Display thumbnails inline with posts, after title"
423
  msgstr ""
424
 
425
+ #: includes/admin/default-settings.php:436
426
+ #: includes/admin/default-settings.php:621
427
+ msgid "Display only thumbnails, no text"
428
  msgstr ""
429
 
430
+ #: includes/admin/default-settings.php:437
431
+ #: includes/admin/default-settings.php:622
432
+ msgid "Do not display thumbnails, only text"
433
  msgstr ""
434
 
435
+ #: includes/admin/default-settings.php:442
436
+ msgid "Thumbnail size"
437
  msgstr ""
438
 
439
+ #: includes/admin/default-settings.php:443
 
440
  msgid ""
441
+ "You can choose from existing image sizes above or create a custom size. If "
442
+ "you have chosen Custom size above, then enter the width, height and crop "
443
+ "settings below. For best results, use a cropped image. If you change the "
444
+ "width and/or height below, existing images will not be automatically resized."
445
  msgstr ""
446
 
447
+ #: includes/admin/default-settings.php:445
448
+ #, php-format
449
+ msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
 
450
  msgstr ""
451
 
452
+ #: includes/admin/default-settings.php:455
453
+ #: includes/admin/default-settings.php:627
454
+ #: includes/modules/class-crp-widget.php:122
455
+ msgid "Thumbnail width"
456
  msgstr ""
457
 
458
+ #: includes/admin/default-settings.php:464
459
+ #: includes/admin/default-settings.php:636
460
+ #: includes/modules/class-crp-widget.php:117
461
+ msgid "Thumbnail height"
462
  msgstr ""
463
 
464
+ #: includes/admin/default-settings.php:473
465
+ msgid "Hard crop thumbnails"
466
  msgstr ""
467
 
468
+ #: includes/admin/default-settings.php:474
469
  msgid ""
470
+ "Check this box to hard crop the thumbnails. i.e. force the width and height "
471
+ "above vs. maintaining proportions."
472
  msgstr ""
473
 
474
+ #: includes/admin/default-settings.php:480
475
+ msgid "Generate thumbnail sizes"
476
  msgstr ""
477
 
478
+ #: includes/admin/default-settings.php:481
479
  msgid ""
480
+ "If you select this option and Custom size is selected above, the plugin will "
481
+ "register the image size with WordPress to create new thumbnails. Does not "
482
+ "update old images as explained above."
483
+ msgstr ""
484
+
485
+ #: includes/admin/default-settings.php:487
486
+ msgid "Thumbnail size attributes"
487
  msgstr ""
488
 
489
+ #: includes/admin/default-settings.php:493
490
+ #, php-format
491
+ msgid "Use CSS to set the width and height: e.g. %s"
492
+ msgstr ""
493
+
494
+ #: includes/admin/default-settings.php:495
495
+ #, php-format
496
+ msgid "Use HTML attributes to set the width and height: e.g. %s"
497
+ msgstr ""
498
+
499
+ #: includes/admin/default-settings.php:496
500
  msgid ""
501
+ "No width or height set. You will need to use external styles to force any "
502
+ "width or height of your choice."
503
  msgstr ""
504
 
505
+ #: includes/admin/default-settings.php:501
506
+ msgid "Thumbnail meta field name"
507
  msgstr ""
508
 
509
+ #: includes/admin/default-settings.php:502
510
  msgid ""
511
+ "The value of this field should contain the URL of the image and can be set "
512
+ "in the metabox in the Edit Post screen"
513
  msgstr ""
514
 
515
+ #: includes/admin/default-settings.php:508
516
+ msgid "Get first image"
517
  msgstr ""
518
 
519
+ #: includes/admin/default-settings.php:509
520
+ msgid ""
521
+ "The plugin will fetch the first image in the post content if this is "
522
+ "enabled. This can slow down the loading of your page if the first image in "
523
+ "the followed posts is large in file-size."
524
  msgstr ""
525
 
526
+ #: includes/admin/default-settings.php:515
527
+ msgid "Use default thumbnail?"
528
  msgstr ""
529
 
530
+ #: includes/admin/default-settings.php:516
531
+ msgid ""
532
+ "If checked, when no thumbnail is found, show a default one from the URL "
533
+ "below. If not checked and no thumbnail is found, no image will be shown."
534
  msgstr ""
535
 
536
+ #: includes/admin/default-settings.php:522 includes/admin/settings-page.php:746
537
+ msgid "Default thumbnail"
538
  msgstr ""
539
 
540
+ #: includes/admin/default-settings.php:523
541
  msgid ""
542
+ "Enter the full URL of the image that you wish to display if no thumbnail is "
543
+ "found. This image will be displayed below."
544
  msgstr ""
545
 
546
+ #: includes/admin/default-settings.php:553
547
+ msgid "Related Posts style"
548
  msgstr ""
549
 
550
+ #: includes/admin/default-settings.php:561
551
+ msgid "Custom CSS"
552
  msgstr ""
553
 
554
+ #: includes/admin/default-settings.php:563
555
+ #, php-format
556
+ msgid ""
557
+ "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
558
+ "CSS classes to style."
559
  msgstr ""
560
 
561
+ #: includes/admin/default-settings.php:592
562
+ msgid "About this tab"
563
  msgstr ""
564
 
565
+ #: includes/admin/default-settings.php:593
566
+ msgid ""
567
+ "Below options override the related posts settings for your blog feed. These "
568
+ "only apply if you have selected to add related posts to Feeds in the General "
569
+ "Options tab. It is recommended to not display thumbnails as there is no easy "
570
+ "way to style the related posts in the feed."
571
  msgstr ""
572
 
573
+ #: includes/admin/default-settings.php:711
574
+ msgid "No styles"
575
  msgstr ""
576
 
577
+ #: includes/admin/default-settings.php:712
578
+ msgid "Select this option if you plan to add your own styles"
579
  msgstr ""
580
 
581
+ #: includes/admin/default-settings.php:716
582
+ msgid "Text only"
583
  msgstr ""
584
 
585
+ #: includes/admin/default-settings.php:717
586
+ msgid "Disable thumbnails and no longer include the default style sheet"
587
  msgstr ""
588
 
589
+ #: includes/admin/default-settings.php:721
590
+ msgid "Rounded thumbnails"
591
  msgstr ""
592
 
593
+ #: includes/admin/default-settings.php:722
594
+ msgid ""
595
+ "Enabling this option will turn on the thumbnails and force their width and "
596
+ "height. It will also turn off the display of the author, excerpt and date if "
597
+ "already enabled. Disabling this option will not revert any settings."
598
+ msgstr ""
599
+
600
+ #: includes/admin/help-tab.php:35 includes/admin/help-tab.php:126
601
  #, php-format
602
  msgid ""
603
+ "For more information or how to get support visit the <a href=\"%1$s"
604
+ "\">WebberZone support site</a>."
 
605
  msgstr ""
606
 
607
+ #: includes/admin/help-tab.php:37 includes/admin/help-tab.php:128
608
+ #, php-format
609
+ msgid ""
610
+ "Support queries should be posted in the <a href=\"%1$s\">WordPress.org "
611
+ "support forums</a>."
612
  msgstr ""
613
 
614
+ #: includes/admin/help-tab.php:40 includes/admin/help-tab.php:131
615
+ #, php-format
616
+ msgid ""
617
+ "<a href=\"%1$s\">Post an issue</a> on <a href=\"%2$s\">GitHub</a> (bug "
618
+ "reports only)."
619
  msgstr ""
620
 
621
+ #: includes/admin/help-tab.php:49 includes/admin/help-tab.php:140
622
+ #: includes/admin/settings-page.php:129
623
+ msgid "General"
624
  msgstr ""
625
 
626
+ #: includes/admin/help-tab.php:51
627
+ msgid ""
628
+ "This screen provides the basic settings for configuring Contextual Related "
629
+ "Posts."
630
  msgstr ""
631
 
632
+ #: includes/admin/help-tab.php:52
633
  msgid ""
634
+ "Enable the trackers and cache, configure basic tracker settings and "
635
+ "uninstall settings."
636
+ msgstr ""
637
+
638
+ #: includes/admin/help-tab.php:59
639
+ msgid "Counter/Tracker"
640
  msgstr ""
641
 
642
+ #: includes/admin/help-tab.php:61
643
  msgid ""
644
+ "This screen provides settings to tweak the display counter and the tracker."
 
 
645
  msgstr ""
646
 
647
+ #: includes/admin/help-tab.php:62
648
  msgid ""
649
+ "Choose where to display the counter and customize the text. Select the type "
650
+ "of tracker and which user groups to track."
651
  msgstr ""
652
 
653
+ #: includes/admin/help-tab.php:69
654
+ msgid "Posts list"
 
655
  msgstr ""
656
 
657
+ #: includes/admin/help-tab.php:71
658
+ msgid ""
659
+ "This screen provides settings to tweak the output of the list of related "
660
+ "posts."
661
  msgstr ""
662
 
663
+ #: includes/admin/help-tab.php:72
664
+ msgid ""
665
+ "Set the number of posts, which categories or posts to exclude, customize "
666
+ "what to display and specific basic HTML markup used to create the posts."
667
  msgstr ""
668
 
669
+ #: includes/admin/help-tab.php:79 includes/admin/settings-page.php:132
670
+ msgid "Thumbnail"
671
  msgstr ""
672
 
673
+ #: includes/admin/help-tab.php:81
674
  msgid ""
675
+ "This screen provides settings to tweak the thumbnail that can be displayed "
676
+ "for each post in the list."
677
  msgstr ""
678
 
679
+ #: includes/admin/help-tab.php:82
680
+ msgid ""
681
+ "Set the location and size of the thumbnail. Additionally, you can choose "
682
+ "additional sources for the thumbnail i.e. a meta field, first image or a "
683
+ "default thumbnail when nothing is available."
684
  msgstr ""
685
 
686
+ #: includes/admin/help-tab.php:89 includes/admin/settings-page.php:133
687
+ msgid "Styles"
688
+ msgstr ""
689
+
690
+ #: includes/admin/help-tab.php:91
691
  msgid ""
692
+ "This screen provides options to control the look and feel of the related "
693
+ "posts list."
 
694
  msgstr ""
695
 
696
+ #: includes/admin/help-tab.php:92
697
+ msgid ""
698
+ "Choose for default set of styles or add your own custom CSS to tweak the "
699
+ "display of the posts."
700
  msgstr ""
701
 
702
+ #: includes/admin/help-tab.php:99
703
+ msgid "Maintenance"
704
  msgstr ""
705
 
706
+ #: includes/admin/help-tab.php:101
707
+ msgid "This screen provides options to control the maintenance cron."
708
  msgstr ""
709
 
710
+ #: includes/admin/help-tab.php:102
711
+ msgid "Choose how often to run maintenance and at what time of the day."
712
  msgstr ""
713
 
714
+ #: includes/admin/help-tab.php:142
715
+ msgid ""
716
+ "This screen provides some tools that help maintain certain features of "
717
+ "Contextual Related Posts."
718
  msgstr ""
719
 
720
+ #: includes/admin/help-tab.php:143
 
721
  msgid ""
722
+ "Clear the cache, reset the related posts tables plus some miscellaneous "
723
+ "fixes for older versions of Contextual Related Posts."
724
  msgstr ""
725
 
726
+ #: includes/admin/modules/cache.php:54
727
+ msgid ""
728
+ "An error occurred clearing the cache. Please contact your site administrator."
729
+ "\\n\\nError message:\\n"
730
  msgstr ""
731
 
732
+ #: includes/admin/modules/cache.php:63
733
+ msgid " cached row(s) cleared"
734
  msgstr ""
735
 
736
+ #: includes/admin/modules/loader.php:29
737
+ msgid "Settings"
 
 
738
  msgstr ""
739
 
740
+ #: includes/admin/modules/loader.php:52 includes/admin/sidebar.php:60
741
+ msgid "Support"
742
  msgstr ""
743
 
744
+ #: includes/admin/modules/loader.php:53
745
+ msgid "Donate"
 
 
746
  msgstr ""
747
 
748
+ #: includes/admin/modules/loader.php:54
749
+ msgid "Contribute"
750
  msgstr ""
751
 
752
+ #: includes/admin/modules/metabox.php:108
753
+ msgid "Disable Related Posts display:"
754
+ msgstr ""
755
+
756
+ #: includes/admin/modules/metabox.php:111
757
  msgid ""
758
+ "If this is checked, then Contextual Related Posts will not automatically "
759
+ "insert the related posts at the end of post content."
 
760
  msgstr ""
761
 
762
+ #: includes/admin/modules/metabox.php:115
763
+ msgid "Exclude this post from the related posts list:"
764
  msgstr ""
765
 
766
+ #: includes/admin/modules/metabox.php:118
767
+ msgid ""
768
+ "If this is checked, then this post will be excluded from the popular posts "
769
+ "list."
770
+ msgstr ""
771
+
772
+ #: includes/admin/modules/metabox.php:122
773
+ #: includes/admin/modules/metabox.php:130
774
+ msgid "Manual related posts:"
775
  msgstr ""
776
 
777
+ #: includes/admin/modules/metabox.php:124
778
+ msgid ""
779
+ "Comma separated list of post, page or custom post type IDs. e.g. "
780
+ "188,320,500. These will be given preference over the related posts generated "
781
+ "by the plugin."
782
  msgstr ""
783
 
784
+ #: includes/admin/modules/metabox.php:125
785
  msgid ""
786
+ "Once you enter the list above and save this page, the plugin will display "
787
+ "the titles of the posts below for your reference. Only IDs corresponding to "
788
+ "published posts or custom post types will be retained."
 
789
  msgstr ""
790
 
791
+ #: includes/admin/modules/metabox.php:141
792
  #, php-format
793
+ msgid "This post type is: %s"
794
  msgstr ""
795
 
796
+ #: includes/admin/modules/metabox.php:152
797
+ msgid "Location of thumbnail"
798
  msgstr ""
799
 
800
+ #: includes/admin/modules/metabox.php:154
801
  msgid ""
802
+ "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
803
+ "image will be used for the post. It will be resized to the thumbnail size "
804
+ "set under Settings &raquo; Related Posts &raquo; Output Options"
805
  msgstr ""
806
 
807
+ #: includes/admin/modules/metabox.php:155
808
+ msgid "The URL above is saved in the meta field:"
809
  msgstr ""
810
 
811
+ #: includes/admin/modules/metabox.php:160
 
812
  msgid ""
813
+ "You have Top 10 WordPress Plugin installed. If you are trying to modify the "
814
+ "thumbnail, then you'll need to make the same change in the Top 10 meta box "
815
+ "on this page."
816
  msgstr ""
817
 
818
+ #: includes/admin/modules/tools.php:32
819
+ msgid "Old settings key does not exist"
 
 
 
820
  msgstr ""
821
 
822
+ #: includes/admin/modules/tools.php:35
823
+ msgid "Old settings key has been deleted"
824
  msgstr ""
825
 
826
+ #: includes/admin/modules/tools.php:43
827
+ msgid "Indices have been recreated"
828
  msgstr ""
829
 
830
+ #: includes/admin/modules/tools.php:53
831
+ msgid "Visit the Settings page"
832
  msgstr ""
833
 
834
+ #: includes/admin/modules/tools.php:65 includes/admin/modules/tools.php:67
835
+ msgid "Clear cache"
836
  msgstr ""
837
 
838
+ #: includes/admin/modules/tools.php:70
839
+ msgid ""
840
+ "Clear the Contextual Related Posts cache. This will also be cleared "
841
+ "automatically when you save the settings page."
842
  msgstr ""
843
 
844
+ #: includes/admin/modules/tools.php:73 includes/admin/modules/tools.php:75
845
+ msgid "Recreate Indices"
846
  msgstr ""
847
 
848
+ #: includes/admin/modules/tools.php:78
 
849
  msgid ""
850
+ "Deletes and recreates the FULLTEXT index in the posts table. If the above "
851
+ "function gives an error, then you can run the below code in phpMyAdmin or "
852
+ "Adminer. Remember to backup your database first!"
853
  msgstr ""
854
 
855
+ #: includes/admin/modules/tools.php:84
856
+ msgid "Other tools"
857
  msgstr ""
858
 
859
+ #: includes/admin/modules/tools.php:86
860
+ msgid "Delete old settings"
 
 
861
  msgstr ""
862
 
863
+ #: includes/admin/modules/tools.php:86
864
+ msgid "This will delete the settings before v2.6.x. Proceed?"
865
  msgstr ""
866
 
867
+ #: includes/admin/modules/tools.php:89
868
  msgid ""
869
+ "From v2.6.x, Contextual Related Posts stores the settings in a new key in "
870
+ "the database. This will delete the old settings for the current blog. It is "
871
+ "recommended that you do this at the earliest after upgrade. However, you "
872
+ "should do this only if you are comfortable with the new settings."
873
  msgstr ""
874
 
875
+ #: includes/admin/save-settings.php:51
876
+ msgid ""
877
+ "Settings have been reset to their default values. Reload this page to view "
878
+ "the updated settings"
879
  msgstr ""
880
 
881
+ #: includes/admin/save-settings.php:119
882
+ msgid "Settings updated."
883
+ msgstr ""
884
+
885
+ #: includes/admin/save-settings.php:123
886
  msgid ""
887
+ "Post author, excerpt and date disabled. Thumbnail location set to inline "
888
+ "before text."
889
  msgstr ""
890
 
891
+ #: includes/admin/save-settings.php:127
892
+ msgid "Thumbnail location set to text only."
893
  msgstr ""
894
 
895
+ #: includes/admin/settings-page.php:32
896
+ msgid "Contextual Related Posts Settings"
 
 
 
897
  msgstr ""
898
 
899
+ #: includes/admin/settings-page.php:36
900
+ msgid "Visit the Tools page"
 
 
 
901
  msgstr ""
902
 
903
+ #: includes/admin/settings-page.php:74
904
+ msgid "Save Changes"
 
905
  msgstr ""
906
 
907
+ #: includes/admin/settings-page.php:83
908
+ msgid "Do you really want to reset all these settings to their default values?"
909
  msgstr ""
910
 
911
+ #: includes/admin/settings-page.php:85
912
+ msgid "Reset all settings"
 
 
 
913
  msgstr ""
914
 
915
+ #: includes/admin/settings-page.php:130
916
+ msgid "List tuning"
917
  msgstr ""
918
 
919
+ #: includes/admin/settings-page.php:131
920
+ msgid "Output"
921
+ msgstr ""
922
+
923
+ #: includes/admin/settings-page.php:134
924
+ msgid "Feed"
925
+ msgstr ""
926
+
927
+ #: includes/admin/settings-page.php:159
928
+ #, php-format
929
  msgid ""
930
+ "The callback function used for the <strong>%s</strong> setting is missing."
 
 
931
  msgstr ""
932
 
933
+ #: includes/admin/settings-page.php:316
934
+ msgid "Modified from default setting"
935
+ msgstr ""
936
+
937
+ #: includes/admin/sidebar.php:20
938
  msgid "Support the development"
939
  msgstr ""
940
 
941
+ #: includes/admin/sidebar.php:27
942
  msgid "Donation for Contextual Related Posts"
943
  msgstr ""
944
 
945
+ #: includes/admin/sidebar.php:29
946
+ msgid "Enter amount in USD"
947
  msgstr ""
948
 
949
+ #: includes/admin/sidebar.php:33
950
  msgid "Send your donation to the author of"
951
  msgstr ""
952
 
953
+ #: includes/admin/sidebar.php:44
954
  msgid "Quick links"
955
  msgstr ""
956
 
957
+ #: includes/admin/sidebar.php:50
958
+ msgid "Contextual Related Posts plugin homepage"
 
 
 
 
959
  msgstr ""
960
 
961
+ #: includes/admin/sidebar.php:55
962
  msgid "FAQ"
963
  msgstr ""
964
 
965
+ #: includes/admin/sidebar.php:65
966
  msgid "Reviews"
967
  msgstr ""
968
 
969
+ #: includes/admin/sidebar.php:70
970
  msgid "Github repository"
971
  msgstr ""
972
 
973
+ #: includes/admin/sidebar.php:75
974
  msgid "Other plugins"
975
  msgstr ""
976
 
977
+ #: includes/admin/sidebar.php:80
978
  msgid "Ajay's blog"
979
  msgstr ""
980
 
981
+ #: includes/admin/sidebar.php:93
982
+ msgid "Follow me"
983
  msgstr ""
984
 
985
+ #: includes/deprecated.php:183
986
  msgid "<h3>Related Posts:</h3>"
987
  msgstr ""
988
 
 
 
 
 
989
  #: includes/main-query.php:195
990
  #, php-format
991
  msgid "Powered by <a href=\"%s\" rel=\"nofollow\">Contextual Related Posts</a>"
992
  msgstr ""
993
 
994
+ #: includes/media.php:69
995
  msgid "thumb_timthumb argument has been deprecated"
996
  msgstr ""
997
 
998
+ #: includes/media.php:73
999
  msgid "thumb_timthumb_q argument has been deprecated"
1000
  msgstr ""
1001
 
1002
+ #: includes/media.php:77
1003
  msgid "filter argument has been deprecated"
1004
  msgstr ""
1005
 
1023
  msgid "Offset"
1024
  msgstr ""
1025
 
1026
+ #: includes/modules/class-crp-widget.php:93
1027
  msgid " Show excerpt?"
1028
  msgstr ""
1029
 
1030
+ #: includes/modules/class-crp-widget.php:98
1031
  msgid " Show author?"
1032
  msgstr ""
1033
 
1034
+ #: includes/modules/class-crp-widget.php:103
1035
  msgid " Show date?"
1036
  msgstr ""
1037
 
1038
+ #: includes/modules/class-crp-widget.php:107
1039
+ msgid "Thumbnail options"
1040
+ msgstr ""
1041
+
1042
+ #: includes/modules/class-crp-widget.php:109
1043
  msgid "Thumbnails inline, before title"
1044
  msgstr ""
1045
 
1046
+ #: includes/modules/class-crp-widget.php:110
1047
  msgid "Thumbnails inline, after title"
1048
  msgstr ""
1049
 
1050
+ #: includes/modules/class-crp-widget.php:111
1051
  msgid "Only thumbnails, no text"
1052
  msgstr ""
1053
 
1054
+ #: includes/modules/class-crp-widget.php:112
1055
  msgid "No thumbnails, only text."
1056
  msgstr ""
1057
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
  #: includes/output-generator.php:239
1059
  msgid " by "
1060
  msgstr ""
languages/contextual-related-posts-en_US.pot CHANGED
@@ -3,9 +3,9 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Contextual Related Posts\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2019-01-23 00:17+0000\n"
7
  "PO-Revision-Date: \n"
8
- "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
9
  "Language-Team: plugins@webberzone.com\n"
10
  "Language: en\n"
11
  "MIME-Version: 1.0\n"
@@ -18,874 +18,988 @@ msgstr ""
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
- #: admin/admin.php:234
22
- msgid "Options saved successfully. If enabled, the cache has been cleared."
23
  msgstr ""
24
 
25
- #: admin/admin.php:237
26
- msgid ""
27
- "Rounded Thumbnails style selected. Author, Excerpt and Date will not be "
28
- "displayed."
29
  msgstr ""
30
 
31
- #: admin/admin.php:240
32
- msgid "Text Only style selected. Thumbnails will not be displayed."
33
  msgstr ""
34
 
35
- #: admin/admin.php:244
 
 
 
 
 
 
 
 
36
  #, php-format
37
- msgid "Pre-built thumbnail size selected. Thumbnail set to %1$d x %2$d."
 
 
 
38
  msgstr ""
39
 
40
- #: admin/admin.php:279
41
- msgid "Options set to Default."
42
  msgstr ""
43
 
44
- #: admin/admin.php:288
45
- msgid "Index recreated"
 
 
46
  msgstr ""
47
 
48
- #: admin/admin.php:305
49
- msgid "Related Posts"
50
  msgstr ""
51
 
52
- #: admin/cache.php:49
 
53
  msgid ""
54
- "An error occurred clearing the cache. Please contact your site administrator."
55
- "\\n\\nError message:\\n"
56
  msgstr ""
57
 
58
- #: admin/cache.php:58
59
- msgid " cached row(s) cleared"
60
  msgstr ""
61
 
62
- #: admin/loader.php:24
63
- msgid "Settings"
64
  msgstr ""
65
 
66
- #: admin/loader.php:47 admin/sidebar-view.php:48
67
- msgid "Support"
68
  msgstr ""
69
 
70
- #: admin/loader.php:48
71
- msgid "Donate"
72
  msgstr ""
73
 
74
- #: admin/loader.php:49
75
- msgid "Contribute"
76
  msgstr ""
77
 
78
- #: admin/main-view.php:32 admin/main-view.php:55
79
- msgid "General options"
80
  msgstr ""
81
 
82
- #: admin/main-view.php:33 admin/main-view.php:163
83
- msgid "List tuning options"
84
  msgstr ""
85
 
86
- #: admin/main-view.php:34 admin/main-view.php:273
87
- msgid "Output options"
88
  msgstr ""
89
 
90
- #: admin/main-view.php:35 admin/main-view.php:477
91
- #: includes/modules/class-crp-widget.php:122
92
- msgid "Thumbnail options"
 
 
93
  msgstr ""
94
 
95
- #: admin/main-view.php:36 admin/main-view.php:658
96
- msgid "Styles"
97
  msgstr ""
98
 
99
- #: admin/main-view.php:37 admin/main-view.php:750
100
- msgid "Feed options"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  msgstr ""
102
 
103
- #: admin/main-view.php:54 admin/main-view.php:162 admin/main-view.php:272
104
- #: admin/main-view.php:476 admin/main-view.php:657 admin/main-view.php:749
105
- #: admin/sidebar-view.php:19 admin/sidebar-view.php:40
106
- #: admin/sidebar-view.php:58
107
- msgid "Click to toggle"
108
  msgstr ""
109
 
110
- #: admin/main-view.php:71
111
- msgid "Cache output?"
112
  msgstr ""
113
 
114
- #: admin/main-view.php:73
115
  msgid ""
116
- "Enabling this option will cache the related posts output when the post is "
117
- "visited the first time. The cache is cleaned when you save this page."
 
 
 
 
118
  msgstr ""
119
 
120
- #: admin/main-view.php:74
121
  msgid ""
122
- "The CRP cache works independently and in addition to any of your caching "
123
- "plugins like WP Super Cache or W3 Total Cache. It is recommended that you "
124
- "enable this on your blog."
125
  msgstr ""
126
 
127
- #: admin/main-view.php:75
128
- msgid "Clear cache"
 
 
 
 
 
 
 
129
  msgstr ""
130
 
131
- #: admin/main-view.php:79
132
- msgid "Automatically add related posts to:"
133
  msgstr ""
134
 
135
- #: admin/main-view.php:81
136
- msgid "Posts"
 
 
137
  msgstr ""
138
 
139
- #: admin/main-view.php:82
140
- msgid "Pages"
141
  msgstr ""
142
 
143
- #: admin/main-view.php:83
144
- msgid "Home page"
145
  msgstr ""
146
 
147
- #: admin/main-view.php:84
148
- msgid "Feeds"
149
  msgstr ""
150
 
151
- #: admin/main-view.php:85
152
- msgid "Category archives"
153
  msgstr ""
154
 
155
- #: admin/main-view.php:86
156
- msgid "Tag archives"
157
  msgstr ""
158
 
159
- #: admin/main-view.php:87
160
- msgid "Other archives"
161
  msgstr ""
162
 
163
- #: admin/main-view.php:88
164
- #, php-format
165
  msgid ""
166
- "If you choose to disable this, please add %1$s to your template file where "
167
- "you want it displayed"
168
  msgstr ""
169
 
170
- #: admin/main-view.php:92
171
- msgid "Display location priority:"
172
  msgstr ""
173
 
174
- #: admin/main-view.php:95
175
- msgid ""
176
- "If you select to automatically add the related posts, CRP will hook into the "
177
- "Content Filter at a priority as specified in this option."
178
  msgstr ""
179
 
180
- #: admin/main-view.php:96
181
  msgid ""
182
- "A higher number will cause the related posts to be processed later and move "
183
- "their display further down after the post content. Any number below 10 is "
184
- "not recommended."
185
  msgstr ""
186
 
187
- #: admin/main-view.php:100
188
- msgid "Insert after paragraph number"
 
 
 
 
189
  msgstr ""
190
 
191
- #: admin/main-view.php:103
192
  msgid ""
193
- "Enter 0 to display the related posts before the post content, -1 to display "
194
- "this at the end or a number to insert it after that paragraph number. If "
195
- "your post has less paragraphs, related posts will be displayed at the end."
 
 
 
 
 
 
 
196
  msgstr ""
197
 
198
- #: admin/main-view.php:107
199
- msgid "Disable on mobile devices:"
 
 
200
  msgstr ""
201
 
202
- #: admin/main-view.php:110
203
- msgid "Disable display of related posts on mobile devices"
204
  msgstr ""
205
 
206
- #: admin/main-view.php:114
207
- msgid "Disable on AMP pages:"
208
  msgstr ""
209
 
210
- #: admin/main-view.php:117
211
- msgid "Disable display of related posts on AMP pages"
212
  msgstr ""
213
 
214
- #: admin/main-view.php:121
215
- msgid "Show metabox:"
216
  msgstr ""
217
 
218
- #: admin/main-view.php:124
219
  msgid ""
220
- "This will add the Contextual Related Posts metabox on Edit Posts or Add New "
221
- "Posts screens. Also applies to Pages and Custom Post Types."
222
  msgstr ""
223
 
224
- #: admin/main-view.php:128
225
- msgid "Limit metabox to Admins only:"
226
  msgstr ""
227
 
228
- #: admin/main-view.php:131
229
  msgid ""
230
- "If this is selected, the metabox will be hidden from anyone who is not an "
231
- "Admin. Otherwise, by default, Contributors and above will be able to see the "
232
- "metabox. This applies only if the above option is selected."
233
  msgstr ""
234
 
235
- #: admin/main-view.php:135
236
- msgid "Tell the world you're using Contextual Related Posts:"
237
  msgstr ""
238
 
239
- #: admin/main-view.php:137
240
- msgid "Optional"
241
  msgstr ""
242
 
243
- #: admin/main-view.php:138
244
- msgid ""
245
- "Adds a nofollow link to Contextual Related Posts homepage as the last time "
246
- "in the list."
247
  msgstr ""
248
 
249
- #: admin/main-view.php:156 admin/main-view.php:266 admin/main-view.php:470
250
- #: admin/main-view.php:651 admin/main-view.php:743 admin/main-view.php:815
251
- #: admin/main-view.php:831
252
- msgid "Save Options"
253
  msgstr ""
254
 
255
- #: admin/main-view.php:179 admin/main-view.php:768
256
- msgid "Number of related posts to display: "
257
  msgstr ""
258
 
259
- #: admin/main-view.php:182
260
- msgid ""
261
- "Maximum number of posts that will be displayed. The actual number may be "
262
- "smaller if less related posts are found."
263
  msgstr ""
264
 
265
- #: admin/main-view.php:186
266
- msgid "Related posts should be newer than:"
 
 
267
  msgstr ""
268
 
269
- #: admin/main-view.php:188
270
- msgid "days"
271
  msgstr ""
272
 
273
- #: admin/main-view.php:189
274
  msgid ""
275
- "This sets the cutoff period for which posts will be displayed. e.g. setting "
276
  "it to 365 will show related posts from the last year only. Set to 0 to "
277
  "disable limiting posts by date."
278
  msgstr ""
279
 
280
- #: admin/main-view.php:193
281
  msgid "Randomize posts"
282
  msgstr ""
283
 
284
- #: admin/main-view.php:195
285
  msgid ""
286
  "This shuffles the top related posts. Does not work if the cache is enabled."
287
  msgstr ""
288
 
289
- #: admin/main-view.php:199
290
- msgid "Find related posts based on content as well as title:"
291
  msgstr ""
292
 
293
- #: admin/main-view.php:201
294
  msgid ""
295
- "If unchecked, only posts titles are used. I recommend using a caching plugin "
296
- "or enabling \"Cache output\" above if you enable this. Each site is "
297
- "different, so toggle this option to see which setting gives you better "
298
- "quality related posts."
299
  msgstr ""
300
 
301
- #: admin/main-view.php:205
302
- msgid "Limit content to be compared:"
303
  msgstr ""
304
 
305
- #: admin/main-view.php:207
306
  msgid ""
307
  "This sets the maximum words of the content that will be matched. Set to 0 "
308
  "for no limit. Max value: 2,000. Only applies if you activate the above "
309
  "option."
310
  msgstr ""
311
 
312
- #: admin/main-view.php:211
313
- msgid "Post types to include in results:"
 
314
  msgstr ""
315
 
316
- #: admin/main-view.php:218
317
  msgid ""
318
- "These post types will be displayed in the list. Includes custom post types."
 
 
319
  msgstr ""
320
 
321
- #: admin/main-view.php:222
322
  msgid "Limit to same post type"
323
  msgstr ""
324
 
325
- #: admin/main-view.php:224
326
  msgid ""
327
  "If checked, the related posts will only be selected from the same post type "
328
  "of the current post."
329
  msgstr ""
330
 
331
- #: admin/main-view.php:228
332
- msgid "List of post or page IDs to exclude from the results:"
333
  msgstr ""
334
 
335
- #: admin/main-view.php:230 admin/main-view.php:401
336
  msgid ""
337
- "Comma separated list of post, page or custom post type IDs. e.g. 188,320,500"
 
338
  msgstr ""
339
 
340
- #: admin/main-view.php:234
341
- msgid "Categories to exclude from the results: "
342
  msgstr ""
343
 
344
- #: admin/main-view.php:237
345
  msgid ""
346
  "Comma separated list of category slugs. The field above has an autocomplete "
347
- "so simply start typing in the beginning of your category name and it will "
348
- "prompt you with options."
349
  msgstr ""
350
 
351
- #: admin/main-view.php:240
352
- msgid "Excluded category IDs are:"
353
  msgstr ""
354
 
355
- #: admin/main-view.php:241
356
- msgid " "
357
- msgstr ""
358
-
359
- #: admin/main-view.php:246
360
- #, php-format
361
  msgid ""
362
- "These might differ from the IDs visible in the Categories page which use the "
363
- "%1$s. CRP uses the %2$s which is unique to this taxonomy."
 
 
364
  msgstr ""
365
 
366
- #: admin/main-view.php:289
367
- msgid "Title of related posts:"
 
368
  msgstr ""
369
 
370
- #: admin/main-view.php:292
371
- #, php-format
372
- msgid ""
373
- "This is the main heading of the related posts. You can also display the "
374
- "current post title by using %1$s"
375
  msgstr ""
376
 
377
- #: admin/main-view.php:296
378
- msgid "When there are no posts, what should be shown?"
 
379
  msgstr ""
380
 
381
- #: admin/main-view.php:300
382
- msgid "Blank Output"
 
383
  msgstr ""
384
 
385
- #: admin/main-view.php:305
386
- msgid "Display:"
 
387
  msgstr ""
388
 
389
- #: admin/main-view.php:311 admin/main-view.php:771
390
- msgid "Show post excerpt in list?"
391
  msgstr ""
392
 
393
- #: admin/main-view.php:314
394
- #, php-format
395
  msgid ""
396
- "Displays the excerpt of the post. If you do not provide an explicit excerpt "
397
- "to a post (in the post editor's optional excerpt field), it will display an "
398
- "automatic excerpt which refers to the first %d words of the post's content"
 
399
  msgstr ""
400
 
401
- #: admin/main-view.php:317
402
- msgid ""
403
- "Rounded Thumbnails style selected under the Custom Styles. Excerpt display "
404
- "is disabled."
405
  msgstr ""
406
 
407
- #: admin/main-view.php:322
408
- msgid "Length of excerpt (in words):"
 
 
409
  msgstr ""
410
 
411
- #: admin/main-view.php:328
412
- msgid "Show post author in list?"
 
 
413
  msgstr ""
414
 
415
- #: admin/main-view.php:331
416
- msgid "Displays the author name prefixed with \"by\". e.g. by John Doe"
417
  msgstr ""
418
 
419
- #: admin/main-view.php:334
420
  msgid ""
421
- "Rounded Thumbnails style selected under the Custom Styles. Author display is "
422
- "disabled."
423
  msgstr ""
424
 
425
- #: admin/main-view.php:339
426
- msgid "Show post date in list?"
427
  msgstr ""
428
 
429
- #: admin/main-view.php:342
430
  msgid ""
431
- "Displays the date of the post. Uses the same date format set in General "
432
- "Options"
 
 
 
 
 
433
  msgstr ""
434
 
435
- #: admin/main-view.php:345
 
 
 
 
 
 
 
 
 
 
436
  msgid ""
437
- "Rounded Thumbnails style selected under the Custom Styles. Date display is "
438
- "disabled."
439
  msgstr ""
440
 
441
- #: admin/main-view.php:350
442
- msgid "Limit post title length (in characters)"
443
  msgstr ""
444
 
445
- #: admin/main-view.php:353
446
  msgid ""
447
- "Any title longer than the number of characters set above will be cut and "
448
- "appended with an ellipsis (&hellip;)"
449
  msgstr ""
450
 
451
- #: admin/main-view.php:357
452
- msgid "Open links in new window"
453
  msgstr ""
454
 
455
- #: admin/main-view.php:363
456
- msgid "Add nofollow attribute to links in the list"
 
 
 
457
  msgstr ""
458
 
459
- #: admin/main-view.php:396
460
- msgid "Exclusion settings:"
461
  msgstr ""
462
 
463
- #: admin/main-view.php:398
464
- msgid "Exclude display of related posts on these posts / pages"
 
 
465
  msgstr ""
466
 
467
- #: admin/main-view.php:404
468
- msgid "Exclude display of related posts on these post types."
469
  msgstr ""
470
 
471
- #: admin/main-view.php:411
472
  msgid ""
473
- "The related posts will not display on any of the above selected post types"
 
474
  msgstr ""
475
 
476
- #: admin/main-view.php:441
477
- msgid "Customize the output:"
478
  msgstr ""
479
 
480
- #: admin/main-view.php:443
481
- msgid "HTML to display before the list of posts: "
482
  msgstr ""
483
 
484
- #: admin/main-view.php:446
485
- msgid "HTML to display before each list item: "
 
 
 
486
  msgstr ""
487
 
488
- #: admin/main-view.php:449
489
- msgid "HTML to display after each list item: "
490
  msgstr ""
491
 
492
- #: admin/main-view.php:452
493
- msgid "HTML to display after the list of posts: "
 
 
 
 
494
  msgstr ""
495
 
496
- #: admin/main-view.php:493 admin/main-view.php:774
497
- msgid "Location of post thumbnail:"
498
  msgstr ""
499
 
500
- #: admin/main-view.php:497 admin/main-view.php:778
501
- msgid "Display thumbnails inline with posts, before title"
502
  msgstr ""
503
 
504
- #: admin/main-view.php:502 admin/main-view.php:782
505
- msgid "Display thumbnails inline with posts, after title"
506
  msgstr ""
507
 
508
- #: admin/main-view.php:507 admin/main-view.php:786
509
- msgid "Display only thumbnails, no text"
510
  msgstr ""
511
 
512
- #: admin/main-view.php:512 admin/main-view.php:790
513
- msgid "Do not display thumbnails, only text."
514
  msgstr ""
515
 
516
- #: admin/main-view.php:516
 
 
 
 
 
 
 
517
  #, php-format
518
  msgid ""
519
- "This setting cannot be changed because an inbuilt style has been selected "
520
- "under the Styles section. If you would like to change this option, please "
521
- "select %1$s under the Styles section."
522
  msgstr ""
523
 
524
- #: admin/main-view.php:516 admin/main-view.php:677
525
- msgid "No styles"
 
 
 
526
  msgstr ""
527
 
528
- #: admin/main-view.php:520
529
- msgid "Thumbnail size:"
 
 
 
530
  msgstr ""
531
 
532
- #: admin/main-view.php:545
533
- msgid "Custom size"
 
534
  msgstr ""
535
 
536
- #: admin/main-view.php:548
537
- msgid "You can choose from existing image sizes above or create a custom size."
 
 
538
  msgstr ""
539
 
540
- #: admin/main-view.php:549
541
  msgid ""
542
- "If you choose an existing size, then the width, height and crop mode "
543
- "settings in the three options below will be automatically updated to reflect "
544
- "the correct dimensions of the setting."
 
 
 
545
  msgstr ""
546
 
547
- #: admin/main-view.php:550
548
  msgid ""
549
- "If you have chosen Custom size above, then enter the width, height and crop "
550
- "settings below. For best results, use a cropped image with the same width "
551
- "and height. The default setting is 150x150 cropped image."
552
  msgstr ""
553
 
554
- #: admin/main-view.php:551
555
  msgid ""
556
- "Any changes to the thumbnail settings doesn't automatically resize existing "
557
- "images."
558
  msgstr ""
559
 
560
- #: admin/main-view.php:554
561
- #, php-format
562
- msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
563
  msgstr ""
564
 
565
- #: admin/main-view.php:562
566
- msgid "Width of the thumbnail:"
 
 
567
  msgstr ""
568
 
569
- #: admin/main-view.php:565
570
- msgid "Height of the thumbnail: "
 
 
571
  msgstr ""
572
 
573
- #: admin/main-view.php:570
574
- msgid "Crop mode:"
575
  msgstr ""
576
 
577
- #: admin/main-view.php:574
578
  msgid ""
579
- "By default, thumbnails will be hard cropped. Uncheck this box to "
580
- "proportionately/soft crop the thumbnails."
581
  msgstr ""
582
 
583
- #: admin/main-view.php:578
584
- msgid "Generate thumbnail sizes:"
 
 
 
585
  msgstr ""
586
 
587
- #: admin/main-view.php:582
 
 
 
 
588
  msgid ""
589
- "If you select this option and Custom size is selected above, the plugin will "
590
- "register the image size with WordPress to create new thumbnails. Does not "
591
- "update old images as explained above."
592
  msgstr ""
593
 
594
- #: admin/main-view.php:586
595
- msgid "Image size attributes:"
 
 
596
  msgstr ""
597
 
598
- #: admin/main-view.php:591
599
- msgid "Style attributes. e.g."
600
  msgstr ""
601
 
602
- #: admin/main-view.php:599
603
- msgid "HTML width and height attributes. e.g."
604
  msgstr ""
605
 
606
- #: admin/main-view.php:606
607
- msgid "No HTML or Style attributes"
608
  msgstr ""
609
 
610
- #: admin/main-view.php:611
611
- msgid "Post thumbnail meta field name:"
 
 
612
  msgstr ""
613
 
614
- #: admin/main-view.php:613
615
- #, php-format
616
  msgid ""
617
- "The value of this field should contain a direct link to the image. This is "
618
- "set in the meta box in the %1$s screen."
619
  msgstr ""
620
 
621
- #: admin/main-view.php:613
622
- msgid "Add New Post"
 
 
623
  msgstr ""
624
 
625
- #: admin/main-view.php:616
626
- msgid "Extract the first image from the post?"
627
  msgstr ""
628
 
629
- #: admin/main-view.php:618
630
- msgid ""
631
- "This will only happen if there is no post thumbnail set and no image URL is "
632
- "specified in the meta field."
633
  msgstr ""
634
 
635
- #: admin/main-view.php:621
636
- msgid "Use default thumbnail?"
637
  msgstr ""
638
 
639
- #: admin/main-view.php:623
640
- msgid ""
641
- "If checked, when no thumbnail is found, show a default one from the URL "
642
- "below. If not checked and no thumbnail is found, no image will be shown."
643
  msgstr ""
644
 
645
- #: admin/main-view.php:626
646
- msgid "Default thumbnail:"
647
  msgstr ""
648
 
649
- #: admin/main-view.php:633
 
 
 
 
650
  msgid ""
651
- "The plugin will first check if the post contains a thumbnail. If it doesn't "
652
- "then it will check the meta field. If this is not available, then it will "
653
- "show the default image as specified above."
654
  msgstr ""
655
 
656
- #: admin/main-view.php:674
657
- msgid "Style of the related posts:"
658
  msgstr ""
659
 
660
- #: admin/main-view.php:679
661
- msgid "Select this option if you plan to add your own styles"
 
 
 
 
 
 
 
662
  msgstr ""
663
 
664
- #: admin/main-view.php:688
665
- msgid "Rounded Thumbnails"
 
 
 
666
  msgstr ""
667
 
668
- #: admin/main-view.php:691
669
  msgid ""
670
- "Enabling this option will turn on the thumbnails and set their width and "
671
- "height to 150px. It will also turn off the display of the author, excerpt "
672
- "and date if already enabled. Disabling this option will not revert any "
673
- "settings."
674
  msgstr ""
675
 
676
- #: admin/main-view.php:695
677
  #, php-format
678
- msgid "You can view the default style at %s"
679
  msgstr ""
680
 
681
- #: admin/main-view.php:703
682
- msgid "Text only"
683
  msgstr ""
684
 
685
- #: admin/main-view.php:705
686
  msgid ""
687
- "Enabling this option will disable thumbnails and no longer include the "
688
- "default style sheet included in the plugin."
 
689
  msgstr ""
690
 
691
- #: admin/main-view.php:720
692
- msgid "Custom CSS to add to header:"
693
  msgstr ""
694
 
695
- #: admin/main-view.php:725
696
- #, php-format
697
  msgid ""
698
- "Do not include %1$s tags. Check out the %2$s for available CSS classes to "
699
- "style."
 
700
  msgstr ""
701
 
702
- #: admin/main-view.php:766
703
- msgid ""
704
- "Below options override the related posts settings for your blog feed. These "
705
- "only apply if you have selected to add related posts to Feeds in the General "
706
- "Options tab."
707
  msgstr ""
708
 
709
- #: admin/main-view.php:794
710
- msgid "Maximum width of the thumbnail: "
711
  msgstr ""
712
 
713
- #: admin/main-view.php:797
714
- msgid "Maximum height of the thumbnail: "
715
  msgstr ""
716
 
717
- #: admin/main-view.php:832
718
- msgid "Default Options"
719
  msgstr ""
720
 
721
- #: admin/main-view.php:832
722
- msgid "Do you want to set options to Default?"
723
  msgstr ""
724
 
725
- #: admin/main-view.php:833
726
- msgid "Recreate Index"
 
 
727
  msgstr ""
728
 
729
- #: admin/main-view.php:833
730
- msgid "Are you sure you want to recreate the index?"
731
  msgstr ""
732
 
733
- #: admin/main-view.php:838
734
- #, php-format
735
  msgid ""
736
- "One or more FULLTEXT indices are missing. Please hit the %1$s at the bottom "
737
- "of the page to fix this."
 
738
  msgstr ""
739
 
740
- #: admin/main-view.php:838
741
- msgid "Recreate Index button"
742
  msgstr ""
743
 
744
- #: admin/main-view.php:843
745
- msgid ""
746
- "If the Recreate Index button fails, please run the following queries in "
747
- "phpMyAdmin or Adminer"
748
  msgstr ""
749
 
750
- #: admin/metabox.php:107
751
- msgid "Disable Related Posts display:"
752
  msgstr ""
753
 
754
- #: admin/metabox.php:110
755
  msgid ""
756
- "If this is checked, then Contextual Related Posts will not automatically "
757
- "insert the related posts at the end of post content."
 
 
758
  msgstr ""
759
 
760
- #: admin/metabox.php:114
761
- msgid "Exclude this post from the related posts list:"
 
 
762
  msgstr ""
763
 
764
- #: admin/metabox.php:117
 
 
 
 
765
  msgid ""
766
- "If this is checked, then this post will be excluded from the popular posts "
767
- "list."
768
  msgstr ""
769
 
770
- #: admin/metabox.php:121 admin/metabox.php:129
771
- msgid "Manual related posts:"
772
  msgstr ""
773
 
774
- #: admin/metabox.php:123
775
- msgid ""
776
- "Comma separated list of post, page or custom post type IDs. e.g. "
777
- "188,320,500. These will be given preference over the related posts generated "
778
- "by the plugin."
779
  msgstr ""
780
 
781
- #: admin/metabox.php:124
782
- msgid ""
783
- "Once you enter the list above and save this page, the plugin will display "
784
- "the titles of the posts below for your reference. Only IDs corresponding to "
785
- "published posts or custom post types will be retained."
786
  msgstr ""
787
 
788
- #: admin/metabox.php:140
789
- #, php-format
790
- msgid "This post type is: %s"
791
  msgstr ""
792
 
793
- #: admin/metabox.php:151
794
- msgid "Location of thumbnail"
795
  msgstr ""
796
 
797
- #: admin/metabox.php:153
798
- msgid ""
799
- "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
800
- "image will be used for the post. It will be resized to the thumbnail size "
801
- "set under Settings &raquo; Related Posts &raquo; Output Options"
802
  msgstr ""
803
 
804
- #: admin/metabox.php:154
805
- msgid "The URL above is saved in the meta field:"
806
  msgstr ""
807
 
808
- #: admin/metabox.php:159
 
 
 
 
 
 
 
 
 
809
  msgid ""
810
- "You have Top 10 WordPress Plugin installed. If you are trying to modify the "
811
- "thumbnail, then you'll need to make the same change in the Top 10 meta box "
812
- "on this page."
813
  msgstr ""
814
 
815
- #: admin/sidebar-view.php:20
 
 
 
 
816
  msgid "Support the development"
817
  msgstr ""
818
 
819
- #: admin/sidebar-view.php:27
820
  msgid "Donation for Contextual Related Posts"
821
  msgstr ""
822
 
823
- #: admin/sidebar-view.php:29
824
- msgid "Enter amount in USD:"
825
  msgstr ""
826
 
827
- #: admin/sidebar-view.php:33
828
  msgid "Send your donation to the author of"
829
  msgstr ""
830
 
831
- #: admin/sidebar-view.php:41
832
  msgid "Quick links"
833
  msgstr ""
834
 
835
- #: admin/sidebar-view.php:45
836
- msgid "WebberZone"
837
- msgstr ""
838
-
839
- #: admin/sidebar-view.php:46
840
- msgid "Plugin homepage"
841
  msgstr ""
842
 
843
- #: admin/sidebar-view.php:47
844
  msgid "FAQ"
845
  msgstr ""
846
 
847
- #: admin/sidebar-view.php:49
848
  msgid "Reviews"
849
  msgstr ""
850
 
851
- #: admin/sidebar-view.php:50
852
  msgid "Github repository"
853
  msgstr ""
854
 
855
- #: admin/sidebar-view.php:51
856
  msgid "Other plugins"
857
  msgstr ""
858
 
859
- #: admin/sidebar-view.php:52
860
  msgid "Ajay's blog"
861
  msgstr ""
862
 
863
- #: admin/sidebar-view.php:59
864
- msgid "Follow us"
865
  msgstr ""
866
 
867
- #: contextual-related-posts.php:100
868
  msgid "<h3>Related Posts:</h3>"
869
  msgstr ""
870
 
871
- #: contextual-related-posts.php:102
872
- msgid "No related posts found"
873
- msgstr ""
874
-
875
  #: includes/main-query.php:195
876
  #, php-format
877
  msgid "Powered by <a href=\"%s\" rel=\"nofollow\">Contextual Related Posts</a>"
878
  msgstr ""
879
 
880
- #: includes/media.php:65
881
  msgid "thumb_timthumb argument has been deprecated"
882
  msgstr ""
883
 
884
- #: includes/media.php:69
885
  msgid "thumb_timthumb_q argument has been deprecated"
886
  msgstr ""
887
 
888
- #: includes/media.php:73
889
  msgid "filter argument has been deprecated"
890
  msgstr ""
891
 
@@ -909,46 +1023,38 @@ msgstr ""
909
  msgid "Offset"
910
  msgstr ""
911
 
912
- #: includes/modules/class-crp-widget.php:98
913
  msgid " Show excerpt?"
914
  msgstr ""
915
 
916
- #: includes/modules/class-crp-widget.php:108
917
  msgid " Show author?"
918
  msgstr ""
919
 
920
- #: includes/modules/class-crp-widget.php:118
921
  msgid " Show date?"
922
  msgstr ""
923
 
924
- #: includes/modules/class-crp-widget.php:124
 
 
 
 
925
  msgid "Thumbnails inline, before title"
926
  msgstr ""
927
 
928
- #: includes/modules/class-crp-widget.php:125
929
  msgid "Thumbnails inline, after title"
930
  msgstr ""
931
 
932
- #: includes/modules/class-crp-widget.php:126
933
  msgid "Only thumbnails, no text"
934
  msgstr ""
935
 
936
- #: includes/modules/class-crp-widget.php:127
937
  msgid "No thumbnails, only text."
938
  msgstr ""
939
 
940
- #: includes/modules/class-crp-widget.php:132
941
- msgid "Thumbnail height"
942
- msgstr ""
943
-
944
- #: includes/modules/class-crp-widget.php:137
945
- msgid "Thumbnail width"
946
- msgstr ""
947
-
948
- #: includes/modules/class-crp-widget.php:141
949
- msgid "Post types to include"
950
- msgstr ""
951
-
952
  #: includes/output-generator.php:239
953
  msgid " by "
954
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: Contextual Related Posts\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2019-04-02 15:15+0100\n"
7
  "PO-Revision-Date: \n"
8
+ "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: plugins@webberzone.com\n"
10
  "Language: en\n"
11
  "MIME-Version: 1.0\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
+ #: includes/admin/admin.php:31
22
+ msgid "Contextual Related Posts"
23
  msgstr ""
24
 
25
+ #: includes/admin/admin.php:32 includes/admin/default-settings.php:172
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 "
45
+ "Posts</a>! Please <a href=\"%2$s\" target=\"_blank\">rate us</a> on <a href="
46
+ "\"%2$s\" target=\"_blank\">WordPress.org</a>"
47
  msgstr ""
48
 
49
+ #: includes/admin/default-settings.php:62
50
+ msgid "Enable cache"
51
  msgstr ""
52
 
53
+ #: includes/admin/default-settings.php:63
54
+ msgid ""
55
+ "Enabling this option will cache the related posts output when the post is "
56
+ "visited the first time. The cache is cleaned when you save this page."
57
  msgstr ""
58
 
59
+ #: includes/admin/default-settings.php:69
60
+ msgid "Automatically add related posts to"
61
  msgstr ""
62
 
63
+ #: includes/admin/default-settings.php:71
64
+ #, php-format
65
  msgid ""
66
+ "If you choose to disable this, please add %1$s to your template file where "
67
+ "you want it displayed"
68
  msgstr ""
69
 
70
+ #: includes/admin/default-settings.php:78
71
+ msgid "Posts"
72
  msgstr ""
73
 
74
+ #: includes/admin/default-settings.php:79
75
+ msgid "Pages"
76
  msgstr ""
77
 
78
+ #: includes/admin/default-settings.php:80
79
+ msgid "Home page"
80
  msgstr ""
81
 
82
+ #: includes/admin/default-settings.php:81
83
+ msgid "Feeds"
84
  msgstr ""
85
 
86
+ #: includes/admin/default-settings.php:82
87
+ msgid "Category archives"
88
  msgstr ""
89
 
90
+ #: includes/admin/default-settings.php:83
91
+ msgid "Tag archives"
92
  msgstr ""
93
 
94
+ #: includes/admin/default-settings.php:84
95
+ msgid "Other archives"
96
  msgstr ""
97
 
98
+ #: includes/admin/default-settings.php:89
99
+ msgid "Display location priority"
100
  msgstr ""
101
 
102
+ #: includes/admin/default-settings.php:90
103
+ msgid ""
104
+ "Select the relative position of the related posts in the post content. A "
105
+ "higher number pushes the related posts later in the content. Any number "
106
+ "below 10 is not recommended."
107
  msgstr ""
108
 
109
+ #: includes/admin/default-settings.php:96
110
+ msgid "Insert after paragraph number"
111
  msgstr ""
112
 
113
+ #: includes/admin/default-settings.php:97
114
+ msgid ""
115
+ "Enter 0 to display the related posts before the post content, -1 to display "
116
+ "this at the end or a number to insert it after that paragraph number. If "
117
+ "your post has less paragraphs, related posts will be displayed at the end."
118
+ msgstr ""
119
+
120
+ #: includes/admin/default-settings.php:104
121
+ msgid "Disable on mobile devices"
122
+ msgstr ""
123
+
124
+ #: includes/admin/default-settings.php:105
125
+ msgid ""
126
+ "Disable display of related posts on mobile devices. Might not always work "
127
+ "with caching plugins."
128
+ msgstr ""
129
+
130
+ #: includes/admin/default-settings.php:111
131
+ msgid "Disable on AMP pages"
132
  msgstr ""
133
 
134
+ #: includes/admin/default-settings.php:112
135
+ msgid "Disable display of related posts on AMP pages."
 
 
 
136
  msgstr ""
137
 
138
+ #: includes/admin/default-settings.php:118
139
+ msgid "Delete options on uninstall"
140
  msgstr ""
141
 
142
+ #: includes/admin/default-settings.php:119
143
  msgid ""
144
+ "If this is checked, all settings related to Contextual Related Posts are "
145
+ "removed from the database if you choose to uninstall/delete the plugin."
146
+ msgstr ""
147
+
148
+ #: includes/admin/default-settings.php:125
149
+ msgid "Show metabox"
150
  msgstr ""
151
 
152
+ #: includes/admin/default-settings.php:126
153
  msgid ""
154
+ "This will add the Contextual Related Posts metabox on Edit Posts or Add New "
155
+ "Posts screens. Also applies to Pages and Custom Post Types."
 
156
  msgstr ""
157
 
158
+ #: includes/admin/default-settings.php:132
159
+ msgid "Limit meta box to Admins only"
160
+ msgstr ""
161
+
162
+ #: includes/admin/default-settings.php:133
163
+ msgid ""
164
+ "If selected, the meta box will be hidden from anyone who is not an Admin. By "
165
+ "default, Contributors and above will be able to see the meta box. Applies "
166
+ "only if the above option is selected."
167
  msgstr ""
168
 
169
+ #: includes/admin/default-settings.php:139
170
+ msgid "Link to Contextual Related Posts plugin page"
171
  msgstr ""
172
 
173
+ #: includes/admin/default-settings.php:140
174
+ msgid ""
175
+ "A no-follow link to the plugin homepage will be added as the last item of "
176
+ "the related posts."
177
  msgstr ""
178
 
179
+ #: includes/admin/default-settings.php:169
180
+ msgid "Heading of posts"
181
  msgstr ""
182
 
183
+ #: includes/admin/default-settings.php:170
184
+ msgid "Displayed before the list of the posts as a master heading"
185
  msgstr ""
186
 
187
+ #: includes/admin/default-settings.php:177
188
+ msgid "Show when no posts are found"
189
  msgstr ""
190
 
191
+ #: includes/admin/default-settings.php:183
192
+ msgid "Blank output"
193
  msgstr ""
194
 
195
+ #: includes/admin/default-settings.php:184
196
+ msgid "Display custom text"
197
  msgstr ""
198
 
199
+ #: includes/admin/default-settings.php:189
200
+ msgid "Custom text"
201
  msgstr ""
202
 
203
+ #: includes/admin/default-settings.php:190
 
204
  msgid ""
205
+ "Enter the custom text that will be displayed if the second option is "
206
+ "selected above."
207
  msgstr ""
208
 
209
+ #: includes/admin/default-settings.php:192 includes/deprecated.php:185
210
+ msgid "No related posts found"
211
  msgstr ""
212
 
213
+ #: includes/admin/default-settings.php:196
214
+ #: includes/admin/default-settings.php:607
215
+ msgid "Show post excerpt"
 
216
  msgstr ""
217
 
218
+ #: includes/admin/default-settings.php:197
219
  msgid ""
220
+ "If the post does not have an excerpt, the plugin will automatically create "
221
+ "one containing the number of words specified in the next option."
 
222
  msgstr ""
223
 
224
+ #: includes/admin/default-settings.php:203
225
+ msgid "Length of excerpt (in words)"
226
+ msgstr ""
227
+
228
+ #: includes/admin/default-settings.php:212
229
+ msgid "Show date"
230
  msgstr ""
231
 
232
+ #: includes/admin/default-settings.php:213
233
  msgid ""
234
+ "Displays the date of the post. Uses the same date format set in General "
235
+ "Options."
236
+ msgstr ""
237
+
238
+ #: includes/admin/default-settings.php:219
239
+ msgid "Show author"
240
+ msgstr ""
241
+
242
+ #: includes/admin/default-settings.php:226
243
+ msgid "Limit post title length (in characters)"
244
  msgstr ""
245
 
246
+ #: includes/admin/default-settings.php:227
247
+ msgid ""
248
+ "Any title longer than the number of characters set above will be cut and "
249
+ "appended with an ellipsis (&hellip;)"
250
  msgstr ""
251
 
252
+ #: includes/admin/default-settings.php:234
253
+ msgid "Open links in new window"
254
  msgstr ""
255
 
256
+ #: includes/admin/default-settings.php:241
257
+ msgid "Add nofollow to links"
258
  msgstr ""
259
 
260
+ #: includes/admin/default-settings.php:248
261
+ msgid "Exclusion settings"
262
  msgstr ""
263
 
264
+ #: includes/admin/default-settings.php:254
265
+ msgid "Exclude display on these posts"
266
  msgstr ""
267
 
268
+ #: includes/admin/default-settings.php:255
269
  msgid ""
270
+ "Comma separated list of post, page or custom post type IDs. e.g. 188,320,500"
 
271
  msgstr ""
272
 
273
+ #: includes/admin/default-settings.php:261
274
+ msgid "Exclude display on these post types"
275
  msgstr ""
276
 
277
+ #: includes/admin/default-settings.php:262
278
  msgid ""
279
+ "The related posts will not display on any of the above selected post types."
 
 
280
  msgstr ""
281
 
282
+ #: includes/admin/default-settings.php:268
283
+ msgid "HTML to display"
284
  msgstr ""
285
 
286
+ #: includes/admin/default-settings.php:274
287
+ msgid "Before the list of posts"
288
  msgstr ""
289
 
290
+ #: includes/admin/default-settings.php:281
291
+ msgid "After the list of posts"
 
 
292
  msgstr ""
293
 
294
+ #: includes/admin/default-settings.php:288
295
+ msgid "Before each list item"
 
 
296
  msgstr ""
297
 
298
+ #: includes/admin/default-settings.php:295
299
+ msgid "After each list item"
300
  msgstr ""
301
 
302
+ #: includes/admin/default-settings.php:325
303
+ #: includes/admin/default-settings.php:598
304
+ msgid "Number of posts to display"
 
305
  msgstr ""
306
 
307
+ #: includes/admin/default-settings.php:326
308
+ msgid ""
309
+ "Maximum number of posts that will be displayed in the list. This option is "
310
+ "used if you don not specify the number of posts in the widget or shortcodes"
311
  msgstr ""
312
 
313
+ #: includes/admin/default-settings.php:334
314
+ msgid "Related posts should be newer than"
315
  msgstr ""
316
 
317
+ #: includes/admin/default-settings.php:335
318
  msgid ""
319
+ "This sets the cut-off period for which posts will be displayed. e.g. setting "
320
  "it to 365 will show related posts from the last year only. Set to 0 to "
321
  "disable limiting posts by date."
322
  msgstr ""
323
 
324
+ #: includes/admin/default-settings.php:342
325
  msgid "Randomize posts"
326
  msgstr ""
327
 
328
+ #: includes/admin/default-settings.php:343
329
  msgid ""
330
  "This shuffles the top related posts. Does not work if the cache is enabled."
331
  msgstr ""
332
 
333
+ #: includes/admin/default-settings.php:349
334
+ msgid "Related posts based on title and content"
335
  msgstr ""
336
 
337
+ #: includes/admin/default-settings.php:350
338
  msgid ""
339
+ "If unchecked, only posts titles are used. Enable the cache if enabling this "
340
+ "option for better performance. Each site is different, so toggle this option "
341
+ "to see which setting gives you better quality related posts."
 
342
  msgstr ""
343
 
344
+ #: includes/admin/default-settings.php:356
345
+ msgid "Limit content to be compared"
346
  msgstr ""
347
 
348
+ #: includes/admin/default-settings.php:357
349
  msgid ""
350
  "This sets the maximum words of the content that will be matched. Set to 0 "
351
  "for no limit. Max value: 2,000. Only applies if you activate the above "
352
  "option."
353
  msgstr ""
354
 
355
+ #: includes/admin/default-settings.php:365
356
+ #: includes/modules/class-crp-widget.php:126
357
+ msgid "Post types to include"
358
  msgstr ""
359
 
360
+ #: includes/admin/default-settings.php:366
361
  msgid ""
362
+ "At least one option should be selected above. Select which post types you "
363
+ "want to include in the list of posts. This field can be overridden using a "
364
+ "comma separated list of post types when using the manual display."
365
  msgstr ""
366
 
367
+ #: includes/admin/default-settings.php:372
368
  msgid "Limit to same post type"
369
  msgstr ""
370
 
371
+ #: includes/admin/default-settings.php:373
372
  msgid ""
373
  "If checked, the related posts will only be selected from the same post type "
374
  "of the current post."
375
  msgstr ""
376
 
377
+ #: includes/admin/default-settings.php:379
378
+ msgid "Post/page IDs to exclude"
379
  msgstr ""
380
 
381
+ #: includes/admin/default-settings.php:380
382
  msgid ""
383
+ "Comma-separated list of post or page IDs to exclude from the list. e.g. "
384
+ "188,320,500"
385
  msgstr ""
386
 
387
+ #: includes/admin/default-settings.php:386
388
+ msgid "Exclude Categories"
389
  msgstr ""
390
 
391
+ #: includes/admin/default-settings.php:387
392
  msgid ""
393
  "Comma separated list of category slugs. The field above has an autocomplete "
394
+ "so simply start typing in the starting letters and it will prompt you with "
395
+ "options. Does not support custom taxonomies."
396
  msgstr ""
397
 
398
+ #: includes/admin/default-settings.php:398
399
+ msgid "Exclude category IDs"
400
  msgstr ""
401
 
402
+ #: includes/admin/default-settings.php:399
 
 
 
 
 
403
  msgid ""
404
+ "This is a readonly field that is automatically populated based on the above "
405
+ "input when the settings are saved. These might differ from the IDs visible "
406
+ "in the Categories page which use the term_id. Contextual Related Posts uses "
407
+ "the term_taxonomy_id which is unique to this taxonomy."
408
  msgstr ""
409
 
410
+ #: includes/admin/default-settings.php:429
411
+ #: includes/admin/default-settings.php:614
412
+ msgid "Location of the post thumbnail"
413
  msgstr ""
414
 
415
+ #: includes/admin/default-settings.php:434
416
+ #: includes/admin/default-settings.php:619
417
+ msgid "Display thumbnails inline with posts, before title"
 
 
418
  msgstr ""
419
 
420
+ #: includes/admin/default-settings.php:435
421
+ #: includes/admin/default-settings.php:620
422
+ msgid "Display thumbnails inline with posts, after title"
423
  msgstr ""
424
 
425
+ #: includes/admin/default-settings.php:436
426
+ #: includes/admin/default-settings.php:621
427
+ msgid "Display only thumbnails, no text"
428
  msgstr ""
429
 
430
+ #: includes/admin/default-settings.php:437
431
+ #: includes/admin/default-settings.php:622
432
+ msgid "Do not display thumbnails, only text"
433
  msgstr ""
434
 
435
+ #: includes/admin/default-settings.php:442
436
+ msgid "Thumbnail size"
437
  msgstr ""
438
 
439
+ #: includes/admin/default-settings.php:443
 
440
  msgid ""
441
+ "You can choose from existing image sizes above or create a custom size. If "
442
+ "you have chosen Custom size above, then enter the width, height and crop "
443
+ "settings below. For best results, use a cropped image. If you change the "
444
+ "width and/or height below, existing images will not be automatically resized."
445
  msgstr ""
446
 
447
+ #: includes/admin/default-settings.php:445
448
+ #, php-format
449
+ msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
 
450
  msgstr ""
451
 
452
+ #: includes/admin/default-settings.php:455
453
+ #: includes/admin/default-settings.php:627
454
+ #: includes/modules/class-crp-widget.php:122
455
+ msgid "Thumbnail width"
456
  msgstr ""
457
 
458
+ #: includes/admin/default-settings.php:464
459
+ #: includes/admin/default-settings.php:636
460
+ #: includes/modules/class-crp-widget.php:117
461
+ msgid "Thumbnail height"
462
  msgstr ""
463
 
464
+ #: includes/admin/default-settings.php:473
465
+ msgid "Hard crop thumbnails"
466
  msgstr ""
467
 
468
+ #: includes/admin/default-settings.php:474
469
  msgid ""
470
+ "Check this box to hard crop the thumbnails. i.e. force the width and height "
471
+ "above vs. maintaining proportions."
472
  msgstr ""
473
 
474
+ #: includes/admin/default-settings.php:480
475
+ msgid "Generate thumbnail sizes"
476
  msgstr ""
477
 
478
+ #: includes/admin/default-settings.php:481
479
  msgid ""
480
+ "If you select this option and Custom size is selected above, the plugin will "
481
+ "register the image size with WordPress to create new thumbnails. Does not "
482
+ "update old images as explained above."
483
+ msgstr ""
484
+
485
+ #: includes/admin/default-settings.php:487
486
+ msgid "Thumbnail size attributes"
487
  msgstr ""
488
 
489
+ #: includes/admin/default-settings.php:493
490
+ #, php-format
491
+ msgid "Use CSS to set the width and height: e.g. %s"
492
+ msgstr ""
493
+
494
+ #: includes/admin/default-settings.php:495
495
+ #, php-format
496
+ msgid "Use HTML attributes to set the width and height: e.g. %s"
497
+ msgstr ""
498
+
499
+ #: includes/admin/default-settings.php:496
500
  msgid ""
501
+ "No width or height set. You will need to use external styles to force any "
502
+ "width or height of your choice."
503
  msgstr ""
504
 
505
+ #: includes/admin/default-settings.php:501
506
+ msgid "Thumbnail meta field name"
507
  msgstr ""
508
 
509
+ #: includes/admin/default-settings.php:502
510
  msgid ""
511
+ "The value of this field should contain the URL of the image and can be set "
512
+ "in the metabox in the Edit Post screen"
513
  msgstr ""
514
 
515
+ #: includes/admin/default-settings.php:508
516
+ msgid "Get first image"
517
  msgstr ""
518
 
519
+ #: includes/admin/default-settings.php:509
520
+ msgid ""
521
+ "The plugin will fetch the first image in the post content if this is "
522
+ "enabled. This can slow down the loading of your page if the first image in "
523
+ "the followed posts is large in file-size."
524
  msgstr ""
525
 
526
+ #: includes/admin/default-settings.php:515
527
+ msgid "Use default thumbnail?"
528
  msgstr ""
529
 
530
+ #: includes/admin/default-settings.php:516
531
+ msgid ""
532
+ "If checked, when no thumbnail is found, show a default one from the URL "
533
+ "below. If not checked and no thumbnail is found, no image will be shown."
534
  msgstr ""
535
 
536
+ #: includes/admin/default-settings.php:522 includes/admin/settings-page.php:746
537
+ msgid "Default thumbnail"
538
  msgstr ""
539
 
540
+ #: includes/admin/default-settings.php:523
541
  msgid ""
542
+ "Enter the full URL of the image that you wish to display if no thumbnail is "
543
+ "found. This image will be displayed below."
544
  msgstr ""
545
 
546
+ #: includes/admin/default-settings.php:553
547
+ msgid "Related Posts style"
548
  msgstr ""
549
 
550
+ #: includes/admin/default-settings.php:561
551
+ msgid "Custom CSS"
552
  msgstr ""
553
 
554
+ #: includes/admin/default-settings.php:563
555
+ #, php-format
556
+ msgid ""
557
+ "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
558
+ "CSS classes to style."
559
  msgstr ""
560
 
561
+ #: includes/admin/default-settings.php:592
562
+ msgid "About this tab"
563
  msgstr ""
564
 
565
+ #: includes/admin/default-settings.php:593
566
+ msgid ""
567
+ "Below options override the related posts settings for your blog feed. These "
568
+ "only apply if you have selected to add related posts to Feeds in the General "
569
+ "Options tab. It is recommended to not display thumbnails as there is no easy "
570
+ "way to style the related posts in the feed."
571
  msgstr ""
572
 
573
+ #: includes/admin/default-settings.php:711
574
+ msgid "No styles"
575
  msgstr ""
576
 
577
+ #: includes/admin/default-settings.php:712
578
+ msgid "Select this option if you plan to add your own styles"
579
  msgstr ""
580
 
581
+ #: includes/admin/default-settings.php:716
582
+ msgid "Text only"
583
  msgstr ""
584
 
585
+ #: includes/admin/default-settings.php:717
586
+ msgid "Disable thumbnails and no longer include the default style sheet"
587
  msgstr ""
588
 
589
+ #: includes/admin/default-settings.php:721
590
+ msgid "Rounded thumbnails"
591
  msgstr ""
592
 
593
+ #: includes/admin/default-settings.php:722
594
+ msgid ""
595
+ "Enabling this option will turn on the thumbnails and force their width and "
596
+ "height. It will also turn off the display of the author, excerpt and date if "
597
+ "already enabled. Disabling this option will not revert any settings."
598
+ msgstr ""
599
+
600
+ #: includes/admin/help-tab.php:35 includes/admin/help-tab.php:126
601
  #, php-format
602
  msgid ""
603
+ "For more information or how to get support visit the <a href=\"%1$s"
604
+ "\">WebberZone support site</a>."
 
605
  msgstr ""
606
 
607
+ #: includes/admin/help-tab.php:37 includes/admin/help-tab.php:128
608
+ #, php-format
609
+ msgid ""
610
+ "Support queries should be posted in the <a href=\"%1$s\">WordPress.org "
611
+ "support forums</a>."
612
  msgstr ""
613
 
614
+ #: includes/admin/help-tab.php:40 includes/admin/help-tab.php:131
615
+ #, php-format
616
+ msgid ""
617
+ "<a href=\"%1$s\">Post an issue</a> on <a href=\"%2$s\">GitHub</a> (bug "
618
+ "reports only)."
619
  msgstr ""
620
 
621
+ #: includes/admin/help-tab.php:49 includes/admin/help-tab.php:140
622
+ #: includes/admin/settings-page.php:129
623
+ msgid "General"
624
  msgstr ""
625
 
626
+ #: includes/admin/help-tab.php:51
627
+ msgid ""
628
+ "This screen provides the basic settings for configuring Contextual Related "
629
+ "Posts."
630
  msgstr ""
631
 
632
+ #: includes/admin/help-tab.php:52
633
  msgid ""
634
+ "Enable the trackers and cache, configure basic tracker settings and "
635
+ "uninstall settings."
636
+ msgstr ""
637
+
638
+ #: includes/admin/help-tab.php:59
639
+ msgid "Counter/Tracker"
640
  msgstr ""
641
 
642
+ #: includes/admin/help-tab.php:61
643
  msgid ""
644
+ "This screen provides settings to tweak the display counter and the tracker."
 
 
645
  msgstr ""
646
 
647
+ #: includes/admin/help-tab.php:62
648
  msgid ""
649
+ "Choose where to display the counter and customize the text. Select the type "
650
+ "of tracker and which user groups to track."
651
  msgstr ""
652
 
653
+ #: includes/admin/help-tab.php:69
654
+ msgid "Posts list"
 
655
  msgstr ""
656
 
657
+ #: includes/admin/help-tab.php:71
658
+ msgid ""
659
+ "This screen provides settings to tweak the output of the list of related "
660
+ "posts."
661
  msgstr ""
662
 
663
+ #: includes/admin/help-tab.php:72
664
+ msgid ""
665
+ "Set the number of posts, which categories or posts to exclude, customize "
666
+ "what to display and specific basic HTML markup used to create the posts."
667
  msgstr ""
668
 
669
+ #: includes/admin/help-tab.php:79 includes/admin/settings-page.php:132
670
+ msgid "Thumbnail"
671
  msgstr ""
672
 
673
+ #: includes/admin/help-tab.php:81
674
  msgid ""
675
+ "This screen provides settings to tweak the thumbnail that can be displayed "
676
+ "for each post in the list."
677
  msgstr ""
678
 
679
+ #: includes/admin/help-tab.php:82
680
+ msgid ""
681
+ "Set the location and size of the thumbnail. Additionally, you can choose "
682
+ "additional sources for the thumbnail i.e. a meta field, first image or a "
683
+ "default thumbnail when nothing is available."
684
  msgstr ""
685
 
686
+ #: includes/admin/help-tab.php:89 includes/admin/settings-page.php:133
687
+ msgid "Styles"
688
+ msgstr ""
689
+
690
+ #: includes/admin/help-tab.php:91
691
  msgid ""
692
+ "This screen provides options to control the look and feel of the related "
693
+ "posts list."
 
694
  msgstr ""
695
 
696
+ #: includes/admin/help-tab.php:92
697
+ msgid ""
698
+ "Choose for default set of styles or add your own custom CSS to tweak the "
699
+ "display of the posts."
700
  msgstr ""
701
 
702
+ #: includes/admin/help-tab.php:99
703
+ msgid "Maintenance"
704
  msgstr ""
705
 
706
+ #: includes/admin/help-tab.php:101
707
+ msgid "This screen provides options to control the maintenance cron."
708
  msgstr ""
709
 
710
+ #: includes/admin/help-tab.php:102
711
+ msgid "Choose how often to run maintenance and at what time of the day."
712
  msgstr ""
713
 
714
+ #: includes/admin/help-tab.php:142
715
+ msgid ""
716
+ "This screen provides some tools that help maintain certain features of "
717
+ "Contextual Related Posts."
718
  msgstr ""
719
 
720
+ #: includes/admin/help-tab.php:143
 
721
  msgid ""
722
+ "Clear the cache, reset the related posts tables plus some miscellaneous "
723
+ "fixes for older versions of Contextual Related Posts."
724
  msgstr ""
725
 
726
+ #: includes/admin/modules/cache.php:54
727
+ msgid ""
728
+ "An error occurred clearing the cache. Please contact your site administrator."
729
+ "\\n\\nError message:\\n"
730
  msgstr ""
731
 
732
+ #: includes/admin/modules/cache.php:63
733
+ msgid " cached row(s) cleared"
734
  msgstr ""
735
 
736
+ #: includes/admin/modules/loader.php:29
737
+ msgid "Settings"
 
 
738
  msgstr ""
739
 
740
+ #: includes/admin/modules/loader.php:52 includes/admin/sidebar.php:60
741
+ msgid "Support"
742
  msgstr ""
743
 
744
+ #: includes/admin/modules/loader.php:53
745
+ msgid "Donate"
 
 
746
  msgstr ""
747
 
748
+ #: includes/admin/modules/loader.php:54
749
+ msgid "Contribute"
750
  msgstr ""
751
 
752
+ #: includes/admin/modules/metabox.php:108
753
+ msgid "Disable Related Posts display:"
754
+ msgstr ""
755
+
756
+ #: includes/admin/modules/metabox.php:111
757
  msgid ""
758
+ "If this is checked, then Contextual Related Posts will not automatically "
759
+ "insert the related posts at the end of post content."
 
760
  msgstr ""
761
 
762
+ #: includes/admin/modules/metabox.php:115
763
+ msgid "Exclude this post from the related posts list:"
764
  msgstr ""
765
 
766
+ #: includes/admin/modules/metabox.php:118
767
+ msgid ""
768
+ "If this is checked, then this post will be excluded from the popular posts "
769
+ "list."
770
+ msgstr ""
771
+
772
+ #: includes/admin/modules/metabox.php:122
773
+ #: includes/admin/modules/metabox.php:130
774
+ msgid "Manual related posts:"
775
  msgstr ""
776
 
777
+ #: includes/admin/modules/metabox.php:124
778
+ msgid ""
779
+ "Comma separated list of post, page or custom post type IDs. e.g. "
780
+ "188,320,500. These will be given preference over the related posts generated "
781
+ "by the plugin."
782
  msgstr ""
783
 
784
+ #: includes/admin/modules/metabox.php:125
785
  msgid ""
786
+ "Once you enter the list above and save this page, the plugin will display "
787
+ "the titles of the posts below for your reference. Only IDs corresponding to "
788
+ "published posts or custom post types will be retained."
 
789
  msgstr ""
790
 
791
+ #: includes/admin/modules/metabox.php:141
792
  #, php-format
793
+ msgid "This post type is: %s"
794
  msgstr ""
795
 
796
+ #: includes/admin/modules/metabox.php:152
797
+ msgid "Location of thumbnail"
798
  msgstr ""
799
 
800
+ #: includes/admin/modules/metabox.php:154
801
  msgid ""
802
+ "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
803
+ "image will be used for the post. It will be resized to the thumbnail size "
804
+ "set under Settings &raquo; Related Posts &raquo; Output Options"
805
  msgstr ""
806
 
807
+ #: includes/admin/modules/metabox.php:155
808
+ msgid "The URL above is saved in the meta field:"
809
  msgstr ""
810
 
811
+ #: includes/admin/modules/metabox.php:160
 
812
  msgid ""
813
+ "You have Top 10 WordPress Plugin installed. If you are trying to modify the "
814
+ "thumbnail, then you'll need to make the same change in the Top 10 meta box "
815
+ "on this page."
816
  msgstr ""
817
 
818
+ #: includes/admin/modules/tools.php:32
819
+ msgid "Old settings key does not exist"
 
 
 
820
  msgstr ""
821
 
822
+ #: includes/admin/modules/tools.php:35
823
+ msgid "Old settings key has been deleted"
824
  msgstr ""
825
 
826
+ #: includes/admin/modules/tools.php:43
827
+ msgid "Indices have been recreated"
828
  msgstr ""
829
 
830
+ #: includes/admin/modules/tools.php:53
831
+ msgid "Visit the Settings page"
832
  msgstr ""
833
 
834
+ #: includes/admin/modules/tools.php:65 includes/admin/modules/tools.php:67
835
+ msgid "Clear cache"
836
  msgstr ""
837
 
838
+ #: includes/admin/modules/tools.php:70
839
+ msgid ""
840
+ "Clear the Contextual Related Posts cache. This will also be cleared "
841
+ "automatically when you save the settings page."
842
  msgstr ""
843
 
844
+ #: includes/admin/modules/tools.php:73 includes/admin/modules/tools.php:75
845
+ msgid "Recreate Indices"
846
  msgstr ""
847
 
848
+ #: includes/admin/modules/tools.php:78
 
849
  msgid ""
850
+ "Deletes and recreates the FULLTEXT index in the posts table. If the above "
851
+ "function gives an error, then you can run the below code in phpMyAdmin or "
852
+ "Adminer. Remember to backup your database first!"
853
  msgstr ""
854
 
855
+ #: includes/admin/modules/tools.php:84
856
+ msgid "Other tools"
857
  msgstr ""
858
 
859
+ #: includes/admin/modules/tools.php:86
860
+ msgid "Delete old settings"
 
 
861
  msgstr ""
862
 
863
+ #: includes/admin/modules/tools.php:86
864
+ msgid "This will delete the settings before v2.6.x. Proceed?"
865
  msgstr ""
866
 
867
+ #: includes/admin/modules/tools.php:89
868
  msgid ""
869
+ "From v2.6.x, Contextual Related Posts stores the settings in a new key in "
870
+ "the database. This will delete the old settings for the current blog. It is "
871
+ "recommended that you do this at the earliest after upgrade. However, you "
872
+ "should do this only if you are comfortable with the new settings."
873
  msgstr ""
874
 
875
+ #: includes/admin/save-settings.php:51
876
+ msgid ""
877
+ "Settings have been reset to their default values. Reload this page to view "
878
+ "the updated settings"
879
  msgstr ""
880
 
881
+ #: includes/admin/save-settings.php:119
882
+ msgid "Settings updated."
883
+ msgstr ""
884
+
885
+ #: includes/admin/save-settings.php:123
886
  msgid ""
887
+ "Post author, excerpt and date disabled. Thumbnail location set to inline "
888
+ "before text."
889
  msgstr ""
890
 
891
+ #: includes/admin/save-settings.php:127
892
+ msgid "Thumbnail location set to text only."
893
  msgstr ""
894
 
895
+ #: includes/admin/settings-page.php:32
896
+ msgid "Contextual Related Posts Settings"
 
 
 
897
  msgstr ""
898
 
899
+ #: includes/admin/settings-page.php:36
900
+ msgid "Visit the Tools page"
 
 
 
901
  msgstr ""
902
 
903
+ #: includes/admin/settings-page.php:74
904
+ msgid "Save Changes"
 
905
  msgstr ""
906
 
907
+ #: includes/admin/settings-page.php:83
908
+ msgid "Do you really want to reset all these settings to their default values?"
909
  msgstr ""
910
 
911
+ #: includes/admin/settings-page.php:85
912
+ msgid "Reset all settings"
 
 
 
913
  msgstr ""
914
 
915
+ #: includes/admin/settings-page.php:130
916
+ msgid "List tuning"
917
  msgstr ""
918
 
919
+ #: includes/admin/settings-page.php:131
920
+ msgid "Output"
921
+ msgstr ""
922
+
923
+ #: includes/admin/settings-page.php:134
924
+ msgid "Feed"
925
+ msgstr ""
926
+
927
+ #: includes/admin/settings-page.php:159
928
+ #, php-format
929
  msgid ""
930
+ "The callback function used for the <strong>%s</strong> setting is missing."
 
 
931
  msgstr ""
932
 
933
+ #: includes/admin/settings-page.php:316
934
+ msgid "Modified from default setting"
935
+ msgstr ""
936
+
937
+ #: includes/admin/sidebar.php:20
938
  msgid "Support the development"
939
  msgstr ""
940
 
941
+ #: includes/admin/sidebar.php:27
942
  msgid "Donation for Contextual Related Posts"
943
  msgstr ""
944
 
945
+ #: includes/admin/sidebar.php:29
946
+ msgid "Enter amount in USD"
947
  msgstr ""
948
 
949
+ #: includes/admin/sidebar.php:33
950
  msgid "Send your donation to the author of"
951
  msgstr ""
952
 
953
+ #: includes/admin/sidebar.php:44
954
  msgid "Quick links"
955
  msgstr ""
956
 
957
+ #: includes/admin/sidebar.php:50
958
+ msgid "Contextual Related Posts plugin homepage"
 
 
 
 
959
  msgstr ""
960
 
961
+ #: includes/admin/sidebar.php:55
962
  msgid "FAQ"
963
  msgstr ""
964
 
965
+ #: includes/admin/sidebar.php:65
966
  msgid "Reviews"
967
  msgstr ""
968
 
969
+ #: includes/admin/sidebar.php:70
970
  msgid "Github repository"
971
  msgstr ""
972
 
973
+ #: includes/admin/sidebar.php:75
974
  msgid "Other plugins"
975
  msgstr ""
976
 
977
+ #: includes/admin/sidebar.php:80
978
  msgid "Ajay's blog"
979
  msgstr ""
980
 
981
+ #: includes/admin/sidebar.php:93
982
+ msgid "Follow me"
983
  msgstr ""
984
 
985
+ #: includes/deprecated.php:183
986
  msgid "<h3>Related Posts:</h3>"
987
  msgstr ""
988
 
 
 
 
 
989
  #: includes/main-query.php:195
990
  #, php-format
991
  msgid "Powered by <a href=\"%s\" rel=\"nofollow\">Contextual Related Posts</a>"
992
  msgstr ""
993
 
994
+ #: includes/media.php:69
995
  msgid "thumb_timthumb argument has been deprecated"
996
  msgstr ""
997
 
998
+ #: includes/media.php:73
999
  msgid "thumb_timthumb_q argument has been deprecated"
1000
  msgstr ""
1001
 
1002
+ #: includes/media.php:77
1003
  msgid "filter argument has been deprecated"
1004
  msgstr ""
1005
 
1023
  msgid "Offset"
1024
  msgstr ""
1025
 
1026
+ #: includes/modules/class-crp-widget.php:93
1027
  msgid " Show excerpt?"
1028
  msgstr ""
1029
 
1030
+ #: includes/modules/class-crp-widget.php:98
1031
  msgid " Show author?"
1032
  msgstr ""
1033
 
1034
+ #: includes/modules/class-crp-widget.php:103
1035
  msgid " Show date?"
1036
  msgstr ""
1037
 
1038
+ #: includes/modules/class-crp-widget.php:107
1039
+ msgid "Thumbnail options"
1040
+ msgstr ""
1041
+
1042
+ #: includes/modules/class-crp-widget.php:109
1043
  msgid "Thumbnails inline, before title"
1044
  msgstr ""
1045
 
1046
+ #: includes/modules/class-crp-widget.php:110
1047
  msgid "Thumbnails inline, after title"
1048
  msgstr ""
1049
 
1050
+ #: includes/modules/class-crp-widget.php:111
1051
  msgid "Only thumbnails, no text"
1052
  msgstr ""
1053
 
1054
+ #: includes/modules/class-crp-widget.php:112
1055
  msgid "No thumbnails, only text."
1056
  msgstr ""
1057
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
  #: includes/output-generator.php:239
1059
  msgid " by "
1060
  msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ Tags: related posts, related, related articles, contextual related posts, simila
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
  Stable tag: trunk
6
- Requires at least: 4.2
7
- Tested up to: 5.0
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!
@@ -95,7 +95,7 @@ Contextual Related Posts is available for [translation directly on WordPress.org
95
  7. Default style of Related Posts
96
  8. Contextual Related Post metabox in the Edit Posts screen
97
  9. CRP Widget
98
-
99
 
100
  == Frequently Asked Questions ==
101
 
@@ -183,6 +183,21 @@ In addition to the above, the shortcode takes every option that the plugin suppo
183
 
184
  == Changelog ==
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  = 2.5.1 =
187
 
188
  * Features:
@@ -372,7 +387,7 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
372
 
373
  == Upgrade Notice ==
374
 
375
- = 2.5.1 =
376
- * New features. Upgrade highly recommended. Please do verify your settings after the upgrade.
377
  Check the Changelog for more details
378
 
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
  Stable tag: trunk
6
+ Requires at least: 4.7
7
+ Tested up to: 5.1
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!
95
  7. Default style of Related Posts
96
  8. Contextual Related Post metabox in the Edit Posts screen
97
  9. CRP Widget
98
+ 10. Tools page
99
 
100
  == Frequently Asked Questions ==
101
 
183
 
184
  == Changelog ==
185
 
186
+ = 2.6.0 =
187
+
188
+ Release post: [https://wzn.io/2JZBZJy](https://wzn.io/2JZBZJy)
189
+
190
+ * Features:
191
+ * Implemented the Settings API for handling plugin settings
192
+ * New Tools page: Recreate the indices, delete the cache and delete old settings
193
+
194
+ * Enhancements:
195
+ * `widget_title` filter includes `$instance` and `id_base` variables
196
+
197
+ * Bug fixes:
198
+ * Checked for non-zero thumbnail width and height in the widget
199
+ * More checks for PHP errors and notices
200
+
201
  = 2.5.1 =
202
 
203
  * Features:
387
 
388
  == Upgrade Notice ==
389
 
390
+ = 2.6.0 =
391
+ * Implemented Settings API. Please verify your settings after the upgrade.
392
  Check the Changelog for more details
393
 
uninstall.php CHANGED
@@ -16,11 +16,11 @@ $option_name = 'ald_crp_settings';
16
 
17
  if ( ! is_multisite() ) {
18
 
19
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related" );
20
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title" );
21
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_content" );
22
 
23
- $wpdb->query(
24
  "
25
  DELETE FROM {$wpdb->postmeta}
26
  WHERE meta_key LIKE 'crp_related_posts%'
@@ -32,7 +32,7 @@ if ( ! is_multisite() ) {
32
  } else {
33
 
34
  // Get all blogs in the network and activate plugin on each one.
35
- $blogids = $wpdb->get_col(
36
  "
37
  SELECT blog_id FROM $wpdb->blogs
38
  WHERE archived = '0' AND spam = '0' AND deleted = '0'
@@ -42,11 +42,11 @@ if ( ! is_multisite() ) {
42
  foreach ( $blogids as $blogid ) {
43
  switch_to_blog( $blogid );
44
 
45
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related" );
46
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title" );
47
- $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_content" );
48
 
49
- $wpdb->query(
50
  "
51
  DELETE FROM {$wpdb->postmeta}
52
  WHERE meta_key LIKE 'crp_related_posts%'
@@ -60,5 +60,5 @@ if ( ! is_multisite() ) {
60
  // Switch back to the current blog.
61
  restore_current_blog();
62
 
63
- }// End if().
64
 
16
 
17
  if ( ! is_multisite() ) {
18
 
19
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
20
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
21
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_content" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
22
 
23
+ $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
24
  "
25
  DELETE FROM {$wpdb->postmeta}
26
  WHERE meta_key LIKE 'crp_related_posts%'
32
  } else {
33
 
34
  // Get all blogs in the network and activate plugin on each one.
35
+ $blogids = $wpdb->get_col( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
36
  "
37
  SELECT blog_id FROM $wpdb->blogs
38
  WHERE archived = '0' AND spam = '0' AND deleted = '0'
42
  foreach ( $blogids as $blogid ) {
43
  switch_to_blog( $blogid );
44
 
45
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
46
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
47
+ $wpdb->query( "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_content" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
48
 
49
+ $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
50
  "
51
  DELETE FROM {$wpdb->postmeta}
52
  WHERE meta_key LIKE 'crp_related_posts%'
60
  // Switch back to the current blog.
61
  restore_current_blog();
62
 
63
+ }
64