Version Description
- Added feature to generate only one link per target url (credits Arjun Sandhu http://www.arjunsandhu.com/)
Download this release
Release Info
Developer | freediver |
Plugin | SEO Smart Links |
Version | 2.6 |
Comparing to | |
See all releases |
Code changes from version 2.5.2 to 2.6
- readme.txt +3 -0
- seo-links.php +40 -17
readme.txt
CHANGED
@@ -25,6 +25,9 @@ Plugin by Vladimir Prelovac a <a href="http://www.prelovac.com/vladimir/services
|
|
25 |
|
26 |
== Changelog ==
|
27 |
|
|
|
|
|
|
|
28 |
= 2.5.2 =
|
29 |
* Added Prevent duplicate links for custom keywords options (credits Adrian Ramiro)
|
30 |
|
25 |
|
26 |
== Changelog ==
|
27 |
|
28 |
+
= 2.6 =
|
29 |
+
* Added feature to generate only one link *per target url* (credits Arjun Sandhu http://www.arjunsandhu.com/)
|
30 |
+
|
31 |
= 2.5.2 =
|
32 |
* Added Prevent duplicate links for custom keywords options (credits Adrian Ramiro)
|
33 |
|
seo-links.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
Plugin Name: SEO Smart Links
|
5 |
-
Version: 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
|
@@ -12,6 +12,8 @@ Description: SEO Smart Links provides automatic SEO benefits for your site in ad
|
|
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') ) :
|
@@ -86,7 +88,10 @@ function SEOLinks_process_text($text, $mode)
|
|
86 |
|
87 |
$maxlinks=($options['maxlinks']>0) ? $options['maxlinks'] : 0;
|
88 |
$maxsingle=($options['maxsingle']>0) ? $options['maxsingle'] : -1;
|
|
|
89 |
$minusage = ($options['minusage']>0) ? $options['minusage'] : 1;
|
|
|
|
|
90 |
|
91 |
$arrignore=$this->explode_trim(",", ($options['ignore']));
|
92 |
if ($options['excludeheading'] == "on") {
|
@@ -150,8 +155,8 @@ function SEOLinks_process_text($text, $mode)
|
|
150 |
|
151 |
foreach ($kw_array as $name=>$url)
|
152 |
{
|
153 |
-
|
154 |
-
if ((!$maxlinks || ($links < $maxlinks)) && (trailingslashit($url)!=$thisurl) && !in_array( $options['casesens'] ? $name : strtolower($name), $arrignore))
|
155 |
{
|
156 |
if (($options['customkey_preventduplicatelink'] == TRUE) || $strpos_fnc($text, $name) !== false) { // credit to Dominik Deobald -- TODO: change string search for preg_match
|
157 |
$name= preg_quote($name, '/');
|
@@ -165,6 +170,7 @@ function SEOLinks_process_text($text, $mode)
|
|
165 |
if ($newtext!=$text) {
|
166 |
$links++;
|
167 |
$text=$newtext;
|
|
|
168 |
}
|
169 |
}
|
170 |
}
|
@@ -186,7 +192,8 @@ function SEOLinks_process_text($text, $mode)
|
|
186 |
foreach ($posts as $postitem)
|
187 |
{
|
188 |
if ((($options['lposts'] && $postitem->post_type=='post') || ($options['lpages'] && $postitem->post_type=='page')) &&
|
189 |
-
(!$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))
|
|
|
190 |
{
|
191 |
if ($strpos_fnc($text, $postitem->post_title) !== false) { // credit to Dominik Deobald
|
192 |
$name = preg_quote($postitem->post_title, '/');
|
@@ -198,9 +205,13 @@ function SEOLinks_process_text($text, $mode)
|
|
198 |
|
199 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
200 |
if ($newtext!=$text) {
|
201 |
-
$url = get_permalink($postitem->ID);
|
202 |
-
|
203 |
-
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
}
|
206 |
}
|
@@ -220,7 +231,7 @@ function SEOLinks_process_text($text, $mode)
|
|
220 |
|
221 |
foreach ($categories as $cat)
|
222 |
{
|
223 |
-
if ((!$maxlinks || ($links < $maxlinks)) && !in_array( $options['casesens'] ? $cat->name : strtolower($cat->name), $arrignore)
|
224 |
{
|
225 |
if ($strpos_fnc($text, $cat->name) !== false) { // credit to Dominik Deobald
|
226 |
$name= preg_quote($cat->name, '/');
|
@@ -229,9 +240,13 @@ function SEOLinks_process_text($text, $mode)
|
|
229 |
|
230 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
231 |
if ($newtext!=$text) {
|
232 |
-
$url = (get_category_link($cat->term_id));
|
233 |
-
$
|
234 |
-
|
|
|
|
|
|
|
|
|
235 |
}
|
236 |
}
|
237 |
}
|
@@ -261,8 +276,12 @@ function SEOLinks_process_text($text, $mode)
|
|
261 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
262 |
if ($newtext!=$text) {
|
263 |
$url = (get_tag_link($tag->term_id));
|
264 |
-
$
|
265 |
-
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
}
|
268 |
}
|
@@ -349,8 +368,8 @@ function SEOLinks_comment_text_filter($text) {
|
|
349 |
'blanko' =>'',
|
350 |
'onlysingle' => 'on',
|
351 |
'casesens' =>'',
|
352 |
-
'allowfeed' => ''
|
353 |
-
|
354 |
);
|
355 |
|
356 |
$saved = get_option($this->SEOLinks_DB_option);
|
@@ -399,6 +418,7 @@ function SEOLinks_comment_text_filter($text) {
|
|
399 |
$options['ignorepost']=$_POST['ignorepost'];
|
400 |
$options['maxlinks']=(int) $_POST['maxlinks'];
|
401 |
$options['maxsingle']=(int) $_POST['maxsingle'];
|
|
|
402 |
$options['minusage']=(int) $_POST['minusage']; // credit to Dominik Deobald
|
403 |
$options['customkey']=$_POST['customkey'];
|
404 |
$options['customkey_preventduplicatelink']=$_POST['customkey_preventduplicatelink'];
|
@@ -435,6 +455,7 @@ function SEOLinks_comment_text_filter($text) {
|
|
435 |
$ignorepost=$options['ignorepost'];
|
436 |
$maxlinks=$options['maxlinks'];
|
437 |
$maxsingle=$options['maxsingle'];
|
|
|
438 |
$minusage=$options['minusage'];
|
439 |
$customkey=stripslashes($options['customkey']);
|
440 |
$customkey_preventduplicatelink=$options['customkey_preventduplicatelink'] == TRUE ? 'checked' : '';
|
@@ -541,10 +562,12 @@ function SEOLinks_comment_text_filter($text) {
|
|
541 |
<br><br>
|
542 |
|
543 |
<h4>Limits</h4>
|
544 |
-
<p>You can limit the maximum number of links SEO Smart Links will generate per post. Set to 0 for no limit. </p>
|
545 |
Max Links: <input type="text" name="maxlinks" size="2" value="$maxlinks"/>
|
546 |
<p>You can also limit maximum number of links created with the same keyword. Set to 0 for no limit. </p>
|
547 |
-
Max Single: <input type="text" name="maxsingle" size="2" value="$maxsingle"/>
|
|
|
|
|
548 |
<br><br>
|
549 |
|
550 |
<h4>External Links</h4>
|
2 |
|
3 |
/*
|
4 |
Plugin Name: SEO Smart Links
|
5 |
+
Version: 2.6
|
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
|
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 |
+
//"Would it be possible to add an option for posts to link only within their respective categories? ..."
|
16 |
+
//Chad is right, that for maximum SEO benefit, the links need to be created within a particular category to make sure they don't destroy the 'Silo Structure' of the blog. In SEO terms, only links within the same category or to the 'top level' page of another category are 'allowed'.
|
17 |
|
18 |
// Avoid name collisions.
|
19 |
if ( !class_exists('SEOLinks') ) :
|
88 |
|
89 |
$maxlinks=($options['maxlinks']>0) ? $options['maxlinks'] : 0;
|
90 |
$maxsingle=($options['maxsingle']>0) ? $options['maxsingle'] : -1;
|
91 |
+
$maxsingleurl=($options['maxsingleurl']>0) ? $options['maxsingleurl'] : 0;
|
92 |
$minusage = ($options['minusage']>0) ? $options['minusage'] : 1;
|
93 |
+
|
94 |
+
$urls = array();
|
95 |
|
96 |
$arrignore=$this->explode_trim(",", ($options['ignore']));
|
97 |
if ($options['excludeheading'] == "on") {
|
155 |
|
156 |
foreach ($kw_array as $name=>$url)
|
157 |
{
|
158 |
+
|
159 |
+
if ((!$maxlinks || ($links < $maxlinks)) && (trailingslashit($url)!=$thisurl) && !in_array( $options['casesens'] ? $name : strtolower($name), $arrignore) && (!$maxsingleurl || $urls[$url]<$maxsingleurl) )
|
160 |
{
|
161 |
if (($options['customkey_preventduplicatelink'] == TRUE) || $strpos_fnc($text, $name) !== false) { // credit to Dominik Deobald -- TODO: change string search for preg_match
|
162 |
$name= preg_quote($name, '/');
|
170 |
if ($newtext!=$text) {
|
171 |
$links++;
|
172 |
$text=$newtext;
|
173 |
+
if (!isset($urls[$url])) $urls[$url]=1; else $urls[$url]++;
|
174 |
}
|
175 |
}
|
176 |
}
|
192 |
foreach ($posts as $postitem)
|
193 |
{
|
194 |
if ((($options['lposts'] && $postitem->post_type=='post') || ($options['lpages'] && $postitem->post_type=='page')) &&
|
195 |
+
(!$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))
|
196 |
+
)
|
197 |
{
|
198 |
if ($strpos_fnc($text, $postitem->post_title) !== false) { // credit to Dominik Deobald
|
199 |
$name = preg_quote($postitem->post_title, '/');
|
205 |
|
206 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
207 |
if ($newtext!=$text) {
|
208 |
+
$url = get_permalink($postitem->ID);
|
209 |
+
if (!$maxsingleurl || $urls[$url]<$maxsingleurl)
|
210 |
+
{
|
211 |
+
$links++;
|
212 |
+
$text=str_replace('$$$url$$$', $url, $newtext);
|
213 |
+
if (!isset($urls[$url])) $urls[$url]=1; else $urls[$url]++;
|
214 |
+
}
|
215 |
}
|
216 |
}
|
217 |
}
|
231 |
|
232 |
foreach ($categories as $cat)
|
233 |
{
|
234 |
+
if ((!$maxlinks || ($links < $maxlinks)) && !in_array( $options['casesens'] ? $cat->name : strtolower($cat->name), $arrignore) )
|
235 |
{
|
236 |
if ($strpos_fnc($text, $cat->name) !== false) { // credit to Dominik Deobald
|
237 |
$name= preg_quote($cat->name, '/');
|
240 |
|
241 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
242 |
if ($newtext!=$text) {
|
243 |
+
$url = (get_category_link($cat->term_id));
|
244 |
+
if (!$maxsingleurl || $urls[$url]<$maxsingleurl)
|
245 |
+
{
|
246 |
+
$links++;
|
247 |
+
$text=str_replace('$$$url$$$', $url, $newtext);
|
248 |
+
if (!isset($urls[$url])) $urls[$url]=1; else $urls[$url]++;
|
249 |
+
}
|
250 |
}
|
251 |
}
|
252 |
}
|
276 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
277 |
if ($newtext!=$text) {
|
278 |
$url = (get_tag_link($tag->term_id));
|
279 |
+
if (!$maxsingleurl || $urls[$url]<$maxsingleurl)
|
280 |
+
{
|
281 |
+
$links++;
|
282 |
+
$text=str_replace('$$$url$$$', $url, $newtext);
|
283 |
+
if (!isset($urls[$url])) $urls[$url]=1; else $urls[$url]++;
|
284 |
+
}
|
285 |
}
|
286 |
}
|
287 |
}
|
368 |
'blanko' =>'',
|
369 |
'onlysingle' => 'on',
|
370 |
'casesens' =>'',
|
371 |
+
'allowfeed' => '',
|
372 |
+
'maxsingleurl' => '1'
|
373 |
);
|
374 |
|
375 |
$saved = get_option($this->SEOLinks_DB_option);
|
418 |
$options['ignorepost']=$_POST['ignorepost'];
|
419 |
$options['maxlinks']=(int) $_POST['maxlinks'];
|
420 |
$options['maxsingle']=(int) $_POST['maxsingle'];
|
421 |
+
$options['maxsingleurl']=(int) $_POST['maxsingleurl'];
|
422 |
$options['minusage']=(int) $_POST['minusage']; // credit to Dominik Deobald
|
423 |
$options['customkey']=$_POST['customkey'];
|
424 |
$options['customkey_preventduplicatelink']=$_POST['customkey_preventduplicatelink'];
|
455 |
$ignorepost=$options['ignorepost'];
|
456 |
$maxlinks=$options['maxlinks'];
|
457 |
$maxsingle=$options['maxsingle'];
|
458 |
+
$maxsingleurl=$options['maxsingleurl'];
|
459 |
$minusage=$options['minusage'];
|
460 |
$customkey=stripslashes($options['customkey']);
|
461 |
$customkey_preventduplicatelink=$options['customkey_preventduplicatelink'] == TRUE ? 'checked' : '';
|
562 |
<br><br>
|
563 |
|
564 |
<h4>Limits</h4>
|
565 |
+
<p>You can limit the maximum number of different links SEO Smart Links will generate per post. Set to 0 for no limit. </p>
|
566 |
Max Links: <input type="text" name="maxlinks" size="2" value="$maxlinks"/>
|
567 |
<p>You can also limit maximum number of links created with the same keyword. Set to 0 for no limit. </p>
|
568 |
+
Max Single: <input type="text" name="maxsingle" size="2" value="$maxsingle"/>
|
569 |
+
<p>Limit number of same URLs the plugin will link to. Works only when Max Single above is set to 1. Set to 0 for no limit. </p>
|
570 |
+
Max Single URLs: <input type="text" name="maxsingleurl" size="2" value="$maxsingleurl"/>
|
571 |
<br><br>
|
572 |
|
573 |
<h4>External Links</h4>
|