Version Description
Download this release
Release Info
Developer | freediver |
Plugin | SEO Smart Links |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 1.7
- readme.txt +3 -0
- seo-links.php +24 -23
readme.txt
CHANGED
@@ -21,6 +21,9 @@ Everything happens completely transparent, and you can edit the options from the
|
|
21 |
|
22 |
|
23 |
Change log
|
|
|
|
|
|
|
24 |
v1.6.4
|
25 |
- Fix in semantics
|
26 |
|
21 |
|
22 |
|
23 |
Change log
|
24 |
+
v1.7
|
25 |
+
- Performance optimization of the plugin. SEO Smart Links causes much lesser strain on the server.
|
26 |
+
|
27 |
v1.6.4
|
28 |
- Fix in semantics
|
29 |
|
seo-links.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
Plugin Name: SEO Smart Links
|
5 |
-
Version: 1.
|
6 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links
|
7 |
Author: Vladimir Prelovac
|
8 |
Author URI: http://www.prelovac.com
|
@@ -54,6 +54,7 @@ function SEOLinks_process_text($text, $mode)
|
|
54 |
//$wpdb->terms;
|
55 |
//$wpdb->term_taxonomy
|
56 |
|
|
|
57 |
if ($options['onlysingle'] && !(is_single() || is_page()))
|
58 |
return $text;
|
59 |
|
@@ -92,7 +93,7 @@ if (!empty($options['customkey']))
|
|
92 |
if (!empty($keyword)) $kw_array[$keyword] = $url;
|
93 |
}
|
94 |
|
95 |
-
|
96 |
{
|
97 |
$name= preg_quote($name, '/');
|
98 |
if (!in_array( strtolower($name), $arrignore))
|
@@ -102,9 +103,8 @@ if (!empty($options['customkey']))
|
|
102 |
$replace="<a title=\"$1\" href=\"$url\">$1</a>";
|
103 |
|
104 |
|
105 |
-
|
106 |
-
{
|
107 |
-
|
108 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
109 |
if ($newtext!=$text) {
|
110 |
$links++;
|
@@ -132,25 +132,22 @@ if ($options['lposts'] || $options['lpages'])
|
|
132 |
foreach ($posts as $postitem)
|
133 |
{
|
134 |
$name = preg_quote($postitem->post_title, '/');
|
|
|
135 |
|
136 |
if (!in_array( strtolower($name), $arrignore))
|
137 |
if ( ($options['lposts'] && $postitem->post_type=='post') || ($options['lpages'] && $postitem->post_type=='page') )
|
138 |
{
|
139 |
-
|
140 |
-
$url = (get_permalink($postitem->ID));
|
141 |
-
|
142 |
$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
|
143 |
-
$replace=
|
144 |
-
|
145 |
-
|
146 |
|
147 |
if (!$maxlinks || ($links < $maxlinks))
|
148 |
{
|
149 |
-
|
150 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
151 |
-
if ($newtext!=$text) {
|
|
|
152 |
$links++;
|
153 |
-
$text
|
154 |
}
|
155 |
}
|
156 |
}
|
@@ -171,26 +168,29 @@ if ($options['lcats'])
|
|
171 |
foreach ($categories as $cat)
|
172 |
{
|
173 |
$name= preg_quote($cat->name, '/');
|
|
|
|
|
174 |
if (!in_array( strtolower($name), $arrignore))
|
175 |
{
|
176 |
-
|
177 |
$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
|
178 |
-
$replace=
|
179 |
|
180 |
|
181 |
if (!$maxlinks || ($links < $maxlinks))
|
182 |
{
|
183 |
|
184 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
185 |
-
if ($newtext!=$text) {
|
|
|
|
|
186 |
$links++;
|
187 |
-
$text
|
188 |
}
|
189 |
}
|
190 |
}
|
191 |
}
|
192 |
}
|
193 |
-
|
194 |
if ($options['ltags'])
|
195 |
{
|
196 |
|
@@ -208,17 +208,18 @@ if ($options['ltags'])
|
|
208 |
$name = preg_quote($tag->name, '/');
|
209 |
if (!in_array( strtolower($name), $arrignore))
|
210 |
{
|
211 |
-
|
212 |
$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
|
213 |
-
$replace=
|
214 |
|
215 |
if (!$maxlinks || ($links < $maxlinks))
|
216 |
{
|
217 |
|
218 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
219 |
-
if ($newtext!=$text) {
|
|
|
220 |
$links++;
|
221 |
-
$text
|
222 |
}
|
223 |
}
|
224 |
|
2 |
|
3 |
/*
|
4 |
Plugin Name: SEO Smart Links
|
5 |
+
Version: 1.7
|
6 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links
|
7 |
Author: Vladimir Prelovac
|
8 |
Author URI: http://www.prelovac.com
|
54 |
//$wpdb->terms;
|
55 |
//$wpdb->term_taxonomy
|
56 |
|
57 |
+
|
58 |
if ($options['onlysingle'] && !(is_single() || is_page()))
|
59 |
return $text;
|
60 |
|
93 |
if (!empty($keyword)) $kw_array[$keyword] = $url;
|
94 |
}
|
95 |
|
96 |
+
foreach ($kw_array as $name=>$url)
|
97 |
{
|
98 |
$name= preg_quote($name, '/');
|
99 |
if (!in_array( strtolower($name), $arrignore))
|
103 |
$replace="<a title=\"$1\" href=\"$url\">$1</a>";
|
104 |
|
105 |
|
106 |
+
if (!$maxlinks || ($links < $maxlinks))
|
107 |
+
{
|
|
|
108 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
109 |
if ($newtext!=$text) {
|
110 |
$links++;
|
132 |
foreach ($posts as $postitem)
|
133 |
{
|
134 |
$name = preg_quote($postitem->post_title, '/');
|
135 |
+
|
136 |
|
137 |
if (!in_array( strtolower($name), $arrignore))
|
138 |
if ( ($options['lposts'] && $postitem->post_type=='post') || ($options['lpages'] && $postitem->post_type=='page') )
|
139 |
{
|
140 |
+
|
|
|
|
|
141 |
$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
|
142 |
+
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
|
|
|
|
143 |
|
144 |
if (!$maxlinks || ($links < $maxlinks))
|
145 |
{
|
|
|
146 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
147 |
+
if ($newtext!=$text) {
|
148 |
+
$url = get_permalink($postitem->ID);
|
149 |
$links++;
|
150 |
+
$text=str_replace('$$$url$$$', $url, $newtext);
|
151 |
}
|
152 |
}
|
153 |
}
|
168 |
foreach ($categories as $cat)
|
169 |
{
|
170 |
$name= preg_quote($cat->name, '/');
|
171 |
+
|
172 |
+
|
173 |
if (!in_array( strtolower($name), $arrignore))
|
174 |
{
|
175 |
+
|
176 |
$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
|
177 |
+
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
178 |
|
179 |
|
180 |
if (!$maxlinks || ($links < $maxlinks))
|
181 |
{
|
182 |
|
183 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
184 |
+
if ($newtext!=$text) {
|
185 |
+
|
186 |
+
$url = (get_category_link($cat->term_id));
|
187 |
$links++;
|
188 |
+
$text=str_replace('$$$url$$$', $url, $newtext);
|
189 |
}
|
190 |
}
|
191 |
}
|
192 |
}
|
193 |
}
|
|
|
194 |
if ($options['ltags'])
|
195 |
{
|
196 |
|
208 |
$name = preg_quote($tag->name, '/');
|
209 |
if (!in_array( strtolower($name), $arrignore))
|
210 |
{
|
211 |
+
|
212 |
$regexp="/(?!(?:[^<]+>|[^>]+<\/a>))\b($name)\b/imsU";
|
213 |
+
$replace='<a title="$1" href="$$$url$$$">$1</a>';
|
214 |
|
215 |
if (!$maxlinks || ($links < $maxlinks))
|
216 |
{
|
217 |
|
218 |
$newtext = preg_replace($regexp, $replace, $text, $maxsingle);
|
219 |
+
if ($newtext!=$text) {
|
220 |
+
$url = (get_tag_link($tag->term_id));
|
221 |
$links++;
|
222 |
+
$text=str_replace('$$$url$$$', $url, $newtext);
|
223 |
}
|
224 |
}
|
225 |
|