SEO Smart Links - Version 1.8.0

Version Description

Download this release

Release Info

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

Code changes from version 1.7.5 to 1.8.0

Files changed (2) hide show
  1. readme.txt +5 -19
  2. seo-links.php +40 -14
readme.txt CHANGED
@@ -13,14 +13,15 @@ SEO Smart Links can automatically link keywords and phrases in your posts and co
13
 
14
  SEO Smart Links can automatically link keywords and phrases in your posts and comments with corresponding posts, pages, categories and tags on your blog.
15
 
16
- Further SEO Smart links allows you to set up your own keywords and set of matching URLs.
17
-
18
- Finally SEO Smart links allows you to set nofollow attribute and open links in new window.
19
 
20
  Everything happens completely transparent, and you can edit the options from the administration settings panel.
21
 
 
22
 
23
- Change log
 
 
24
 
25
  v1.7.1
26
  - More performance optimizations
@@ -29,21 +30,6 @@ v1.7.1
29
  v1.7
30
  - Performance optimization of the plugin. SEO Smart Links causes much lesser strain on the server.
31
 
32
- v1.6.4
33
- - Fix in semantics
34
-
35
- v1.6.3
36
- - Fixed issue with too short titles (now titles shorter then 4 characters are ignored)
37
- - Targets are sorted by length and longer titles are linked to first
38
-
39
- v1.6.2
40
- - Fixed small issue with database leading to compability issues with some WP isntallations
41
-
42
- v1.6
43
- - Added option to process only single posts and pages
44
-
45
-
46
-
47
  Plugin by Vladimir Prelovac. Need help with <a href="http://www.prelovac.com/vladimir/services">WordPress SEO</a>?
48
 
49
  == Credits ==
13
 
14
  SEO Smart Links can automatically link keywords and phrases in your posts and comments with corresponding posts, pages, categories and tags on your blog.
15
 
16
+ Further SEO Smart links allows you to set up your own keywords and set of matching URLs. Finally SEO Smart links allows you to set nofollow attribute and open links in new window.
 
 
17
 
18
  Everything happens completely transparent, and you can edit the options from the administration settings panel.
19
 
20
+ Change log:
21
 
22
+ v1.8.0
23
+ - Added support for non-english characters (Unicode)
24
+ - Added support for keyword synonyms (in keywords section of the settings screen)
25
 
26
  v1.7.1
27
  - More performance optimizations
30
  v1.7
31
  - Performance optimization of the plugin. SEO Smart Links causes much lesser strain on the server.
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  Plugin by Vladimir Prelovac. Need help with <a href="http://www.prelovac.com/vladimir/services">WordPress SEO</a>?
34
 
35
  == Credits ==
seo-links.php CHANGED
@@ -2,16 +2,14 @@
2
 
3
  /*
4
  Plugin Name: SEO Smart Links
5
- Version: 1.7.5
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 SEO benefits for your blog by inter-linking the articles.
10
-
11
  */
12
 
13
 
14
-
15
  // Avoid name collisions.
16
  if ( !class_exists('SEOLinks') ) :
17
 
@@ -49,6 +47,8 @@ function SEOLinks_process_text($text, $mode)
49
  $options = $this->get_options();
50
 
51
  $links=0;
 
 
52
 
53
 
54
 
@@ -86,10 +86,28 @@ function SEOLinks_process_text($text, $mode)
86
  {
87
 
88
  $kw_array = array();
 
 
89
  foreach (explode("\n", $options['customkey']) as $line) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  list($keyword, $url) = array_map('trim', explode(",", $line, 2));
91
  if (!empty($keyword)) $kw_array[$keyword] = $url;
92
- }
93
 
94
  foreach ($kw_array as $name=>$url)
