Related Posts Thumbnails Plugin for WordPress - Version 1.6.2

Version Description

  • Important release, Please upgrade immediately.

=

Download this release

Release Info

Developer hiddenpearls
Plugin Icon 128x128 Related Posts Thumbnails Plugin for WordPress
Version 1.6.2
Comparing to
See all releases

Code changes from version 1.6.1 to 1.6.2

assets/css/admin.css ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #rpt_subscribe_btn{
2
+ display: block;
3
+ margin: 20px auto 0;
4
+ }
5
+ #relpoststh-settings .nav-tab-wrapper li a {
6
+ float: none;
7
+ margin:0;
8
+ padding: 7px 20px;
9
+ display: block;
10
+ height: auto;
11
+ background: none;
12
+ }
13
+ #relpoststh-settings .nav-tab-wrapper li{
14
+ margin-bottom: 0;
15
+ margin-left: -1px;
16
+ }
17
+ #relpoststh-settings::after{
18
+ display: table;
19
+ content: "";
20
+ clear: both;
21
+ }
22
+ #relpoststh-settings{
23
+ display: table;
24
+ width: calc(100% - 2px);
25
+ border:1px solid #ccc;
26
+ margin: 0;
27
+ }
28
+ .relpoststh .wpbr-tabsWrapper{
29
+ width: calc(100% - 265px);
30
+ float: left;
31
+ }
32
+ #relpoststh-settings .nav-tab-wrapper{
33
+ display: table-cell;
34
+ vertical-align: top;
35
+ width: 202px;
36
+ }
37
+ .relpoststh .form-table th:first-child{
38
+ width: 110px;
39
+ }
40
+ .relpoststh #relpoststh-settings .metabox-holder{
41
+ display: table-cell;
42
+ padding: 10px;
43
+ background: #fff;
44
+ }
45
+ #relpoststh-settings .nav-tab-wrapper li:first-child{
46
+ margin-top: -1px;
47
+ }
48
+ #relpoststh-settings .nav-tab-wrapper li a.nav-tab-active{
49
+ background: #fff;
50
+ }
51
+ #relpoststh-settings .nav-tab-wrapper li a.nav-tab-active{
52
+ border-right: transparent;
53
+ }
54
+ #relpoststh-settings .nav-tab-wrapper li:last-child a{
55
+ border-bottom: 1px solid #ccc;
56
+ }
57
+ .relpoststh #the-list .approve{
58
+ display: block;
59
+ }
60
+ .relpoststh .postbox{
61
+ padding: 10px;
62
+ }
63
+ .relpoststh .wpbr-sidebar{
64
+ width: 255px !important;
65
+ float: right;
66
+ min-width: inherit;
67
+ box-sizing: border-box;
68
+ }
69
+ .relpoststh .wpbr-sidebar .postbox{
70
+ min-width: inherit;
71
+ width: auto;
72
+ }
73
+ .relpoststh .wpbr-sidebar ul li a{
74
+ width: 100%;
75
+ display: block;
76
+ }
77
+ .relpoststh .wpbr-sidebar .wp-core-ui .button{
78
+ position: relative;
79
+ }
80
+ .relpoststh .wpbr-sidebar .dashicons{
81
+ position: absolute;
82
+ right: 10px;
83
+ margin-top: 3px;
84
+ }
85
+ .relpoststh .postbox ul li a{
86
+ position: relative;
87
+ }
88
+ .relpoststh .wpbr-button-container{
89
+ padding: 10px 0;
90
+ overflow: hidden;
91
+ }
92
+ .relpoststh .wpbr-social-links a{
93
+ text-decoration: none;
94
+ }
95
+ .relpoststh .wpbr-button-container{
96
+ padding: 10px;
97
+ overflow: hidden;
98
+ border:1px solid #ccc;
99
+ }
100
+ .relpoststh .wpbr-button-container.top{
101
+ border-bottom: 0;
102
+ }
103
+ .relpoststh .wpbr-button-container.bottom{
104
+ border-top: 0;
105
+ }
106
+ .relpoststh .wpb-rpt-settings-submit{
107
+ float:right;
108
+ }
109
+ .relpoststh .wpbr-sidebar h2{
110
+ margin: 0;
111
+ padding: 10px;
112
+ border-bottom: 1px solid #ccc;
113
+ }
114
+ .relpoststh .wpbr-sidebar ul li .twitter .dashicons {
115
+ color: #45b0e3;
116
+ }
117
+ .relpoststh .wpbr-sidebar ul li .facebook .dashicons {
118
+ color: #3b5998;
119
+ }
120
+ .relpoststh .wpbr-sidebar ul li .wordpress .dashicons {
121
+ color: #21759b;
122
+ }
123
+ .relpoststh .wpbr-sidebar ul li .rss .dashicons {
124
+ color: #FF6600;
125
+ }
126
+ #relpoststh-settings p.submit{
127
+ display: none;
128
+ }
129
+ .relpoststh #wpbr_custom_css .form-table th{
130
+ width: 0;
131
+ }
132
+ .relpoststh #wpbr_custom_css .form-table td{
133
+ width: 100%;
134
+ }
135
+ .relpoststh .wpbr-wrap:after{
136
+ content: '';
137
+ display: table;
138
+ clear: both;
139
+ }
140
+ .relpoststh .metabox-holder{
141
+ padding-top: 0 !important;
142
+ padding-right: 15px !important;
143
+ }
144
+ .relpoststh .setting-notification{
145
+ position: absolute;
146
+ width: auto;
147
+ padding: 16px 10px;
148
+ left: 0;
149
+ top: 0;
150
+ background-color: #fcf8e3;
151
+ color: #c09853;
152
+ height: 100%;
153
+ box-sizing: border-box;
154
+ display: none;
155
+ }
156
+ #relpoststh-settings .postbox{
157
+ border: 0px solid #e5e5e5;
158
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.0);
159
+ box-shadow: 0 1px 1px rgba(0,0,0,.0);
160
+ }
161
+ #relpoststh-settings .nav-tab-wrapper{
162
+ padding-top: 0;
163
+ border-bottom: 0px solid #ccc;
164
+ border-right: 1px solid #ccc;
165
+ }
166
+ #relpoststh-settings .nav-tab-wrapper li a.nav-tab-active{
167
+ margin: 0 -1px 0 0;
168
+ outline: none;
169
+ box-shadow: none;
170
+ }
171
+ #relpoststh-settings .nav-tab-wrapper .nav-tab{
172
+ border-right: 0;
173
+ }
174
+ .plugins_lists li{
175
+ padding-bottom: 12px;
176
+ line-height: 1.4;
177
+ }
178
+ .rpt-top-bar{
179
+ background: #f3fbff;
180
+ overflow: hidden;
181
+ padding: 15px 0;
182
+ }
183
+ .rpt-top-bar img{
184
+ float: left;
185
+ width: 118px;
186
+ }
187
+ .rpt-top-bar-content{
188
+ overflow: hidden;
189
+ }
190
+ .rpt-top-bar-content h3{
191
+ margin: 10px 0;
192
+ }
193
+ .rpt-top-bar-content p{
194
+ margin: 0;
195
+ }
assets/css/front.css ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .related-posts-nav {
2
+ border: 0pt none;
3
+ margin: 0pt;
4
+ padding: 0pt;
5
+ }
6
+ .related-posts-nav:after {
7
+ content: '';
8
+ display: block;
9
+ clear: both;
10
+ }
11
+ .related-posts-nav>li {
12
+ list-style: none;
13
+ padding: 0;
14
+ margin: 0;
15
+ float: left;
16
+ }
17
+ .related-posts-nav>li:after {
18
+ content: '';
19
+ display: block;
20
+ clear: both;
21
+ }
22
+ .related-posts-nav>li:before {
23
+ display: none;
24
+ }
25
+ .related-posts-nav>li>a {
26
+ border-bottom: medium none;
27
+ margin: 0pt;
28
+ padding: 6px;
29
+ display: block;
30
+ float: left;
31
+ text-decoration: none;
32
+ text-align: center;
33
+ cursor: pointer;
34
+ border-right: #ddd;
35
+ background-color: #fff;
36
+ }
37
+ .related-posts-nav>li>a:hover {
38
+ background-color: #eeeeef;
39
+ }
40
+ .related-posts-nav>li>a>.related-post-list-item-inner-container {
41
+ border: 0pt none;
42
+ margin: 0pt;
43
+ padding: 0pt;
44
+ width: 150px;
45
+ height: 225px;
46
+ }
47
+ .related-posts-nav>li>a>.related-post-list-item-inner-container>.related-post-list-item-img-container {
48
+ border: 0pt none;
49
+ margin: 0pt;
50
+ padding: 0pt;
51
+ width: 150px;
52
+ height: 150px;
53
+ background-size: cover;
54
+ background-repeat: no-repeat;
55
+ background-attachment: scroll;
56
+ background-position: 0 0;
57
+ }
58
+ .related-posts-nav>li>a>.related-post-list-item-inner-container>.related-post-list-item-text-container {
59
+ border: 0pt none;
60
+ margin: 3px 0pt 0pt;
61
+ padding: 0pt;
62
+ font-style: normal;
63
+ font-variant: normal;
64
+ font-weight: normal;
65
+ font-size: 12px;
66
+ line-height: normal;
67
+ font-stretch: normal;
68
+ color: #333333;
69
+ }
70
+ .related-post-list-item-link {
71
+ box-shadow: none !important;
72
+ }
73
+ /* Burhan */
74
+ #related_posts_thumbnails {
75
+ list-style-type: none;
76
+ list-style-position: inside;
77
+ padding: 0;
78
+ margin: 0
79
+ }
80
+ #related_posts_thumbnails li {
81
+ float: left;
82
+ padding: 0;
83
+ margin: 0;
84
+ padding: 5px;
85
+ display: block;
86
+ max-width: 100%;
87
+ }
88
+ .relpost_content {
89
+ display: block;
90
+ overflow: hidden;
91
+ font-style: normal;
92
+ font-variant: normal;
93
+ font-weight: normal;
94
+ line-height: normal;
95
+ font-stretch: normal;
96
+ -x-system-font: none;
97
+ text-decoration: none;
98
+ max-width: 100%;
99
+ }
100
+ .relpost-post-image {
101
+ padding: 0;
102
+ margin: 0;
103
+ border: 0 none;
104
+ max-width: 100%;
105
+ }
106
+ .relpost-block-container{
107
+ border: 0 none ;
108
+ margin: 0;
109
+ padding: 0;
110
+ }
111
+ .relpost-block-single{
112
+ border-bottom: medium none;
113
+ margin: 0;
114
+ padding: 6px;
115
+ display: block;
116
+ float: left;
117
+ text-decoration: none;
118
+ text-align: center;
119
+ cursor: pointer;
120
+ margin-right: -1px;
121
+ margin-bottom: 5px;
122
+ overflow: hidden;
123
+ }
124
+ .relpost-block-single-image{
125
+ border: 0 none ;
126
+ margin: 0;
127
+ padding: 0;
128
+ -moz-background-clip: border;
129
+ -moz-background-origin: padding;
130
+ -moz-background-inline-policy: continuous;
131
+ background-size: cover;
132
+ max-width: 100%;
133
+ }
134
+ .relpost-block-single-text{
135
+ border: 0 none;
136
+ margin: 3px 0 0;
137
+ padding: 0;
138
+ font-style: normal;
139
+ font-variant: normal;
140
+ font-weight: normal;
141
+ line-height: normal;
142
+ font-stretch: normal;
143
+ -x-system-font: none;
144
+ }
145
+ html[dir="rtl"] .relpost-block-single{
146
+ float: right;
147
+ }
148
+ html[dir="rtl"] #related_posts_thumbnails li{
149
+ float: right;
150
+ }
assets/images/rpt-logo.png ADDED
Binary file
assets/js/admin.js ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // IIFE - Immediately Invoked Function Expression
2
+ (function($, window, document) {
3
+
4
+
5
+ // Listen for the jQuery ready event on the document
6
+ $(function() {
7
+
8
+ // The DOM is ready!
9
+
10
+ // colorpicker
11
+ $('[name="relpoststh_background"], [name="relpoststh_hoverbackground"], [name="relpoststh_bordercolor"], [name="relpoststh_fontcolor"]').wpColorPicker();
12
+
13
+ // datepicker
14
+ $('.rpt_post_include').datepicker( {
15
+ dateFormat: 'yy-mm-dd'
16
+ } );
17
+
18
+ // Clear datepicker value
19
+ $('.rpt_clear_date').on('click', function(event) {
20
+ event.preventDefault();
21
+ $('.rpt_post_include').datepicker('setDate', null);
22
+ });
23
+
24
+
25
+ $('[name="relpoststh_number"],[name="relpoststh_customwidth"],[name="relpoststh_customheight"],[name="relpoststh_fontsize"],[name="relpoststh_textlength"],[name="relpoststh_excerptlength"],[name="relpoststh_textblockheight"]').keypress(function (e) {
26
+ //if the letter is not digit then display error and don't type anything
27
+ if (e.which !== 8 && e.which !== 0 && (e.which < 48 || e.which > 57)) {
28
+ //display error message
29
+ $(this).nextAll('.rpt-no-validate-error').show().delay(2000).fadeOut("400");
30
+ return false;
31
+ }
32
+ });
33
+
34
+
35
+ // $('#wpbr_rpt_relation_options').on('click', function(){
36
+ //
37
+ // $('.nav-tab').removeClass('nav-tab-active');
38
+ // $(this).addClass('nav-tab-active');
39
+ //
40
+ // $('#content_general_options').hide();
41
+ // $('#content_style_options').hide();
42
+ // $('#content_thumbnail_options').hide();
43
+ // $('#content_relation_options').show();
44
+ //
45
+ // });
46
+ //
47
+ // $('#wpbr_rpt_general_options').on('click', function(){
48
+ //
49
+ // $('.nav-tab').removeClass('nav-tab-active');
50
+ // $(this).addClass('nav-tab-active');
51
+ //
52
+ // $('#content_general_options').show();
53
+ // $('#content_style_options').hide();
54
+ // $('#content_thumbnail_options').hide();
55
+ // $('#content_relation_options').hide();
56
+ //
57
+ // });
58
+ //
59
+ //
60
+ // $('#wpbr_rpt_style_options').on('click', function(){
61
+ //
62
+ // $('.nav-tab').removeClass('nav-tab-active');
63
+ // $(this).addClass('nav-tab-active');
64
+ //
65
+ // $('#content_general_options').hide();
66
+ // $('#content_style_options').show();
67
+ // $('#content_thumbnail_options').hide();
68
+ // $('#content_relation_options').hide();
69
+ //
70
+ // });
71
+ //
72
+ //
73
+ // $('#wpbr_rpt_thumbnails_source').on('click', function(){
74
+ //
75
+ // $('.nav-tab').removeClass('nav-tab-active');
76
+ // $(this).addClass('nav-tab-active');
77
+ //
78
+ // $('#content_general_options').hide();
79
+ // $('#content_style_options').hide();
80
+ // $('#content_thumbnail_options').show();
81
+ // $('#content_relation_options').hide();
82
+ //
83
+ // });
84
+
85
+ // Settings Tabs
86
+ $(".select_all").click(function(){
87
+ if (this.checked) {
88
+ $(this).parent().find("div.select_specific").hide();
89
+ }
90
+ else {
91
+ $(this).parent().find("div.select_specific").show();
92
+ }
93
+ });
94
+ $('#relpoststh_thsource').change(function(){
95
+ if (this.value == 'post-thumbnails') {
96
+ $('#relpoststh-post-thumbnails').show();
97
+ $('#relpoststh-custom-field').hide();
98
+ }
99
+ else {
100
+ $('#relpoststh-post-thumbnails').hide();
101
+ $('#relpoststh-custom-field').show();
102
+ }
103
+ });
104
+ $('#relpoststh_output_style').change(function(){
105
+ if (this.value == 'list') {
106
+ $('#relpoststh_cleanhtml').show();
107
+ }
108
+ else {
109
+ $('#relpoststh_cleanhtml').hide();
110
+ }
111
+ });
112
+ $("input[name='relpoststh_relation']").change(function(){
113
+ if ($("input[name='relpoststh_relation']:checked").val() == 'custom') {
114
+ $('#custom_taxonomies').show();
115
+ }
116
+ else {
117
+ $('#custom_taxonomies').hide();
118
+ }
119
+ });
120
+
121
+ // Ajax for subsriber
122
+ $('#rpt_subscribe_btn').on('click', function(event) {
123
+ event.preventDefault();
124
+
125
+ var subscriber_mail = $('#rpt_subscribe_mail').val();
126
+ var name = $('#rpt_subscribe_name').val();
127
+ if (!subscriber_mail) {
128
+ $('.rpt_subscribe_warning').html('Please Enter Email');
129
+ return;
130
+ }
131
+
132
+ $.ajax({
133
+ url: 'https://wpbrigade.com/wp-json/wpbrigade/v1/subsribe-to-mailchimp',
134
+ type: 'POST',
135
+ data: {
136
+ subscriber_mail : subscriber_mail,
137
+ name : name,
138
+ plugin_name : 'rpt'
139
+ },
140
+ beforeSend : function() {
141
+ $('.rpt_subscribe_loader').show();
142
+ $('#rpt_subscribe_btn').attr('disabled', 'disabled');
143
+ }
144
+ })
145
+ .done(function(res) {
146
+ $('.rpt_return_message').html(res);
147
+ $('.rpt_subscribe_loader').hide();
148
+ });
149
+
150
+ });
151
+
152
+
153
+ // Switches option sections
154
+ $('#relpoststh-settings .postbox').hide();
155
+ var activetab = '';
156
+ if (typeof(localStorage) != 'undefined' ) {
157
+ activetab = localStorage.getItem("rpt-activetab");
158
+ }
159
+
160
+ //if url has section id as hash then set it as active or override the current local storage value
161
+ if(window.location.hash){
162
+ activetab = window.location.hash;
163
+ if (typeof(localStorage) != 'undefined' ) {
164
+ localStorage.setItem("rpt-activetab", activetab);
165
+ }
166
+ }
167
+
168
+ if (activetab != '' && $(activetab).length ) {
169
+ $(activetab).fadeIn();
170
+ } else {
171
+ $('#relpoststh-settings .postbox:first').fadeIn();
172
+ }
173
+ $('#relpoststh-settings .postbox .collapsed').each(function(){
174
+ $(this).find('input:checked').parent().parent().parent().nextAll().each(
175
+ function(){
176
+ if ($(this).hasClass('last')) {
177
+ $(this).removeClass('hidden');
178
+ return false;
179
+ }
180
+ $(this).filter('.hidden').removeClass('hidden');
181
+ });
182
+ });
183
+
184
+ if (activetab != '' && $(activetab + '-tab').length ) {
185
+ $(activetab + '-tab').addClass('nav-tab-active');
186
+ }
187
+ else {
188
+ $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
189
+ }
190
+ $('.nav-tab-wrapper a').click(function(evt) {
191
+ $('.nav-tab-wrapper a').removeClass('nav-tab-active');
192
+ $(this).addClass('nav-tab-active').blur();
193
+ var clicked_group = $(this).attr('href');
194
+ if (typeof(localStorage) != 'undefined' ) {
195
+ localStorage.setItem("rpt-activetab", $(this).attr('href'));
196
+ }
197
+ $('#relpoststh-settings .postbox').hide();
198
+ $(clicked_group).fadeIn();
199
+ evt.preventDefault();
200
+ });
201
+
202
+ }); // End of document ready
203
+
204
+ // The rest of the code goes here!
205
+
206
+ }(window.jQuery, window, document));
inc/rpt-deactivate-form.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .wp-rpt-hidden{
3
+ overflow: hidden;
4
+ }
5
+ .wp-rpt-popup-overlay .wp-rpt-internal-message{
6
+ margin: 3px 0 3px 22px;
7
+ display: none;
8
+ }
9
+ .wp-rpt-reason-input{
10
+ margin: 3px 0 3px 22px;
11
+ display: none;
12
+ }
13
+ .wp-rpt-reason-input input[type="text"]{
14
+ width: 100%;
15
+ display: block;
16
+ }
17
+ .wp-rpt-popup-overlay{
18
+ background: rgba(0,0,0, .8);
19
+ position: fixed;
20
+ top:0;
21
+ left: 0;
22
+ height: 100%;
23
+ width: 100%;
24
+ z-index: 1000;
25
+ overflow: auto;
26
+ visibility: hidden;
27
+ opacity: 0;
28
+ transition: opacity 0.3s ease-in-out:
29
+ }
30
+ .wp-rpt-popup-overlay.wp-rpt-active{
31
+ opacity: 1;
32
+ visibility: visible;
33
+ }
34
+ .wp-rpt-serveypanel{
35
+ width: 600px;
36
+ background: #fff;
37
+ margin: 65px auto 0;
38
+ }
39
+ .wp-rpt-popup-header{
40
+ background: #f1f1f1;
41
+ padding: 20px;
42
+ border-bottom: 1px solid #ccc;
43
+ }
44
+ .wp-rpt-popup-header h2{
45
+ margin: 0;
46
+ }
47
+ .wp-rpt-popup-body{
48
+ padding: 10px 20px;
49
+ }
50
+ .wp-rpt-popup-footer{
51
+ background: #f9f3f3;
52
+ padding: 10px 20px;
53
+ border-top: 1px solid #ccc;
54
+ }
55
+ .wp-rpt-popup-footer:after{
56
+ content:"";
57
+ display: table;
58
+ clear: both;
59
+ }
60
+ .action-btns{
61
+ float: right;
62
+ }
63
+ .wp-rpt-anonymous{
64
+ display: none;
65
+ }
66
+ .attention, .error-message {
67
+ color: red;
68
+ font-weight: 600;
69
+ display: none;
70
+ }
71
+ .wp-rpt-spinner{
72
+ display: none;
73
+ }
74
+ .wp-rpt-spinner img{
75
+ margin-top: 3px;
76
+ }
77
+
78
+ </style>
79
+
80
+ <div class="wp-rpt-popup-overlay">
81
+ <div class="wp-rpt-serveypanel">
82
+ <form action="#" method="post" id="wp-rpt-deactivate-form">
83
+ <div class="wp-rpt-popup-header">
84
+ <h2><?php _e( 'Quick feedback about Related Posts Thumbnails', 'related-posts-thumbnails' ); ?></h2>
85
+ </div>
86
+ <div class="wp-rpt-popup-body">
87
+ <h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', 'related-posts-thumbnails' ); ?></h3>
88
+ <ul id="wp-rpt-reason-list">
89
+ <li class="wp-rpt-reason" data-input-type="" data-input-placeholder="">
90
+ <label>
91
+ <span>
92
+ <input type="radio" name="wp-rpt-selected-reason" value="1">
93
+ </span>
94
+ <span><?php _e( 'I only needed the plugin for a short period', 'related-posts-thumbnails' ); ?></span>
95
+ </label>
96
+ <div class="wp-rpt-internal-message"></div>
97
+ </li>
98
+ <li class="wp-rpt-reason has-input" data-input-type="textfield">
99
+ <label>
100
+ <span>
101
+ <input type="radio" name="wp-rpt-selected-reason" value="2">
102
+ </span>
103
+ <span><?php _e( 'I found a better plugin', 'related-posts-thumbnails' ); ?></span>
104
+ </label>
105
+ <div class="wp-rpt-internal-message"></div>
106
+ <div class="wp-rpt-reason-input"><span class="message error-message"><?php _e( 'Kindly tell us the name of plugin', 'related-posts-thumbnails' ); ?></span><input type="text" name="better_plugin" placeholder="What's the plugin's name?"></div>
107
+ </li>
108
+ <li class="wp-rpt-reason" data-input-type="" data-input-placeholder="">
109
+ <label>
110
+ <span>
111
+ <input type="radio" name="wp-rpt-selected-reason" value="3">
112
+ </span>
113
+ <span><?php _e( 'The plugin broke my site', 'related-posts-thumbnails' ); ?></span>
114
+ </label>
115
+ <div class="wp-rpt-internal-message"></div>
116
+ </li>
117
+ <li class="wp-rpt-reason" data-input-type="" data-input-placeholder="">
118
+ <label>
119
+ <span>
120
+ <input type="radio" name="wp-rpt-selected-reason" value="4">
121
+ </span>
122
+ <span><?php _e( 'The plugin suddenly stopped working', 'related-posts-thumbnails' ); ?></span>
123
+ </label>
124
+ <div class="wp-rpt-internal-message"></div>
125
+ </li>
126
+ <li class="wp-rpt-reason" data-input-type="" data-input-placeholder="">
127
+ <label>
128
+ <span>
129
+ <input type="radio" name="wp-rpt-selected-reason" value="5">
130
+ </span>
131
+ <span><?php _e( 'I no longer need the plugin', 'related-posts-thumbnails' ); ?></span>
132
+ </label>
133
+ <div class="wp-rpt-internal-message"></div>
134
+ </li>
135
+ <li class="wp-rpt-reason" data-input-type="" data-input-placeholder="">
136
+ <label>
137
+ <span>
138
+ <input type="radio" name="wp-rpt-selected-reason" value="6">
139
+ </span>
140
+ <span><?php _e( "It's a temporary deactivation. I'm just debugging an issue.", 'related-posts-thumbnails' ); ?></span>
141
+ </label>
142
+ <div class="wp-rpt-internal-message"></div>
143
+ </li>
144
+ <li class="wp-rpt-reason has-input" data-input-type="textfield" >
145
+ <label>
146
+ <span>
147
+ <input type="radio" name="wp-rpt-selected-reason" value="7">
148
+ </span>
149
+ <span><?php _e( 'Other', 'related-posts-thumbnails' ); ?></span>
150
+ </label>
151
+ <div class="wp-rpt-internal-message"></div>
152
+ <div class="wp-rpt-reason-input"><span class="message error-message "><?php _e( 'Kindly tell us the reason so we can improve.', 'related-posts-thumbnails' ); ?></span><input type="text" name="other_reason" placeholder="Would you like to share what's other reason ?"></div>
153
+ </li>
154
+ </ul>
155
+ </div>
156
+ <div class="wp-rpt-popup-footer">
157
+ <label class="wp-rpt-anonymous"><input type="checkbox" /><?php _e( 'Anonymous feedback', 'related-posts-thumbnails' ); ?></label>
158
+ <input type="button" class="button button-secondary button-skip wp-rpt-popup-skip-feedback" value="Skip &amp; Deactivate" >
159
+ <div class="action-btns">
160
+ <span class="wp-rpt-spinner"><img src="<?php echo admin_url( '/images/spinner.gif' ); ?>" alt=""></span>
161
+ <input type="submit" class="button button-secondary button-deactivate wp-rpt-popup-allow-deactivate" value="Submit &amp; Deactivate" disabled="disabled">
162
+ <a href="#" class="button button-primary wp-rpt-popup-button-close"><?php _e( 'Cancel', 'related-posts-thumbnails' ); ?></a>
163
+
164
+ </div>
165
+ </div>
166
+ </form>
167
+ </div>
168
+ </div>
169
+
170
+
171
+ <script>
172
+ (function( $ ) {
173
+
174
+ $(function() {
175
+
176
+ var pluginSlug = 'related-posts-thumbnails';
177
+ // Code to fire when the DOM is ready.
178
+
179
+ $(document).on('click', 'tr[data-slug="' + pluginSlug + '"] .deactivate', function(e){
180
+ e.preventDefault();
181
+
182
+ $('.wp-rpt-popup-overlay').addClass('wp-rpt-active');
183
+ $('body').addClass('wp-rpt-hidden');
184
+ });
185
+ $(document).on('click', '.wp-rpt-popup-button-close', function () {
186
+ close_popup();
187
+ });
188
+ $(document).on('click', ".wp-rpt-serveypanel,tr[data-slug='" + pluginSlug + "'] .deactivate",function(e){
189
+ e.stopPropagation();
190
+ });
191
+
192
+ $(document).click(function(){
193
+ close_popup();
194
+ });
195
+ $('.wp-rpt-reason label').on('click', function(){
196
+ if($(this).find('input[type="radio"]').is(':checked')){
197
+ //$('.wp-rpt-anonymous').show();
198
+ $(this).next().next('.wp-rpt-reason-input').show().end().end().parent().siblings().find('.wp-rpt-reason-input').hide();
199
+ }
200
+ });
201
+ $('input[type="radio"][name="wp-rpt-selected-reason"]').on('click', function(event) {
202
+ $(".wp-rpt-popup-allow-deactivate").removeAttr('disabled');
203
+ });
204
+ $(document).on('submit', '#wp-rpt-deactivate-form', function(event) {
205
+ event.preventDefault();
206
+
207
+ var _reason = $(this).find('input[type="radio"][name="wp-rpt-selected-reason"]:checked').val();
208
+ var _reason_details = '';
209
+ if ( _reason == 2 ) {
210
+ _reason_details = $(this).find("input[type='text'][name='better_plugin']").val();
211
+ } else if ( _reason == 7 ) {
212
+ _reason_details = $(this).find("input[type='text'][name='other_reason']").val();
213
+ }
214
+
215
+ if ( ( _reason == 7 || _reason == 2 ) && _reason_details == '' ) {
216
+ $('.message.error-message').show();
217
+ return ;
218
+ }
219
+
220
+ $.ajax({
221
+ url: ajaxurl,
222
+ type: 'POST',
223
+ data: {
224
+ action : 'rpt_deactivate',
225
+ reason : _reason,
226
+ reason_detail : _reason_details,
227
+ },
228
+ beforeSend: function(){
229
+ $(".wp-rpt-spinner").show();
230
+ $(".wp-rpt-popup-allow-deactivate").attr("disabled", "disabled");
231
+ }
232
+ })
233
+ .done(function() {
234
+ $(".wp-rpt-spinner").hide();
235
+ // $(".wp-rpt-popup-allow-deactivate").removeAttr("disabled");
236
+ window.location.href = $("tr[data-slug='"+ pluginSlug +"'] .deactivate a").attr('href');
237
+ });
238
+
239
+ });
240
+
241
+ $('.wp-rpt-popup-skip-feedback').on('click', function(e){
242
+ window.location.href = $("tr[data-slug='"+ pluginSlug +"'] .deactivate a").attr('href');
243
+ })
244
+
245
+ function close_popup() {
246
+ $('.wp-rpt-popup-overlay').removeClass('wp-rpt-active');
247
+ $('#wp-rpt-deactivate-form').trigger("reset");
248
+ $(".wp-rpt-popup-allow-deactivate").attr('disabled', 'disabled');
249
+ $(".wp-rpt-reason-input").hide();
250
+ $('body').removeClass('wp-rpt-hidden');
251
+ $('.message.error-message').hide();
252
+ }
253
+ });
254
+
255
+ })( jQuery ); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code.
256
+ </script>
inc/rpt-settings.php ADDED
@@ -0,0 +1,666 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Admin interface
4
+ if ( isset( $_POST['action'] ) && ($_POST['action'] == 'update') ) {
5
+ if ( ! current_user_can( 'manage_options' ) ) {
6
+ wp_die( __( 'No access', 'related-posts-thumbnails' ) );
7
+ }
8
+ check_admin_referer( 'related-posts-thumbnails' );
9
+ $validation = true;
10
+
11
+ $set_date = isset( $_POST['rpt_post_include'] ) ? sanitize_text_field( wp_unslash( $_POST['rpt_post_include'] ) ) : '';
12
+
13
+ if ( $validation ) {
14
+
15
+ if ( isset( $_POST['relpoststh_single_only'] ) ) {
16
+ update_option( 'relpoststh_single_only', sanitize_text_field( wp_unslash( $_POST['relpoststh_single_only'] ) ) );
17
+ } else {
18
+ update_option( 'relpoststh_single_only', '0' );
19
+ }
20
+
21
+ if ( isset( $_POST['relpoststh_post_types'] ) ) {
22
+ update_option( 'relpoststh_post_types', array_map( 'sanitize_text_field', wp_unslash( $_POST['relpoststh_post_types'] ) ) );
23
+ } else {
24
+ update_option( 'relpoststh_post_types', array() );
25
+ }
26
+
27
+ if ( isset( $_POST['onlywiththumbs'] ) ) {
28
+ update_option( 'relpoststh_onlywiththumbs', sanitize_text_field( wp_unslash( $_POST['onlywiththumbs'] ) ) );
29
+ } else {
30
+ update_option( 'relpoststh_onlywiththumbs', '0' );
31
+ }
32
+
33
+ if ( isset( $_POST['relpoststh_output_style'] ) ) {
34
+ update_option( 'relpoststh_output_style', sanitize_text_field( wp_unslash( $_POST['relpoststh_output_style'] ) ) );
35
+ }
36
+
37
+ if ( isset( $_POST['relpoststh_cleanhtml'] ) ) {
38
+ update_option( 'relpoststh_cleanhtml', sanitize_text_field( wp_unslash( $_POST['relpoststh_cleanhtml'] ) ) );
39
+ } else {
40
+ update_option( 'relpoststh_cleanhtml', '0' );
41
+ }
42
+
43
+ if ( isset( $_POST['relpoststh_auto'] ) ) {
44
+ update_option( 'relpoststh_auto', sanitize_text_field( wp_unslash( $_POST['relpoststh_auto'] ) ) );
45
+ } else {
46
+ update_option( 'relpoststh_auto', '0' );
47
+ }
48
+
49
+ if ( isset( $_POST['relpoststh_top_text'] ) ) {
50
+ update_option( 'relpoststh_top_text', wp_kses( $_POST['relpoststh_top_text'], $this->wp_kses_rp_args ) );
51
+ }
52
+
53
+
54
+ if ( isset( $_POST['relpoststh_number'] ) ) {
55
+ update_option( 'relpoststh_number', absint( $_POST['relpoststh_number'] ) );
56
+ }
57
+
58
+ if ( isset( $_POST['relpoststh_relation'] ) ) {
59
+ update_option( 'relpoststh_relation', sanitize_text_field( wp_unslash( $_POST['relpoststh_relation'] ) ) );
60
+ }
61
+
62
+ if ( isset( $_POST['relpoststh_default_image'] ) ) {
63
+ update_option( 'relpoststh_default_image', sanitize_text_field( wp_unslash( $_POST['relpoststh_default_image'] ) ) );
64
+ }
65
+
66
+ if ( isset( $_POST['relpoststh_poststhname'] ) ) {
67
+ update_option( 'relpoststh_poststhname', sanitize_text_field( wp_unslash( $_POST['relpoststh_poststhname'] ) ) );
68
+ }
69
+
70
+ if ( isset( $_POST['relpoststh_background'] ) ) {
71
+ update_option( 'relpoststh_background', sanitize_text_field( wp_unslash( $_POST['relpoststh_background'] ) ) );
72
+ }
73
+
74
+ if ( isset( $_POST['relpoststh_hoverbackground'] ) ) {
75
+ update_option( 'relpoststh_hoverbackground', sanitize_text_field( wp_unslash( $_POST['relpoststh_hoverbackground'] ) ) );
76
+ }
77
+
78
+
79
+ if ( isset( $_POST['relpoststh_bordercolor'] ) ) {
80
+ update_option( 'relpoststh_bordercolor', sanitize_text_field( wp_unslash( $_POST['relpoststh_bordercolor'] ) ) );
81
+ }
82
+
83
+ if ( isset( $_POST['relpoststh_fontcolor'] ) ) {
84
+ update_option( 'relpoststh_fontcolor', sanitize_text_field( wp_unslash( $_POST['relpoststh_fontcolor'] ) ) );
85
+ }
86
+
87
+ if ( isset( $_POST['relpoststh_fontsize'] ) ) {
88
+ update_option( 'relpoststh_fontsize', sanitize_text_field( wp_unslash( $_POST['relpoststh_fontsize'] ) ) );
89
+ }
90
+
91
+ if ( isset( $_POST['relpoststh_fontfamily'] ) ) {
92
+ update_option( 'relpoststh_fontfamily', sanitize_text_field( wp_unslash( $_POST['relpoststh_fontfamily'] ) ) );
93
+ }
94
+
95
+ if ( isset( $_POST['relpoststh_textlength'] ) ) {
96
+ update_option( 'relpoststh_textlength', sanitize_text_field( wp_unslash( $_POST['relpoststh_textlength'] ) ) );
97
+ }
98
+
99
+ if ( isset( $_POST['relpoststh_excerptlength'] ) ) {
100
+ update_option( 'relpoststh_excerptlength', sanitize_text_field( wp_unslash( $_POST['relpoststh_excerptlength'] ) ) );
101
+ }
102
+
103
+ if ( isset( $_POST['relpoststh_thsource'] ) ) {
104
+ update_option( 'relpoststh_thsource', sanitize_text_field( wp_unslash( $_POST['relpoststh_thsource'] ) ) );
105
+ }
106
+
107
+ if ( isset( $_POST['relpoststh_customfield'] ) ) {
108
+ update_option( 'relpoststh_customfield', sanitize_text_field( wp_unslash( $_POST['relpoststh_customfield'] ) ) );
109
+ }
110
+
111
+ if ( isset( $_POST['relpoststh_theme_resize_url'] ) ) {
112
+ update_option( 'relpoststh_theme_resize_url', sanitize_text_field( wp_unslash( $_POST['relpoststh_theme_resize_url'] ) ) );
113
+ }
114
+
115
+ if ( isset( $_POST['relpoststh_customwidth'] ) ) {
116
+ update_option( 'relpoststh_customwidth', sanitize_text_field( wp_unslash( $_POST['relpoststh_customwidth'] ) ) );
117
+ }
118
+
119
+ if ( isset( $_POST['relpoststh_customheight'] ) ) {
120
+ update_option( 'relpoststh_customheight', sanitize_text_field( wp_unslash( $_POST['relpoststh_customheight'] ) ) );
121
+ }
122
+
123
+ if ( isset( $_POST['relpoststh_textblockheight'] ) ) {
124
+ update_option( 'relpoststh_textblockheight', sanitize_text_field( wp_unslash( $_POST['relpoststh_textblockheight'] ) ) );
125
+ }
126
+
127
+ if ( isset( $_POST['relpoststh_customwidth'] ) ) {
128
+ update_option( 'relpoststh_customwidth', sanitize_text_field( wp_unslash( $_POST['relpoststh_customwidth'] ) ) );
129
+ }
130
+
131
+ if ( isset( $_POST['relpoststh_categories'] ) ) {
132
+ update_option( 'relpoststh_categories', array_map( 'sanitize_text_field', wp_unslash( $_POST['relpoststh_categories'] ) ) );
133
+ } else {
134
+ update_option( 'relpoststh_categories', array() );
135
+ }
136
+
137
+ if ( isset( $_POST['relpoststh_categoriesall'] ) ) {
138
+ update_option( 'relpoststh_categoriesall', sanitize_text_field( wp_unslash( $_POST['relpoststh_categoriesall'] ) ) );
139
+ } else {
140
+ update_option( 'relpoststh_categoriesall', '' );
141
+ }
142
+
143
+ if ( isset( $_POST['relpoststh_show_categoriesall'] ) ) {
144
+ update_option( 'relpoststh_show_categoriesall', sanitize_text_field( wp_unslash( $_POST['relpoststh_show_categoriesall'] ) ) );
145
+ } else {
146
+ update_option( 'relpoststh_show_categoriesall', '' );
147
+ }
148
+
149
+ if ( isset( $_POST['relpoststh_show_categories'] ) ) {
150
+ update_option( 'relpoststh_show_categories', array_map( 'sanitize_text_field', wp_unslash( $_POST['relpoststh_show_categories'] ) ) );
151
+ } else {
152
+ update_option( 'relpoststh_show_categories', array() );
153
+ }
154
+
155
+ if ( isset( $_POST['relpoststh_devmode'] ) ) {
156
+ update_option( 'relpoststh_devmode', sanitize_text_field( wp_unslash( $_POST['relpoststh_devmode'] ) ) );
157
+ } else {
158
+ update_option( 'relpoststh_devmode', '0' );
159
+ }
160
+
161
+ update_option( 'relpoststh_startdate', $set_date );
162
+
163
+ if ( isset( $_POST['relpoststh_custom_taxonomies'] ) ) {
164
+ update_option( 'relpoststh_custom_taxonomies', array_map( 'sanitize_text_field', wp_unslash( $_POST['relpoststh_custom_taxonomies'] ) ) );
165
+ } else {
166
+ update_option( 'relpoststh_custom_taxonomies', array() );
167
+ }
168
+
169
+ echo "<div class='updated fade'><p>" . __( 'Settings updated', 'related-posts-thumbnails' ) . '</p></div>';
170
+ } else {
171
+ echo "<div class='error fade'><p>" . __( 'Settings update failed', 'related-posts-thumbnails' ) . '. ' . $error . '</p></div>';
172
+ }
173
+ }
174
+ $available_sizes = array(
175
+ 'thumbnail' => 'thumbnail',
176
+ 'medium' => 'medium',
177
+ );
178
+ if ( current_theme_supports( 'post-thumbnails' ) ) {
179
+ global $_wp_additional_image_sizes;
180
+ if ( is_array( $_wp_additional_image_sizes ) ) {
181
+ $available_sizes = array_merge( $available_sizes, $_wp_additional_image_sizes );
182
+ }
183
+ }
184
+
185
+ $relpoststh_single_only = get_option( 'relpoststh_single_only', $this->single_only );
186
+ $relpoststh_auto = get_option( 'relpoststh_auto', $this->auto );
187
+ $relpoststh_cleanhtml = get_option( 'relpoststh_cleanhtml', 0 );
188
+ $relpoststh_relation = get_option( 'relpoststh_relation', $this->relation );
189
+ $relpoststh_thsource = get_option( 'relpoststh_thsource', $this->thsource );
190
+ $relpoststh_devmode = get_option( 'relpoststh_devmode', $this->devmode );
191
+ $relpoststh_categoriesall = get_option( 'relpoststh_categoriesall', $this->categories_all );
192
+ $relpoststh_categories = get_option( 'relpoststh_categories' );
193
+ $relpoststh_show_categories = get_option( 'relpoststh_show_categories', get_option( 'relpoststh_categories' ) );
194
+ $relpoststh_show_categoriesall = get_option( 'relpoststh_show_categoriesall', $relpoststh_categoriesall );
195
+ $onlywiththumbs = get_option( 'relpoststh_onlywiththumbs', false );
196
+ $relpoststh_startdate = explode( '-', get_option( 'relpoststh_startdate' ) );
197
+ $relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
198
+ $thsources = array(
199
+ 'post-thumbnails' => __( 'Post thumbnails', 'related_posts_thumbnails' ),
200
+ 'custom-field' => __( 'Custom field', 'related_posts_thumbnails' ),
201
+ );
202
+ $categories = get_categories();
203
+ if ( $this->wp_version >= 3 ) {
204
+ $post_types = get_post_types( array( 'public' => 1 ) );
205
+ } else {
206
+ $post_types = get_post_types();
207
+ }
208
+ $relpoststh_post_types = get_option( 'relpoststh_post_types', $this->post_types );
209
+ $output_styles = array(
210
+ 'div' => __( 'Blocks', 'related-posts-thumbnails' ),
211
+ 'list' => __( 'List', 'related-posts-thumbnails' ),
212
+ );
213
+ $relation_options = array(
214
+ 'categories' => __( 'Categories', 'related-posts-thumbnails' ),
215
+ 'tags' => __( 'Tags', 'related-posts-thumbnails' ),
216
+ 'both' => __( 'Categories and Tags', 'related-posts-thumbnails' ),
217
+ 'no' => __( 'Random', 'related-posts-thumbnails' ),
218
+ 'custom' => __( 'Custom', 'related-posts-thumbnails' ),
219
+ );
220
+ if ( $this->wp_version >= 3 ) {
221
+ $custom_taxonomies = get_taxonomies( array( 'public' => 1 ) );
222
+ $relpoststh_custom_taxonomies = get_option( 'relpoststh_custom_taxonomies', $this->custom_taxonomies );
223
+ if ( ! is_array( $relpoststh_custom_taxonomies ) ) {
224
+ $relpoststh_custom_taxonomies = array();
225
+ }
226
+ } else {
227
+ $relation_options['custom'] .= ' ' . __( '(This option is available for WP v3+ only)', 'related_posts_thumbnails' );
228
+ }
229
+ ?>
230
+
231
+ <div class="wrap relpoststh">
232
+
233
+ <div class="rpt-top-bar">
234
+ <a href="https://wpbrigade.com/"><img src="<?php echo plugins_url( 'assets/images/rpt-logo.png', dirname( __FILE__ ) ); ?>" alt="Related Post Thumbnails"></a>
235
+ <div class="rpt-top-bar-content">
236
+ <h3>Related Post Thumbnails - <?php _e( 'Settings' ); ?>:</h3>
237
+ <p><?php _e( '<strong>Related Post Thumbnails</strong> by <strong><a href="https://wpbrigade.com/">WPBrigade</a></strong>.', 'related-posts-thumbnails' ); ?></p>
238
+ </div>
239
+ </div>
240
+
241
+ <div class="icon32" id="icon-options-general"><br></div>
242
+ <h2><?php _e( 'Related Posts Thumbnails Settings', 'related-posts-thumbnails' ); ?></h2>
243
+
244
+ <form action="?page=related-posts-thumbnails" method="POST" style="clear:both;">
245
+ <input type="hidden" name="action" value="update" />
246
+ <?php wp_nonce_field( 'related-posts-thumbnails' ); ?>
247
+
248
+ <div class="wpbr-wrap"><div class="wpbr-tabsWrapper">
249
+ <div class="wpbr-button-container top">
250
+ <div class="setting-notification">
251
+ <?php echo __( 'Settings have changed, you should save them!' , 'related-posts-thumbnails' ); ?>
252
+ </div>
253
+ <input type="submit" name="Submit" class="wpb-rpt-settings-submit button button-primary button-big" value="<?php esc_html_e( 'Save Settings','related-posts-thumbnails' ); ?>" id="wpb_rpt_save_setting_top">
254
+ </div>
255
+
256
+ <div id="relpoststh-settings" class="">
257
+ <ul class="nav-tab-wrapper">
258
+ <li> <a href="#content_general_options" class="nav-tab" id="content_general_options-tab">General Display Options</a> </li>
259
+ <li> <a href="#content_thumbnail_options" class="nav-tab" id="content_thumbnail_options-tab">Thumbnails source</a> </li>
260
+ <li> <a href="#content_style_options" class="nav-tab" id="content_style_options-tab">Style options:</a> </li>
261
+ <li> <a href="#content_relation_options" class="nav-tab" id="content_relation_options-tab">Relation Builder Options</a> </li>
262
+ </ul>
263
+
264
+ <div class="metabox-holder">
265
+ <div class="postbox" style="padding: 20px" id="content_general_options">
266
+ <h2><?php _e( 'General Display Options', 'related-posts-thumbnails' ); ?>:</h2>
267
+
268
+ <table class="form-table">
269
+ <tr valign="top">
270
+ <th scope="row"><?php _e( 'Automatically append to the post content', 'related-posts-thumbnails' ); ?>:</th>
271
+ <td>
272
+ <input type="checkbox" name="relpoststh_auto" id="relpoststh_auto" value="1"
273
+ <?php
274
+ if ( $relpoststh_auto ) {
275
+ echo 'checked="checked"'; }
276
+ ?>
277
+ />
278
+ <label for="relpoststh_auto"><?php _e( 'Or use <b>&lt;?php get_related_posts_thumbnails(); ?&gt;</b> in the Loop', 'related-posts-thumbnails' ); ?></label><br />
279
+ </td>
280
+ </tr>
281
+ <tr valign="top">
282
+ <th scope="row"><?php _e( 'Developer mode', 'related-posts-thumbnails' ); ?>:</th>
283
+ <td>
284
+ <input type="checkbox" name="relpoststh_devmode" id="relpoststh_devmode" value="1"
285
+ <?php
286
+ if ( $relpoststh_devmode ) {
287
+ echo 'checked="checked"'; }
288
+ ?>
289
+ />
290
+ <label for="relpoststh_devmode"><?php _e( 'This will add debugging information in HTML source', 'related-posts-thumbnails' ); ?></label><br />
291
+ </td>
292
+ </tr>
293
+ <tr valign="top">
294
+ <th scope="row"><?php _e( 'Page type', 'related-posts-thumbnails' ); ?>:</th>
295
+ <td>
296
+ <input type="checkbox" name="relpoststh_single_only" id="relpoststh_single_only" value="1"
297
+ <?php
298
+ if ( $relpoststh_single_only ) {
299
+ echo 'checked="checked"'; }
300
+ ?>
301
+ />
302
+ <label for="relpoststh_single_only"><?php _e( 'Show on single posts only', 'related-posts-thumbnails' ); ?></label><br />
303
+ </td>
304
+ </tr>
305
+ <tr valign="top">
306
+ <th scope="row"><?php _e( 'Post types', 'related-posts-thumbnails' ); ?>:</th>
307
+ <td>
308
+ <?php if ( is_array( $post_types ) && count( $post_types ) ) : ?>
309
+ <?php foreach ( $post_types as $post_type ) : ?>
310
+ <input type="checkbox" name="relpoststh_post_types[]" id="pt_<?php echo $post_type; ?>" value="<?php echo $post_type; ?>"
311
+ <?php
312
+ if ( in_array( $post_type, $relpoststh_post_types ) ) {
313
+ echo 'checked="checked"'; }
314
+ ?>
315
+ />
316
+ <label for="pt_<?php echo $post_type; ?>"><?php echo $post_type; ?></label>
317
+ <?php endforeach; ?>
318
+ <?php endif; ?>
319
+ </td>
320
+ </tr>
321
+ <tr valign="top">
322
+ <th scope="row"><?php _e( 'Categories on which related thumbnails will appear', 'related-posts-thumbnails' ); ?>:</th>
323
+ <td>
324
+ <?php $this->display_categories_list( $relpoststh_categoriesall, $categories, $relpoststh_categories, 'relpoststh_categoriesall', 'relpoststh_categories' ); ?>
325
+ </td>
326
+ </tr>
327
+ <tr valign="top">
328
+ <th scope="row"><?php _e( 'Categories that will appear in related thumbnails', 'related-posts-thumbnails' ); ?>:</th>
329
+ <td>
330
+ <?php $this->display_categories_list( $relpoststh_show_categoriesall, $categories, $relpoststh_show_categories, 'relpoststh_show_categoriesall', 'relpoststh_show_categories' ); ?>
331
+ </td>
332
+ </tr>
333
+ <tr>
334
+ <th scope="row"><?php _e( 'Include only posts after', 'related-posts-thumbnails' ); ?>:</th>
335
+ <td>
336
+ <input type="text" class="rpt_post_include" name="rpt_post_include" value="<?php echo get_option( 'relpoststh_startdate' ); ?>">
337
+ <button type="button" class="rpt_clear_date">Clear</button>
338
+ <label for="relpoststh_excerptlength"><?php _e( 'Leave empty for all posts dates', 'related-posts-thumbnails' ); ?></label><br />
339
+ </td>
340
+ </tr>
341
+ <tr>
342
+ <th scope="row"><?php _e( 'Top text', 'related-posts-thumbnails' ); ?>:</th>
343
+ <td>
344
+ <input type="text" name="relpoststh_top_text" value="<?php echo stripslashes( htmlspecialchars( get_option( 'relpoststh_top_text', $this->top_text ) ) ); ?>" size="50"/>
345
+ </td>
346
+ </tr>
347
+ <tr>
348
+ <th scope="row"><?php _e( 'Number of similar posts to display', 'related-posts-thumbnails' ); ?>:</th>
349
+ <td>
350
+ <input type="text" name="relpoststh_number" value="<?php echo get_option( 'relpoststh_number', $this->number ); ?>" size="2"/>
351
+ <span class='rpt-no-validate-error' style="display:none;color:red;"><?php _e( 'Only Digits are allow', 'related-posts-thumbnails' ); ?></span>
352
+ </td>
353
+ </tr>
354
+ <tr>
355
+ <th scope="row"><?php _e( 'Default image URL', 'related-posts-thumbnails' ); ?>:</th>
356
+ <td>
357
+ <input type="text" name="relpoststh_default_image" value="<?php echo get_option( 'relpoststh_default_image', $this->default_image ); ?>" size="50"/>
358
+ </td>
359
+ </tr>
360
+ <tr>
361
+ <th scope="row"><?php _e( 'Thumbnails source', 'related-posts-thumbnails' ); ?>:</th>
362
+ <td>
363
+ <select name="relpoststh_thsource" id="relpoststh_thsource">
364
+ <?php foreach ( $thsources as $name => $title ) : ?>
365
+ <option value="<?php echo $name; ?>"
366
+ <?php
367
+ if ( $relpoststh_thsource == $name ) {
368
+ echo 'selected'; }
369
+ ?>
370
+ ><?php echo $title; ?></option>
371
+ <?php endforeach; ?>
372
+ </select>
373
+ </td>
374
+ </tr>
375
+ </table>
376
+ </div>
377
+
378
+ <div class="postbox" style="padding: 20px; display:none;" id="content_thumbnail_options">
379
+ <div style="padding: 20px" id="relpoststh-post-thumbnails"
380
+ <?php
381
+ if ( $relpoststh_thsource != 'post-thumbnails' ) :
382
+ ?>
383
+ style="display:none" <?php endif; ?>>
384
+ <h2><?php _e( 'Thumbnails source', 'related-posts-thumbnails' ); ?>:</h2>
385
+ <table class="form-table">
386
+ <tr valign="top">
387
+ <th scope="row"><?php _e( 'Post-thumbnails name', 'related-posts-thumbnails' ); ?>:</th>
388
+ <td>
389
+ <select name="relpoststh_poststhname">
390
+ <?php foreach ( $available_sizes as $size_name => $size ) : ?>
391
+ <option
392
+ <?php
393
+ if ( $size_name == get_option( 'relpoststh_poststhname', $this->poststhname ) ) {
394
+ echo 'selected'; }
395
+ ?>
396
+ ><?php echo $size_name; ?></option>
397
+ <?php endforeach; ?>
398
+ </select>
399
+ <?php if ( ! current_theme_supports( 'post-thumbnails' ) ) : ?>
400
+ (<?php _e( 'Your theme has to support post-thumbnails to have more choices', 'related-posts-thumbnails' ); ?>)
401
+ <?php endif; ?>
402
+ </td>
403
+ </tr>
404
+ <?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?>
405
+ <tr>
406
+ <th scope="row"><?php _e( 'Show posts only with thumbnails', 'related-posts-thumbnails' ); ?>:</th>
407
+ <td>
408
+ <input type="checkbox" name="onlywiththumbs" id="onlywiththumbs" value="1"
409
+ <?php
410
+ if ( $onlywiththumbs ) {
411
+ echo 'checked="checked"'; }
412
+ ?>
413
+ />
414
+ <label for="onlywiththumbs"><?php _e( 'Only posts with assigned Featured Image', 'related-posts-thumbnails' ); ?></label><br />
415
+ </td>
416
+ </tr>
417
+ <?php endif; ?>
418
+ </table>
419
+ </div>
420
+ <div style="padding: 20px" id="relpoststh-custom-field"
421
+ <?php
422
+ if ( $relpoststh_thsource != 'custom-field' ) :
423
+ ?>
424
+ style="display:none" <?php endif; ?>>
425
+ <h2><?php _e( 'Thumbnails source', 'related-posts-thumbnails' ); ?>:</h2>
426
+ <table class="form-table">
427
+ <tr valign="top">
428
+ <th scope="row"><?php _e( 'Custom field name', 'related-posts-thumbnails' ); ?>:</th>
429
+ <td>
430
+ <input type="text" name="relpoststh_customfield" value="<?php echo get_option( 'relpoststh_customfield', $this->custom_field ); ?>" size="50"/>
431
+ </td>
432
+ </tr>
433
+ <tr valign="top">
434
+ <th scope="row"><?php _e( 'Size', 'related-posts-thumbnails' ); ?>:</th>
435
+ <td>
436
+ <?php _e( 'Width', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_customwidth" value="<?php echo get_option( 'relpoststh_customwidth', $this->custom_width ); ?>" size="3"/>px x
437
+ <?php _e( 'Height', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_customheight" value="<?php echo get_option( 'relpoststh_customheight', $this->custom_height ); ?>" size="3"/>px
438
+ <span class='rpt-no-validate-error' style="display:none;color:red;"><?php _e( 'Only Digits are allow', 'related-posts-thumbnails' ); ?></span>
439
+ </td>
440
+ </tr>
441
+ <tr valign="top">
442
+ <th scope="row"><?php _e( 'Theme resize url', 'related-posts-thumbnails' ); ?>:</th>
443
+ <td>
444
+ <input type="text" name="relpoststh_theme_resize_url" value="<?php echo get_option( 'relpoststh_theme_resize_url', '' ); ?>" size="50"/>
445
+ (<?php _e( 'If your theme resizes images, enter URL to its resizing PHP file', 'related-posts-thumbnails' ); ?>)
446
+ </td>
447
+ </tr>
448
+ </table>
449
+ </div>
450
+ </div>
451
+
452
+ <div class="postbox" style="padding: 20px; display:none;" id="content_style_options">
453
+ <h2><?php _e( 'Style options', 'related-posts-thumbnails' ); ?>:</h2>
454
+ <table class="form-table">
455
+ <tr>
456
+ <th scope="row"><?php _e( 'Output style', 'related-posts-thumbnails' ); ?>:</th>
457
+ <td>
458
+ <select name="relpoststh_output_style" id="relpoststh_output_style">
459
+ <?php foreach ( $output_styles as $name => $title ) : ?>
460
+ <option value="<?php echo $name; ?>"
461
+ <?php
462
+ if ( $relpoststh_output_style == $name ) {
463
+ echo 'selected'; }
464
+ ?>
465
+ ><?php echo $title; ?></option>
466
+ <?php endforeach; ?>
467
+ </select>
468
+ <span id="relpoststh_cleanhtml" style="display:
469
+ <?php
470
+ if ( $relpoststh_output_style == 'list' ) {
471
+ echo 'inline';
472
+ } else {
473
+ echo 'none'; }
474
+ ?>
475
+ ;"><?php _e( 'Turn off plugin styles', 'related-posts-thumbnails' ); ?> <input type="checkbox" name="relpoststh_cleanhtml"
476
+ <?php
477
+ if ( $relpoststh_cleanhtml ) {
478
+ echo 'checked="checked"'; }
479
+ ?>
480
+ /></span>
481
+ </td>
482
+ </tr>
483
+ <tr valign="top">
484
+ <th scope="row"><?php _e( 'Background color', 'related-posts-thumbnails' ); ?>:</th>
485
+ <td>
486
+ <input type="text" name="relpoststh_background" value="<?php echo get_option( 'relpoststh_background', $this->background ); ?>" data-default-color="<?php echo $this->background; ?>"/>
487
+ </td>
488
+ </tr>
489
+ <tr valign="top">
490
+ <th scope="row"><?php _e( 'Background color on mouse over', 'related-posts-thumbnails' ); ?>:</th>
491
+ <td>
492
+ <input type="text" name="relpoststh_hoverbackground" value="<?php echo get_option( 'relpoststh_hoverbackground', $this->hoverbackground ); ?>" data-default-color="<?php echo $this->hoverbackground; ?>" />
493
+ </td>
494
+ </tr>
495
+ <tr valign="top">
496
+ <th scope="row"><?php _e( 'Border color', 'related-posts-thumbnails' ); ?>:</th>
497
+ <td>
498
+ <input type="text" name="relpoststh_bordercolor" value="<?php echo get_option( 'relpoststh_bordercolor', $this->border_color ); ?>" data-default-color="<?php echo $this->border_color; ?>"/>
499
+ </td>
500
+ </tr>
501
+ <tr valign="top">
502
+ <th scope="row"><?php _e( 'Font color', 'related-posts-thumbnails' ); ?>:</th>
503
+ <td>
504
+ <input type="text" name="relpoststh_fontcolor" value="<?php echo get_option( 'relpoststh_fontcolor', $this->font_color ); ?>" data-default-color="<?php echo $this->font_color; ?>"/>
505
+ </td>
506
+ </tr>
507
+ <tr valign="top">
508
+ <th scope="row"><?php _e( 'Font family', 'related-posts-thumbnails' ); ?>:</th>
509
+ <td>
510
+ <input type="text" name="relpoststh_fontfamily" value="<?php echo stripslashes( htmlspecialchars( get_option( 'relpoststh_fontfamily', $this->font_family ) ) ); ?>" size="50"/>
511
+ </td>
512
+ </tr>
513
+ <tr valign="top">
514
+ <th scope="row"><?php _e( 'Font size', 'related-posts-thumbnails' ); ?>:</th>
515
+ <td>
516
+ <input type="text" name="relpoststh_fontsize" value="<?php echo get_option( 'relpoststh_fontsize', $this->font_size ); ?>" size="7"/>
517
+ <span class='rpt-no-validate-error' style="display:none;color:red;"><?php _e( 'Only Digits are allow', 'related-posts-thumbnails' ); ?></span>
518
+ </td>
519
+ </tr>
520
+ <tr valign="top">
521
+ <th scope="row"><?php _e( 'Text maximum length', 'related-posts-thumbnails' ); ?>:</th>
522
+ <td>
523
+ <input type="text" name="relpoststh_textlength" value="<?php echo get_option( 'relpoststh_textlength', $this->text_length ); ?>" size="7"/>
524
+ <label for="relpoststh_textlength"><?php _e( 'Set 0 for no title', 'related-posts-thumbnails' ); ?></label>
525
+ <span class='rpt-no-validate-error' style="display:none;color:red;"><?php _e( 'Only Digits are allow', 'related-posts-thumbnails' ); ?></span>
526
+ <br />
527
+ </td>
528
+ </tr>
529
+ <tr valign="top">
530
+ <th scope="row"><?php _e( 'Excerpt maximum length', 'related-posts-thumbnails' ); ?>:</th>
531
+ <td>
532
+ <input type="text" name="relpoststh_excerptlength" value="<?php echo get_option( 'relpoststh_excerptlength', $this->excerpt_length ); ?>" size="7"/>
533
+ <label for="relpoststh_excerptlength"><?php _e( 'Set 0 for no excerpt', 'related-posts-thumbnails' ); ?></label>
534
+ <span class='rpt-no-validate-error' style="display:none;color:red;"><?php _e( 'Only Digits are allow', 'related-posts-thumbnails' ); ?></span>
535
+ <br />
536
+ </td>
537
+ </tr>
538
+ <tr valign="top">
539
+ <th scope="row"><?php _e( 'Text block height', 'related-posts-thumbnails' ); ?>:</th>
540
+ <td>
541
+ <input type="text" name="relpoststh_textblockheight" value="<?php echo get_option( 'relpoststh_textblockheight', $this->text_block_height ); ?>" size="7"/> px
542
+ <span class='rpt-no-validate-error' style="display:none;color:red;"><?php _e( 'Only Digits are allow', 'related-posts-thumbnails' ); ?></span>
543
+ </td>
544
+ </tr>
545
+ </table>
546
+ </div>
547
+ <div class="postbox" style="padding: 20px; display:none;" id="content_relation_options">
548
+ <h2><?php _e( 'Relation Builder Options', 'related-posts-thumbnails' ); ?>:</h2>
549
+ <table class="form-table">
550
+ <tr valign="top">
551
+ <th scope="row"><?php _e( 'Relation based on', 'related-posts-thumbnails' ); ?>:</th>
552
+ <td>
553
+ <?php if ( is_array( $relation_options ) && count( $relation_options ) ) : ?>
554
+ <?php foreach ( $relation_options as $ro_key => $ro_name ) : ?>
555
+ <input type="radio" name="relpoststh_relation" id="relpoststh_relation_<?php echo $ro_key; ?>" value="<?php echo $ro_key; ?>"
556
+ <?php
557
+ if ( $relpoststh_relation == $ro_key ) {
558
+ echo 'checked="checked"'; }
559
+ ?>
560
+ />
561
+ <label for="relpoststh_relation_<?php echo $ro_key; ?>"><?php echo $ro_name; ?></label><br />
562
+ <?php endforeach; ?>
563
+ <?php endif; ?>
564
+ <div id="custom_taxonomies" style="display:
565
+ <?php
566
+ if ( $relpoststh_relation == 'custom' ) {
567
+ echo 'inline';
568
+ } else {
569
+ echo 'none'; }
570
+ ?>
571
+ ;">
572
+ <?php if ( is_array( $custom_taxonomies ) && count( $custom_taxonomies ) ) : ?>
573
+ <?php foreach ( $custom_taxonomies as $custom_taxonomy ) : ?>
574
+ <input type="checkbox" name="relpoststh_custom_taxonomies[]" id="ct_<?php echo $custom_taxonomy; ?>" value="<?php echo $custom_taxonomy; ?>"
575
+ <?php
576
+ if ( in_array( $custom_taxonomy, $relpoststh_custom_taxonomies ) ) {
577
+ echo 'checked="checked"'; }
578
+ ?>
579
+ />
580
+ <label for="ct_<?php echo $custom_taxonomy; ?>"><?php echo $custom_taxonomy; ?></label>
581
+ <?php endforeach; ?>
582
+ <?php endif; ?>
583
+ </div>
584
+ </td>
585
+ </tr>
586
+ </table>
587
+ </div>
588
+ <!-- <input name="Submit" value="<?php _e( 'Save Changes', 'related-posts-thumbnails' ); ?>" type="submit" class="button-primary"> -->
589
+ </div>
590
+ </div>
591
+
592
+ <div class="wpbr-button-container bottom">
593
+ <div class="wpbr-social-links alignleft">
594
+ <a href="https://profiles.wordpress.org/hiddenpearls/" class="wordpress" target="_blank"><span class="dashicons dashicons-wordpress"></span></a>
595
+ </div>
596
+ <input type="submit" name="Submit" class="wpb-rpt-settings-submit button button-primary button-big" value="<?php esc_html_e( 'Save Settings','related-posts-thumbnails' ); ?>" id="wpb_rpt_save_setting_bottom">
597
+ </div>
598
+ </div>
599
+
600
+ <div class="metabox-holder wpbr-sidebar">
601
+ <div class="sidebar postbox">
602
+ <h2><?php esc_html_e( 'Spread the Word' , 'related-posts-thumbnails' ); ?></h2>
603
+ <ul>
604
+ <li>
605
+ <a href="http://twitter.com/share?text=This is Best Related Post Thumbnails Plugin for WordPress&url=https://wordpress.org/support/view/plugin-reviews/related-posts-thumbnails" data-count="none" class="button twitter" target="_blank" title="Post to Twitter Now"><?php esc_html_e( 'Share on Twitter' , 'related-posts-thumbnails' ); ?><span class="dashicons dashicons-twitter"></span></a>
606
+ </li>
607
+
608
+ <li>
609
+ <a href="https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/support/view/plugin-reviews/related-posts-thumbnails" class="button facebook" target="_blank" title="Share with your facebook friends about this awesome plugin."><?php esc_html_e( 'Share on Facebook' , 'related-posts-thumbnails' ); ?><span class="dashicons dashicons-facebook"></span>
610
+ </a>
611
+ </li>
612
+
613
+ <li>
614
+ <a href="https://wordpress.org/support/view/plugin-reviews/related-posts-thumbnails?filter=5" class="button wordpress" target="_blank" title="Rate on Wordpress.org"><?php esc_html_e( 'Rate on Wordpress.org' , 'related-posts-thumbnails' ); ?><span class="dashicons dashicons-wordpress"></span>
615
+ </a>
616
+ </li>
617
+ </ul>
618
+ </div>
619
+
620
+ <div class="sidebar postbox">
621
+
622
+ <h2><?php esc_html_e( 'Subscribe Newsletter' , 'related-posts-thumbnails' ); ?></h2>
623
+ <ul>
624
+ <li>
625
+ <label for="">Email</label>
626
+ <input type="email" name="subscriber_mail" value="<?php echo get_option( 'admin_email' ); ?>" id="rpt_subscribe_mail">
627
+ <p class='rpt_subscribe_warning'></p>
628
+ </li>
629
+ <li>
630
+ <label for="">Name</label>
631
+ <input type="text" name="subscriber_name" id="rpt_subscribe_name" value="<?php echo wp_get_current_user()->display_name; ?>" id="rpt_subscribe_mail">
632
+ </li>
633
+ <li>
634
+ <input type="submit" value="Subscribe Now" class="button button-primary button-big" id='rpt_subscribe_btn' />
635
+ <img src="<?php echo admin_url( 'images/spinner.gif' ); ?>" class='rpt_subscribe_loader' style="display:none" />
636
+ </li>
637
+ <li>
638
+ <p class='rpt_return_message'></p>
639
+ </li>
640
+ </ul>
641
+ </div>
642
+
643
+ <div class="sidebar postbox">
644
+ <h2><?php esc_html_e( 'Recommended Plugins' , 'related-posts-thumbnails' ); ?></h2>
645
+ <!-- <p>Following are the plugins highly recommend by Team WPBrigade.</p> -->
646
+ <ul class="plugins_lists">
647
+ <li>
648
+ <a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/?utm_source=related-posts-lite&utm_medium=sidebar&utm_campaign=pro-upgrade" data-count="none" target="_blank" title="Post to Twitter Now"><?php esc_html_e( 'LoginPress - Login Customizer' , 'related-posts-thumbnails' ); ?></a>
649
+ </li>
650
+
651
+ <li>
652
+ <a href="https://analytify.io/ref/73/?utm_source=related-posts-lite&utm_medium=sidebar&utm_campaign=pro-upgrade" target="_blank" title="Share with your facebook friends about this awesome plugin."><?php esc_html_e( 'Google Analytics by Analytify' , 'related-posts-thumbnails' ); ?></span>
653
+ </a>
654
+ </li>
655
+
656
+ <li>
657
+ <a href="http://wpbrigade.com/recommend/maintenance-mode" target="_blank" title="Under Construction & Maintenance mode"><?php esc_html_e( 'Under Construction & Maintenance mode' , 'related-posts-thumbnails' ); ?></span>
658
+ </a>
659
+ </li>
660
+ </ul>
661
+ </div>
662
+ </div>
663
+
664
+ </div>
665
+ </form>
666
+ <p style="margin-top: 40px;"><small><?php _e( 'If you experience some problems with this plugin please let me know about it on <a target="_blank" href="https://wpbrigade.com/wordpress/plugins/related-posts/">Plugin\'s homepage</a>. If you think this plugin is awesome please vote on <a target="_blank" href="https://wordpress.org/plugins/related-posts-thumbnails/">WordPress plugin page</a>. Thanks!', 'related-posts-thumbnails' ); ?></small></p>
inc/rpt-widget.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ function get_related_posts_thumbnails() {
6
+ global $related_posts_thumbnails;
7
+ echo $related_posts_thumbnails->get_html();
8
+ }
9
+
10
+ /**
11
+ * Related Posts Widget, will be displayed on post page
12
+ */
13
+ class RelatedPostsThumbnailsWidget extends WP_Widget {
14
+
15
+ function __construct() {
16
+ $args = array(
17
+ 'classname' => 'relpoststh_widget',
18
+ );
19
+ parent::__construct( false, 'Related Posts Thumbnails', $args );
20
+ }
21
+
22
+ function widget( $args, $instance ) {
23
+ if ( is_single() && ! is_page() ) { // display on post page only
24
+ extract( $args );
25
+ $title = apply_filters( 'widget_title', $instance['title'] );
26
+ echo $before_widget;
27
+ if ( $title ) {
28
+ echo $before_title . $title . $after_title; }
29
+ get_related_posts_thumbnails();
30
+ echo $after_widget;
31
+ }
32
+ }
33
+
34
+ function update( $new_instance, $old_instance ) {
35
+ $instance = $old_instance;
36
+ $instance['title'] = strip_tags( $new_instance['title'] );
37
+ return $instance;
38
+ }
39
+
40
+ function form( $instance ) {
41
+ $title = esc_attr( $instance['title'] );
42
+ ?>
43
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
44
+ <?php
45
+ }
46
+ } // class RelatedPostsThumbnailsWidget
47
+
48
+
49
+ /**
50
+ * Register Widget.
51
+ *
52
+ */
53
+ function register_wpb_rpt_widget() {
54
+ register_widget( 'RelatedPostsThumbnailsWidget' );
55
+ }
56
+ add_action( 'widgets_init', 'register_wpb_rpt_widget' );
57
+
58
+ ?>
readme.txt CHANGED
@@ -1,10 +1,12 @@
1
  === Related Posts Thumbnails Plugin for WordPress ===
2
  Contributors: marynixie, hiddenpearls, WPBrigade
3
- Donate link: http://wordpress.shaldybina.com/donate
4
  Tags: related, posts, thumbnails, Related Content, related posts, pages, similar posts, shortcodes, widgets, related thumbs
5
- Requires at least: 2.9
6
  Tested up to: 4.9
7
- Stable tag: 1.6.1
 
 
8
 
9
  Related Posts by WPBrigade is The Best Customizable plugin, that nicely displays related posts thumbnails under the post.
10
 
@@ -12,7 +14,7 @@ Related Posts by WPBrigade is The Best Customizable plugin, that nicely displays
12
 
13
  **[Related Posts by WPBrigade](https://wpbrigade.com/wordpress/plugins/related-posts/?utm_source=related-posts-lite&utm_medium=readme&utm_campaign=pro-upgrade-rp)** will add related posts thumbnails after the post. This Related Posts Plugin allows to customize thumbnail sizes, display settings and type of relation.
14
 
15
- By default it uses generated by Wordpress thumbnail for the first image appeared in the post, that was uploaded on the server with sizes as set in Media settings. You can select between 'thumbnail' and 'medium' size options. In addition if your theme supports Post Thumbnails feature introduced in Wordpress 2.9 you can specify custom thumbnail size. You can also specify post custom field name to be used as thumbnails source.
16
 
17
  Thumbnails are arranged in columns under the post with related posts title/excerpt under each post thumbnail. Colors of background, border, text, text sizes, background on mouse over, title and excerpt length can be customized. See screenshot.
18
 
@@ -46,7 +48,7 @@ Related Links:
46
 
47
  = How does this plugin decide which image to use as post thumbnail? =
48
 
49
- If your theme supports Wordpress Posts Thumbnail feature and post has a specified Post Thumbnail as seen on Edit Post page, when this image will be used as a post thumbnail in related posts. The size of the image is determined by plugin setting 'Post-thumbnails name'.
50
 
51
  If your theme does not support Post Thumbnail feature or post has no assigned thumbnail, when the first image on the post will be used as a thumbnail.
52
 
@@ -65,11 +67,19 @@ If there are no images of the specified size in the post, or file does not exist
65
 
66
  == Upgrade Notice ==
67
 
68
- = 1.6.1 =
69
- * Important release, Please upgrade immediately. BugFix: Center align output and image.
70
 
71
  == Changelog ==
72
 
 
 
 
 
 
 
 
 
73
  = 1.6.1 =
74
  * BugFix: Center align output and image.
75
 
@@ -199,7 +209,7 @@ Fixed relative custom URL
199
  Fixed selection of categories on plugin settings page
200
 
201
  = 1.2.4 =
202
- Last french version
203
 
204
  = 1.2.3 =
205
  Added option to set theme php resizing script
1
  === Related Posts Thumbnails Plugin for WordPress ===
2
  Contributors: marynixie, hiddenpearls, WPBrigade
3
+ Donate link: https://wpbrigade.com/
4
  Tags: related, posts, thumbnails, Related Content, related posts, pages, similar posts, shortcodes, widgets, related thumbs
5
+ Requires at least: 3.6
6
  Tested up to: 4.9
7
+ Stable tag: 1.6.2
8
+ License: GPLv3 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
  Related Posts by WPBrigade is The Best Customizable plugin, that nicely displays related posts thumbnails under the post.
12
 
14
 
15
  **[Related Posts by WPBrigade](https://wpbrigade.com/wordpress/plugins/related-posts/?utm_source=related-posts-lite&utm_medium=readme&utm_campaign=pro-upgrade-rp)** will add related posts thumbnails after the post. This Related Posts Plugin allows to customize thumbnail sizes, display settings and type of relation.
16
 
17
+ By default it uses generated by WordPress thumbnail for the first image appeared in the post, that was uploaded on the server with sizes as set in Media settings. You can select between 'thumbnail' and 'medium' size options. In addition if your theme supports Post Thumbnails feature introduced in WordPress 2.9 you can specify custom thumbnail size. You can also specify post custom field name to be used as thumbnails source.
18
 
19
  Thumbnails are arranged in columns under the post with related posts title/excerpt under each post thumbnail. Colors of background, border, text, text sizes, background on mouse over, title and excerpt length can be customized. See screenshot.
20
 
48
 
49
  = How does this plugin decide which image to use as post thumbnail? =
50
 
51
+ If your theme supports WordPress Posts Thumbnail feature and post has a specified Post Thumbnail as seen on Edit Post page, when this image will be used as a post thumbnail in related posts. The size of the image is determined by plugin setting 'Post-thumbnails name'.
52
 
53
  If your theme does not support Post Thumbnail feature or post has no assigned thumbnail, when the first image on the post will be used as a thumbnail.
54
 
67
 
68
  == Upgrade Notice ==
69
 
70
+ = 1.6.2 =
71
+ * Important release, Please upgrade immediately.
72
 
73
  == Changelog ==
74
 
75
+ = 1.6.2 - 2018-02-27 =
76
+ * Feature : Change inline style to class.
77
+ * Feature : Add RTL support.
78
+ * Bug Fix : Undefined variable on shortcode.
79
+ * Bug Fix : Fix encoding tag on excerpt.
80
+ * Enhancement : Add color picker on color settings.
81
+ * Enhancement : Add date picker on date settings.
82
+
83
  = 1.6.1 =
84
  * BugFix: Center align output and image.
85
 
209
  Fixed selection of categories on plugin settings page
210
 
211
  = 1.2.4 =
212
+ Last French version
213
 
214
  = 1.2.3 =
215
  Added option to set theme php resizing script
related-posts-thumbnails.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WordPress Related Posts Thumbnails
4
  * Plugin URI: https://wpbrigade.com/wordpress/plugins/related-posts/?utm_source=related-posts-lite&utm_medium=plugin-uri&utm_campaign=pro-upgrade-rp
5
  * Description: Showing related posts thumbnails under the posts.
6
- * Version: 1.6.1
7
  * Author: WPBrigade
8
  * Author URI: https://WPBrigade.com/?utm_source=related-posts-lite&utm_medium=author-link&utm_campaign=pro-upgrade-rp
9
  */
@@ -25,30 +25,30 @@
25
  */
26
  class RelatedPostsThumbnails {
27
  /* Default values. PHP 4 compatible */
28
- var $single_only = '1';
29
- var $auto = '1';
30
- var $top_text = '<h3>Related posts:</h3>';
31
- var $number = 3;
32
- var $relation = 'categories';
33
- var $poststhname = 'thumbnail';
34
- var $background = '#FFFFFF';
35
- var $hoverbackground = '#EEEEEF';
36
- var $border_color = '#DDDDDD';
37
- var $font_color = '#333333';
38
- var $font_family = 'Arial';
39
- var $font_size = '12';
40
- var $text_length = '100';
41
- var $excerpt_length = '0';
42
- var $custom_field = '';
43
- var $custom_height = '100';
44
- var $custom_width = '100';
45
- var $text_block_height = '75';
46
- var $thsource = 'post-thumbnails';
47
- var $categories_all = '1';
48
- var $devmode = '0';
49
- var $output_style = 'div';
50
- var $post_types = array( 'post' );
51
- var $custom_taxonomies = array();
52
 
53
  protected $wp_kses_rp_args = array(
54
 
@@ -62,10 +62,14 @@ class RelatedPostsThumbnails {
62
  );
63
 
64
  function __construct() {
 
 
65
  // initialization
66
  load_plugin_textdomain( 'related-posts-thumbnails', false, basename( dirname( __FILE__ ) ) . '/locale' );
67
  $this->default_image = esc_url( plugins_url( 'img/default.png', __FILE__ ) );
68
 
 
 
69
  // Compatibility for old default image path.
70
  if ( $this->is_old_default_img() )
71
  update_option( 'relpoststh_default_image', $this->default_image );
@@ -79,73 +83,222 @@ class RelatedPostsThumbnails {
79
 
80
  $this->wp_version = get_bloginfo( 'version' );
81
 
82
- add_action( 'wp_ajax_relpost_subscriber', array( $this, 'relpost_subscriber' ) );
83
- }
84
-
85
- function relpost_subscriber() {
86
- $email = sanitize_email( wp_unslash( $_POST['subscriber_mail'] ) );
87
- $display_name = sanitize_text_field( wp_unslash( $_POST['name'] ) );
88
-
89
 
90
- $data = array(
91
- 'email_address' => $email,
92
- "status_if_new" => "pending",
93
- // 'status' => 'pending', // "subscribed","unsubscribed","cleaned","pending"
94
- 'merge_fields' => array(
95
- 'FNAME' => $display_name
96
- ),
97
- 'interests' => array(
98
- '5f0e7578b3' => true, // add interest ? loginPress => d91a783713 || Related Posts Thumbnails => 1c85722a4b || Newsletter Subscribers => 3eefb18f62
99
- )
100
- );
101
 
 
102
 
103
- $apiKey = '7f32f907a2e6ceeaf8a97fc00b962b2b-us15';
104
- $listId = '30d28e0fc3';
105
 
106
- $memberId = md5( strtolower( $data['email_address'] ) );
107
- $dataCenter = substr( $apiKey , strpos( $apiKey,'-' ) + 1 );
108
 
 
 
 
 
 
 
109
 
110
- $url = 'https://' . $dataCenter . '.api.mailchimp.com/3.0/lists/' . $listId .'/members/' . $memberId;
111
 
112
- // 2d13665c08ff83f22de7cc7da216db12
113
- $json = json_encode( $data );
114
 
115
- $ch = curl_init( $url );
 
116
 
117
- curl_setopt( $ch, CURLOPT_USERPWD, 'user:' . $apiKey );
118
- curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json' ) );
119
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
120
- curl_setopt( $ch, CURLOPT_TIMEOUT, 10 );
121
- curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PUT' );
122
- curl_setopt( $ch, CURLOPT_POST, true );
123
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
124
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $json );
125
 
126
- curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)' );
 
 
127
 
128
- $result = curl_exec( $ch );
129
 
130
- if( $request_type == 'GET' ){
131
- $result_array = json_decode ( $result , true );
132
- $status = $result_array['status'];
133
- return $status;
 
 
 
 
 
 
134
  }
135
- // var_dump($result);
136
- // var_dump( curl_getinfo( $ch ) );
137
 
138
- $httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
 
139
 
140
- curl_close( $ch );
141
- if ( 200 == $httpCode ) {
142
- echo "Thank you!";
143
- } else {
144
- echo "oops! Please try again later.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  wp_die();
147
  }
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  /**
150
  * [is_old_default_img Check the compatibility for old default image path.]
151
  * @return boolean Return true if path is old.
@@ -180,6 +333,10 @@ class RelatedPostsThumbnails {
180
  $debug = 'Developer mode initialisation; Version: 1.2.9;';
181
  $time = microtime( true );
182
  $posts_number = get_option( 'relpoststh_number', $this->number );
 
 
 
 
183
 
184
  if ( $posts_number <= 0 ) { // return nothing if this parameter was set to <= 0
185
  return $this->finish_process( $output, $debug . 'Posts number is 0;', $time );
@@ -340,14 +497,16 @@ class RelatedPostsThumbnails {
340
  $relpoststh_cleanhtml = get_option( 'relpoststh_cleanhtml', 0 );
341
  $text_height = get_option( 'relpoststh_textblockheight', $this->text_block_height );
342
 
 
343
  if ( $relpoststh_output_style == 'list' ) {
344
  $output .= '<ul id="related_posts_thumbnails"';
345
- if ( ! $relpoststh_cleanhtml ) {
346
- $output .= ' style="list-style-type:none; list-style-position: inside; padding: 0; margin:0"';
347
- }
348
  $output .= '>';
349
  } else {
350
- $output .= '<div style="clear: both"></div><div style="border: 0pt none ; margin: 0pt; padding: 0pt;">';
 
351
  }
352
 
353
  foreach ( $posts as $post ) {
@@ -427,6 +586,7 @@ class RelatedPostsThumbnails {
427
 
428
  if ( ! empty( $title ) && ! empty( $excerpt ) ) {
429
  $title = '<b>' . $title . '</b>';
 
430
  $excerpt = '<br/>' . $excerpt;
431
  }
432
 
@@ -438,25 +598,25 @@ class RelatedPostsThumbnails {
438
  $fontface = str_replace( '"', "'", stripslashes( get_option( 'relpoststh_fontfamily', $this->font_family ) ) );
439
  $output .= '<li ';
440
  if ( ! $relpoststh_cleanhtml ) {
441
- $output .= ' style="float: left; padding: 0; margin:0; padding: 5px; display: block; border-right: 1px solid ' . get_option( 'relpoststh_bordercolor', $this->border_color ) . '; background-color: ' . get_option( 'relpoststh_background', $this->background ) . '" onmouseout="this.style.backgroundColor=\'' . get_option( 'relpoststh_background', $this->background ) . '\'" onmouseover="this.style.backgroundColor=\'' . get_option( 'relpoststh_hoverbackground', $this->hoverbackground ) . '\'"';
442
  }
443
  $output .= '>';
444
- $output .= '<a href="' . $link . '" ><img alt="' . $title . '" src="' . $url . '" width="' . $width . '" height="' . $height . '" ';
445
  if ( ! $relpoststh_cleanhtml ) {
446
- $output .= 'style="padding: 0px; margin: 0px; border: 0pt none;"';
447
  }
448
  $output .= '/></a>';
449
  if ( $text_height != '0' ) {
450
- $output .= '<a href="' . $link . '"';
451
  if ( ! $relpoststh_cleanhtml ) {
452
- $output .= ' style="display: block; width: ' . $width . 'px; overflow: hidden;height: ' . $text_height . 'px; font-family: ' . $fontface . '; font-style: normal; font-variant: normal; font-weight: normal; font-size: ' . get_option( 'relpoststh_fontsize', $this->font_size ) . 'px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; color: ' . get_option( 'relpoststh_fontcolor', $this->font_color ) . ';text-decoration: none;"'; }
453
  $output .= '><span>' . $title . $excerpt . '</span></a></li>';
454
  }
455
  } else {
456
- $output .= '<a onmouseout="this.style.backgroundColor=\'' . get_option( 'relpoststh_background', $this->background ) . '\'" onmouseover="this.style.backgroundColor=\'' . get_option( 'relpoststh_hoverbackground', $this->hoverbackground ) . '\'" style="background-color: ' . get_option( 'relpoststh_background', $this->background ) . '; border-right: 1px solid ' . get_option( 'relpoststh_bordercolor', $this->border_color ) . '; border-bottom: medium none; margin: 0pt; padding: 6px; display: block; float: left; text-decoration: none; text-align: center; cursor: pointer;" href="' . get_permalink( $post->ID ) . '">';
457
- $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; width: ' . $width . 'px; height: ' . ( $height + $text_height ) . 'px;">';
458
- $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; background: transparent url(' . $url . ') no-repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: ' . $width . 'px; height: ' . $height . 'px; background-size: cover;"></div>';
459
- $output .= '<div style="border: 0pt none; margin: 3px 0pt 0pt; padding: 0pt; font-family: ' . $fontface . '; font-style: normal; font-variant: normal; font-weight: normal; font-size: ' . get_option( 'relpoststh_fontsize', $this->font_size ) . 'px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; color: ' . get_option( 'relpoststh_fontcolor', $this->font_color ) . ';">' . $title . $excerpt . '</div>';
460
  $output .= '</div>';
461
  $output .= '</a>';
462
  }
@@ -467,6 +627,7 @@ class RelatedPostsThumbnails {
467
  $output .= '</div>';
468
  }
469
  $output .= '<div style="clear: both"></div>';
 
470
  return $this->finish_process( $output, $debug, $time );
471
  }
472
 
@@ -484,7 +645,7 @@ class RelatedPostsThumbnails {
484
  if ( $length == 0 ) {
485
  return '';
486
  } else {
487
- $text = htmlspecialchars( strip_tags( strip_shortcodes( $text ) ) );
488
  if ( function_exists( 'mb_strlen' ) ) {
489
  return ( ( mb_strlen( $text ) > $length ) ? mb_substr( $text, 0, $length ) . '...' : $text );
490
  } else {
@@ -522,881 +683,12 @@ class RelatedPostsThumbnails {
522
  }
523
 
524
  function admin_menu() {
525
- $page = add_menu_page( __( 'Related Posts Thumbnails', 'related-posts-thumbnails' ), __( 'Related Posts', 'related-posts-thumbnails' ), 'administrator', 'related-posts-thumbnails', array( $this, 'admin_interface' ) );
526
  }
527
 
528
  function admin_interface() {
529
- // Admin interface
530
- if ( isset( $_POST['action'] ) && ($_POST['action'] == 'update') ) {
531
- if ( ! current_user_can( 'manage_options' ) ) {
532
- wp_die( __( 'No access', 'related-posts-thumbnails' ) );
533
- }
534
- check_admin_referer( 'related-posts-thumbnails' );
535
- $validation = true;
536
- if ( ! empty( $_POST['relpoststh_year'] ) || ! empty( $_POST['relpoststh_month'] ) || ! empty( $_POST['relpoststh_year'] ) ) { // check date
537
- $set_date = sprintf( '%04d-%02d-%02d', $_POST['relpoststh_year'], $_POST['relpoststh_month'], $_POST['relpoststh_day'] );
538
- if ( checkdate( intval( $_POST['relpoststh_month'] ), intval( $_POST['relpoststh_day'] ), intval( $_POST['relpoststh_year'] ) ) === false ) {
539
- $validation = false;
540
- $error = __( 'Wrong date', 'related-posts-thumbnails' ) . ': ' . sprintf( '%d/%d/%d', $_POST['relpoststh_month'], $_POST['relpoststh_day'], $_POST['relpoststh_year'] );
541
- }
542
- } else {
543
- $set_date = '';
544
- }
545
- if ( $validation ) {
546
-
547
- if( isset( $_POST['relpoststh_single_only'] ) ) {
548
- update_option( 'relpoststh_single_only', sanitize_text_field( wp_unslash( $_POST['relpoststh_single_only'] ) ) );
549
- } else {
550
- update_option( 'relpoststh_single_only', '0' );
551
- }
552
-
553
- if( isset( $_POST['relpoststh_post_types'] ) ) {
554
- update_option( 'relpoststh_post_types', array_map( 'sanitize_text_field', wp_unslash( $_POST['relpoststh_post_types'] ) ) );
555
- } else {
556
- update_option( 'relpoststh_post_types', array() );
557
- }
558
-
559
- if( isset( $_POST['onlywiththumbs'] ) ) {
560
- update_option( 'relpoststh_onlywiththumbs', sanitize_text_field( wp_unslash( $_POST['onlywiththumbs'] ) ) );
561
- } else {
562
- update_option( 'relpoststh_onlywiththumbs', '0' );
563
- }
564
-
565
- if( isset( $_POST['relpoststh_output_style'] ) ) {
566
- update_option( 'relpoststh_output_style', sanitize_text_field( wp_unslash( $_POST['relpoststh_output_style'] ) ) );
567
- }
568
-
569
- if( isset( $_POST['relpoststh_cleanhtml'] ) ) {
570
- update_option( 'relpoststh_cleanhtml', sanitize_text_field( wp_unslash( $_POST['relpoststh_cleanhtml'] ) ) );
571
- } else {
572
- update_option( 'relpoststh_cleanhtml', '0' );
573
- }
574
-
575
- if( isset( $_POST['relpoststh_auto'] ) ) {
576
- update_option( 'relpoststh_auto', sanitize_text_field( wp_unslash( $_POST['relpoststh_auto'] ) ) );
577
- } else {
578
- update_option( 'relpoststh_auto', '0' );
579
- }
580
-
581
- if( isset( $_POST['relpoststh_top_text'] ) ) {
582
- update_option( 'relpoststh_top_text', wp_kses( $_POST['relpoststh_top_text'], $this->wp_kses_rp_args ) );
583
- }
584
-
585
-
586
- if( isset( $_POST['relpoststh_number'] ) ) {
587
- update_option( 'relpoststh_number', absint( $_POST['relpoststh_number'] ) );
588
- }
589
-
590
- if( isset( $_POST['relpoststh_relation'] ) ) {
591
- update_option( 'relpoststh_relation', sanitize_text_field( wp_unslash( $_POST['relpoststh_relation'] ) ) );
592
- }
593
-
594
- if( isset( $_POST['relpoststh_default_image'] ) ) {
595
- update_option( 'relpoststh_default_image', sanitize_text_field( wp_unslash( $_POST['relpoststh_default_image'] ) ) );
596
- }
597
-
598
- if( isset( $_POST['relpoststh_poststhname'] ) ) {
599
- update_option( 'relpoststh_poststhname', sanitize_text_field( wp_unslash( $_POST['relpoststh_poststhname'] ) ) );
600
- }
601
-
602
- if( isset( $_POST['relpoststh_background'] ) ) {
603
- update_option( 'relpoststh_background', sanitize_text_field( wp_unslash( $_POST['relpoststh_background'] ) ) );
604
- }
605
-
606
- if( isset( $_POST['relpoststh_hoverbackground'] ) ) {
607
- update_option( 'relpoststh_hoverbackground', sanitize_text_field( wp_unslash( $_POST['relpoststh_hoverbackground'] ) ) );
608
- }
609
-
610
-
611
- if( isset( $_POST['relpoststh_bordercolor'] ) ) {
612
- update_option( 'relpoststh_bordercolor', sanitize_text_field( wp_unslash( $_POST['relpoststh_bordercolor'] ) ) );
613
- }
614
-
615
- if( isset( $_POST['relpoststh_fontcolor'] ) ) {
616
- update_option( 'relpoststh_fontcolor', sanitize_text_field( wp_unslash( $_POST['relpoststh_fontcolor'] ) ) );
617
- }
618
-
619
- if( isset( $_POST['relpoststh_fontsize'] ) ) {
620
- update_option( 'relpoststh_fontsize', sanitize_text_field( wp_unslash( $_POST['relpoststh_fontsize'] ) ) );
621
- }
622
-
623
- if( isset( $_POST['relpoststh_fontfamily'] ) ) {
624
- update_option( 'relpoststh_fontfamily', sanitize_text_field( wp_unslash( $_POST['relpoststh_fontfamily'] ) ) );
625
- }
626
-
627
- if( isset( $_POST['relpoststh_textlength'] ) ) {
628
- update_option( 'relpoststh_textlength', sanitize_text_field( wp_unslash( $_POST['relpoststh_textlength'] ) ) );
629
- }
630
-
631
- if( isset( $_POST['relpoststh_excerptlength'] ) ) {
632
- update_option( 'relpoststh_excerptlength', sanitize_text_field( wp_unslash( $_POST['relpoststh_excerptlength'] ) ) );
633
- }
634
-
635
- if( isset( $_POST['relpoststh_thsource'] ) ) {
636
- update_option( 'relpoststh_thsource', sanitize_text_field( wp_unslash( $_POST['relpoststh_thsource'] ) ) );
637
- }
638
-
639
- if( isset( $_POST['relpoststh_customfield'] ) ) {
640
- update_option( 'relpoststh_customfield', sanitize_text_field( wp_unslash( $_POST['relpoststh_customfield'] ) ) );
641
- }
642
-
643
- if( isset( $_POST['relpoststh_theme_resize_url'] ) ) {
644
- update_option( 'relpoststh_theme_resize_url', sanitize_text_field( wp_unslash( $_POST['relpoststh_theme_resize_url'] ) ) );
645
- }
646
-
647
- if( isset( $_POST['relpoststh_customwidth'] ) ) {
648
- update_option( 'relpoststh_customwidth', sanitize_text_field( wp_unslash( $_POST['relpoststh_customwidth'] ) ) );
649
- }
650
-
651
- if( isset( $_POST['relpoststh_customheight'] ) ) {
652
- update_option( 'relpoststh_customheight', sanitize_text_field( wp_unslash( $_POST['relpoststh_customheight'] ) ) );
653
- }
654
-
655
- if( isset( $_POST['relpoststh_textblockheight'] ) ) {
656
- update_option( 'relpoststh_textblockheight', sanitize_text_field( wp_unslash( $_POST['relpoststh_textblockheight'] ) ) );
657
- }
658
-
659
- if( isset( $_POST['relpoststh_customwidth'] ) ) {
660
- update_option( 'relpoststh_customwidth', sanitize_text_field( wp_unslash( $_POST['relpoststh_customwidth'] ) ) );
661
- }
662
-
663
- if( isset( $_POST['relpoststh_categories'] ) ) {
664
- update_option( 'relpoststh_categories', array_map( 'sanitize_text_field', wp_unslash( $_POST['relpoststh_categories'] ) ) );
665
- } else {
666
- update_option( 'relpoststh_categories', array() );
667
- }
668
-
669
- if( isset( $_POST['relpoststh_categoriesall'] ) ) {
670
- update_option( 'relpoststh_categoriesall', sanitize_text_field( wp_unslash( $_POST['relpoststh_categoriesall'] ) ) );
671
- } else {
672
- update_option( 'relpoststh_categoriesall', '' );
673
- }
674
-
675
- if( isset( $_POST['relpoststh_show_categoriesall'] ) ) {
676
- update_option( 'relpoststh_show_categoriesall', sanitize_text_field( wp_unslash( $_POST['relpoststh_show_categoriesall'] ) ) );
677
- } else {
678
- update_option( 'relpoststh_show_categoriesall', '' );
679
- }
680
-
681
- if( isset( $_POST['relpoststh_show_categories'] ) ) {
682
- update_option( 'relpoststh_show_categories', array_map( 'sanitize_text_field', wp_unslash( $_POST['relpoststh_show_categories'] ) ) );
683
- } else {
684
- update_option( 'relpoststh_show_categories', array() );
685
- }
686
 
687
- if( isset( $_POST['relpoststh_devmode'] ) ) {
688
- update_option( 'relpoststh_devmode', sanitize_text_field( wp_unslash( $_POST['relpoststh_devmode'] ) ) );
689
- } else {
690
- update_option( 'relpoststh_devmode', '0' );
691
- }
692
-
693
- update_option( 'relpoststh_startdate', $set_date );
694
-
695
- if( isset( $_POST['relpoststh_custom_taxonomies'] ) ) {
696
- update_option( 'relpoststh_custom_taxonomies', array_map( 'sanitize_text_field', wp_unslash( $_POST['relpoststh_custom_taxonomies'] ) ) );
697
- } else {
698
- update_option( 'relpoststh_custom_taxonomies', array() );
699
- }
700
-
701
- echo "<div class='updated fade'><p>" . __( 'Settings updated', 'related-posts-thumbnails' ) .'</p></div>';
702
- } else {
703
- echo "<div class='error fade'><p>" . __( 'Settings update failed', 'related-posts-thumbnails' ) . '. '. $error . '</p></div>';
704
- }
705
- }
706
- $available_sizes = array( 'thumbnail' => 'thumbnail', 'medium' => 'medium' );
707
- if ( current_theme_supports( 'post-thumbnails' ) ) {
708
- global $_wp_additional_image_sizes;
709
- if ( is_array( $_wp_additional_image_sizes ) ) {
710
- $available_sizes = array_merge( $available_sizes, $_wp_additional_image_sizes );
711
- }
712
- }
713
- $relpoststh_single_only = get_option( 'relpoststh_single_only', $this->single_only );
714
- $relpoststh_auto = get_option( 'relpoststh_auto', $this->auto );
715
- $relpoststh_cleanhtml = get_option( 'relpoststh_cleanhtml', 0 );
716
- $relpoststh_relation = get_option( 'relpoststh_relation', $this->relation );
717
- $relpoststh_thsource = get_option( 'relpoststh_thsource', $this->thsource );
718
- $relpoststh_devmode = get_option( 'relpoststh_devmode', $this->devmode );
719
- $relpoststh_categoriesall = get_option( 'relpoststh_categoriesall', $this->categories_all );
720
- $relpoststh_categories = get_option( 'relpoststh_categories' );
721
- $relpoststh_show_categories = get_option( 'relpoststh_show_categories', get_option( 'relpoststh_categories' ) );
722
- $relpoststh_show_categoriesall = get_option( 'relpoststh_show_categoriesall', $relpoststh_categoriesall );
723
- $onlywiththumbs = get_option( 'relpoststh_onlywiththumbs', false );
724
- $relpoststh_startdate = explode( '-', get_option( 'relpoststh_startdate' ) );
725
- $relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
726
- $thsources = array( 'post-thumbnails' => __( 'Post thumbnails', 'related_posts_thumbnails' ), 'custom-field' => __( 'Custom field', 'related_posts_thumbnails' ) );
727
- $categories = get_categories();
728
- if ( $this->wp_version >= 3 ) {
729
- $post_types = get_post_types( array( 'public' => 1 ) );
730
- } else {
731
- $post_types = get_post_types();
732
- }
733
- $relpoststh_post_types = get_option( 'relpoststh_post_types', $this->post_types );
734
- $output_styles = array( 'div' => __( 'Blocks', 'related-posts-thumbnails' ), 'list' => __( 'List', 'related-posts-thumbnails' ) );
735
- $relation_options = array( 'categories' => __( 'Categories', 'related-posts-thumbnails' ), 'tags' => __( 'Tags', 'related-posts-thumbnails' ), 'both' => __( 'Categories and Tags', 'related-posts-thumbnails' ), 'no' => __( 'Random', 'related-posts-thumbnails' ), 'custom' => __( 'Custom', 'related-posts-thumbnails' ) );
736
- if ( $this->wp_version >= 3 ) {
737
- $custom_taxonomies = get_taxonomies( array( 'public' => 1 ) );
738
- $relpoststh_custom_taxonomies = get_option( 'relpoststh_custom_taxonomies', $this->custom_taxonomies );
739
- if ( ! is_array( $relpoststh_custom_taxonomies ) ) {
740
- $relpoststh_custom_taxonomies = array();
741
- }
742
- } else {
743
- $relation_options['custom'] .= ' '. __( '(This option is available for WP v3+ only)', 'related_posts_thumbnails' );
744
- }
745
- ?>
746
- <script type="text/javascript">
747
- jQuery(document).ready(function($) {
748
-
749
- $('#wpbr_rpt_relation_options').on('click', function(){
750
-
751
- $('.nav-tab').removeClass('nav-tab-active');
752
- $(this).addClass('nav-tab-active');
753
-
754
- $('#content_general_options').hide();
755
- $('#content_style_options').hide();
756
- $('#content_thumbnail_options').hide();
757
- $('#content_relation_options').show();
758
-
759
- });
760
-
761
- $('#wpbr_rpt_general_options').on('click', function(){
762
-
763
- $('.nav-tab').removeClass('nav-tab-active');
764
- $(this).addClass('nav-tab-active');
765
-
766
- $('#content_general_options').show();
767
- $('#content_style_options').hide();
768
- $('#content_thumbnail_options').hide();
769
- $('#content_relation_options').hide();
770
-
771
- });
772
-
773
-
774
- $('#wpbr_rpt_style_options').on('click', function(){
775
-
776
- $('.nav-tab').removeClass('nav-tab-active');
777
- $(this).addClass('nav-tab-active');
778
-
779
- $('#content_general_options').hide();
780
- $('#content_style_options').show();
781
- $('#content_thumbnail_options').hide();
782
- $('#content_relation_options').hide();
783
-
784
- });
785
-
786
-
787
- $('#wpbr_rpt_thumbnails_source').on('click', function(){
788
-
789
- $('.nav-tab').removeClass('nav-tab-active');
790
- $(this).addClass('nav-tab-active');
791
-
792
- $('#content_general_options').hide();
793
- $('#content_style_options').hide();
794
- $('#content_thumbnail_options').show();
795
- $('#content_relation_options').hide();
796
-
797
- });
798
-
799
-
800
-
801
-
802
- $(".select_all").click(function(){
803
- if (this.checked) {
804
- $(this).parent().find("div.select_specific").hide();
805
- }
806
- else {
807
- $(this).parent().find("div.select_specific").show();
808
- }
809
- });
810
- $('#relpoststh_thsource').change(function(){
811
- if (this.value == 'post-thumbnails') {
812
- $('#relpoststh-post-thumbnails').show();
813
- $('#relpoststh-custom-field').hide();
814
- }
815
- else {
816
- $('#relpoststh-post-thumbnails').hide();
817
- $('#relpoststh-custom-field').show();
818
- }
819
- });
820
- $('#relpoststh_output_style').change(function(){
821
- if (this.value == 'list') {
822
- $('#relpoststh_cleanhtml').show();
823
- }
824
- else {
825
- $('#relpoststh_cleanhtml').hide();
826
- }
827
- });
828
- $("input[name='relpoststh_relation']").change(function(){
829
- if ($("input[name='relpoststh_relation']:checked").val() == 'custom') {
830
- $('#custom_taxonomies').show();
831
- }
832
- else {
833
- $('#custom_taxonomies').hide();
834
- }
835
- });
836
-
837
- // Ajax for subsriber
838
- $('#rpt_subscribe_btn').on('click', function(event) {
839
- event.preventDefault();
840
-
841
- var subscriber_mail = $('#rpt_subscribe_mail').val();
842
- var name = $('#rpt_subscribe_name').val();
843
- if (!subscriber_mail) {
844
- $('.rpt_subscribe_warning').html('Please Enter Email');
845
- return;
846
- }
847
-
848
- $.ajax({
849
- url: ajaxurl,
850
- type: 'POST',
851
- data: {
852
- subscriber_mail : subscriber_mail,
853
- action : 'relpost_subscriber',
854
- name : name
855
- },
856
- beforeSend : function() {
857
- $('.rpt_subscribe_loader').show();
858
- $('#rpt_subscribe_btn').attr('disabled', 'disabled');
859
- }
860
- })
861
- .done(function(res) {
862
- $('.rpt_return_message').html(res);
863
- $('.rpt_subscribe_loader').hide();
864
- });
865
-
866
- });
867
- });
868
- </script>
869
- <style>
870
-
871
- #rpt_subscribe_btn{
872
- display: block;
873
- margin: 20px auto 0;
874
- }
875
-
876
- #relpoststh-settings .nav-tab-wrapper li a {
877
- float: none;
878
- margin:0;
879
- padding: 7px 20px;
880
- display: block;
881
- height: auto;
882
- background: none;
883
- }
884
-
885
- #relpoststh-settings .nav-tab-wrapper li{
886
- margin-bottom: 0;
887
- margin-left: -1px;
888
- }
889
- #relpoststh-settings::after{
890
- display: table;
891
- content: "";
892
- clear: both;
893
- }
894
- #relpoststh-settings{
895
- display: table;
896
- width: calc(100% - 2px);
897
- border:1px solid #ccc;
898
- margin: 0;
899
- }
900
-
901
- .relpoststh .wpbr-tabsWrapper{
902
- width: calc(100% - 265px);
903
- float: left;
904
- }
905
- #relpoststh-settings .nav-tab-wrapper{
906
- display: table-cell;
907
- vertical-align: top;
908
- width: 202px;
909
- }
910
- .relpoststh .form-table th:first-child{
911
- width: 110px;
912
- }
913
- .relpoststh #relpoststh-settings .metabox-holder{
914
- display: table-cell;
915
- padding: 10px;
916
- background: #fff;
917
- }
918
- #relpoststh-settings .nav-tab-wrapper li:first-child{
919
- margin-top: -1px;
920
- }
921
- #relpoststh-settings .nav-tab-wrapper li a.nav-tab-active{
922
- background: #fff;
923
- }
924
- #relpoststh-settings .nav-tab-wrapper li a.nav-tab-active{
925
- border-right: transparent;
926
- }
927
- #relpoststh-settings .nav-tab-wrapper li:last-child a{
928
- border-bottom: 1px solid #ccc;
929
- }
930
- .relpoststh #the-list .approve{
931
- display: block;
932
- }
933
- .relpoststh .postbox{
934
- padding: 10px;
935
- }
936
- .relpoststh .wpbr-sidebar{
937
- width: 255px !important;
938
- float: right;
939
- min-width: inherit;
940
- box-sizing: border-box;
941
- }
942
- .relpoststh .wpbr-sidebar .postbox{
943
- min-width: inherit;
944
- width: auto;
945
- }
946
- .relpoststh .wpbr-sidebar ul li a{
947
- width: 100%;
948
- display: block;
949
- }
950
- .relpoststh .wpbr-sidebar .wp-core-ui .button{
951
- position: relative;
952
- }
953
- .relpoststh .wpbr-sidebar .dashicons{
954
- position: absolute;
955
- right: 10px;
956
- margin-top: 3px;
957
- }
958
- .relpoststh .postbox ul li a{
959
- position: relative;
960
- }
961
-
962
- .relpoststh .wpbr-button-container{
963
- padding: 10px 0;
964
- overflow: hidden;
965
- }
966
- .relpoststh .wpbr-social-links a{
967
- text-decoration: none;
968
- }
969
- .relpoststh .wpbr-button-container{
970
- padding: 10px;
971
- overflow: hidden;
972
- border:1px solid #ccc;
973
-
974
- }
975
- .relpoststh .wpbr-button-container.top{
976
- border-bottom: 0;
977
- }
978
- .relpoststh .wpbr-button-container.bottom{
979
- border-top: 0;
980
- }
981
- .relpoststh .wpbrmedia-settings-submit{
982
- float:right;
983
- }
984
- .relpoststh .wpbr-sidebar h2{
985
- margin: 0;
986
- padding: 10px;
987
- border-bottom: 1px solid #ccc;
988
- }
989
- .relpoststh .wpbr-sidebar ul li .twitter .dashicons {
990
- color: #45b0e3;
991
- }
992
- .relpoststh .wpbr-sidebar ul li .facebook .dashicons {
993
- color: #3b5998;
994
- }
995
- .relpoststh .wpbr-sidebar ul li .wordpress .dashicons {
996
- color: #21759b;
997
- }
998
- .relpoststh .wpbr-sidebar ul li .rss .dashicons {
999
- color: #FF6600;
1000
- }
1001
- #relpoststh-settings p.submit{
1002
- display: none;
1003
- }
1004
- .relpoststh #wpbr_custom_css .form-table th{
1005
- width: 0;
1006
- }
1007
- .relpoststh #wpbr_custom_css .form-table td{
1008
- width: 100%;
1009
- }
1010
- .relpoststh .wpbr-wrap:after{
1011
- content: '';
1012
- display: table;
1013
- clear: both;
1014
- }
1015
-
1016
- .relpoststh .metabox-holder{
1017
- padding-top: 0 !important;
1018
- padding-right: 15px !important;
1019
- }
1020
-
1021
- .relpoststh .setting-notification{
1022
- position: absolute;
1023
- width: auto;
1024
- padding: 16px 10px;
1025
- left: 0;
1026
- top: 0;
1027
- background-color: #fcf8e3;
1028
- color: #c09853;
1029
- height: 100%;
1030
- box-sizing: border-box;
1031
- display: none;
1032
- }
1033
- #relpoststh-settings .postbox{
1034
- border: 0px solid #e5e5e5;
1035
- -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.0);
1036
- box-shadow: 0 1px 1px rgba(0,0,0,.0);
1037
- }
1038
- #relpoststh-settings .nav-tab-wrapper{
1039
- padding-top: 0;
1040
- border-bottom: 0px solid #ccc;
1041
- border-right: 1px solid #ccc;
1042
- }
1043
- #relpoststh-settings .nav-tab-wrapper li a.nav-tab-active{
1044
- margin: 0 -1px 0 0;
1045
- outline: none;
1046
- box-shadow: none;
1047
- }
1048
- #relpoststh-settings .nav-tab-wrapper .nav-tab{
1049
- border-right: 0;
1050
- }
1051
- .plugins_lists li{
1052
- padding-bottom: 12px;
1053
- line-height: 1.4;
1054
- }
1055
- </style>
1056
- <div class="wrap relpoststh">
1057
- <div class="icon32" id="icon-options-general"><br></div>
1058
- <h2><?php _e( 'Related Posts Thumbnails Settings', 'related-posts-thumbnails' ); ?></h2>
1059
-
1060
- <form action="?page=related-posts-thumbnails" method="POST" style="clear:both;">
1061
- <input type="hidden" name="action" value="update" />
1062
- <?php wp_nonce_field( 'related-posts-thumbnails' ); ?>
1063
-
1064
- <div class="wpbr-wrap"><div class="wpbr-tabsWrapper">
1065
- <div class="wpbr-button-container top">
1066
- <div class="setting-notification">
1067
- <?php echo __( 'Settings have changed, you should save them!' , 'related-posts-thumbnails' ); ?>
1068
- </div>
1069
- <input type="submit" name="Submit" class="wpbrmedia-settings-submit button button-primary button-big" value="<?php esc_html_e( 'Save Settings','related-posts-thumbnails' );?>" id="wpbr_save_setting_top">
1070
- </div>
1071
-
1072
- <div id="relpoststh-settings" class="">
1073
- <ul class="nav-tab-wrapper">
1074
- <li> <a href="#nogo" class="nav-tab nav-tab-active" id="wpbr_rpt_general_options">General Display Options</a> </li>
1075
- <li> <a href="#nogo" class="nav-tab" id="wpbr_rpt_thumbnails_source">Thumbnails source</a> </li>
1076
- <li> <a href="#nogo" class="nav-tab" id="wpbr_rpt_style_options">Style options:</a> </li>
1077
- <li> <a href="#nogo" class="nav-tab" id="wpbr_rpt_relation_options">Relation Builder Options</a> </li>
1078
- </ul>
1079
-
1080
- <div class="metabox-holder">
1081
- <div class="postbox" style="padding: 20px" id="content_general_options">
1082
- <h2><?php _e( 'General Display Options', 'related-posts-thumbnails' ); ?>:</h2>
1083
-
1084
- <table class="form-table">
1085
- <tr valign="top">
1086
- <th scope="row"><?php _e( 'Automatically append to the post content', 'related-posts-thumbnails' ); ?>:</th>
1087
- <td>
1088
- <input type="checkbox" name="relpoststh_auto" id="relpoststh_auto" value="1" <?php if ( $relpoststh_auto ) { echo 'checked="checked"'; } ?>/>
1089
- <label for="relpoststh_auto"><?php _e( 'Or use <b>&lt;?php get_related_posts_thumbnails(); ?&gt;</b> in the Loop', 'related-posts-thumbnails' ); ?></label><br />
1090
- </td>
1091
- </tr>
1092
- <tr valign="top">
1093
- <th scope="row"><?php _e( 'Developer mode', 'related-posts-thumbnails' ); ?>:</th>
1094
- <td>
1095
- <input type="checkbox" name="relpoststh_devmode" id="relpoststh_devmode" value="1" <?php if ( $relpoststh_devmode ) { echo 'checked="checked"'; } ?>/>
1096
- <label for="relpoststh_devmode"><?php _e( 'This will add debugging information in HTML source', 'related-posts-thumbnails' ); ?></label><br />
1097
- </td>
1098
- </tr>
1099
- <tr valign="top">
1100
- <th scope="row"><?php _e( 'Page type', 'related-posts-thumbnails' ); ?>:</th>
1101
- <td>
1102
- <input type="checkbox" name="relpoststh_single_only" id="relpoststh_single_only" value="1" <?php if ( $relpoststh_single_only ) { echo 'checked="checked"'; } ?>/>
1103
- <label for="relpoststh_single_only"><?php _e( 'Show on single posts only', 'related-posts-thumbnails' ); ?></label><br />
1104
- </td>
1105
- </tr>
1106
- <tr valign="top">
1107
- <th scope="row"><?php _e( 'Post types', 'related-posts-thumbnails' ); ?>:</th>
1108
- <td>
1109
- <?php if ( is_array( $post_types ) && count( $post_types ) ) : ?>
1110
- <?php foreach ( $post_types as $post_type ) : ?>
1111
- <input type="checkbox" name="relpoststh_post_types[]" id="pt_<?php echo $post_type; ?>" value="<?php echo $post_type; ?>" <?php if ( in_array( $post_type, $relpoststh_post_types ) ) { echo 'checked="checked"'; } ?>/>
1112
- <label for="pt_<?php echo $post_type; ?>"><?php echo $post_type; ?></label>
1113
- <?php endforeach; ?>
1114
- <?php endif; ?>
1115
- </td>
1116
- </tr>
1117
- <tr valign="top">
1118
- <th scope="row"><?php _e( 'Categories on which related thumbnails will appear', 'related-posts-thumbnails' ); ?>:</th>
1119
- <td>
1120
- <?php $this->display_categories_list( $relpoststh_categoriesall, $categories, $relpoststh_categories, 'relpoststh_categoriesall', 'relpoststh_categories' ); ?>
1121
- </td>
1122
- </tr>
1123
- <tr valign="top">
1124
- <th scope="row"><?php _e( 'Categories that will appear in related thumbnails', 'related-posts-thumbnails' ); ?>:</th>
1125
- <td>
1126
- <?php $this->display_categories_list( $relpoststh_show_categoriesall, $categories, $relpoststh_show_categories, 'relpoststh_show_categoriesall', 'relpoststh_show_categories' ); ?>
1127
- </td>
1128
- </tr>
1129
- <tr>
1130
- <th scope="row"><?php _e( 'Include only posts after', 'related-posts-thumbnails' ); ?>:</th>
1131
- <td>
1132
- <?php _e( 'Year', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_year" size="4" value="<?php if ( isset( $relpoststh_startdate[0] ) ) { echo $relpoststh_startdate[0]; } ?>"> <?php _e( 'Month', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_month" size="2" value="<?php if ( isset( $relpoststh_startdate[1] ) ) { echo $relpoststh_startdate[1]; } ?>"> <?php _e( 'Day', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_day" size="2" value="<?php if ( isset( $relpoststh_startdate[2] ) ) { echo $relpoststh_startdate[2]; } ?>"> <label for="relpoststh_excerptlength"><?php _e( 'Leave empty for all posts dates', 'related-posts-thumbnails' ); ?></label><br />
1133
- </td>
1134
- </tr>
1135
- <tr>
1136
- <th scope="row"><?php _e( 'Top text', 'related-posts-thumbnails' ); ?>:</th>
1137
- <td>
1138
- <input type="text" name="relpoststh_top_text" value="<?php echo stripslashes( htmlspecialchars( get_option( 'relpoststh_top_text', $this->top_text ) ) ); ?>" size="50"/>
1139
- </td>
1140
- </tr>
1141
- <tr>
1142
- <th scope="row"><?php _e( 'Number of similar posts to display', 'related-posts-thumbnails' ); ?>:</th>
1143
- <td>
1144
- <input type="text" name="relpoststh_number" value="<?php echo get_option( 'relpoststh_number', $this->number ); ?>" size="2"/>
1145
- </td>
1146
- </tr>
1147
- <tr>
1148
- <th scope="row"><?php _e( 'Default image URL', 'related-posts-thumbnails' ); ?>:</th>
1149
- <td>
1150
- <input type="text" name="relpoststh_default_image" value="<?php echo get_option( 'relpoststh_default_image', $this->default_image );?>" size="50"/>
1151
- </td>
1152
- </tr>
1153
- <tr>
1154
- <th scope="row"><?php _e( 'Thumbnails source', 'related-posts-thumbnails' ); ?>:</th>
1155
- <td>
1156
- <select name="relpoststh_thsource" id="relpoststh_thsource">
1157
- <?php foreach ( $thsources as $name => $title ) : ?>
1158
- <option value="<?php echo $name; ?>" <?php if ( $relpoststh_thsource == $name ) { echo 'selected'; } ?>><?php echo $title; ?></option>
1159
- <?php endforeach; ?>
1160
- </select>
1161
- </td>
1162
- </tr>
1163
- </table>
1164
- </div>
1165
-
1166
- <div class="postbox" style="padding: 20px; display:none;" id="content_thumbnail_options">
1167
- <div style="padding: 20px" id="relpoststh-post-thumbnails" <?php if ( $relpoststh_thsource != 'post-thumbnails' ) : ?> style="display:none" <?php endif; ?>>
1168
- <h2><?php _e( 'Thumbnails source', 'related-posts-thumbnails' ); ?>:</h2>
1169
- <table class="form-table">
1170
- <tr valign="top">
1171
- <th scope="row"><?php _e( 'Post-thumbnails name', 'related-posts-thumbnails' ); ?>:</th>
1172
- <td>
1173
- <select name="relpoststh_poststhname">
1174
- <?php foreach ( $available_sizes as $size_name => $size ) : ?>
1175
- <option <?php if ( $size_name == get_option( 'relpoststh_poststhname', $this->poststhname ) ) { echo 'selected'; } ?>><?php echo $size_name; ?></option>
1176
- <?php endforeach; ?>
1177
- </select>
1178
- <?php if ( ! current_theme_supports( 'post-thumbnails' ) ) : ?>
1179
- (<?php _e( 'Your theme has to support post-thumbnails to have more choices', 'related-posts-thumbnails' ); ?>)
1180
- <?php endif; ?>
1181
- </td>
1182
- </tr>
1183
- <?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?>
1184
- <tr>
1185
- <th scope="row"><?php _e( 'Show posts only with thumbnails', 'related-posts-thumbnails' ); ?>:</th>
1186
- <td>
1187
- <input type="checkbox" name="onlywiththumbs" id="onlywiththumbs" value="1" <?php if ( $onlywiththumbs ) { echo 'checked="checked"'; } ?>/>
1188
- <label for="onlywiththumbs"><?php _e( 'Only posts with assigned Featured Image', 'related-posts-thumbnails' ); ?></label><br />
1189
- </td>
1190
- </tr>
1191
- <?php endif; ?>
1192
- </table>
1193
- </div>
1194
- <div style="padding: 20px" id="relpoststh-custom-field" <?php if ( $relpoststh_thsource != 'custom-field' ) : ?> style="display:none" <?php endif; ?>>
1195
- <h2><?php _e( 'Thumbnails source', 'related-posts-thumbnails' ); ?>:</h2>
1196
- <table class="form-table">
1197
- <tr valign="top">
1198
- <th scope="row"><?php _e( 'Custom field name', 'related-posts-thumbnails' ); ?>:</th>
1199
- <td>
1200
- <input type="text" name="relpoststh_customfield" value="<?php echo get_option( 'relpoststh_customfield', $this->custom_field );?>" size="50"/>
1201
- </td>
1202
- </tr>
1203
- <tr valign="top">
1204
- <th scope="row"><?php _e( 'Size', 'related-posts-thumbnails' ); ?>:</th>
1205
- <td>
1206
- <?php _e( 'Width', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_customwidth" value="<?php echo get_option( 'relpoststh_customwidth', $this->custom_width );?>" size="3"/>px x
1207
- <?php _e( 'Height', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_customheight" value="<?php echo get_option( 'relpoststh_customheight', $this->custom_height );?>" size="3"/>px
1208
- </td>
1209
- </tr>
1210
- <tr valign="top">
1211
- <th scope="row"><?php _e( 'Theme resize url', 'related-posts-thumbnails' ); ?>:</th>
1212
- <td>
1213
- <input type="text" name="relpoststh_theme_resize_url" value="<?php echo get_option( 'relpoststh_theme_resize_url', '' );?>" size="50"/>
1214
- (<?php _e( 'If your theme resizes images, enter URL to its resizing PHP file', 'related-posts-thumbnails' ); ?>)
1215
- </td>
1216
- </tr>
1217
- </table>
1218
- </div>
1219
- </div>
1220
-
1221
- <div class="postbox" style="padding: 20px; display:none;" id="content_style_options">
1222
- <h2><?php _e( 'Style options', 'related-posts-thumbnails' ); ?>:</h2>
1223
- <table class="form-table">
1224
- <tr>
1225
- <th scope="row"><?php _e( 'Output style', 'related-posts-thumbnails' ); ?>:</th>
1226
- <td>
1227
- <select name="relpoststh_output_style" id="relpoststh_output_style">
1228
- <?php foreach ( $output_styles as $name => $title ) : ?>
1229
- <option value="<?php echo $name; ?>" <?php if ( $relpoststh_output_style == $name ) { echo 'selected'; } ?>><?php echo $title; ?></option>
1230
- <?php endforeach; ?>
1231
- </select>
1232
- <span id="relpoststh_cleanhtml" style="display: <?php if ( $relpoststh_output_style == 'list' ) { echo 'inline';
1233
- } else { echo 'none'; }?>;"><?php _e( 'Turn off plugin styles', 'related-posts-thumbnails' ); ?> <input type="checkbox" name="relpoststh_cleanhtml" <?php if ( $relpoststh_cleanhtml ) { echo 'checked="checked"'; } ?> /></span>
1234
- </td>
1235
- </tr>
1236
- <tr valign="top">
1237
- <th scope="row"><?php _e( 'Background color', 'related-posts-thumbnails' ); ?>:</th>
1238
- <td>
1239
- <input type="text" name="relpoststh_background" value="<?php echo get_option( 'relpoststh_background', $this->background ); ?>" size="7"/>
1240
- </td>
1241
- </tr>
1242
- <tr valign="top">
1243
- <th scope="row"><?php _e( 'Background color on mouse over', 'related-posts-thumbnails' ); ?>:</th>
1244
- <td>
1245
- <input type="text" name="relpoststh_hoverbackground" value="<?php echo get_option( 'relpoststh_hoverbackground', $this->hoverbackground ); ?>" size="7"/>
1246
- </td>
1247
- </tr>
1248
- <tr valign="top">
1249
- <th scope="row"><?php _e( 'Border color', 'related-posts-thumbnails' ); ?>:</th>
1250
- <td>
1251
- <input type="text" name="relpoststh_bordercolor" value="<?php echo get_option( 'relpoststh_bordercolor', $this->border_color )?>" size="7"/>
1252
- </td>
1253
- </tr>
1254
- <tr valign="top">
1255
- <th scope="row"><?php _e( 'Font color', 'related-posts-thumbnails' ); ?>:</th>
1256
- <td>
1257
- <input type="text" name="relpoststh_fontcolor" value="<?php echo get_option( 'relpoststh_fontcolor', $this->font_color ); ?>" size="7"/>
1258
- </td>
1259
- </tr>
1260
- <tr valign="top">
1261
- <th scope="row"><?php _e( 'Font family', 'related-posts-thumbnails' ); ?>:</th>
1262
- <td>
1263
- <input type="text" name="relpoststh_fontfamily" value="<?php echo stripslashes( htmlspecialchars( get_option( 'relpoststh_fontfamily', $this->font_family ) ) ); ?>" size="50"/>
1264
- </td>
1265
- </tr>
1266
- <tr valign="top">
1267
- <th scope="row"><?php _e( 'Font size', 'related-posts-thumbnails' ); ?>:</th>
1268
- <td>
1269
- <input type="text" name="relpoststh_fontsize" value="<?php echo get_option( 'relpoststh_fontsize', $this->font_size )?>" size="7"/>
1270
- </td>
1271
- </tr>
1272
- <tr valign="top">
1273
- <th scope="row"><?php _e( 'Text maximum length', 'related-posts-thumbnails' ); ?>:</th>
1274
- <td>
1275
- <input type="text" name="relpoststh_textlength" value="<?php echo get_option( 'relpoststh_textlength', $this->text_length )?>" size="7"/>
1276
- <label for="relpoststh_textlength"><?php _e( 'Set 0 for no title', 'related-posts-thumbnails' ); ?></label><br />
1277
- </td>
1278
- </tr>
1279
- <tr valign="top">
1280
- <th scope="row"><?php _e( 'Excerpt maximum length', 'related-posts-thumbnails' ); ?>:</th>
1281
- <td>
1282
- <input type="text" name="relpoststh_excerptlength" value="<?php echo get_option( 'relpoststh_excerptlength', $this->excerpt_length )?>" size="7"/>
1283
- <label for="relpoststh_excerptlength"><?php _e( 'Set 0 for no excerpt', 'related-posts-thumbnails' ); ?></label><br />
1284
- </td>
1285
- </tr>
1286
- <tr valign="top">
1287
- <th scope="row"><?php _e( 'Text block height', 'related-posts-thumbnails' ); ?>:</th>
1288
- <td>
1289
- <input type="text" name="relpoststh_textblockheight" value="<?php echo get_option( 'relpoststh_textblockheight', $this->text_block_height )?>" size="7"/> px
1290
- </td>
1291
- </tr>
1292
- </table>
1293
- </div>
1294
- <div class="postbox" style="padding: 20px; display:none;" id="content_relation_options">
1295
- <h2><?php _e( 'Relation Builder Options', 'related-posts-thumbnails' ); ?>:</h2>
1296
- <table class="form-table">
1297
- <tr valign="top">
1298
- <th scope="row"><?php _e( 'Relation based on', 'related-posts-thumbnails' ); ?>:</th>
1299
- <td>
1300
- <?php if ( is_array( $relation_options ) && count( $relation_options ) ) : ?>
1301
- <?php foreach ( $relation_options as $ro_key => $ro_name ) : ?>
1302
- <input type="radio" name="relpoststh_relation" id="relpoststh_relation_<?php echo $ro_key; ?>" value="<?php echo $ro_key; ?>" <?php if ( $relpoststh_relation == $ro_key ) { echo 'checked="checked"'; } ?>/>
1303
- <label for="relpoststh_relation_<?php echo $ro_key; ?>"><?php echo $ro_name; ?></label><br />
1304
- <?php endforeach; ?>
1305
- <?php endif; ?>
1306
- <div id="custom_taxonomies" style="display: <?php if ( $relpoststh_relation == 'custom' ) { echo 'inline';
1307
- } else { echo 'none'; }?>;">
1308
- <?php if ( is_array( $custom_taxonomies ) && count( $custom_taxonomies ) ) : ?>
1309
- <?php foreach ( $custom_taxonomies as $custom_taxonomy ) : ?>
1310
- <input type="checkbox" name="relpoststh_custom_taxonomies[]" id="ct_<?php echo $custom_taxonomy; ?>" value="<?php echo $custom_taxonomy; ?>" <?php if ( in_array( $custom_taxonomy, $relpoststh_custom_taxonomies ) ) { echo 'checked="checked"'; } ?>/>
1311
- <label for="ct_<?php echo $custom_taxonomy; ?>"><?php echo $custom_taxonomy; ?></label>
1312
- <?php endforeach; ?>
1313
- <?php endif; ?>
1314
- </div>
1315
- </td>
1316
- </tr>
1317
- </table>
1318
- </div>
1319
- <!-- <input name="Submit" value="<?php _e( 'Save Changes', 'related-posts-thumbnails' ); ?>" type="submit" class="button-primary"> -->
1320
- </div>
1321
- </div>
1322
-
1323
- <div class="wpbr-button-container bottom">
1324
- <div class="wpbr-social-links alignleft">
1325
- <a href="https://profiles.wordpress.org/hiddenpearls/" class="wordpress" target="_blank"><span class="dashicons dashicons-wordpress"></span></a>
1326
- </div>
1327
- <input type="submit" name="Submit" class="wpbrmedia-settings-submit button button-primary button-big" value="<?php esc_html_e( 'Save Settings','related-posts-thumbnails' ); ?>" id="wpbr_save_setting_bottom">
1328
- </div>
1329
- </div>
1330
-
1331
- <div class="metabox-holder wpbr-sidebar">
1332
- <div class="sidebar postbox">
1333
- <h2><?php esc_html_e( 'Spread the Word' , 'related-posts-thumbnails' )?></h2>
1334
- <ul>
1335
- <li>
1336
- <a href="http://twitter.com/share?text=This is Best Related Post Thumbnails Plugin for WordPress&url=https://wordpress.org/support/view/plugin-reviews/related-posts-thumbnails" data-count="none" class="button twitter" target="_blank" title="Post to Twitter Now"><?php esc_html_e( 'Share on Twitter' , 'related-posts-thumbnails' )?><span class="dashicons dashicons-twitter"></span></a>
1337
- </li>
1338
-
1339
- <li>
1340
- <a href="https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/support/view/plugin-reviews/related-posts-thumbnails" class="button facebook" target="_blank" title="Share with your facebook friends about this awesome plugin."><?php esc_html_e( 'Share on Facebook' , 'related-posts-thumbnails' )?><span class="dashicons dashicons-facebook"></span>
1341
- </a>
1342
- </li>
1343
-
1344
- <li>
1345
- <a href="https://wordpress.org/support/view/plugin-reviews/related-posts-thumbnails?filter=5" class="button wordpress" target="_blank" title="Rate on Wordpress.org"><?php esc_html_e( 'Rate on Wordpress.org' , 'related-posts-thumbnails' )?><span class="dashicons dashicons-wordpress"></span>
1346
- </a>
1347
- </li>
1348
- </ul>
1349
- </div>
1350
- <form>
1351
-
1352
- <div class="sidebar postbox">
1353
-
1354
- <h2><?php esc_html_e( 'Subscribe Newsletter' , 'related-posts-thumbnails' )?></h2>
1355
- <ul>
1356
- <li>
1357
- <label for="">Email</label>
1358
- <input type="email" name="subscriber_mail" value="<?php echo get_option( 'admin_email' ) ?>" id="rpt_subscribe_mail">
1359
- <p class='rpt_subscribe_warning'></p>
1360
- </li>
1361
- <li>
1362
- <label for="">Name</label>
1363
- <input type="text" name="subscriber_name" id="rpt_subscribe_name" value="<?php echo wp_get_current_user()->display_name ?>" id="rpt_subscribe_mail">
1364
- </li>
1365
- <li>
1366
- <input type="submit" value="Subscribe Now" class="button button-primary button-big" id='rpt_subscribe_btn' />
1367
- <img src="<?php echo admin_url( 'images/spinner.gif' ) ?>" class='rpt_subscribe_loader' style="display:none" />
1368
- </li>
1369
- <li>
1370
- <p class='rpt_return_message'></p>
1371
- </li>
1372
- </ul>
1373
- </div>
1374
-
1375
- <div class="sidebar postbox">
1376
- <h2><?php esc_html_e( 'Recommended Plugins' , 'related-posts-thumbnails' )?></h2>
1377
- <!-- <p>Following are the plugins highly recommend by Team WPBrigade.</p> -->
1378
- <ul class="plugins_lists">
1379
- <li>
1380
- <a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/?utm_source=related-posts-lite&utm_medium=sidebar&utm_campaign=pro-upgrade" data-count="none" target="_blank" title="Post to Twitter Now"><?php esc_html_e( 'LoginPress - Login Customizer' , 'related-posts-thumbnails' )?></a>
1381
- </li>
1382
-
1383
- <li>
1384
- <a href="https://analytify.io/ref/73/?utm_source=related-posts-lite&utm_medium=sidebar&utm_campaign=pro-upgrade" target="_blank" title="Share with your facebook friends about this awesome plugin."><?php esc_html_e( 'Google Analytics by Analytify' , 'related-posts-thumbnails' )?></span>
1385
- </a>
1386
- </li>
1387
-
1388
- <li>
1389
- <a href="http://wpbrigade.com/recommend/maintenance-mode" target="_blank" title="Under Construction & Maintenance mode"><?php esc_html_e( 'Under Construction & Maintenance mode' , 'related-posts-thumbnails' )?></span>
1390
- </a>
1391
- </li>
1392
- </ul>
1393
- </div>
1394
- </div>
1395
-
1396
- </div>
1397
- </form>
1398
- <p style="margin-top: 40px;"><small><?php _e( 'If you experience some problems with this plugin please let me know about it on <a target="_blank" href="https://wpbrigade.com/wordpress/plugins/related-posts/">Plugin\'s homepage</a>. If you think this plugin is awesome please vote on <a target="_blank" href="https://wordpress.org/plugins/related-posts-thumbnails/">Wordpress plugin page</a>. Thanks!', 'related-posts-thumbnails' ); ?></small></p>
1399
- <?php
1400
  }
1401
 
1402
  function display_categories_list( $categoriesall, $categories, $selected_categories, $all_name, $specific_name ) {
@@ -1411,54 +703,49 @@ class RelatedPostsThumbnails {
1411
  </div>
1412
  <?php
1413
  }
1414
- }
1415
 
1416
- add_action( 'init', 'related_posts_thumbnails' );
1417
 
1418
- function related_posts_thumbnails() {
1419
- global $related_posts_thumbnails;
1420
- $related_posts_thumbnails = new RelatedPostsThumbnails();
1421
- }
1422
 
1423
- function get_related_posts_thumbnails() {
1424
- global $related_posts_thumbnails;
1425
- echo $related_posts_thumbnails->get_html();
1426
- }
1427
 
1428
- /**
1429
- * Related Posts Widget, will be displayed on post page
1430
- */
1431
- class RelatedPostsThumbnailsWidget extends WP_Widget {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1432
 
1433
- function __construct() {
1434
- parent::__construct( false, $name = 'Related Posts Thumbnails' );
1435
  }
1436
 
1437
- function widget( $args, $instance ) {
1438
- if ( is_single() && ! is_page() ) { // display on post page only
1439
- extract( $args );
1440
- $title = apply_filters( 'widget_title', $instance['title'] );
1441
- echo $before_widget;
1442
- if ( $title ) {
1443
- echo $before_title . $title . $after_title; }
1444
- get_related_posts_thumbnails();
1445
- echo $after_widget;
1446
- }
1447
- }
1448
 
1449
- function update( $new_instance, $old_instance ) {
1450
- $instance = $old_instance;
1451
- $instance['title'] = strip_tags( $new_instance['title'] );
1452
- return $instance;
1453
- }
1454
 
1455
- function form( $instance ) {
1456
- $title = esc_attr( $instance['title'] );
1457
- ?>
1458
- <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
1459
- <?php
1460
- }
1461
- } // class RelatedPostsThumbnailsWidget
 
 
1462
 
1463
- add_action( 'widgets_init', create_function( '', 'return register_widget("RelatedPostsThumbnailsWidget");' ) );
1464
  ?>
3
  * Plugin Name: WordPress Related Posts Thumbnails
4
  * Plugin URI: https://wpbrigade.com/wordpress/plugins/related-posts/?utm_source=related-posts-lite&utm_medium=plugin-uri&utm_campaign=pro-upgrade-rp
5
  * Description: Showing related posts thumbnails under the posts.
6
+ * Version: 1.6.2
7
  * Author: WPBrigade
8
  * Author URI: https://WPBrigade.com/?utm_source=related-posts-lite&utm_medium=author-link&utm_campaign=pro-upgrade-rp
9
  */
25
  */
26
  class RelatedPostsThumbnails {
27
  /* Default values. PHP 4 compatible */
28
+ public $single_only = '1';
29
+ public $auto = '1';
30
+ public $top_text = '<h3>Related posts:</h3>';
31
+ public $number = 3;
32
+ public $relation = 'categories';
33
+ public $poststhname = 'thumbnail';
34
+ public $background = '#ffffff';
35
+ public $hoverbackground = '#eeeeee';
36
+ public $border_color = '#dddddd';
37
+ public $font_color = '#333333';
38
+ public $font_family = 'Arial';
39
+ public $font_size = '12';
40
+ public $text_length = '100';
41
+ public $excerpt_length = '0';
42
+ public $custom_field = '';
43
+ public $custom_height = '100';
44
+ public $custom_width = '100';
45
+ public $text_block_height = '75';
46
+ public $thsource = 'post-thumbnails';
47
+ public $categories_all = '1';
48
+ public $devmode = '0';
49
+ public $output_style = 'div';
50
+ public $post_types = array( 'post' );
51
+ public $custom_taxonomies = array();
52
 
53
  protected $wp_kses_rp_args = array(
54
 
62
  );
63
 
64
  function __construct() {
65
+
66
+ $this->constant();
67
  // initialization
68
  load_plugin_textdomain( 'related-posts-thumbnails', false, basename( dirname( __FILE__ ) ) . '/locale' );
69
  $this->default_image = esc_url( plugins_url( 'img/default.png', __FILE__ ) );
70
 
71
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
72
+
73
  // Compatibility for old default image path.
74
  if ( $this->is_old_default_img() )
75
  update_option( 'relpoststh_default_image', $this->default_image );
83
 
84
  $this->wp_version = get_bloginfo( 'version' );
85
 
86
+ add_action( 'admin_footer', array( $this, 'add_deactive_modal' ) );
87
+ add_action( 'wp_ajax_rpt_deactivate', array( $this, 'rpt_deactivate' ) );
 
 
 
 
 
88
 
89
+ add_action( 'admin_init', array( $this, 'review_notice' ) );
90
+ add_action( 'wp_enqueue_scripts', array( $this, 'front_scripts' ) );
 
 
 
 
 
 
 
 
 
91
 
92
+ add_action( 'wp_head', array( $this, 'head_style' ) );
93
 
94
+ }
 
95
 
96
+ function admin_scripts( $page ) {
 
97
 
98
+ if ( 'toplevel_page_related-posts-thumbnails' === $page ) {
99
+ wp_enqueue_style( 'rpt_admin_css', plugins_url( 'assets/css/admin.css', __FILE__ ), false, RELATED_POSTS_THUMBNAILS_VERSION );
100
+ wp_enqueue_style( 'jquery-ui', 'http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css' );
101
+ wp_enqueue_style( 'wp-color-picker' );
102
+ wp_enqueue_script( 'rpt_admin_js', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery', 'wp-color-picker', 'jquery-ui-datepicker' ), RELATED_POSTS_THUMBNAILS_VERSION );
103
+ }
104
 
105
+ }
106
 
107
+ function front_scripts() {
 
108
 
109
+ wp_enqueue_style( 'rpt_front_style', plugins_url( 'assets/css/front.css', __FILE__ ), false, RELATED_POSTS_THUMBNAILS_VERSION );
110
+ }
111
 
112
+ function constant() {
 
 
 
 
 
 
 
113
 
114
+ define( 'RELATED_POSTS_THUMBNAILS_VERSION', '1.6.2' );
115
+ define( 'RELATED_POSTS_THUMBNAILS_FEEDBACK_SERVER', 'https://wpbrigade.com/' );
116
+ define( 'RELATED_POSTS_THUMBNAILS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
117
 
118
+ }
119
 
120
+ /**
121
+ * Show the popup on pluing deactivate
122
+ *
123
+ * @since 1.6.2
124
+ */
125
+ function add_deactive_modal() {
126
+ global $pagenow;
127
+
128
+ if ( 'plugins.php' !== $pagenow ) {
129
+ return;
130
  }
 
 
131
 
132
+ include RELATED_POSTS_THUMBNAILS_PLUGIN_DIR. 'inc/rpt-deactivate-form.php';
133
+ }
134
 
135
+
136
+ /**
137
+ * Send the user responce to api.
138
+ *
139
+ * @since 1.6.2
140
+ */
141
+ function rpt_deactivate() {
142
+ $email = get_option( 'admin_email' );
143
+ $_reason = sanitize_text_field( wp_unslash( $_POST['reason'] ) );
144
+ $reason_detail = sanitize_text_field( wp_unslash( $_POST['reason_detail'] ) );
145
+ $reason = '';
146
+
147
+ if ( $_reason == '1' ) {
148
+ $reason = 'I only needed the plugin for a short period';
149
+ } elseif ( $_reason == '2' ) {
150
+ $reason = 'I found a better plugin';
151
+ } elseif ( $_reason == '3' ) {
152
+ $reason = 'The plugin broke my site';
153
+ } elseif ( $_reason == '4' ) {
154
+ $reason = 'The plugin suddenly stopped working';
155
+ } elseif ( $_reason == '5' ) {
156
+ $reason = 'I no longer need the plugin';
157
+ } elseif ( $_reason == '6' ) {
158
+ $reason = 'It\'s a temporary deactivation. I\'m just debugging an issue.';
159
+ } elseif ( $_reason == '7' ) {
160
+ $reason = 'Other';
161
  }
162
+ $fields = array(
163
+ 'email' => $email,
164
+ 'website' => get_site_url(),
165
+ 'action' => 'Deactivate',
166
+ 'reason' => $reason,
167
+ 'reason_detail' => $reason_detail,
168
+ 'blog_language' => get_bloginfo( 'language' ),
169
+ 'wordpress_version' => get_bloginfo( 'version' ),
170
+ 'php_version' => PHP_VERSION,
171
+ 'plugin_version' => RELATED_POSTS_THUMBNAILS_VERSION,
172
+ 'plugin_name' => 'Related Post Thumbnails',
173
+ );
174
+
175
+ $response = wp_remote_post( RELATED_POSTS_THUMBNAILS_FEEDBACK_SERVER, array(
176
+ 'method' => 'POST',
177
+ 'timeout' => 5,
178
+ 'httpversion' => '1.0',
179
+ 'blocking' => false,
180
+ 'headers' => array(),
181
+ 'body' => $fields,
182
+ ) );
183
+
184
  wp_die();
185
  }
186
 
187
+ /**
188
+ * Check either to show notice or not.
189
+ *
190
+ * @since 1.8.2
191
+ */
192
+ public function review_notice() {
193
+
194
+ $this->review_dismissal();
195
+ $this->review_prending();
196
+
197
+ $review_dismissal = get_option( 'rpt_review_dismiss' );
198
+ if ( 'yes' == $review_dismissal ) {
199
+ return;
200
+ }
201
+
202
+ $activation_time = get_option( 'rpt_active_time' );
203
+ if ( ! $activation_time ) {
204
+
205
+ $activation_time = time();
206
+ add_option( 'rpt_active_time', $activation_time );
207
+ }
208
+
209
+ // 1296000 = 15 Days in seconds.
210
+ if ( time() - $activation_time > 1296000 ) {
211
+ add_action( 'admin_notices' , array( $this, 'review_notice_message' ) );
212
+ }
213
+
214
+ }
215
+
216
+ /**
217
+ * Show review Message After 15 days.
218
+ *
219
+ * @since 1.8.2
220
+ */
221
+ public function review_notice_message() {
222
+
223
+ $scheme = ( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY ) ) ? '&' : '?';
224
+ $url = $_SERVER['REQUEST_URI'] . $scheme . 'rpt_review_dismiss=yes';
225
+ $dismiss_url = wp_nonce_url( $url, 'rpt-review-nonce' );
226
+
227
+ $_later_link = $_SERVER['REQUEST_URI'] . $scheme . 'ssb_review_later=yes';
228
+ $later_url = wp_nonce_url( $_later_link, 'rpt-review-nonce' );
229
+
230
+ ?>
231
+ <style media="screen">
232
+ .rpt-review-notice { padding: 15px 0; background-color: #fff; border-radius: 3px; margin: 20px 20px 0 0; border-left: 4px solid transparent; } .rpt-review-notice:after { content: ''; display: table; clear: both; }
233
+ .rpt-review-thumbnail { float: left; line-height: 80px; text-align: center; width: 117px; }
234
+ .rpt-review-thumbnail img { width: 118px; vertical-align: middle; }
235
+ .rpt-review-text { overflow: hidden; }
236
+ .rpt-review-text h3 { font-size: 24px; margin: 0 0 5px; font-weight: 400; line-height: 1.3; }
237
+ .rpt-review-text p { font-size: 13px; margin: 0 0 5px; }
238
+ .rpt-review-ul { margin: 0; padding: 0; }
239
+ .rpt-review-ul li { display: inline-block; margin-right: 15px; }
240
+ .rpt-review-ul li a { display: inline-block; color: #10738B; text-decoration: none; padding-left: 26px; position: relative; }
241
+ .rpt-review-ul li a span { position: absolute; left: 0; top: -2px; }
242
+ </style>
243
+ <div class="rpt-review-notice">
244
+ <div class="rpt-review-thumbnail">
245
+ <img src="<?php echo plugins_url( 'assets/images/rpt-logo.png', __FILE__ ) ?>" alt="">
246
+ </div>
247
+ <div class="rpt-review-text">
248
+ <h3><?php _e( 'Leave A Review?', 'related-posts-thumbnails' ) ?></h3>
249
+ <p><?php _e( 'We hope you\'ve enjoyed using Related Post Thumbnails! Would you consider leaving us a review on WordPress.org?', 'related-posts-thumbnails' ) ?></p>
250
+ <ul class="rpt-review-ul"><li><a href="https://wordpress.org/support/plugin/related-posts-thumbnails/reviews/?filter=5" target="_blank"><span class="dashicons dashicons-external"></span><?php _e( 'Sure! I\'d love to!', 'related-posts-thumbnails' ) ?></a></li>
251
+ <li><a href="<?php echo $dismiss_url ?>"><span class="dashicons dashicons-smiley"></span><?php _e( 'I\'ve already left a review', 'related-posts-thumbnails' ) ?></a></li>
252
+ <li><a href="<?php echo $later_url ?>"><span class="dashicons dashicons-calendar-alt"></span><?php _e( 'Maybe Later', 'related-posts-thumbnails' ) ?></a></li>
253
+ <li><a href="<?php echo $dismiss_url ?>"><span class="dashicons dashicons-dismiss"></span><?php _e( 'Never show again', 'related-posts-thumbnails' ) ?></a></li></ul>
254
+ </div>
255
+ </div>
256
+ <?php
257
+ }
258
+
259
+ /**
260
+ * Set time to current so review notice will popup after 15 days
261
+ *
262
+ * @since 1.8.2
263
+ */
264
+ function review_prending() {
265
+
266
+ // delete_site_option( 'rpt_review_dismiss' );
267
+ if ( ! is_admin() ||
268
+ ! current_user_can( 'manage_options' ) ||
269
+ ! isset( $_GET['_wpnonce'] ) ||
270
+ ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'rpt-review-nonce' ) ||
271
+ ! isset( $_GET['ssb_review_later'] ) ) {
272
+
273
+ return;
274
+ }
275
+
276
+ // Reset Time to current time.
277
+ update_option( 'rpt_active_time', time() );
278
+
279
+ }
280
+
281
+ /**
282
+ * Check and Dismiss review message.
283
+ *
284
+ * @since 1.8.2
285
+ */
286
+ private function review_dismissal() {
287
+
288
+ //delete_option( 'rpt_review_dismiss' );
289
+ if ( ! is_admin() ||
290
+ ! current_user_can( 'manage_options' ) ||
291
+ ! isset( $_GET['_wpnonce'] ) ||
292
+ ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'rpt-review-nonce' ) ||
293
+ ! isset( $_GET['rpt_review_dismiss'] ) ) {
294
+
295
+ return;
296
+ }
297
+
298
+ add_option( 'rpt_review_dismiss', 'yes' );
299
+ }
300
+
301
+
302
  /**
303
  * [is_old_default_img Check the compatibility for old default image path.]
304
  * @return boolean Return true if path is old.
333
  $debug = 'Developer mode initialisation; Version: 1.2.9;';
334
  $time = microtime( true );
335
  $posts_number = get_option( 'relpoststh_number', $this->number );
336
+ $height = '';
337
+ $width = '';
338
+ $output = '<div class="relpost-thumb-wrapper">';
339
+ $alt = '';
340
 
341
  if ( $posts_number <= 0 ) { // return nothing if this parameter was set to <= 0
342
  return $this->finish_process( $output, $debug . 'Posts number is 0;', $time );
497
  $relpoststh_cleanhtml = get_option( 'relpoststh_cleanhtml', 0 );
498
  $text_height = get_option( 'relpoststh_textblockheight', $this->text_block_height );
499
 
500
+
501
  if ( $relpoststh_output_style == 'list' ) {
502
  $output .= '<ul id="related_posts_thumbnails"';
503
+ // if ( ! $relpoststh_cleanhtml ) {
504
+ // $output .= ' style="list-style-type:none; list-style-position: inside; padding: 0; margin:0"';
505
+ // }
506
  $output .= '>';
507
  } else {
508
+ // $output .= '<div style="clear: both"></div><ul class="related-posts-nav">';
509
+ $output .= '<div style="clear: both"></div><div class="relpost-block-container">';
510
  }
511
 
512
  foreach ( $posts as $post ) {
586
 
587
  if ( ! empty( $title ) && ! empty( $excerpt ) ) {
588
  $title = '<b>' . $title . '</b>';
589
+ $alt = $title;
590
  $excerpt = '<br/>' . $excerpt;
591
  }
592
 
598
  $fontface = str_replace( '"', "'", stripslashes( get_option( 'relpoststh_fontfamily', $this->font_family ) ) );
599
  $output .= '<li ';
600
  if ( ! $relpoststh_cleanhtml ) {
601
+ // $output .= ' onmouseout="this.style.backgroundColor=\'' . get_option( 'relpoststh_background', $this->background ) . '\'"';
602
  }
603
  $output .= '>';
604
+ $output .= '<a href="' . $link . '" ><img class="relpost-post-image" alt="' . $alt . '" src="' . $url . '" width="' . $width . '" height="' . $height . '" ';
605
  if ( ! $relpoststh_cleanhtml ) {
606
+ // $output .= 'style="padding: 0px; margin: 0px; border: 0pt none;"';
607
  }
608
  $output .= '/></a>';
609
  if ( $text_height != '0' ) {
610
+ $output .= '<a href="' . $link . '" class="relpost_content"';
611
  if ( ! $relpoststh_cleanhtml ) {
612
+ $output .= ' style="width: ' . $width . 'px;height: ' . $text_height . 'px; font-family: ' . $fontface . '; "'; }
613
  $output .= '><span>' . $title . $excerpt . '</span></a></li>';
614
  }
615
  } else {
616
+ $output .= '<a class="relpost-block-single" href="' . get_permalink( $post->ID ) . '">';
617
+ $output .= '<div style="width: ' . $width . 'px; height: ' . ( $height + $text_height ) . 'px;">';
618
+ $output .= '<div class="relpost-block-single-image" style=" background: transparent url(' . $url . ') no-repeat scroll 0% 0%; width: ' . $width . 'px; height: ' . $height . 'px; "></div>';
619
+ $output .= '<div class="relpost-block-single-text" style="font-family: ' . $fontface . '; font-size: ' . get_option( 'relpoststh_fontsize', $this->font_size ) . 'px; color: ' . get_option( 'relpoststh_fontcolor', $this->font_color ) . ';">' . $title . $excerpt . '</div>';
620
  $output .= '</div>';
621
  $output .= '</a>';
622
  }
627
  $output .= '</div>';
628
  }
629
  $output .= '<div style="clear: both"></div>';
630
+ $output .= '</div>';
631
  return $this->finish_process( $output, $debug, $time );
632
  }
633
 
645
  if ( $length == 0 ) {
646
  return '';
647
  } else {
648
+ $text = strip_tags( strip_shortcodes( $text ) );
649
  if ( function_exists( 'mb_strlen' ) ) {
650
  return ( ( mb_strlen( $text ) > $length ) ? mb_substr( $text, 0, $length ) . '...' : $text );
651
  } else {
683
  }
684
 
685
  function admin_menu() {
686
+ $page = add_menu_page( __( 'Related Posts Thumbnails', 'related-posts-thumbnails' ), __( 'Related Posts', 'related-posts-thumbnails' ), 'administrator', 'related-posts-thumbnails', array( $this, 'admin_interface' ), 'dashicons-screenoptions' );
687
  }
688
 
689
  function admin_interface() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
690
 
691
+ include_once RELATED_POSTS_THUMBNAILS_PLUGIN_DIR . '/inc/rpt-settings.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
  }
693
 
694
  function display_categories_list( $categoriesall, $categories, $selected_categories, $all_name, $specific_name ) {
703
  </div>
704
  <?php
705
  }
 
706
 
 
707
 
 
 
 
 
708
 
 
 
 
 
709
 
710
+ function head_style() {
711
+ ?>
712
+ <style>
713
+ #related_posts_thumbnails li{
714
+ border-right: 1px solid <?php echo get_option( 'relpoststh_bordercolor', $this->border_color ) ?>;
715
+ background-color: <?php echo get_option( 'relpoststh_background', $this->background ) ?>
716
+ }
717
+ #related_posts_thumbnails li:hover{
718
+ background-color: <?php echo get_option( 'relpoststh_hoverbackground', $this->hoverbackground ) ?>;
719
+ }
720
+ .relpost_content{
721
+ font-size: <?php echo get_option( 'relpoststh_fontsize', $this->font_size ) . 'px' ?>;
722
+ color: <?php echo get_option( 'relpoststh_fontcolor', $this->font_color ) ?>;
723
+ }
724
+ .relpost-block-single{
725
+ background-color: <?php echo get_option( 'relpoststh_background', $this->background ) ?>;
726
+ border-right: 1px solid <?php echo get_option( 'relpoststh_bordercolor', $this->border_color ) ?>;
727
+ border-left: 1px solid <?php echo get_option( 'relpoststh_bordercolor', $this->border_color ) ?>;
728
+ margin-right: -1px;
729
+ }
730
+ .relpost-block-single:hover{
731
+ background-color: <?php echo get_option( 'relpoststh_hoverbackground', $this->hoverbackground ) ?>;
732
+ }
733
+ </style>
734
 
735
+ <?php
 
736
  }
737
 
 
 
 
 
 
 
 
 
 
 
 
738
 
739
+ }
 
 
 
 
740
 
741
+ add_action( 'init', 'related_posts_thumbnails' );
742
+
743
+ function related_posts_thumbnails() {
744
+ global $related_posts_thumbnails;
745
+ $related_posts_thumbnails = new RelatedPostsThumbnails();
746
+ }
747
+
748
+ // Include Widget File.
749
+ include_once plugin_dir_path( __FILE__ ) . 'inc/rpt-widget.php';
750
 
 
751
  ?>