Version Description
- Added Prevent duplicate links for custom keywords options (credits Adrian Ramiro)
Download this release
Release Info
| Developer | freediver |
| Plugin | |
| Version | 2.5.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.4 to 2.5.2
- readme.txt +8 -2
- seo-links.php +48 -11
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: freediver
|
|
| 3 |
Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
|
| 4 |
Tags: Post, posts, comments, links, seo, google, automatic, affiliate
|
| 5 |
Requires at least: 2.3
|
| 6 |
-
Tested up to: 2.
|
| 7 |
Stable tag: trunk
|
| 8 |
|
| 9 |
SEO Smart Links provides automatic SEO benefits for your site in addition to custom keyword lists, nofollow and much more.
|
|
@@ -25,6 +25,12 @@ Plugin by Vladimir Prelovac a <a href="http://www.prelovac.com/vladimir/services
|
|
| 25 |
|
| 26 |
== Changelog ==
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
= 2.4 =
|
| 29 |
* Added LIMIT 2000 to most queries, should speed things up on large sites
|
| 30 |
|
|
@@ -32,7 +38,7 @@ Plugin by Vladimir Prelovac a <a href="http://www.prelovac.com/vladimir/services
|
|
| 32 |
* General bug fixes. Fixed the issue with str_split. Solved heading issue which changed style code in heading tags.
|
| 33 |
|
| 34 |
= 2.3 =
|
| 35 |
-
* Prevent linking inside heading tags (h1, h2..) (credits to
|
| 36 |
|
| 37 |
= 2.2.2 =
|
| 38 |
* Readme file consolidated
|
| 3 |
Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
|
| 4 |
Tags: Post, posts, comments, links, seo, google, automatic, affiliate
|
| 5 |
Requires at least: 2.3
|
| 6 |
+
Tested up to: 2.9.2
|
| 7 |
Stable tag: trunk
|
| 8 |
|
| 9 |
SEO Smart Links provides automatic SEO benefits for your site in addition to custom keyword lists, nofollow and much more.
|
| 25 |
|
| 26 |
== Changelog ==
|
| 27 |
|
| 28 |
+
= 2.5.2 =
|
| 29 |
+
* Added Prevent duplicate links for custom keywords options (credits Adrian Ramiro)
|
| 30 |
+
|
| 31 |
+
= 2.5 =
|
| 32 |
+
* Added support RSS feed processing
|
| 33 |
+
|
| 34 |
= 2.4 =
|
| 35 |
* Added LIMIT 2000 to most queries, should speed things up on large sites
|
| 36 |
|
| 38 |
* General bug fixes. Fixed the issue with str_split. Solved heading issue which changed style code in heading tags.
|
| 39 |
|
| 40 |
= 2.3 =
|
| 41 |
+
* Prevent linking inside heading tags (h1, h2..) (credits to Chris Tew)
|
| 42 |
|
| 43 |
= 2.2.2 =
|
| 44 |
* Readme file consolidated
|
seo-links.php
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
|
| 3 |
/*
|
| 4 |
Plugin Name: SEO Smart Links
|
| 5 |
-
Version: 2.
|
| 6 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links
|
| 7 |
-
Author: Vladimir Prelovac
|
| 8 |
Author URI: http://www.prelovac.com/vladimir
|
| 9 |
-
Description: SEO Smart Links provides automatic SEO benefits for your site in addition to custom keyword lists, nofollow and much more.
|
| 10 |
*/
|
| 11 |
|
| 12 |
// todo It's possible to have option for case insensitive ?
|
|
@@ -53,8 +53,9 @@ function SEOLinks_process_text($text, $mode)
|
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
|
|
|
| 58 |
return $text;
|
| 59 |
|
| 60 |
$arrignorepost=$this->explode_trim(",", ($options['ignorepost']));
|
|
@@ -108,6 +109,26 @@ function SEOLinks_process_text($text, $mode)
|
|
| 108 |
|
| 109 |
// thanks PK for the suggestion
|
| 110 |
foreach (explode("\n", $options['customkey']) as $line) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
$chunks = array_map('trim', explode(",", $line));
|
| 112 |
$total_chuncks = count($chunks);
|
| 113 |
if($total_chuncks > 2) {
|
|
@@ -120,7 +141,10 @@ function SEOLinks_process_text($text, $mode)
|
|
| 120 |
} else {
|
| 121 |
list($keyword, $url) = array_map('trim', explode(",", $line, 2));
|
| 122 |
if (!empty($keyword)) $kw_array[$keyword] = $url;
|
|
|
|
|
|
|
| 123 |
}
|
|
|
|
| 124 |
}
|
| 125 |
|
| 126 |
|
|
@@ -129,9 +153,11 @@ function SEOLinks_process_text($text, $mode)
|
|
| 129 |
|
| 130 |
if ((!$maxlinks || ($links < $maxlinks)) && (trailingslashit($url)!=$thisurl) && !in_array( $options['casesens'] ? $name : strtolower($name), $arrignore))
|
| 131 |
{
|
| 132 |
-
if ($strpos_fnc($text, $name) !== false) { // credit to Dominik Deobald
|
| 133 |
$name= preg_quote($name, '/');
|
| 134 |
|
|
|
|
|
|
|
| 135 |
$replace="<a title=\"$1\" href=\"$url\">$1</a>";
|
| 136 |
$regexp=str_replace('$name', $name, $reg);
|
| 137 |
//$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))(?<!\p{L})($name)(?!\p{L})/imsU";
|
|
@@ -316,12 +342,14 @@ function SEOLinks_comment_text_filter($text) {
|
|
| 316 |
'maxsingle' => 1,
|
| 317 |
'minusage' => 1,
|
| 318 |
'customkey' => '',
|
|
|
|
| 319 |
'nofoln' =>'',
|
| 320 |
'nofolo' =>'',
|
| 321 |
'blankn' =>'',
|
| 322 |
'blanko' =>'',
|
| 323 |
'onlysingle' => 'on',
|
| 324 |
-
'casesens' =>''
|
|
|
|
| 325 |
|
| 326 |
);
|
| 327 |
|
|
@@ -368,17 +396,19 @@ function SEOLinks_comment_text_filter($text) {
|
|
| 368 |
$options['lcats']=$_POST['lcats'];
|
| 369 |
$options['ltags']=$_POST['ltags'];
|
| 370 |
$options['ignore']=$_POST['ignore'];
|
| 371 |
-
|
| 372 |
$options['maxlinks']=(int) $_POST['maxlinks'];
|
| 373 |
$options['maxsingle']=(int) $_POST['maxsingle'];
|
| 374 |
$options['minusage']=(int) $_POST['minusage']; // credit to Dominik Deobald
|
| 375 |
$options['customkey']=$_POST['customkey'];
|
|
|
|
| 376 |
$options['nofoln']=$_POST['nofoln'];
|
| 377 |
$options['nofolo']=$_POST['nofolo'];
|
| 378 |
$options['blankn']=$_POST['blankn'];
|
| 379 |
$options['blanko']=$_POST['blanko'];
|
| 380 |
$options['onlysingle']=$_POST['onlysingle'];
|
| 381 |
$options['casesens']=$_POST['casesens'];
|
|
|
|
| 382 |
|
| 383 |
|
| 384 |
update_option($this->SEOLinks_DB_option, $options);
|
|
@@ -402,17 +432,19 @@ function SEOLinks_comment_text_filter($text) {
|
|
| 402 |
$lcats=$options['lcats']=='on'?'checked':'';
|
| 403 |
$ltags=$options['ltags']=='on'?'checked':'';
|
| 404 |
$ignore=$options['ignore'];
|
| 405 |
-
|
| 406 |
$maxlinks=$options['maxlinks'];
|
| 407 |
$maxsingle=$options['maxsingle'];
|
| 408 |
$minusage=$options['minusage'];
|
| 409 |
$customkey=stripslashes($options['customkey']);
|
|
|
|
| 410 |
$nofoln=$options['nofoln']=='on'?'checked':'';
|
| 411 |
$nofolo=$options['nofolo']=='on'?'checked':'';
|
| 412 |
$blankn=$options['blankn']=='on'?'checked':'';
|
| 413 |
$blanko=$options['blanko']=='on'?'checked':'';
|
| 414 |
$onlysingle=$options['onlysingle']=='on'?'checked':'';
|
| 415 |
$casesens=$options['casesens']=='on'?'checked':'';
|
|
|
|
| 416 |
|
| 417 |
if (!is_numeric($minusage)) $minusage = 1;
|
| 418 |
|
|
@@ -479,7 +511,10 @@ function SEOLinks_comment_text_filter($text) {
|
|
| 479 |
<h2>Settings</h2>
|
| 480 |
<p>To reduce database load you can choose to have SEO SMART links work only on single posts and pages (for example not on main page or archives).</p>
|
| 481 |
<input type="checkbox" name="onlysingle" $onlysingle /><label for="onlysingle"> Process only single posts and pages</label> <br>
|
| 482 |
-
|
|
|
|
|
|
|
|
|
|
| 483 |
<p>Set whether matching should be case sensitive.</p>
|
| 484 |
<input type="checkbox" name="casesens" $casesens /><label for="casesens"> Case sensitive matching</label> <br>
|
| 485 |
|
|
@@ -500,6 +535,8 @@ function SEOLinks_comment_text_filter($text) {
|
|
| 500 |
cars, car, autos, auto, http://mycarblog.com/<br />
|
| 501 |
</p>
|
| 502 |
|
|
|
|
|
|
|
| 503 |
<textarea name="customkey" id="customkey" rows="10" cols="90" >$customkey</textarea>
|
| 504 |
<br><br>
|
| 505 |
|
|
@@ -529,7 +566,7 @@ function SEOLinks_comment_text_filter($text) {
|
|
| 529 |
|
| 530 |
</div>
|
| 531 |
|
| 532 |
-
<h5>WordPress plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
|
| 533 |
</div>
|
| 534 |
END;
|
| 535 |
|
| 2 |
|
| 3 |
/*
|
| 4 |
Plugin Name: SEO Smart Links
|
| 5 |
+
Version: 2.5.2
|
| 6 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links
|
| 7 |
+
Author: Vladimir Prelovac
|
| 8 |
Author URI: http://www.prelovac.com/vladimir
|
| 9 |
+
Description: SEO Smart Links provides automatic SEO benefits for your site in addition to custom keyword lists, nofollow and much more. (Brian Edition)
|
| 10 |
*/
|
| 11 |
|
| 12 |
// todo It's possible to have option for case insensitive ?
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
+
if (is_feed() && !$options['allowfeed'])
|
| 57 |
+
return $text;
|
| 58 |
+
else if ($options['onlysingle'] && !(is_single() || is_page()))
|
| 59 |
return $text;
|
| 60 |
|
| 61 |
$arrignorepost=$this->explode_trim(",", ($options['ignorepost']));
|
| 109 |
|
| 110 |
// thanks PK for the suggestion
|
| 111 |
foreach (explode("\n", $options['customkey']) as $line) {
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
if($options['customkey_preventduplicatelink'] == TRUE) { //Prevent duplicate links for grouped custom keywords
|
| 116 |
+
|
| 117 |
+
$line = trim($line);
|
| 118 |
+
$lastDelimiterPos=strrpos($line, ',');
|
| 119 |
+
$url = substr($line, $lastDelimiterPos + 1 );
|
| 120 |
+
$keywords = substr($line, 0, $lastDelimiterPos);
|
| 121 |
+
|
| 122 |
+
if(!empty($keywords) && !empty($url)){
|
| 123 |
+
$kw_array[$keywords] = $url;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
$keywords='';
|
| 127 |
+
$url='';
|
| 128 |
+
|
| 129 |
+
} else { //Old custom keywords behaviour
|
| 130 |
+
|
| 131 |
+
|
| 132 |
$chunks = array_map('trim', explode(",", $line));
|
| 133 |
$total_chuncks = count($chunks);
|
| 134 |
if($total_chuncks > 2) {
|
| 141 |
} else {
|
| 142 |
list($keyword, $url) = array_map('trim', explode(",", $line, 2));
|
| 143 |
if (!empty($keyword)) $kw_array[$keyword] = $url;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
}
|
| 147 |
+
|
| 148 |
}
|
| 149 |
|
| 150 |
|
| 153 |
|
| 154 |
if ((!$maxlinks || ($links < $maxlinks)) && (trailingslashit($url)!=$thisurl) && !in_array( $options['casesens'] ? $name : strtolower($name), $arrignore))
|
| 155 |
{
|
| 156 |
+
if (($options['customkey_preventduplicatelink'] == TRUE) || $strpos_fnc($text, $name) !== false) { // credit to Dominik Deobald -- TODO: change string search for preg_match
|
| 157 |
$name= preg_quote($name, '/');
|
| 158 |
|
| 159 |
+
if($options['customkey_preventduplicatelink'] == TRUE) $name = str_replace(',','|',$name); //Modifying RegExp for count all grouped keywords as the same one
|
| 160 |
+
|
| 161 |
$replace="<a title=\"$1\" href=\"$url\">$1</a>";
|
| 162 |
$regexp=str_replace('$name', $name, $reg);
|
| 163 |
//$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))(?<!\p{L})($name)(?!\p{L})/imsU";
|
| 342 |
'maxsingle' => 1,
|
| 343 |
'minusage' => 1,
|
| 344 |
'customkey' => '',
|
| 345 |
+
'customkey_preventduplicatelink' => FALSE,
|
| 346 |
'nofoln' =>'',
|
| 347 |
'nofolo' =>'',
|
| 348 |
'blankn' =>'',
|
| 349 |
'blanko' =>'',
|
| 350 |
'onlysingle' => 'on',
|
| 351 |
+
'casesens' =>'',
|
| 352 |
+
'allowfeed' => ''
|
| 353 |
|
| 354 |
);
|
| 355 |
|
| 396 |
$options['lcats']=$_POST['lcats'];
|
| 397 |
$options['ltags']=$_POST['ltags'];
|
| 398 |
$options['ignore']=$_POST['ignore'];
|
| 399 |
+
$options['ignorepost']=$_POST['ignorepost'];
|
| 400 |
$options['maxlinks']=(int) $_POST['maxlinks'];
|
| 401 |
$options['maxsingle']=(int) $_POST['maxsingle'];
|
| 402 |
$options['minusage']=(int) $_POST['minusage']; // credit to Dominik Deobald
|
| 403 |
$options['customkey']=$_POST['customkey'];
|
| 404 |
+
$options['customkey_preventduplicatelink']=$_POST['customkey_preventduplicatelink'];
|
| 405 |
$options['nofoln']=$_POST['nofoln'];
|
| 406 |
$options['nofolo']=$_POST['nofolo'];
|
| 407 |
$options['blankn']=$_POST['blankn'];
|
| 408 |
$options['blanko']=$_POST['blanko'];
|
| 409 |
$options['onlysingle']=$_POST['onlysingle'];
|
| 410 |
$options['casesens']=$_POST['casesens'];
|
| 411 |
+
$options['allowfeed']=$_POST['allowfeed'];
|
| 412 |
|
| 413 |
|
| 414 |
update_option($this->SEOLinks_DB_option, $options);
|
| 432 |
$lcats=$options['lcats']=='on'?'checked':'';
|
| 433 |
$ltags=$options['ltags']=='on'?'checked':'';
|
| 434 |
$ignore=$options['ignore'];
|
| 435 |
+
$ignorepost=$options['ignorepost'];
|
| 436 |
$maxlinks=$options['maxlinks'];
|
| 437 |
$maxsingle=$options['maxsingle'];
|
| 438 |
$minusage=$options['minusage'];
|
| 439 |
$customkey=stripslashes($options['customkey']);
|
| 440 |
+
$customkey_preventduplicatelink=$options['customkey_preventduplicatelink'] == TRUE ? 'checked' : '';
|
| 441 |
$nofoln=$options['nofoln']=='on'?'checked':'';
|
| 442 |
$nofolo=$options['nofolo']=='on'?'checked':'';
|
| 443 |
$blankn=$options['blankn']=='on'?'checked':'';
|
| 444 |
$blanko=$options['blanko']=='on'?'checked':'';
|
| 445 |
$onlysingle=$options['onlysingle']=='on'?'checked':'';
|
| 446 |
$casesens=$options['casesens']=='on'?'checked':'';
|
| 447 |
+
$allowfeed=$options['allowfeed']=='on'?'checked':'';
|
| 448 |
|
| 449 |
if (!is_numeric($minusage)) $minusage = 1;
|
| 450 |
|
| 511 |
<h2>Settings</h2>
|
| 512 |
<p>To reduce database load you can choose to have SEO SMART links work only on single posts and pages (for example not on main page or archives).</p>
|
| 513 |
<input type="checkbox" name="onlysingle" $onlysingle /><label for="onlysingle"> Process only single posts and pages</label> <br>
|
| 514 |
+
<br />
|
| 515 |
+
<p>Allow processing of RSS feeds. SEO Smart links will embed links in all posts in your RSS feed (according to other options)</p>
|
| 516 |
+
<input type="checkbox" name="allowfeed" $allowfeed /><label for="allowfeed"> Process RSS feeds</label> <br>
|
| 517 |
+
<br />
|
| 518 |
<p>Set whether matching should be case sensitive.</p>
|
| 519 |
<input type="checkbox" name="casesens" $casesens /><label for="casesens"> Case sensitive matching</label> <br>
|
| 520 |
|
| 535 |
cars, car, autos, auto, http://mycarblog.com/<br />
|
| 536 |
</p>
|
| 537 |
|
| 538 |
+
<input type="checkbox" name="customkey_preventduplicatelink" $customkey_preventduplicatelink /><label for="customkey_preventduplicatelink"> Prevent Duplicate links for grouped keywords (will link only first of the keywords found in text)</label> <br>
|
| 539 |
+
|
| 540 |
<textarea name="customkey" id="customkey" rows="10" cols="90" >$customkey</textarea>
|
| 541 |
<br><br>
|
| 542 |
|
| 566 |
|
| 567 |
</div>
|
| 568 |
|
| 569 |
+
<h5>Another fine WordPress plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
|
| 570 |
</div>
|
| 571 |
END;
|
| 572 |
|