95
  {
@@ -97,9 +115,10 @@ function SEOLinks_process_text($text, $mode)
97
  if (!$maxlinks || ($links < $maxlinks) && !in_array( strtolower($name), $arrignore) && strstr($text, $name))
98
  {
99
  $name= preg_quote($name, '/');
100
- $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
101
- $replace="<a title=\"$1\" href=\"$url\">$1</a>";
102
 
 
 
 
103
  $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
104
  if ($newtext!=$text) {
105
  $links++;
@@ -130,7 +149,9 @@ function SEOLinks_process_text($text, $mode)
130
  (!$maxlinks || ($links < $maxlinks)) && (!in_array( strtolower($postitem->post_title), $arrignore)) && strstr($text, $postitem->post_title) )
131
  {
132
  $name = preg_quote($postitem->post_title, '/');
133
- $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
 
 
134
  $replace='<a title="$1" href="$$$url$$$">$1</a>';
135
 
136
  $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
@@ -159,7 +180,7 @@ function SEOLinks_process_text($text, $mode)
159
  if ((!$maxlinks || ($links < $maxlinks)) && !in_array( strtolower($cat->name), $arrignore) && strstr($text, $cat->name) )
160
  {
161
  $name= preg_quote($cat->name, '/');
162
- $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
163
  $replace='<a title="$1" href="$$$url$$$">$1</a>';
164
 
165
  $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
@@ -190,7 +211,7 @@ function SEOLinks_process_text($text, $mode)
190
  if ((!$maxlinks || ($links < $maxlinks)) && !in_array( strtolower($name), $arrignore) && strstr($text, $tag->name))
191
  {
192
  $name = preg_quote($tag->name, '/');
193
- $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
194
  $replace='<a title="$1" href="$$$url$$$">$1</a>';
195
 
196
  $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
@@ -305,6 +326,7 @@ function SEOLinks_comment_text_filter($text) {
305
  $options = $this->get_options();
306
  if ( isset($_POST['submitted']) ) {
307
 
 
308
 
309
  $options['post']=$_POST['post'];
310
  $options['postself']=$_POST['postself'];
@@ -355,6 +377,9 @@ function SEOLinks_comment_text_filter($text) {
355
  $blanko=$options['blanko']=='on'?'checked':'';
356
  $onlysingle=$options['onlysingle']=='on'?'checked':'';
357
 
 
 
 
358
 
359
  $imgpath=trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-automatic-links/i';
360
  echo <<<END
@@ -384,6 +409,7 @@ function SEOLinks_comment_text_filter($text) {
384
 
385
  <div class="dbx-content">
386
  <form name="SEOLinks" action="$action_url" method="post">
 
387
  <input type="hidden" name="submitted" value="1" />
388
  <h3>Overview</h3>
389
 
@@ -415,10 +441,10 @@ function SEOLinks_comment_text_filter($text) {
415
  <input type="text" name="ignore" size="90" value="$ignore"/>
416
  <br><br>
417
  <h3>Custom Keywords</h3>
418
- <p>Here you can enter manually the extra keywords you want to automaticaly link. Use comma to seperate keyword and url, next one in next line and so on. You can have these keywords link to any url, not only your site.</p>
419
  <p>Example:<br />
420
- google, http://www.google.com<br />
421
- vladimir prelovac, http://www.prelovac.com/vladimir
422
  </p>
423
 
424
  <textarea name="customkey" id="customkey" rows="15" cols="80" >$customkey</textarea>
@@ -440,7 +466,7 @@ function SEOLinks_comment_text_filter($text) {
440
  <input type="checkbox" name="blanko" $blanko /><label for="blanko"> Open in new window</label> <br>
441
 
442
 
443
- <div class="submit"><input type="submit" name="Submit" value="Update" /></div>
444
  </form>
445
  </div>
446
 
2
 
3
  /*
4
  Plugin Name: SEO Smart Links
5
+ Version: 1.8.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
9
+ Description: SEO Smart Links provides automatic inter-linking of your articles, custom keyword lists and much more.
 
10
  */
11
 
12
 
 
13
  // Avoid name collisions.
14
  if ( !class_exists('SEOLinks') ) :
15
 
47
  $options = $this->get_options();
48
 
49
  $links=0;
50
+
51
+
52
 
53
 
54
 
86
  {
87
 
88
  $kw_array = array();
89
+
90
+ // thanks PK for the suggestion
91
  foreach (explode("\n", $options['customkey']) as $line) {
92
+ $chunks = array_map('trim', explode(",", $line));
93
+ $total_chuncks = count($chunks);
94
+ if($total_chuncks > 2) {
95
+ $i = 0;
96
+ $url = $chunks[$total_chuncks-1];
97
+ while($i < $total_chuncks-1) {
98
+ if (!empty($chunks[$i])) $kw_array[$chunks[$i]] = $url;
99
+ $i++;
100
+ }
101
+ } else {
102
+ list($keyword, $url) = array_map('trim', explode(",", $line, 2));
103
+ if (!empty($keyword)) $kw_array[$keyword] = $url;
104
+ }
105
+ }
106
+
107
+ /*foreach (explode("\n", $options['customkey']) as $line) {
108
  list($keyword, $url) = array_map('trim', explode(",", $line, 2));
109
  if (!empty($keyword)) $kw_array[$keyword] = $url;
110
+ }*/
111
 
112
  foreach ($kw_array as $name=>$url)
113
  {
115
  if (!$maxlinks || ($links < $maxlinks) && !in_array( strtolower($name), $arrignore) && strstr($text, $name))
116
  {
117
  $name= preg_quote($name, '/');
 
 
118
 
119
+ $replace="<a title=\"$1\" href=\"$url\">$1</a>";
120
+ //$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU"; // this didnt work with unicode
121
+ $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))(?<!\p{L})($name)(?!\p{L})/imsU";
122
  $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
123
  if ($newtext!=$text) {
124
  $links++;
149
  (!$maxlinks || ($links < $maxlinks)) && (!in_array( strtolower($postitem->post_title), $arrignore)) && strstr($text, $postitem->post_title) )
150
  {
151
  $name = preg_quote($postitem->post_title, '/');
152
+
153
+ $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))(?<!\p{L})($name)(?!\p{L})/imsU";
154
+
155
  $replace='<a title="$1" href="$$$url$$$">$1</a>';
156
 
157
  $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
180
  if ((!$maxlinks || ($links < $maxlinks)) && !in_array( strtolower($cat->name), $arrignore) && strstr($text, $cat->name) )
181
  {
182
  $name= preg_quote($cat->name, '/');
183
+ $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))(?<!\p{L})($name)(?!\p{L})/imsU";
184
  $replace='<a title="$1" href="$$$url$$$">$1</a>';
185
 
186
  $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
211
  if ((!$maxlinks || ($links < $maxlinks)) && !in_array( strtolower($name), $arrignore) && strstr($text, $tag->name))
212
  {
213
  $name = preg_quote($tag->name, '/');
214
+ $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))(?<!\p{L})($name)(?!\p{L})/imsU";
215
  $replace='<a title="$1" href="$$$url$$$">$1</a>';
216
 
217
  $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
326
  $options = $this->get_options();
327
  if ( isset($_POST['submitted']) ) {
328
 
329
+ check_admin_referer('seo-smart-links');
330
 
331
  $options['post']=$_POST['post'];
332
  $options['postself']=$_POST['postself'];
377
  $blanko=$options['blanko']=='on'?'checked':'';
378
  $onlysingle=$options['onlysingle']=='on'?'checked':'';
379
 
380
+ $nonce=wp_create_nonce( 'seo-smart-links');
381
+
382
+
383
 
384
  $imgpath=trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-automatic-links/i';
385
  echo <<<END
409
 
410
  <div class="dbx-content">
411
  <form name="SEOLinks" action="$action_url" method="post">
412
+ <input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />
413
  <input type="hidden" name="submitted" value="1" />
414
  <h3>Overview</h3>
415
 
441
  <input type="text" name="ignore" size="90" value="$ignore"/>
442
  <br><br>
443
  <h3>Custom Keywords</h3>
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 />
447
+ cars, car, autos, auto, http://mycarblog.com/<br />
448
  </p>
449
 
450
  <textarea name="customkey" id="customkey" rows="15" cols="80" >$customkey</textarea>
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