Inline Related Posts - Version 3.0.7

Version Description

Release Date - 2021-08-24

  • IWP-83 Make the linkRel attribute default to 'dofollow' and provide an option to prevent all related post links from changing with every page refresh.
Download this release

Release Info

Developer data443
Plugin Icon 128x128 Inline Related Posts
Version 3.0.7
Comparing to
See all releases

Code changes from version 3.0.6 to 3.0.7

includes/admin/settings.php CHANGED
@@ -213,6 +213,7 @@ function irp_ui_settings() {
213
  $irp->Options->setRewriteThreshold($irp->Utils->iqs('irpRewriteThreshold', 300));
214
  $irp->Options->setHookPriority($irp->Utils->iqs('irpHookPriority', 99999));
215
  $irp->Options->setRewriteAtEnd($irp->Utils->iqs('irpRewriteAtEnd'));
 
216
 
217
  $irp->Options->setEngineSearch($irp->Utils->iqs('irpEngineSearch', IRP_ENGINE_SEARCH_CATEGORIES_TAGS));
218
 
@@ -301,6 +302,7 @@ function irp_ui_settings() {
301
  $irp->Form->number('irpRewriteThreshold', $irp->Options->getRewriteThreshold(), $args);
302
  $irp->Form->number('irpHookPriority', $irp->Options->getHookPriority());
303
  $irp->Form->checkbox('irpRewriteAtEnd', $irp->Options->isRewriteAtEnd());
 
304
  $irp->Form->p('');
305
 
306
  $options=$irp->Options->getRewritePostTypes();
@@ -322,8 +324,8 @@ function irp_ui_settings() {
322
  );
323
  $irp->Form->select('irpEngineSearch', $irp->Options->getEngineSearch(), $options);
324
  $options=array();
325
- $options[]=array('id'=>'nofollow', 'name'=>'nofollow');
326
  $options[]=array('id'=>'dofollow', 'name'=>'dofollow');
 
327
  $k='linkRel';
328
 
329
  $irp->Form->select($prefix.$k, $irp->Utils->get($template, $k), $options);
213
  $irp->Options->setRewriteThreshold($irp->Utils->iqs('irpRewriteThreshold', 300));
214
  $irp->Options->setHookPriority($irp->Utils->iqs('irpHookPriority', 99999));
215
  $irp->Options->setRewriteAtEnd($irp->Utils->iqs('irpRewriteAtEnd'));
216
+ $irp->Options->setRewriteStaticLinks($irp->Utils->iqs('irpRewriteStaticLinks'));
217
 
218
  $irp->Options->setEngineSearch($irp->Utils->iqs('irpEngineSearch', IRP_ENGINE_SEARCH_CATEGORIES_TAGS));
219
 
302
  $irp->Form->number('irpRewriteThreshold', $irp->Options->getRewriteThreshold(), $args);
303
  $irp->Form->number('irpHookPriority', $irp->Options->getHookPriority());
304
  $irp->Form->checkbox('irpRewriteAtEnd', $irp->Options->isRewriteAtEnd());
305
+ $irp->Form->checkbox('irpRewriteStaticLinks', $irp->Options->isRewriteStaticLinks());
306
  $irp->Form->p('');
307
 
308
  $options=$irp->Options->getRewritePostTypes();
324
  );
325
  $irp->Form->select('irpEngineSearch', $irp->Options->getEngineSearch(), $options);
326
  $options=array();
 
327
  $options[]=array('id'=>'dofollow', 'name'=>'dofollow');
328
+ $options[]=array('id'=>'nofollow', 'name'=>'nofollow');
329
  $k='linkRel';
330
 
331
  $irp->Form->select($prefix.$k, $irp->Utils->get($template, $k), $options);
includes/admin/whatsnew.php CHANGED
@@ -18,7 +18,7 @@ function irp_ui_whats_new() {
18
  }
19
  </style>
20
 
21
- <p class="irp-headline">Welcome in Inline Related Posts (v.<?php echo IRP_PLUGIN_VERSION ?>)</p>
22
  <p class="irp-headline" style="font-size: 35px;">Get even more page views with box themes</p>
23
  <div style="clear:both; height:30px;"></div>
24
 
18
  }
