SEO Smart Links - Version 1.9

Version Description

Download this release

Release Info

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

Code changes from version 1.8.2 to 1.9

Files changed (8) hide show
  1. i/help.png +0 -0
  2. i/home.png +0 -0
  3. i/idea.png +0 -0
  4. i/more.png +0 -0
  5. i/p1.png +0 -0
  6. i/rate.png +0 -0
  7. readme.txt +2 -2
  8. seo-links.php +19 -26
i/help.png ADDED
Binary file
i/home.png ADDED
Binary file
i/idea.png ADDED
Binary file
i/more.png ADDED
Binary file
i/p1.png ADDED
Binary file
i/rate.png ADDED
Binary file
readme.txt CHANGED
@@ -19,8 +19,8 @@ Everything happens completely transparent, and you can edit the options from the
19
 
20
  Change log:
21
 
22
- v1.8.2
23
- - Fixed problem with linking to the same post
24
 
25
  v1.8.0
26
  - Added support for non-english characters (Unicode)
19
 
20
  Change log:
21
 
22
+ v1.9
23
+ - Various improvements and bug fixes
24
 
25
  v1.8.0
26
  - Added support for non-english characters (Unicode)
seo-links.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: SEO Smart Links
5
- Version: 1.8.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
@@ -48,9 +48,6 @@ function SEOLinks_process_text($text, $mode)
48
 
49
  $links=0;
50
 
51
-
52
-
53
-
54
 
55
  if ($options['onlysingle'] && !(is_single() || is_page()))
56
  return $text;
@@ -62,29 +59,25 @@ function SEOLinks_process_text($text, $mode)
62
  else if ($post->post_type=='page' && !$options['page'])
63
  return $text;
64
 
65
- if (($post->post_type=='page' && !$options['pageself']) || ($post->post_type=='post' && !$options['postself']))
 
66
  $thistitle=strtolower($post->post_title);
 
67
  else
68
  $thistitle='';
69
 
70
  }
71
-
72
- $maxlinks=($options['maxlinks']>0) ? $options['maxlinks'] : 0;
73
 
 
74
  $maxsingle=($options['maxsingle']>0) ? $options['maxsingle'] : -1;
75
-
76
-
77
-
78
-
79
  $arrignore=$this->explode_trim(",", strtolower($options['ignore']));
80
-
81
 
82
  $text = " $text ";
83
 
84
  // custom keywords
85
  if (!empty($options['customkey']))
