SEO Smart Links - Version 2.3

Version Description

Download this release

Release Info

Developer freediver
Plugin Icon 128x128 SEO Smart Links
Version 2.3
Comparing to
See all releases

Code changes from version 2.2.2 to 2.3

Files changed (2) hide show
  1. readme.txt +3 -0
  2. seo-links.php +26 -1
readme.txt CHANGED
@@ -25,6 +25,9 @@ Plugin by Vladimir Prelovac a <a href="http://www.prelovac.com/vladimir/services
25
26
== Changelog ==
27
28
= 2.2.2 =
29
* Readme file consolidated
30
25
26
== Changelog ==
27
28
+ = 2.3=
29
+ * Prevent linking inside heading tags (h1, h2..) (credits to <a href="http://www.munchweb.com">Chris Tew</a>)
30
+
31
= 2.2.2 =
32
* Readme file consolidated
33
seo-links.php CHANGED
@@ -2,7 +2,7 @@
2
3
/*
4
Plugin Name: SEO Smart Links
5
- Version: 2.2.2
6
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links
7
Author: Vladimir Prelovac</a>
8
Author URI: http://www.prelovac.com/vladimir
@@ -88,6 +88,10 @@ function SEOLinks_process_text($text, $mode)
88
$minusage = ($options['minusage']>0) ? $options['minusage'] : 1;
89
90
$arrignore=$this->explode_trim(",", ($options['ignore']));
91
92
// $reg_post = $options['casesens'] ? '/(?!(?:[^<]+>|[^>]+<\/a>))($name)/msU' : '/(?!(?:[^<]+>|[^>]+<\/a>))($name)/imsU';
93
// $reg = $options['casesens'] ? '/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/msU' : '/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU';
@@ -239,6 +243,10 @@ function SEOLinks_process_text($text, $mode)
239
}
240
}
241
242
return trim( $text );
243
244
}
@@ -296,6 +304,7 @@ function SEOLinks_comment_text_filter($text) {
296
'page' => 'on',
297
'pageself' => '',
298
'comment' => '',
299
'lposts' => 'on',
300
'lpages' => 'on',
301
'lcats' => '',
@@ -352,6 +361,7 @@ function SEOLinks_comment_text_filter($text) {
352
$options['page']=$_POST['page'];
353
$options['pageself']=$_POST['pageself'];
354
$options['comment']=$_POST['comment'];
355
$options['lposts']=$_POST['lposts'];
356
$options['lpages']=$_POST['lpages'];
357
$options['lcats']=$_POST['lcats'];
@@ -385,6 +395,7 @@ function SEOLinks_comment_text_filter($text) {
385
$page=$options['page']=='on'?'checked':'';
386
$pageself=$options['pageself']=='on'?'checked':'';
387
$comment=$options['comment']=='on'?'checked':'';
388
$lposts=$options['lposts']=='on'?'checked':'';
389
$lpages=$options['lpages']=='on'?'checked':'';
390
$lcats=$options['lcats']=='on'?'checked':'';
@@ -451,6 +462,9 @@ function SEOLinks_comment_text_filter($text) {
451
<br />
452
<input type="checkbox" name="comment" $comment /><label for="comment"> Comments</label> (may slow down performance) <br>
453
454
<h4>Target</h4>
455
<p>The targets SEO Smart links should consider. The match will be based on post/page title or category/tag name, case insensitive.</p>
456
<input type="checkbox" name="lposts" $lposts /><label for="lposts"> Posts</label> <br>
@@ -547,4 +561,15 @@ if ( class_exists('SEOLinks') ) :
547
}
548
endif;
549
550
?>
2
3
/*
4
Plugin Name: SEO Smart Links
5
+ Version: 2.3
6
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links
7
Author: Vladimir Prelovac</a>
8
Author URI: http://www.prelovac.com/vladimir
88
$minusage = ($options['minusage']>0) ? $options['minusage'] : 1;
89
90
$arrignore=$this->explode_trim(",", ($options['ignore']));
91
+ if ($options['excludeheading'] == "on") {
92
+ //Here insert special characters
93
+ $text = preg_replace('%(<h.*?>)(.*?)(</h.*?>)%sie', "'\\1'.insertspecialchars('\\2').'\\3'", $text);
94
+ }
95
96
// $reg_post = $options['casesens'] ? '/(?!(?:[^<]+>|[^>]+<\/a>))($name)/msU' : '/(?!(?:[^<]+>|[^>]+<\/a>))($name)/imsU';
97
// $reg = $options['casesens'] ? '/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/msU' : '/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU';
243
}
244
}
245
246
+ if ($options['excludeheading'] == "on") {
247
+ //Here insert special characters
248
+ $text = preg_replace('%(<h.*?>)(.*?)(</h.*?>)%sie', "'\\1'.removespecialchars('\\2').'\\3'", $text);
249
+ }
250
return trim( $text );
251
252
}
304
'page' => 'on',
305
'pageself' => '',
306
'comment' => '',
307
+ 'excludeheading' => 'on',
308
'lposts' => 'on',
309
'lpages' => 'on',
310
'lcats' => '',
361
$options['page']=$_POST['page'];
362
$options['pageself']=$_POST['pageself'];
363
$options['comment']=$_POST['comment'];
364
+ $options['excludeheading']=$_POST['excludeheading'];
365
$options['lposts']=$_POST['lposts'];
366
$options['lpages']=$_POST['lpages'];
367
$options['lcats']=$_POST['lcats'];
395
$page=$options['page']=='on'?'checked':'';
396
$pageself=$options['pageself']=='on'?'checked':'';
397
$comment=$options['comment']=='on'?'checked':'';
398
+ $excludeheading=$options['excludeheading']=='on'?'checked':'';
399
$lposts=$options['lposts']=='on'?'checked':'';
400
$lpages=$options['lpages']=='on'?'checked':'';
401
$lcats=$options['lcats']=='on'?'checked':'';
462
<br />
463
<input type="checkbox" name="comment" $comment /><label for="comment"> Comments</label> (may slow down performance) <br>
464
465
+ <h4>Excluding</h4>
466
+ <input type="checkbox" name="excludeheading" $excludeheading/><label for="excludeheading">Prevent linking in heading tags (h1,h2,h3,h4,h5,h6).</label>
467
+
468
<h4>Target</h4>
469
<p>The targets SEO Smart links should consider. The match will be based on post/page title or category/tag name, case insensitive.</p>
470
<input type="checkbox" name="lposts" $lposts /><label for="lposts"> Posts</label> <br>
561
}
562
endif;
563
564
+ function insertspecialchars($str) {
565
+ $strarr = str_split($str);
566
+ $str = implode("<!---->", $strarr);
567
+ return $str;
568
+ }
569
+ function removespecialchars($str) {
570
+ $strarr = explode("<!---->", $str);
571
+ $str = implode("", $strarr);
572
+ return $str;
573
+ }
574
+
575
?>