19
  </style>
20
 
21
+ <p class="irp-headline">Welcome to Inline Related Posts (v.<?php echo IRP_PLUGIN_VERSION ?>)</p>
22
  <p class="irp-headline" style="font-size: 35px;">Get even more page views with box themes</p>
23
  <div style="clear:both; height:30px;"></div>
24
 
includes/classes/core/HtmlTemplate.php CHANGED
@@ -188,10 +188,10 @@ class IRP_HtmlTemplate {
188
  $values['assets']=IRP_PLUGIN_ASSETS;
189
  $values['demoLink']=irp_preview_link();
190
 
191
- if(isset($values['linkRel'])) {
192
- $values['linkRel']=$values['linkRel'];
193
- if($values['linkRel']!='nofollow') {
194
- $values['linkRel']='';
195
  }
196
  }
197
  $values['linkRel']=($values['linkRel']!='' ? 'rel="'.$values['linkRel'].'"' : '');
@@ -269,7 +269,7 @@ class IRP_HtmlTemplate {
269
  $code.='<div style="font-size:10px;">';
270
  $code.='<span class="poweredByText">Powered by</span>';
271
  $code.='&nbsp;';
272
- $code.='<a rel="nofollow" style="font-weight:bold;" href="https://wordpress.org/plugins/intelly-related-posts/" target="_blank">';
273
  $code.='Inline Related Posts';
274
  $code.='</a>';
275
  $code.='</div>';
@@ -279,15 +279,13 @@ class IRP_HtmlTemplate {
279
  $mt=$irp->Options->getMarginTop();
280
  $mb=$irp->Options->getMarginBottom();
281
  $code='<div style="clear:both; margin-top:'.$mt.'; margin-bottom:'.$mb.';">'.$code.'</div>';
282
- //$code.="\n";
283
- //$code.="<br>";
284
  }
285
 
286
  $defaults=$irp->HtmlTemplate->getDefaults();
287
  $defaults=$defaults[$options['template']];
288
  if($code!='' && isset($defaults['proTheme']) && $irp->Utils->isTrue($defaults['proTheme'])) {
289
  $code.='<p style="text-align:center;">';
290
- $code.='<a style="font-size:20px; color:green; font-weight:bold;" href="'.$values['demoLink'].'" rel="nofollow" target="_blank">';
291
  $code.='Click here to preview your posts with PRO themes ››';
292
  $code.='</p>';
293
  $code.='</a>';
188
  $values['assets']=IRP_PLUGIN_ASSETS;
189
  $values['demoLink']=irp_preview_link();
190
 
191
+ if (isset($values['linkRel'])) {
192
+ $values['linkRel'] = $values['linkRel'];
193
+ if ($values['linkRel'] != 'nofollow' && $values['linkRel'] != 'dofollow') {
194
+ $values['linkRel'] = '';
195
  }
196
  }
197
  $values['linkRel']=($values['linkRel']!='' ? 'rel="'.$values['linkRel'].'"' : '');
269
  $code.='<div style="font-size:10px;">';
270
  $code.='<span class="poweredByText">Powered by</span>';
271
  $code.='&nbsp;';
272
+ $code.='<a rel="' . IRP_DEFAULT_LINK_REL_ATTRIBUTE . '" style="font-weight:bold;" href="https://wordpress.org/plugins/intelly-related-posts/" target="_blank">';
273
  $code.='Inline Related Posts';
274
  $code.='</a>';
275
  $code.='</div>';
279
  $mt=$irp->Options->getMarginTop();
280
  $mb=$irp->Options->getMarginBottom();
281
  $code='<div style="clear:both; margin-top:'.$mt.'; margin-bottom:'.$mb.';">'.$code.'</div>';
 
 
282
  }
283
 
284
  $defaults=$irp->HtmlTemplate->getDefaults();
285
  $defaults=$defaults[$options['template']];
286
  if($code!='' && isset($defaults['proTheme']) && $irp->Utils->isTrue($defaults['proTheme'])) {
287
  $code.='<p style="text-align:center;">';
288
+ $code.='<a style="font-size:20px; color:green; font-weight:bold;" href="'.$values['demoLink'].'" rel="' . IRP_DEFAULT_LINK_REL_ATTRIBUTE . '" target="_blank">';
289
  $code.='Click here to preview your posts with PRO themes ››';
290
  $code.='</p>';
291
  $code.='</a>';
includes/classes/utils/AppOptions.php CHANGED
@@ -21,15 +21,61 @@ class IRP_AppOptions extends IRP_Options {
21
  $array=$this->getRequest('RelatedPostsIds', array());
22
  return (is_array($array) && count($array)>0);
23
  }
24
- public function initRelatedPostsIds($ids) {
 
 
 
 
 
 
25
  $this->setRequest('RelatedPostsIds', $ids);
26
- if($ids) {
27
  shuffle($ids);
28
  }
29
  $this->setRequest('ToShowPostsIds', $ids);
30
  $this->setRequest('ShownPostsIdsSequence', array());
31
  $this->setRewriteBoxesWritten(0);
32
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  public function refreshRelatedPostsIds() {
34
  $ids=$this->getRequest('RelatedPostsIds', array());
35
  $this->initRelatedPostsIds($ids);
@@ -114,7 +160,7 @@ class IRP_AppOptions extends IRP_Options {
114
 
115
  $defaults=array(
116
  'template'=>''
117
- , 'linkRel'=>$this->getOption('LinkRel', 'nofollow')
118
  , 'linkTarget'=>$this->getOption('LinkTarget', '_blank')
119
  , 'ctaText'=>$this->getOption('RelatedText', 'READ')
120
  , 'ctaTextColor'=>$this->getOption('TemplateRelatedTextColor', '')
@@ -145,6 +191,23 @@ class IRP_AppOptions extends IRP_Options {
145
  public function setRewriteActive($value) {
146
  $this->setOption('RewriteActive', $value);
147
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  public function getExcludedPostsIds() {
149
  return $this->getOption('ExcludedPostsIds', array());
150
  }
21
  $array=$this->getRequest('RelatedPostsIds', array());
22
  return (is_array($array) && count($array)>0);
23
  }
24
+
25
+ public function initRelatedPostsIds($ids, $postId = -1)
26
+ {
27
+ $staticLinks = $this->isRewriteStaticLinks();
28
+ if ($postId > 0 && $staticLinks) {
29
+ $ids = $this->getStaticLinks($postId, $ids);
30
+ }
31
  $this->setRequest('RelatedPostsIds', $ids);
32
+ if ($ids && !$staticLinks) {
33
  shuffle($ids);
34
  }
35
  $this->setRequest('ToShowPostsIds', $ids);
36
  $this->setRequest('ShownPostsIdsSequence', array());
37
  $this->setRewriteBoxesWritten(0);
38
  }
39
+
40
+ private function getStaticLinks($postId, $ids)
41
+ {
42
+ $key = 'POST_' . $postId;
43
+ $staticIds = $this->getOption($key, array());
44
+ $checkedDate = get_the_modified_date('', $postId) . ' ' . get_the_modified_time('', $postId);
45
+ if (empty($staticIds)) {
46
+ $data = array (
47
+ 'date' => $checkedDate,
48
+ 'ids' => $ids
49
+ );
50
+ $this->setOption($key, $data);
51
+ } else {
52
+ $savedDate = $staticIds['date'];
53
+ $savedIds = $staticIds['ids'];
54
+ $valid = $this->validatePostIds($savedIds);
55
+ if (!$valid || $savedDate != $checkedDate) {
56
+ $data = array (
57
+ 'date' => $checkedDate,
58
+ 'ids' => $ids
59
+ );
60
+ $this->setOption($key, $data);
61
+ } else {
62
+ $ids = $savedIds;
63
+ }
64
+ }
65
+ return $ids;
66
+ }
67
+
68
+ private function validatePostIds($ids)
69
+ {
70
+ foreach ($ids as $id) {
71
+ $status = get_post_status($id);
72
+ if ($status === false) {
73
+ return false;
74
+ }
75
+ }
76
+ return true;
77
+ }
78
+
79
  public function refreshRelatedPostsIds() {
80
  $ids=$this->getRequest('RelatedPostsIds', array());
81
  $this->initRelatedPostsIds($ids);
160
 
161
  $defaults=array(
162
  'template'=>''
163
+ , 'linkRel'=>$this->getOption('LinkRel', IRP_DEFAULT_LINK_REL_ATTRIBUTE)
164
  , 'linkTarget'=>$this->getOption('LinkTarget', '_blank')
165
  , 'ctaText'=>$this->getOption('RelatedText', 'READ')
166
  , 'ctaTextColor'=>$this->getOption('TemplateRelatedTextColor', '')
191
  public function setRewriteActive($value) {
192
  $this->setOption('RewriteActive', $value);
193
  }
194
+
195
+ public function isRewriteStaticLinks()
196
+ {
197
+ return $this->getOption('RewriteStaticLinks', false);
198
+ }
199
+
200
+ public function setRewriteStaticLinks($value)
201
+ {
202
+ if (!$value && $this->isRewriteStaticLinks()) {
203
+ // remove all saved links
204
+ global $wpdb;
205
+ $sql = "DELETE FROM `wp_options` where option_name like 'IRP_POST_%'";
206
+ $wpdb->query($sql);
207
+ }
208
+ $this->setOption('RewriteStaticLinks', $value);
209
+ }
210
+
211
  public function getExcludedPostsIds() {
212
  return $this->getOption('ExcludedPostsIds', array());
213
  }
includes/core.php CHANGED
@@ -15,7 +15,7 @@ function irp_head() {
15
  $irp->Options->setPostShown($post);
16
  $args=array('postId'=>$post->ID, 'shuffle'=>TRUE, 'count'=>-1);
17
  $ids=$irp->Manager->getRelatedPostsIds($args);
18
- $irp->Options->initRelatedPostsIds($ids);
19
  //$irp->Log->info('POST ID=%s IS SHOWN, RELATED POSTS=%s', $post->ID, $ids);
20
  }
21
  }
@@ -181,7 +181,7 @@ function irp_ui_get_box($ids, $options=NULL) {
181
  }
182
  if($irp->Utils->isTrue($options['demo'])) {
183
  $options['postHref']='javascript:void(0);';
184
- $options['linkRel']='nofollow';
185
  $options['linkTarget']='';
186
  //$options['hasShadow']=TRUE;
187
  //$options['hasPoweredBy']=1;
@@ -204,7 +204,7 @@ function irp_ui_get_box($ids, $options=NULL) {
204
  }
205
  } elseif($irp->Utils->isTrue($options['preview'])) {
206
  $options['postHref']='javascript:IRP_changeRelatedBox();';
207
- $options['linkRel']='nofollow';
208
  $options['linkTarget']='';
209
  }
210
 
@@ -240,7 +240,7 @@ function irp_the_content($content)
240
  $irp->Options->setPostShown($post);
241
  $args=array('postId'=>$post->ID, 'shuffle'=>TRUE, 'count'=>-1);
242
  $ids=$irp->Manager->getRelatedPostsIds($args);
243
- $irp->Options->initRelatedPostsIds($ids);
244
  //$irp->Log->info('POST ID=%s IS SHOWN, RELATED POSTS=%s', $post->ID, $ids);
245
  }
246
  } else {
15
  $irp->Options->setPostShown($post);
16
  $args=array('postId'=>$post->ID, 'shuffle'=>TRUE, 'count'=>-1);
17
  $ids=$irp->Manager->getRelatedPostsIds($args);
18
+ $irp->Options->initRelatedPostsIds($ids, $post->ID);
19
  //$irp->Log->info('POST ID=%s IS SHOWN, RELATED POSTS=%s', $post->ID, $ids);
20
  }
21
  }
181
  }
182
  if($irp->Utils->isTrue($options['demo'])) {
183
  $options['postHref']='javascript:void(0);';
184
+ $options['linkRel'] = IRP_DEFAULT_LINK_REL_ATTRIBUTE;
185
  $options['linkTarget']='';
186
  //$options['hasShadow']=TRUE;
187
  //$options['hasPoweredBy']=1;
204
  }
205
  } elseif($irp->Utils->isTrue($options['preview'])) {
206
  $options['postHref']='javascript:IRP_changeRelatedBox();';
207
+ $options['linkRel'] = IRP_DEFAULT_LINK_REL_ATTRIBUTE;
208
  $options['linkTarget']='';
209
  }
210
 
240
  $irp->Options->setPostShown($post);
241
  $args=array('postId'=>$post->ID, 'shuffle'=>TRUE, 'count'=>-1);
242
  $ids=$irp->Manager->getRelatedPostsIds($args);
243
+ $irp->Options->initRelatedPostsIds($ids, $post->ID);
244
  //$irp->Log->info('POST ID=%s IS SHOWN, RELATED POSTS=%s', $post->ID, $ids);
245
  }
246
  } else {
index.php CHANGED
@@ -6,13 +6,13 @@ Description: Inline Related Posts AUTOMATICALLY inserts related posts INSIDE you
6
  Author: IntellyWP
7
  Author URI: http://intellywp.com/
8
  Email: support@intellywp.com
9
- Version: 3.0.6
10
  */
11
  define('IRP_PLUGIN_PREFIX', 'IRP_');
12
  define('IRP_PLUGIN_FILE',__FILE__);
13
  define('IRP_PLUGIN_SLUG', 'intelly-related-posts');
14
  define('IRP_PLUGIN_NAME', 'Inline Related Posts');
15
- define('IRP_PLUGIN_VERSION', '3.0.6');
16
  define('IRP_PLUGIN_AUTHOR', 'IntellyWP');
17
  define('IRP_PLUGIN_ROOT', dirname(__FILE__).'/');
18
  define('IRP_PLUGIN_IMAGES', plugins_url( 'assets/images/', __FILE__ ));
@@ -25,6 +25,7 @@ define('IRP_QUERY_POSTS_OF_TYPE', 1);
25
  define('IRP_QUERY_POST_TYPES', 2);
26
  define('IRP_QUERY_CATEGORIES', 3);
27
  define('IRP_QUERY_TAGS', 4);
 
28
 
29
  define('IRP_ENGINE_SEARCH_CATEGORIES_TAGS', 0);
30
  define('IRP_ENGINE_SEARCH_CATEGORIES', 1);
6
  Author: IntellyWP
7
  Author URI: http://intellywp.com/
8
  Email: support@intellywp.com
9
+ Version: 3.0.7
10
  */
11
  define('IRP_PLUGIN_PREFIX', 'IRP_');
12
  define('IRP_PLUGIN_FILE',__FILE__);
13
  define('IRP_PLUGIN_SLUG', 'intelly-related-posts');
14
  define('IRP_PLUGIN_NAME', 'Inline Related Posts');
15
+ define('IRP_PLUGIN_VERSION', '3.0.7');
16
  define('IRP_PLUGIN_AUTHOR', 'IntellyWP');
17
  define('IRP_PLUGIN_ROOT', dirname(__FILE__).'/');
18
  define('IRP_PLUGIN_IMAGES', plugins_url( 'assets/images/', __FILE__ ));
25
  define('IRP_QUERY_POST_TYPES', 2);
26
  define('IRP_QUERY_CATEGORIES', 3);
27
  define('IRP_QUERY_TAGS', 4);
28
+ define('IRP_DEFAULT_LINK_REL_ATTRIBUTE', 'dofollow'); // use dofollow or nofollow
29
 
30
  define('IRP_ENGINE_SEARCH_CATEGORIES_TAGS', 0);
31
  define('IRP_ENGINE_SEARCH_CATEGORIES', 1);
languages/Lang.txt CHANGED
@@ -92,6 +92,7 @@ Settings.irpText=Related text
92
  Settings.irpBackgroundColor=Background Color
93
  Settings.irpBorderColor=Border Color
94
  Settings.irpRewriteActive=Insert in already existing posts?
 
95
  Settings.irpRewriteBoxesCount=How many boxes per single post?
96
  Settings.irpRewritePostsInBoxCount=Max posts per box N.
97
  Settings.irpRewriteThreshold=Interval between the boxes <i>(minimum N° words)</i>
92
  Settings.irpBackgroundColor=Background Color
93
  Settings.irpBorderColor=Border Color
94
  Settings.irpRewriteActive=Insert in already existing posts?
95
+ Settings.irpRewriteStaticLinks=Keep links static once inserted.
96
  Settings.irpRewriteBoxesCount=How many boxes per single post?
97
  Settings.irpRewritePostsInBoxCount=Max posts per box N.
98
  Settings.irpRewriteThreshold=Interval between the boxes <i>(minimum N° words)</i>
readme.txt CHANGED
@@ -9,8 +9,7 @@ Inline Related Posts AUTOMATICALLY inserts related posts INSIDE your content, ca
9
  == Description ==
10
  <p>This plugin is a service of <a href="https://www.data443.com" rel="nofollow ugc">Data443.com</a>.</p>
11
 
12
- <p>Data443 is a Data Security and Privacy Compliance company that is publicly traded <a href="https://finance.yahoo.com/quote/ATDS?p=ATD" rel="nofollow ugc">ATDS</a>. We have been providing leading GDPR compliance products such as <a href="https://wordpress.org/plugins/gdpr-framework/" rel="nofollow ugc">WordPress GDPR Framework</a> and <a href="https://www.data443.com/classidocs-home/" rel="nofollow ugc">ClassiDocs</a>, Blockchain privacy, and enterprise cloud eDiscovery tools.</p>
13
-
14
 
15
  Companies like Entrepreneur, The Wall Street Journal, BBC, Business Insider, Financial Times and many others understood this concept and embraced it as you can see in this GIF in <a href="https://wordpress.org/plugins/intelly-related-posts/screenshots/">Screenshots</a>.
16
 
@@ -88,6 +87,11 @@ Absolutely Not! Inline Related Posts is built with lightweight code so you won
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
91
  = 3.0.6 =
92
  *Release Date - 2021-07-13*
93
 
9
  == Description ==
10
  <p>This plugin is a service of <a href="https://www.data443.com" rel="nofollow ugc">Data443.com</a>.</p>
11
 
12
+ <p>Data443 is a Data Security and Privacy Compliance company that is publicly traded <a href="https://finance.yahoo.com/quote/ATDS?p=ATD" rel="nofollow ugc">ATDS</a>. We have been providing leading GDPR compliance products such as <a href="https://wordpress.org/plugins/gdpr-framework/" rel="nofollow ugc">WordPress GDPR Framework</a> and <a href="https://data443.com/products/data-identification-manager/" rel="nofollow ugc">Data Identification Manager</a>, Blockchain privacy, and enterprise cloud eDiscovery tools.</p>
 
13
 
14
  Companies like Entrepreneur, The Wall Street Journal, BBC, Business Insider, Financial Times and many others understood this concept and embraced it as you can see in this GIF in <a href="https://wordpress.org/plugins/intelly-related-posts/screenshots/">Screenshots</a>.
15
 
87
 
88
  == Changelog ==
89
 
90
+ = 3.0.7 =
91
+ *Release Date - 2021-08-24*
92
+
93
+ * IWP-83 Make the linkRel attribute default to 'dofollow' and provide an option to prevent all related post links from changing with every page refresh.
94
+
95
  = 3.0.6 =
96
  *Release Date - 2021-07-13*
97