SEO Smart Links - Version 1.5

Version Description

Download this release

Release Info

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

Code changes from version 1.4 to 1.5

Files changed (2) hide show
  1. readme.txt +7 -3
  2. seo-links.php +50 -19
readme.txt CHANGED
@@ -11,15 +11,19 @@ SEO Smart Links can automatically link keywords and phrases in your posts and co
11
 
12
  == Description ==
13
 
14
- SEO Smart Links automatically searches for keywords and phrases in the text of your posts and comments add add links to the corresponding posts, pages, categories and tags on your blog.
15
 
16
- It's often forgotten about, why not interlink from key pages deeper into the site? If you forget SEO Smart Links won't.
17
- It also give your visitors an opportunity to visit other sections of your site that may be an interest for them.
 
18
 
19
  Everything happens completely transparent, and you can edit the options from the administration settings panel.
20
 
21
 
22
  Change log
 
 
 
23
  v1.4
24
  - Added option for custom keywrods. No you can specify unlimited numbers of your keywords and url's to link to
25
 
11
 
12
  == Description ==
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
+ v1.5
25
+ - Added nofollow and new window options
26
+
27
  v1.4
28
  - Added option for custom keywrods. No you can specify unlimited numbers of your keywords and url's to link to
29
 
seo-links.php CHANGED
@@ -2,11 +2,11 @@
2
 
3
  /*
4
  Plugin Name: SEO Smart Links
5
- Version: 1.4
6
  Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links
7
  Author: Vladimir Prelovac
8
  Author URI: http://www.prelovac.com
9
- Description: SEO Smart Links can automatically link keywords and phrases in your posts and comments with corresponding posts, pages, categories and tags.
10
 
11
  */
12
 
@@ -118,10 +118,11 @@ if ($options['lposts'] || $options['lpages'])
118
  {
119
  if ( !$posts = wp_cache_get( 'seo-links-posts', 'seo-smart-links' ) ) {
120
 
 
121
  $query="SELECT post_title, ID, guid, post_type FROM $wpdb->posts WHERE post_status = 'publish'";
122
  $posts = $wpdb->get_results($query);
123
 
124
- wp_cache_add( 'seo-links-posts', $posts, 'seo-smart-links',86400 );
125
  }
126
 
127
 
@@ -225,11 +226,17 @@ return trim( $text );
225
  }
226
 
227
  function SEOLinks_the_content_filter($text) {
228
- return $this->SEOLinks_process_text($text, 0);
 
 
 
229
  }
230
 
231
  function SEOLinks_comment_text_filter($text) {
232
- return $this->SEOLinks_process_text($text, 1);
 
 
 
233
  }
234
 
235
  function explode_trim($separator, $text)
@@ -261,6 +268,11 @@ function SEOLinks_comment_text_filter($text) {
261
  'maxlinks' => 3,
262
  'maxsingle' => 1,
263
  'customkey' => '',
 
 
 
 
 
264
  );
265
 
266
  $saved = get_option($this->SEOLinks_DB_option);