86
- {
87
-
88
  $kw_array = array();
89
 
90
  // thanks PK for the suggestion
@@ -112,7 +105,7 @@ function SEOLinks_process_text($text, $mode)
112
  foreach ($kw_array as $name=>$url)
113
  {
114
 
115
- if (!$maxlinks || ($links < $maxlinks) && !in_array( strtolower($name), $arrignore) && strstr($text, $name))
116
  {
117
  $name= preg_quote($name, '/');
118
 
@@ -129,13 +122,14 @@ function SEOLinks_process_text($text, $mode)
129
  }
130
  }
131
 
 
132
  // posts and pages
133
  if ($options['lposts'] || $options['lpages'])
134
  {
135
  if ( !$posts = wp_cache_get( 'seo-links-posts', 'seo-smart-links' ) ) {
136
 
137
 
138
- $query="SELECT post_title, ID, guid, post_type FROM $wpdb->posts WHERE post_status = 'publish' AND LENGTH(post_title)>3 ORDER BY LENGTH(post_title) DESC";
139
  $posts = $wpdb->get_results($query);
140
 
141
  wp_cache_add( 'seo-links-posts', $posts, 'seo-smart-links', 86400 );
@@ -144,15 +138,12 @@ function SEOLinks_process_text($text, $mode)
144
 
145
  foreach ($posts as $postitem)
146
  {
147
-
148
  if ((($options['lposts'] && $postitem->post_type=='post') || ($options['lpages'] && $postitem->post_type=='page')) &&
149
- (!$maxlinks || ($links < $maxlinks)) && strtolower($postitem->post_title)!=$thistitle && (!in_array( strtolower($postitem->post_title), $arrignore)) && strstr($text, $postitem->post_title) )
150
  {
151
-
152
-
153
  $name = preg_quote($postitem->post_title, '/');
154
 
155
- $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
156
 
157
  $replace='<a title="$1" href="$$$url$$$">$1</a>';
158
 
@@ -179,7 +170,7 @@ function SEOLinks_process_text($text, $mode)
179
 
180
  foreach ($categories as $cat)
181
  {
182
- if ((!$maxlinks || ($links < $maxlinks)) && !in_array( strtolower($cat->name), $arrignore) && strstr($text, $cat->name) )
183
  {
184
  $name= preg_quote($cat->name, '/');
185
  $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
@@ -210,7 +201,7 @@ function SEOLinks_process_text($text, $mode)
210
 
211
  foreach ($tags as $tag)
212
  {
213
- if ((!$maxlinks || ($links < $maxlinks)) && !in_array( strtolower($name), $arrignore) && strstr($text, $tag->name))
214
  {
215
  $name = preg_quote($tag->name, '/');
216
  $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
@@ -422,9 +413,11 @@ function SEOLinks_comment_text_filter($text) {
422
  <h3>Internal Links</h3>
423
  <p>SEO Smart Links can process your posts, pages and comments in search for keywords to automatically interlink.</p>
424
  <input type="checkbox" name="post" $post/><label for="post"> Posts</label>
425
- <ul><input type="checkbox" name="postself" $postself/><label for="postself"> Allow links to itself</label></ul>
 
426
  <input type="checkbox" name="page" $page/><label for="page"> Pages</label>
427
- <ul><input type="checkbox" name="pageself" $pageself/><label for="pageself"> Allow links to itself</label></ul>
 
428
  <input type="checkbox" name="comment" $comment /><label for="comment"> Comments</label> (may slow down performance) <br>
429
 
430
  <h4>Target</h4>
@@ -449,7 +442,7 @@ function SEOLinks_comment_text_filter($text) {
449
  cars, car, autos, auto, http://mycarblog.com/<br />
450
  </p>
451
 
452
- <textarea name="customkey" id="customkey" rows="15" cols="80" >$customkey</textarea>
453
  <br><br>
454
 
455
  <h3>Limits</h3>
2
 
3
  /*
4
  Plugin Name: SEO Smart Links
5
+ Version: 1.9
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
48
 
49
  $links=0;
50
 
 
 
 
51
 
52
  if ($options['onlysingle'] && !(is_single() || is_page()))
53
  return $text;
59
  else if ($post->post_type=='page' && !$options['page'])
60
  return $text;
61
 
62
+ if (($post->post_type=='page' && !$options['pageself']) || ($post->post_type=='post' && !$options['postself'])) {
63
+
64
  $thistitle=strtolower($post->post_title);
65
+ }
66
  else
67
  $thistitle='';
68
 
69
  }
 
 
70
 
71
+ $maxlinks=($options['maxlinks']>0) ? $options['maxlinks'] : 0;
72
  $maxsingle=($options['maxsingle']>0) ? $options['maxsingle'] : -1;
73
+
 
 
 
74
  $arrignore=$this->explode_trim(",", strtolower($options['ignore']));
 
75
 
76
  $text = " $text ";
77
 
78
  // custom keywords
79
  if (!empty($options['customkey']))
80
+ {
 
81
  $kw_array = array();
82
 
83
  // thanks PK for the suggestion
105
  foreach ($kw_array as $name=>$url)
106
  {
107
 
108
+ if ((!$maxlinks || ($links < $maxlinks)) && strtolower($name)!=$thistitle && !in_array( strtolower($name), $arrignore))
109
  {
110
  $name= preg_quote($name, '/');
111
 
122
  }
123
  }
124
 
125
+
126
  // posts and pages
127
  if ($options['lposts'] || $options['lpages'])
128
  {
129
  if ( !$posts = wp_cache_get( 'seo-links-posts', 'seo-smart-links' ) ) {
130
 
131
 
132
+ $query="SELECT post_title, ID, post_type FROM $wpdb->posts WHERE post_status = 'publish' AND LENGTH(post_title)>3 ORDER BY LENGTH(post_title) DESC";
133
  $posts = $wpdb->get_results($query);
134
 
135
  wp_cache_add( 'seo-links-posts', $posts, 'seo-smart-links', 86400 );
138
 
139
  foreach ($posts as $postitem)
140
  {
 
141
  if ((($options['lposts'] && $postitem->post_type=='post') || ($options['lpages'] && $postitem->post_type=='page')) &&
142
+ (!$maxlinks || ($links < $maxlinks)) && (strtolower($postitem->post_title)!=$thistitle) && (!in_array( strtolower($postitem->post_title), $arrignore)) )
143
  {
 
 
144
  $name = preg_quote($postitem->post_title, '/');
145
 
146
+ $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))($name)/imsU";
147
 
148
  $replace='<a title="$1" href="$$$url$$$">$1</a>';
149
 
170
 
171
  foreach ($categories as $cat)
172
  {
173
+ if ((!$maxlinks || ($links < $maxlinks)) && (strtolower($cat->name)!=$thistitle) && !in_array( strtolower($cat->name), $arrignore) )
174
  {
175
  $name= preg_quote($cat->name, '/');
176
  $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
201
 
202
  foreach ($tags as $tag)
203
  {
204
+ if ((!$maxlinks || ($links < $maxlinks)) && (strtolower($tag->name)!=$thistitle) && !in_array( strtolower($tag->name), $arrignore) )
205
  {
206
  $name = preg_quote($tag->name, '/');
207
  $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
413
  <h3>Internal Links</h3>
414
  <p>SEO Smart Links can process your posts, pages and comments in search for keywords to automatically interlink.</p>
415
  <input type="checkbox" name="post" $post/><label for="post"> Posts</label>
416
+ <ul>&nbsp;<input type="checkbox" name="postself" $postself/><label for="postself"> Allow links to self</label></ul>
417
+ <br />
418
  <input type="checkbox" name="page" $page/><label for="page"> Pages</label>
419
+ <ul>&nbsp;<input type="checkbox" name="pageself" $pageself/><label for="pageself"> Allow links to self</label></ul>
420
+ <br />
421
  <input type="checkbox" name="comment" $comment /><label for="comment"> Comments</label> (may slow down performance) <br>
422
 
423
  <h4>Target</h4>
442
  cars, car, autos, auto, http://mycarblog.com/<br />
443
  </p>
444
 
445
+ <textarea name="customkey" id="customkey" rows="10" cols="80" >$customkey</textarea>
446
  <br><br>
447
 
448
  <h3>Limits</h3>