Version Description
Download this release
Release Info
Developer | freediver |
Plugin | SEO Smart Links |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.9.3 to 2.0
- i/paypal.gif +0 -0
- i/twit.png +0 -0
- readme.txt +2 -0
- seo-links.php +47 -32
i/paypal.gif
ADDED
Binary file
|
i/twit.png
ADDED
Binary file
|
readme.txt
CHANGED
@@ -21,6 +21,8 @@ Everything happens completely transparent, and you can edit the options from the
|
|
21 |
|
22 |
Change log:
|
23 |
|
|
|
|
|
24 |
|
25 |
v1.9.3
|
26 |
- Various improvements and bug fixes
|
21 |
|
22 |
Change log:
|
23 |
|
24 |
+
v2.0
|
25 |
+
- Added the option for case sensitive matching
|
26 |
|
27 |
v1.9.3
|
28 |
- Various improvements and bug fixes
|
seo-links.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
Plugin Name: SEO Smart Links
|
5 |
-
Version:
|
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
|
@@ -11,6 +11,7 @@ Description: SEO Smart Links provides automatic SEO benefits for your site in ad
|
|
11 |
|
12 |
// todo It's possible to have option for case insensitive ?
|
13 |
// $count in preg_replace, max links towards same url
|
|
|
14 |
|
15 |
// Avoid name collisions.
|
16 |
if ( !class_exists('SEOLinks') ) :
|
@@ -50,6 +51,8 @@ function SEOLinks_process_text($text, $mode)
|
|
50 |
|
51 |
$links=0;
|
52 |
|
|
|
|
|
53 |
|
54 |
if ($options['onlysingle'] && !(is_single() || is_page()))
|
55 |
return $text;
|
@@ -63,7 +66,7 @@ function SEOLinks_process_text($text, $mode)
|
|
63 |
|
64 |
if (($post->post_type=='page' && !$options['pageself']) || ($post->post_type=='post' && !$options['postself'])) {
|
65 |
|
66 |
-
$thistitle
|
67 |
$thisurl=trailingslashit(get_permalink($post->ID));
|
68 |
}
|
69 |
else {
|
@@ -76,7 +79,10 @@ function SEOLinks_process_text($text, $mode)
|
|
76 |
$maxlinks=($options['maxlinks']>0) ? $options['maxlinks'] : 0;
|
77 |
$maxsingle=($options['maxsingle']>0) ? $options['maxsingle'] : -1;
|
78 |
|
79 |
-
$arrignore=$this->explode_trim(",",
|
|
|
|
|
|
|
80 |
|
81 |
$text = " $text ";
|
82 |
|
@@ -110,13 +116,13 @@ function SEOLinks_process_text($text, $mode)
|
|
110 |
foreach ($kw_array as $name=>$url)
|
111 |
{
|
112 |
|
113 |
-
if ((!$maxlinks || ($links < $maxlinks)) && (trailingslashit($url)!=$thisurl) && !in_array( strtolower($name), $arrignore))
|
114 |
{
|
115 |
|
116 |
$name= preg_quote($name, '/');
|
117 |
|
118 |
$replace="<a title=\"$1\" href=\"$url\">$1</a>";
|
119 |
-
$regexp=
|
120 |
//$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))(?<!\p{L})($name)(?!\p{L})/imsU";
|
121 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
122 |
if ($newtext!=$text) {
|
@@ -145,11 +151,12 @@ function SEOLinks_process_text($text, $mode)
|
|
145 |
foreach ($posts as $postitem)
|
146 |
{
|
147 |
if ((($options['lposts'] && $postitem->post_type=='post') || ($options['lpages'] && $postitem->post_type=='page')) &&
|
148 |
-
(!$maxlinks || ($links < $maxlinks)) && (strtolower($postitem->post_title)!=$thistitle) && (!in_array( strtolower($postitem->post_title), $arrignore)) )
|
149 |
{
|
150 |
$name = preg_quote($postitem->post_title, '/');
|
151 |
|
152 |
-
$regexp=
|
|
|
153 |
|
154 |
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
155 |
|
@@ -176,10 +183,10 @@ function SEOLinks_process_text($text, $mode)
|
|
176 |
|
177 |
foreach ($categories as $cat)
|
178 |
{
|
179 |
-
if ((!$maxlinks || ($links < $maxlinks)) && !in_array( strtolower($cat->name), $arrignore) )
|
180 |
{
|
181 |
$name= preg_quote($cat->name, '/');
|
182 |
-
$regexp=
|
183 |
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
184 |
|
185 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
@@ -207,10 +214,10 @@ function SEOLinks_process_text($text, $mode)
|
|
207 |
|
208 |
foreach ($tags as $tag)
|
209 |
{
|
210 |
-
if ((!$maxlinks || ($links < $maxlinks)) && !in_array( strtolower($tag->name), $arrignore) )
|
211 |
{
|
212 |
$name = preg_quote($tag->name, '/');
|
213 |
-
$regexp=
|
214 |
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
215 |
|
216 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
@@ -292,7 +299,8 @@ function SEOLinks_comment_text_filter($text) {
|
|
292 |
'nofolo' =>'',
|
293 |
'blankn' =>'',
|
294 |
'blanko' =>'',
|
295 |
-
'onlysingle' => 'on'
|
|
|
296 |
|
297 |
);
|
298 |
|
@@ -346,6 +354,7 @@ function SEOLinks_comment_text_filter($text) {
|
|
346 |
$options['blankn']=$_POST['blankn'];
|
347 |
$options['blanko']=$_POST['blanko'];
|
348 |
$options['onlysingle']=$_POST['onlysingle'];
|
|
|
349 |
|
350 |
|
351 |
update_option($this->SEOLinks_DB_option, $options);
|
@@ -376,6 +385,7 @@ function SEOLinks_comment_text_filter($text) {
|
|
376 |
$blankn=$options['blankn']=='on'?'checked':'';
|
377 |
$blanko=$options['blanko']=='on'?'checked':'';
|
378 |
$onlysingle=$options['onlysingle']=='on'?'checked':'';
|
|
|
379 |
|
380 |
$nonce=wp_create_nonce( 'seo-smart-links');
|
381 |
|
@@ -388,18 +398,17 @@ function SEOLinks_comment_text_filter($text) {
|
|
388 |
<div id="poststuff" style="margin-top:10px;">
|
389 |
|
390 |
<div id="sideblock" style="float:right;width:220px;margin-left:10px;">
|
391 |
-
<
|
392 |
<div id="dbx-content" style="text-decoration:none;">
|
393 |
-
|
394 |
-
<img src="$imgpath/
|
395 |
-
|
396 |
-
<img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
|
397 |
<br />
|
398 |
-
|
399 |
-
<
|
400 |
-
<img src="$imgpath/
|
401 |
-
|
402 |
-
<
|
403 |
</div>
|
404 |
</div>
|
405 |
|
@@ -409,13 +418,13 @@ function SEOLinks_comment_text_filter($text) {
|
|
409 |
<form name="SEOLinks" action="$action_url" method="post">
|
410 |
<input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />
|
411 |
<input type="hidden" name="submitted" value="1" />
|
412 |
-
<
|
413 |
|
414 |
<p>SEO Smart Links can automatically link keywords and phrases in your posts and comments with corresponding posts, pages, categories and tags on your blog.</p>
|
415 |
<p>Further SEO Smart links allows you to set up your own keywords and set of matching URLs.</p>
|
416 |
<p>Finally SEO Smart links allows you to set nofollow attribute and open links in new window.</p>
|
417 |
|
418 |
-
<
|
419 |
<p>SEO Smart Links can process your posts, pages and comments in search for keywords to automatically interlink.</p>
|
420 |
<input type="checkbox" name="post" $post/><label for="post"> Posts</label>
|
421 |
<ul> <input type="checkbox" name="postself" $postself/><label for="postself"> Allow links to self</label></ul>
|
@@ -432,15 +441,20 @@ function SEOLinks_comment_text_filter($text) {
|
|
432 |
<input type="checkbox" name="lcats" $lcats /><label for="lcats"> Categories</label> (may slow down performance) <br>
|
433 |
<input type="checkbox" name="ltags" $ltags /><label for="ltags"> Tags</label> (may slow down performance) <br>
|
434 |
|
435 |
-
<
|
436 |
<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>
|
437 |
<input type="checkbox" name="onlysingle" $onlysingle /><label for="onlysingle"> Process only single posts and pages</label> <br>
|
438 |
|
439 |
-
<
|
|
|
|
|
|
|
440 |
<p>You may wish to ignore certain words or phrases from automatic linking. Seperate them by comma.</p>
|
441 |
<input type="text" name="ignore" size="90" value="$ignore"/>
|
442 |
-
|
443 |
-
|
|
|
|
|
444 |
<p>Here you can enter manually the extra keywords you want to automaticaly link. Use comma to seperate keywords and add target url at the end. Use a new line for new url and set of keywords. You can have these keywords link to any url, not only your site.</p>
|
445 |
<p>Example:<br />
|
446 |
vladimir prelovac, http://www.prelovac.com/vladimir<br />
|
@@ -450,13 +464,14 @@ function SEOLinks_comment_text_filter($text) {
|
|
450 |
<textarea name="customkey" id="customkey" rows="10" cols="90" >$customkey</textarea>
|
451 |
<br><br>
|
452 |
|
453 |
-
<
|
454 |
<p>You can limit the maximum number of links SEO Smart Links will generate per post. Set to 0 for no limit. </p>
|
455 |
Max Links: <input type="text" name="maxlinks" size="2" value="$maxlinks"/>
|
456 |
<p>You can also limit maximum number of links created with the same keyword. Set to 0 for no limit. </p>
|
457 |
Max Single: <input type="text" name="maxsingle" size="2" value="$maxsingle"/>
|
458 |
-
|
459 |
-
|
|
|
460 |
<p>SEO Smart links can open external links in new window and add nofollow attribute.</p>
|
461 |
|
462 |
|
@@ -466,7 +481,7 @@ function SEOLinks_comment_text_filter($text) {
|
|
466 |
<input type="checkbox" name="blanko" $blanko /><label for="blanko"> Open in new window</label> <br>
|
467 |
|
468 |
|
469 |
-
<div class="submit"><input type="submit" name="Submit" value="Update" class="button-primary" /></div>
|
470 |
</form>
|
471 |
</div>
|
472 |
|
2 |
|
3 |
/*
|
4 |
Plugin Name: SEO Smart Links
|
5 |
+
Version: 2.0
|
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
|
11 |
|
12 |
// todo It's possible to have option for case insensitive ?
|
13 |
// $count in preg_replace, max links towards same url
|
14 |
+
// If possible I'd be interested in having the plugin to not autolink keywords within (ie H1, H2 etc)
|
15 |
|
16 |
// Avoid name collisions.
|
17 |
if ( !class_exists('SEOLinks') ) :
|
51 |
|
52 |
$links=0;
|
53 |
|
54 |
+
|
55 |
+
|
56 |
|
57 |
if ($options['onlysingle'] && !(is_single() || is_page()))
|
58 |
return $text;
|
66 |
|
67 |
if (($post->post_type=='page' && !$options['pageself']) || ($post->post_type=='post' && !$options['postself'])) {
|
68 |
|
69 |
+
$thistitle=$options['casesens'] ? $post->post_title : strtolower($post->post_title);
|
70 |
$thisurl=trailingslashit(get_permalink($post->ID));
|
71 |
}
|
72 |
else {
|
79 |
$maxlinks=($options['maxlinks']>0) ? $options['maxlinks'] : 0;
|
80 |
$maxsingle=($options['maxsingle']>0) ? $options['maxsingle'] : -1;
|
81 |
|
82 |
+
$arrignore=$this->explode_trim(",", ($options['ignore']));
|
83 |
+
|
84 |
+
$reg_post = $options['casesens'] ? '/(?!(?:[^<]+>|[^>]+<\/a>))($name)/msU' : '/(?!(?:[^<]+>|[^>]+<\/a>))($name)/imsU';
|
85 |
+
$reg = $options['casesens'] ? '/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/msU' : '/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU';
|
86 |
|
87 |
$text = " $text ";
|
88 |
|
116 |
foreach ($kw_array as $name=>$url)
|
117 |
{
|
118 |
|
119 |
+
if ((!$maxlinks || ($links < $maxlinks)) && (trailingslashit($url)!=$thisurl) && !in_array( $options['casesens'] ? $name : strtolower($name), $arrignore))
|
120 |
{
|
121 |
|
122 |
$name= preg_quote($name, '/');
|
123 |
|
124 |
$replace="<a title=\"$1\" href=\"$url\">$1</a>";
|
125 |
+
$regexp=str_replace('$name', $name, $reg);
|
126 |
//$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))(?<!\p{L})($name)(?!\p{L})/imsU";
|
127 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
128 |
if ($newtext!=$text) {
|
151 |
foreach ($posts as $postitem)
|
152 |
{
|
153 |
if ((($options['lposts'] && $postitem->post_type=='post') || ($options['lpages'] && $postitem->post_type=='page')) &&
|
154 |
+
(!$maxlinks || ($links < $maxlinks)) && (($options['casesens'] ? $postitem->post_title : strtolower($postitem->post_title))!=$thistitle) && (!in_array( ($options['casesens'] ? $postitem->post_title : strtolower($postitem->post_title)), $arrignore)) )
|
155 |
{
|
156 |
$name = preg_quote($postitem->post_title, '/');
|
157 |
|
158 |
+
$regexp=str_replace('$name', $name, $reg_post);
|
159 |
+
|
160 |
|
161 |
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
162 |
|
183 |
|
184 |
foreach ($categories as $cat)
|
185 |
{
|
186 |
+
if ((!$maxlinks || ($links < $maxlinks)) && !in_array( $options['casesens'] ? $cat->name : strtolower($cat->name), $arrignore) )
|
187 |
{
|
188 |
$name= preg_quote($cat->name, '/');
|
189 |
+
$regexp=str_replace('$name', $name, $reg); ;
|
190 |
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
191 |
|
192 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
214 |
|
215 |
foreach ($tags as $tag)
|
216 |
{
|
217 |
+
if ((!$maxlinks || ($links < $maxlinks)) && !in_array( $options['casesens'] ? $tag->name : strtolower($tag->name), $arrignore) )
|
218 |
{
|
219 |
$name = preg_quote($tag->name, '/');
|
220 |
+
$regexp=str_replace('$name', $name, $reg); ;
|
221 |
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
222 |
|
223 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
299 |
'nofolo' =>'',
|
300 |
'blankn' =>'',
|
301 |
'blanko' =>'',
|
302 |
+
'onlysingle' => 'on',
|
303 |
+
'casesens' =>''
|
304 |
|
305 |
);
|
306 |
|
354 |
$options['blankn']=$_POST['blankn'];
|
355 |
$options['blanko']=$_POST['blanko'];
|
356 |
$options['onlysingle']=$_POST['onlysingle'];
|
357 |
+
$options['casesens']=$_POST['casesens'];
|
358 |
|
359 |
|
360 |
update_option($this->SEOLinks_DB_option, $options);
|
385 |
$blankn=$options['blankn']=='on'?'checked':'';
|
386 |
$blanko=$options['blanko']=='on'?'checked':'';
|
387 |
$onlysingle=$options['onlysingle']=='on'?'checked':'';
|
388 |
+
$casesens=$options['casesens']=='on'?'checked':'';
|
389 |
|
390 |
$nonce=wp_create_nonce( 'seo-smart-links');
|
391 |
|
398 |
<div id="poststuff" style="margin-top:10px;">
|
399 |
|
400 |
<div id="sideblock" style="float:right;width:220px;margin-left:10px;">
|
401 |
+
<h2>Information</h2>
|
402 |
<div id="dbx-content" style="text-decoration:none;">
|
403 |
+
<img src="$imgpath/home.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links"> SEO Smart Links Home</a><br />
|
404 |
+
<img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/seo-automatic-links/"> Rate this plugin</a><br />
|
405 |
+
<img src="$imgpath/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/forum"> Support and Help</a><br />
|
|
|
406 |
<br />
|
407 |
+
<a style="text-decoration:none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2567254"><img src="$imgpath/paypal.gif"></a>
|
408 |
+
<br /><br />
|
409 |
+
<img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> Cool WordPress Plugins</a><br />
|
410 |
+
<img src="$imgpath/twit.png"><a style="text-decoration:none;" href="http://twitter.com/vprelovac"> Follow updates on Twitter</a><br />
|
411 |
+
<img src="$imgpath/idea.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a>
|
412 |
</div>
|
413 |
</div>
|
414 |
|
418 |
<form name="SEOLinks" action="$action_url" method="post">
|
419 |
<input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />
|
420 |
<input type="hidden" name="submitted" value="1" />
|
421 |
+
<h2>Overview</h2>
|
422 |
|
423 |
<p>SEO Smart Links can automatically link keywords and phrases in your posts and comments with corresponding posts, pages, categories and tags on your blog.</p>
|
424 |
<p>Further SEO Smart links allows you to set up your own keywords and set of matching URLs.</p>
|
425 |
<p>Finally SEO Smart links allows you to set nofollow attribute and open links in new window.</p>
|
426 |
|
427 |
+
<h2>Internal Links</h2>
|
428 |
<p>SEO Smart Links can process your posts, pages and comments in search for keywords to automatically interlink.</p>
|
429 |
<input type="checkbox" name="post" $post/><label for="post"> Posts</label>
|
430 |
<ul> <input type="checkbox" name="postself" $postself/><label for="postself"> Allow links to self</label></ul>
|
441 |
<input type="checkbox" name="lcats" $lcats /><label for="lcats"> Categories</label> (may slow down performance) <br>
|
442 |
<input type="checkbox" name="ltags" $ltags /><label for="ltags"> Tags</label> (may slow down performance) <br>
|
443 |
|
444 |
+
<h2>Settings</h2>
|
445 |
<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>
|
446 |
<input type="checkbox" name="onlysingle" $onlysingle /><label for="onlysingle"> Process only single posts and pages</label> <br>
|
447 |
|
448 |
+
<p>Set whether matching should be case sensitive.</p>
|
449 |
+
<input type="checkbox" name="casesens" $casesens /><label for="casesens"> Case sensitive matching</label> <br>
|
450 |
+
|
451 |
+
<h4>Ignore keywords</h4>
|
452 |
<p>You may wish to ignore certain words or phrases from automatic linking. Seperate them by comma.</p>
|
453 |
<input type="text" name="ignore" size="90" value="$ignore"/>
|
454 |
+
<br><br>
|
455 |
+
|
456 |
+
|
457 |
+
<h4>Custom Keywords</h4>
|
458 |
<p>Here you can enter manually the extra keywords you want to automaticaly link. Use comma to seperate keywords and add target url at the end. Use a new line for new url and set of keywords. You can have these keywords link to any url, not only your site.</p>
|
459 |
<p>Example:<br />
|
460 |
vladimir prelovac, http://www.prelovac.com/vladimir<br />
|
464 |
<textarea name="customkey" id="customkey" rows="10" cols="90" >$customkey</textarea>
|
465 |
<br><br>
|
466 |
|
467 |
+
<h4>Limits</h4>
|
468 |
<p>You can limit the maximum number of links SEO Smart Links will generate per post. Set to 0 for no limit. </p>
|
469 |
Max Links: <input type="text" name="maxlinks" size="2" value="$maxlinks"/>
|
470 |
<p>You can also limit maximum number of links created with the same keyword. Set to 0 for no limit. </p>
|
471 |
Max Single: <input type="text" name="maxsingle" size="2" value="$maxsingle"/>
|
472 |
+
<br><br>
|
473 |
+
|
474 |
+
<h4>External Links</h4>
|
475 |
<p>SEO Smart links can open external links in new window and add nofollow attribute.</p>
|
476 |
|
477 |
|
481 |
<input type="checkbox" name="blanko" $blanko /><label for="blanko"> Open in new window</label> <br>
|
482 |
|
483 |
|
484 |
+
<div class="submit"><input type="submit" name="Submit" value="Update options" class="button-primary" /></div>
|
485 |
</form>
|
486 |
</div>
|
487 |
|