@@ -307,9 +319,12 @@ function SEOLinks_comment_text_filter($text) {
307
  $options['maxlinks']=(int) $_POST['maxlinks'];
308
  $options['maxsingle']=(int) $_POST['maxsingle'];
309
  $options['customkey']=$_POST['customkey'];
310
-
311
-
 
 
312
 
 
313
  update_option($this->SEOLinks_DB_option, $options);
314
  $this->SEOLinks_delete_cache(0);
315
  echo '<div class="updated fade"><p>Plugin settings saved.</p></div>';
@@ -333,6 +348,11 @@ function SEOLinks_comment_text_filter($text) {
333
  $maxlinks=$options['maxlinks'];
334
  $maxsingle=$options['maxsingle'];
335
  $customkey=$options['customkey'];
 
 
 
 
 
336
 
337
  $imgpath=trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-automatic-links/i';
338
  echo <<<END
@@ -363,20 +383,22 @@ function SEOLinks_comment_text_filter($text) {
363
  <div class="dbx-content">
364
  <form name="SEOLinks" action="$action_url" method="post">
365
  <input type="hidden" name="submitted" value="1" />
366
- <h3>Options</h3>
367
 
368
  <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>
 
 
369
 
370
- <h4>Source</h4>
371
- <p>SEO Smart Links can process your posts, pages and comments. Select your preference.</p>
372
  <input type="checkbox" name="post" $post/><label for="post"> Posts</label>
373
  <ul><input type="checkbox" name="postself" $postself/><label for="postself"> Allow links to itself</label></ul>
374
  <input type="checkbox" name="page" $page/><label for="page"> Pages</label>
375
  <ul><input type="checkbox" name="pageself" $postself/><label for="pageself"> Allow links to itself</label></ul>
376
  <input type="checkbox" name="comment" $comment /><label for="comment"> Comments</label> <br>
377
 
378
- <h4>Links</h4>
379
- <p>Links set where SEO Smart links should try and find appropriate link targets. The match will be based on post/page title or category/tag name, case insensitive.</p>
380
  <input type="checkbox" name="lposts" $lposts /><label for="lposts"> Posts</label> <br>
381
  <input type="checkbox" name="lpages" $lpages /><label for="lpages"> Pages</label> <br>
382
  <input type="checkbox" name="lcats" $lcats /><label for="lcats"> Categories</label> <br>
@@ -384,9 +406,9 @@ function SEOLinks_comment_text_filter($text) {
384
 
385
  <h4>Ignore</h4>
386
  <p>You may wish to ignore certain words or phrases from automatic linking. Seperate them by comma.</p>
387
- <input type="text" name="ignore" size="90" value="$ignore"/>
388
-
389
- <h4>Custom Keywords</h4>
390
  <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>
391
  <p>Example:<br />
392
  google, http://www.google.com<br />
@@ -394,13 +416,22 @@ function SEOLinks_comment_text_filter($text) {
394
  </p>
395
 
396
  <textarea name="customkey" id="customkey" rows="15" cols="80" >$customkey</textarea>
397
-
398
 
399
- <h4>Limits</h4>
400
- <p>You can limit the maximum number of links you want to generate in a post. Set to 0 or empty for no limit. </p>
401
  Max Links: <input type="text" name="maxlinks" size="2" value="$maxlinks"/>
402
- <p>You can also limit maximum number of links towards the same target in a post. Set to 0 or empty for no limit. </p>
403
  Max Single: <input type="text" name="maxsingle" size="2" value="$maxsingle"/>
 
 
 
 
 
 
 
 
 
404
 
405
 
406
  <div class="submit"><input type="submit" name="Submit" value="Update" /></div>
2
 
3
  /*
4
  Plugin Name: SEO Smart Links
5
+ Version: 1.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
9
+ Description: SEO Smart Links provides smart interlinking for your blog and additional SEO features for advanced users.
10
 
11
  */
12
 
118
  {
119
  if ( !$posts = wp_cache_get( 'seo-links-posts', 'seo-smart-links' ) ) {
120
 
121
+
122
  $query="SELECT post_title, ID, guid, post_type FROM $wpdb->posts WHERE post_status = 'publish'";
123
  $posts = $wpdb->get_results($query);
124
 
125
+ wp_cache_add( 'seo-links-posts', $posts, 'seo-smart-links', 86400 );
126
  }
127
 
128
 
226
  }
227
 
228
  function SEOLinks_the_content_filter($text) {
229
+ $result=$this->SEOLinks_process_text($text, 0);
230
+ $result = preg_replace('%<a(\s+.*?href=\S(?!' . get_bloginfo('wpurl') . '))%i', '<a target="_blank"\\1', $result); // credit to Kaf Oseo
231
+ $result = preg_replace('%<a(\s+.*?href=\S(?!' . get_bloginfo('wpurl') . '))%i', '<a rel="nofollow"\\1', $result);
232
+ return $result;
233
  }
234
 
235
  function SEOLinks_comment_text_filter($text) {
236
+ $result = $this->SEOLinks_process_text($text, 1);
237
+ $result = preg_replace('%<a(\s+.*?href=\S(?!' . get_bloginfo('wpurl') . '))%i', '<a target="_blank"\\1', $result); // credit to Kaf Oseo
238
+ $result = preg_replace('%<a(\s+.*?href=\S(?!' . get_bloginfo('wpurl') . '))%i', '<a rel="nofollow"\\1', $result);
239
+ return $result;
240
  }
241
 
242
  function explode_trim($separator, $text)
268
  'maxlinks' => 3,
269
  'maxsingle' => 1,
270
  'customkey' => '',
271
+ 'nofoln' =>'',
272
+ 'nofolo' =>'',
273
+ 'blankn' =>'',
274
+ 'blanko' =>''
275
+
276
  );
277
 
278
  $saved = get_option($this->SEOLinks_DB_option);
319
  $options['maxlinks']=(int) $_POST['maxlinks'];
320
  $options['maxsingle']=(int) $_POST['maxsingle'];
321
  $options['customkey']=$_POST['customkey'];
322
+ $options['nofoln']=$_POST['nofoln'];
323
+ $options['nofolo']=$_POST['nofolo'];
324
+ $options['blankn']=$_POST['blankn'];
325
+ $options['blanko']=$_POST['blanko'];
326
 
327
+
328
  update_option($this->SEOLinks_DB_option, $options);
329
  $this->SEOLinks_delete_cache(0);
330
  echo '<div class="updated fade"><p>Plugin settings saved.</p></div>';
348
  $maxlinks=$options['maxlinks'];
349
  $maxsingle=$options['maxsingle'];
350
  $customkey=$options['customkey'];
351
+ $nofoln=$options['nofoln']=='on'?'checked':'';
352
+ $nofolo=$options['nofolo']=='on'?'checked':'';
353
+ $blankn=$options['blankn']=='on'?'checked':'';
354
+ $blanko=$options['blanko']=='on'?'checked':'';
355
+
356
 
357
  $imgpath=trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-automatic-links/i';
358
  echo <<<END
383
  <div class="dbx-content">
384
  <form name="SEOLinks" action="$action_url" method="post">
385
  <input type="hidden" name="submitted" value="1" />
386
+ <h3>Overview</h3>
387
 
388
  <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>
389
+ <p>Further SEO Smart links allows you to set up your own keywords and set of matching URLs.</p>
390
+ <p>Finally SEO Smart links allows you to set nofollow attribute and open links in new window.</p>
391
 
392
+ <h3>Internal Links</h3>
393
+ <p>SEO Smart Links can process your posts, pages and comments in search for keywords to automatically interlink.</p>
394
  <input type="checkbox" name="post" $post/><label for="post"> Posts</label>
395
  <ul><input type="checkbox" name="postself" $postself/><label for="postself"> Allow links to itself</label></ul>
396
  <input type="checkbox" name="page" $page/><label for="page"> Pages</label>
397
  <ul><input type="checkbox" name="pageself" $postself/><label for="pageself"> Allow links to itself</label></ul>
398
  <input type="checkbox" name="comment" $comment /><label for="comment"> Comments</label> <br>
399
 
400
+ <h4>Target</h4>
401
+ <p>The targets SEO Smart links should consider. The match will be based on post/page title or category/tag name, case insensitive.</p>
402
  <input type="checkbox" name="lposts" $lposts /><label for="lposts"> Posts</label> <br>
403
  <input type="checkbox" name="lpages" $lpages /><label for="lpages"> Pages</label> <br>
404
  <input type="checkbox" name="lcats" $lcats /><label for="lcats"> Categories</label> <br>
406
 
407
  <h4>Ignore</h4>
408
  <p>You may wish to ignore certain words or phrases from automatic linking. Seperate them by comma.</p>
409
+ <input type="text" name="ignore" size="90" value="$ignore"/>
410
+ <br><br>
411
+ <h3>Custom Keywords</h3>
412
  <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>
413
  <p>Example:<br />
414
  google, http://www.google.com<br />
416
  </p>
417
 
418
  <textarea name="customkey" id="customkey" rows="15" cols="80" >$customkey</textarea>
419
+ <br><br>
420
 
421
+ <h3>Limits</h3>
422
+ <p>You can limit the maximum number of links SEO Smart Links will generate per post. Set to 0 for no limit. </p>
423
  Max Links: <input type="text" name="maxlinks" size="2" value="$maxlinks"/>
424
+ <p>You can also limit maximum number of links towards the same target in a post. Set to 0 for no limit. </p>
425
  Max Single: <input type="text" name="maxsingle" size="2" value="$maxsingle"/>
426
+ <br><br>
427
+ <h3>External Links</h3>
428
+ <p>SEO Smart links can open external links in new window and add nofollow attribute.</p>
429
+
430
+
431
+ <input type="checkbox" name="nofolo" $nofolo /><label for="nofolo"> Add nofollow attribute</label> <br>
432
+
433
+
434
+ <input type="checkbox" name="blanko" $blanko /><label for="blanko"> Open in new window</label> <br>
435
 
436
 
437
  <div class="submit"><input type="submit" name="Submit" value="Update" /></div>