SEO Smart Links - Version 1.4

Version Description

Download this release

Release Info

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

Code changes from version 1.3 to 1.4

Files changed (3) hide show
  1. i/rate.png +0 -0
  2. readme.txt +13 -6
  3. seo-links.php +99 -50
i/rate.png ADDED
Binary file
readme.txt CHANGED
@@ -19,13 +19,12 @@ It also give your visitors an opportunity to visit other sections of your site t
19
Everything happens completely transparent, and you can edit the options from the administration settings panel.
20
21
22
- v1.3:
23
- - Enabled caching for speeding queries up. Make sure you have
24
- define(ENABLE_CACHE, true);
25
-
26
- set in your wp-config.php
27
28
-
29
30
v1.2:
31
- Added limits options
@@ -74,6 +73,14 @@ You should have received a copy of the GNU General Public License along with SEO
74
75
Just install activate it on your blog. Default options are enough to get you going. If you want to tweak it, you can always edit the options. Be sure to check "ignore" options where you can state what keywords and phrases not to link.
76
77
78
= Can I suggest an feature for the plugin? =
79
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
26
+ v1.3:
27
+ - Enabled caching for speeding queries up.
28
29
v1.2:
30
- Added limits options
73
74
Just install activate it on your blog. Default options are enough to get you going. If you want to tweak it, you can always edit the options. Be sure to check "ignore" options where you can state what keywords and phrases not to link.
75
76
+ = How do I enable SEO Smart Links cache?
77
+
78
+ Make sure you have enabled WordPress cache by adding this line to your wp-config.php
79
+
80
+ define(ENABLE_CACHE, true);
81
+
82
+ Please be careful when editing this file and always make a backup!
83
+
84
85
= Can I suggest an feature for the plugin? =
86
seo-links.php CHANGED
@@ -2,7 +2,7 @@
2
3
/*
4
Plugin Name: SEO Smart Links
5
- Version: 1.3
6
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links
7
Author: Vladimir Prelovac
8
Author URI: http://www.prelovac.com
@@ -79,6 +79,41 @@ $arrignore=$this->explode_trim(",", strtolower($options['ignore'].$add));
79
80
$text = " $text ";
81
82
if ($options['lposts'] || $options['lpages'])
83
{
84
if ( !$posts = wp_cache_get( 'seo-links-posts', 'seo-smart-links' ) ) {
@@ -197,22 +232,7 @@ function SEOLinks_comment_text_filter($text) {
197
return $this->SEOLinks_process_text($text, 1);
198
}
199
200
- // Handle our options
201
- function get_options() {
202
-
203
-
204
- $existing_options = get_option($this->SEOLinks_DB_option);
205
-
206
- if (!empty($existing_options)) {
207
- foreach ($existing_options as $key => $option)
208
- $options[$key] = $option;
209
- }
210
- else
211
- return 0;
212
- return $options;
213
- }
214
-
215
- function explode_trim($separator, $text)
216
{
217
$arr = explode($separator, $text);
218
@@ -223,40 +243,56 @@ function explode_trim($separator, $text)
223
}
224
return $ret;
225
}
226
227
// Set up everything
228
function install() {
229
$SEOLinks_options = $this->get_options();
230
- if (!$SEOLinks_options)
231
- {
232
- $options = array();
233
-
234
- $options['post']='on';
235
- $options['postself']='';
236
- $options['page']='on';
237
- $options['pageself']='';
238
- $options['comment']='';
239
- $options['lposts']='on';
240
- $options['lpages']='on';
241
- $options['lcats']='';
242
- $options['ltags']='';
243
- $options['ignore']='about,';
244
- $options['maxlinks']=3;
245
- $options['maxsingle']=1;
246
-
247
248
- update_option($this->SEOLinks_DB_option, $options);
249
- }
250
251
}
252
253
function handle_options()
254
{
255
256
-
257
if ( isset($_POST['submitted']) ) {
258
- $options = array();
259
- //print_r($_POST);
260
261
$options['post']=$_POST['post'];
262
$options['postself']=$_POST['postself'];
@@ -268,8 +304,9 @@ function explode_trim($separator, $text)
268
$options['lcats']=$_POST['lcats'];
269
$options['ltags']=$_POST['ltags'];
270
$options['ignore']=$_POST['ignore'];
271
- $options['maxlinks']=$_POST['maxlinks'];
272
- $options['maxsingle']=$_POST['maxsingle'];
273
274
275
@@ -279,7 +316,7 @@ function explode_trim($separator, $text)
279
}
280
281
282
- $options = $this->get_options();
283
284
$action_url = $_SERVER['REQUEST_URI'];
285
@@ -295,6 +332,7 @@ function explode_trim($separator, $text)
295
$ignore=$options['ignore'];
296
$maxlinks=$options['maxlinks'];
297
$maxsingle=$options['maxsingle'];
298
299
$imgpath=trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-automatic-links/i';
300
echo <<<END
@@ -307,15 +345,16 @@ function explode_trim($separator, $text)
307
<div id="sideblock" style="float:right;width:220px;margin-left:10px;">
308
<h3>Information</h3>
309
<div id="dbx-content" style="text-decoration:none;">
310
- <img src="$imgpath/home.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links"> SEO Smart Links Home</a><br /><br />
311
- <img src="$imgpath/idea.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links#comments"> Suggest a Feature</a><br /><br />
312
- <img src="$imgpath/more.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
313
<br />
314
315
<p align="center">
316
<img src="$imgpath/p1.png"></p>
317
318
- <p> <img src="$imgpath/help.png"><a href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></p>
319
</div>
320
</div>
321
@@ -337,16 +376,26 @@ function explode_trim($separator, $text)
337
<input type="checkbox" name="comment" $comment /><label for="comment"> Comments</label> <br>
338
339
<h4>Links</h4>
340
- <p>Select automatic link targets.</p>
341
<input type="checkbox" name="lposts" $lposts /><label for="lposts"> Posts</label> <br>
342
<input type="checkbox" name="lpages" $lpages /><label for="lpages"> Pages</label> <br>
343
- <input type="checkbox" name="lcats" $lcats /><label for="lcats"> Categories (can slow down big sites)</label> <br>
344
- <input type="checkbox" name="ltags" $ltags /><label for="ltags"> Tags (can slow down big sites)</label> <br>
345
346
<h4>Ignore</h4>
347
- <p>You may wish to ignore certain words or phrases. Seperate them by comma.</p>
348
<input type="text" name="ignore" size="90" value="$ignore"/>
349
350
<h4>Limits</h4>
351
<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>
352
Max Links: <input type="text" name="maxlinks" size="2" value="$maxlinks"/>
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
79
80
$text = " $text ";
81
82
+
83
+ if (!empty($options['customkey']))
84
+ {
85
+
86
+ $kw_array = array();
87
+ foreach (explode("\n", $options['customkey']) as $line) {
88
+ list($keyword, $url) = array_map('trim', explode(",", $line, 2));
89
+ if (!empty($keyword)) $kw_array[$keyword] = $url;
90
+ }
91
+
92
+ foreach ($kw_array as $name=>$url)
93
+ {
94
+ $name= preg_quote($name, '/');
95
+ if (!in_array( strtolower($name), $arrignore))
96
+ {
97
+
98
+ $regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
99
+ $replace="<a title=\"$1\" href=\"$url\">$1</a>";
100
+
101
+
102
+ if (!$maxlinks || ($links < $maxlinks))
103
+ {
104
+
105
+ $newtext = preg_replace($regexp, $replace, $text, $maxsingle);
106
+ if ($newtext!=$text) {
107
+ $links++;
108
+ $text=$newtext;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+
115
+ }
116
+
117
if ($options['lposts'] || $options['lpages'])
118
{
119
if ( !$posts = wp_cache_get( 'seo-links-posts', 'seo-smart-links' ) ) {
232
return $this->SEOLinks_process_text($text, 1);
233
}
234
235
+ function explode_trim($separator, $text)
236
{
237
$arr = explode($separator, $text);
238
243
}
244
return $ret;
245
}
246
+
247
+ // Handle our options
248
+ function get_options() {
249
+
250
+ $options = array(
251
+ 'post' => 'o',
252
+ 'postself' => '',
253
+ 'page' => 'on',
254
+ 'pageself' => '',
255
+ 'comment' => '',
256
+ 'lposts' => 'on',
257
+ 'lpages' => 'on',
258
+ 'lcats' => '',
259
+ 'ltags' => '',
260
+ 'ignore' => 'about,',
261
+ 'maxlinks' => 3,
262
+ 'maxsingle' => 1,
263
+ 'customkey' => '',
264
+ );
265
+
266
+ $saved = get_option($this->SEOLinks_DB_option);
267
+
268
+
269
+ if (!empty($saved)) {
270
+ foreach ($saved as $key => $option)
271
+ $options[$key] = $option;
272
+ }
273
+
274
+ if ($saved != $options)
275
+ update_option($this->SEOLinks_DB_option, $options);
276
+
277
+ return $options;
278
+
279
+ }
280
+
281
+
282
283
// Set up everything
284
function install() {
285
$SEOLinks_options = $this->get_options();
286
287
288
}
289
290
function handle_options()
291
{
292
293
+ $options = $this->get_options();
294
if ( isset($_POST['submitted']) ) {
295
+
296
297
$options['post']=$_POST['post'];
298
$options['postself']=$_POST['postself'];
304
$options['lcats']=$_POST['lcats'];
305
$options['ltags']=$_POST['ltags'];
306
$options['ignore']=$_POST['ignore'];
307
+ $options['maxlinks']=(int) $_POST['maxlinks'];
308
+ $options['maxsingle']=(int) $_POST['maxsingle'];
309
+ $options['customkey']=$_POST['customkey'];
310
311
312
316
}
317
318
319
+
320
321
$action_url = $_SERVER['REQUEST_URI'];
322
332
$ignore=$options['ignore'];
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
345
<div id="sideblock" style="float:right;width:220px;margin-left:10px;">
346
<h3>Information</h3>
347
<div id="dbx-content" style="text-decoration:none;">
348
+ <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 /><br />
349
+ <img src="$imgpath/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links#comments"> Suggest a Feature</a><br /><br />
350
+ <img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/seo-automatic-links/"> Rate SEO Smart Links</a><br /><br />
351
+ <img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
352
<br />
353
354
<p align="center">
355
<img src="$imgpath/p1.png"></p>
356
357
+ <p> <img src="$imgpath/idea.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></p>
358
</div>
359
</div>
360
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>
383
+ <input type="checkbox" name="ltags" $ltags /><label for="ltags"> Tags</label> <br>
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 />
393
+ vladimir prelovac, http://www.prelovac.com/vladimir
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"/>