SEO Friendly Images - Version 2.5

Version Description

  • Fixed bug that sometimes prevented overriding the ALT tag
  • Added support for %tags, replacing post tags (thanks Gerben Tiemens!)
Download this release

Release Info

Developer freediver
Plugin Icon 128x128 SEO Friendly Images
Version 2.5
Comparing to
See all releases

Code changes from version 2.4.4 to 2.5

Files changed (2) hide show
  1. readme.txt +8 -6
  2. seo-friendly-images.php +30 -28
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: freediver
3
  Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=920155875
4
  Tags: seo, images, Post, admin, google
5
- Requires at least: 2.0
6
- Tested up to: 2.8.4
7
  Stable tag: trunk
8
 
9
  SEO Friendly Images automatically adds alt and title attributes to all your images. Improves traffic from search results and makes the tags w3c/xHTML valid as well.
@@ -11,9 +11,9 @@ SEO Friendly Images automatically adds alt and title attributes to all your imag
11
  == Description ==
12
 
13
 
14
- SEO Friendly Images is a Wordpress optimization plugin which automatically updates all images with proper ALT and TITLE attributes. If your images do not have ALT and TITLE already set, SEO Friendly Images will add them according the options you set. Additionally this makes the post W3C/xHTML valid as well.
15
 
16
- ALT attribute is important part of search engine optimization. It describes your image to search engine and when a user searches for a certain image this is a key determining factor for a match.
17
 
18
  TITLE attribute play lesser role but is important for visitors as this text will automatically appear in the tooltip when mouse is over the image.
19
 
@@ -21,8 +21,10 @@ Plugin by Vladimir Prelovac. Need <a href="http://www.prelovac.com/vladimir/serv
21
 
22
  == Changelog ==
23
 
24
- = 2.4.4 =
25
- * Updates support to WP 2.8.4
 
 
26
 
27
  = 2.4.1 =
28
  * Alt tag replaces dashes and underscore
2
  Contributors: freediver
3
  Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=920155875
4
  Tags: seo, images, Post, admin, google
5
+ Requires at least: 2.5
6
+ Tested up to: 3.0.1
7
  Stable tag: trunk
8
 
9
  SEO Friendly Images automatically adds alt and title attributes to all your images. Improves traffic from search results and makes the tags w3c/xHTML valid as well.
11
  == Description ==
12
 
13
 
14
+ SEO Friendly Images is a Wordpress SEO plugin which automatically updates all images with proper ALT and TITLE attributes. If your images do not have ALT and TITLE already set, SEO Friendly Images will add them according the options you set. Additionally this makes the post W3C/xHTML valid as well.
15
 
16
+ ALT attribute is important part of search engine optimization. It describes your images to search engine and when a user searches for a certain image this is a key determining factor for a match.
17
 
18
  TITLE attribute play lesser role but is important for visitors as this text will automatically appear in the tooltip when mouse is over the image.
19
 
21
 
22
  == Changelog ==
23
 
24
+ = 2.5 =
25
+ * Fixed bug that sometimes prevented overriding the ALT tag
26
+ * Added support for %tags, replacing post tags (thanks Gerben Tiemens!)
27
+
28
 
29
  = 2.4.1 =
30
  * Alt tag replaces dashes and underscore
seo-friendly-images.php CHANGED
@@ -4,19 +4,20 @@
4
  Plugin Name: SEO Friendly Images
5
  Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-friendly-images
6
  Description: Automatically adds alt and title attributes to all your images. Improves traffic from search results and makes them W3C/xHTML valid as well.
7
- Version: 2.4.4
8
  Author: Vladimir Prelovac
9
  Author URI: http://www.prelovac.com/vladimir
10
 
11
  To-Do:
12
  - localization
 
13
 
14
 
15
  Copyright 2008 Vladimir Prelovac vprelovac@gmail.com
16
 
17
  */
18
 
19
- $seo_friendly_images_localversion="2.3.2";
20
  $sfi_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
21
  function seo_friendly_images_add_pages()
22
  {
@@ -71,23 +72,13 @@ function seo_friendly_images_options_page()
71
 
72
 
73
  echo <<<END
74
- <div class="wrap" style="max-width:950px !important;">
75
  <h2>SEO Friendly Images</h2>
76
 
77
  <div id="poststuff" style="margin-top:10px;">
78
 
79
- <div id="sideblock" style="float:right;width:220px;margin-left:10px;">
80
- <h2>Information</h2>
81
- <div id="dbx-content" style="text-decoration:none;">
82
- <img src="$imgpath/home.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins/seo-image"> SEO Friendly Images Home</a><br /><br />
83
- <img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/seo-image/"> Rate this plugin</a><br /><br />
84
- <img src="$imgpath/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/forum"> Support and Help</a><br />
85
- <p >
86
- <a style="text-decoration:none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2567254"><img src="$imgpath/paypal.gif"></a>
87
- </p><br />
88
- <img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> Cool WordPress Plugins</a><br /><br />
89
- <img src="$imgpath/twit.png"><a style="text-decoration:none;" href="http://twitter.com/vprelovac"> Follow updates on Twitter</a><br /><br />
90
- <img src="$imgpath/idea.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a>
91
  </div>
92
  </div>
93
 
@@ -104,6 +95,7 @@ function seo_friendly_images_options_page()
104
  <li>%title - replaces post title</li>
105
  <li>%name - replaces image file name (without extension)</li>
106
  <li>%category - replaces post category</li>
 
107
  </ul>
108
 
109
 
@@ -142,7 +134,7 @@ Setting title attribute to "%name photo" will produce title="Ferrari photo"</p>
142
 
143
  </div>
144
 
145
- <h5>a plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
146
  </div>
147
  END;
148
 
@@ -159,7 +151,7 @@ function remove_extension($name) {
159
  function seo_friendly_images_process($matches) {
160
 
161
  global $post;
162
-
163
 
164
  $title = $post->post_title;
165
 
@@ -186,11 +178,24 @@ function seo_friendly_images_process($matches) {
186
  $pieces = preg_split('/(\w+=)/', $matches[0], -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
187
  ### Add missing pieces.
188
 
189
- $cats=get_the_category();
 
 
 
 
 
 
 
 
 
 
 
 
190
  if (!in_array('title=', $pieces)) {
191
  $titletext_rep=str_replace("%title", $post->post_title, $titletext_rep);
192
  $titletext_rep=str_replace("%name", $source[0], $titletext_rep);
193
  $titletext_rep=str_replace("%category", $cats[0]->slug, $titletext_rep);
 
194
 
195
 
196
  $titletext_rep=str_replace('"', '', $titletext_rep);
@@ -199,36 +204,34 @@ function seo_friendly_images_process($matches) {
199
  $titletext_rep=str_replace("_", " ", $titletext_rep);
200
  $titletext_rep=str_replace("-", " ", $titletext_rep);
201
  //$titletext_rep=ucwords(strtolower($titletext_rep));
202
-
203
-
204
-
205
  array_push($pieces, ' title="' . $titletext_rep . '"');
206
  }
 
207
  if (!in_array('alt=', $pieces) ) {
208
  $alttext_rep=str_replace("%title", $post->post_title, $alttext_rep);
209
  $alttext_rep=str_replace("%name", $source[0], $alttext_rep);
210
  $alttext_rep=str_replace("%category", $cats[0]->slug, $alttext_rep);
211
-
212
  $alttext_rep=str_replace("\"", "", $alttext_rep);
213
  $alttext_rep=str_replace("'", "", $alttext_rep);
214
 
215
  $alttext_rep=(str_replace("-", " ", $alttext_rep));
216
  $alttext_rep=(str_replace("_", " ", $alttext_rep));
217
-
218
  array_push($pieces, ' alt="' . $alttext_rep . '"');
219
  }
220
  else
221
  {
222
 
223
  $key=array_search('alt=',$pieces);
 
224
 
225
- if ((trim($pieces[$key+1])=='""') || (strpos($saved, str_replace('"','',trim($pieces[$key+1]))) && $override=="on"))
226
  {
227
-
228
  $alttext_rep=str_replace("%title", $post->post_title, $alttext_rep);
229
  $alttext_rep=str_replace("%name", $source[0], $alttext_rep);
230
  $alttext_rep=str_replace("%category", $cats[0]->slug, $alttext_rep);
231
-
 
232
  $alttext_rep=str_replace("\"", "", $alttext_rep);
233
  $alttext_rep=str_replace("'", "", $alttext_rep);
234
 
@@ -240,7 +243,6 @@ function seo_friendly_images_process($matches) {
240
  }
241
  }
242
 
243
-
244
  return implode('', $pieces).' /';
245
  }
246
 
@@ -249,7 +251,7 @@ function seo_friendly_images($content) {
249
  }
250
 
251
 
252
- add_filter('the_content', 'seo_friendly_images', 50);
253
 
254
  add_action( 'after_plugin_row', 'seo_friendly_images_check_plugin_version' );
255
 
4
  Plugin Name: SEO Friendly Images
5
  Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-friendly-images
6
  Description: Automatically adds alt and title attributes to all your images. Improves traffic from search results and makes them W3C/xHTML valid as well.
7
+ Version: 2.5
8
  Author: Vladimir Prelovac
9
  Author URI: http://www.prelovac.com/vladimir
10
 
11
  To-Do:
12
  - localization
13
+ - integration module with google xml sitempas to support images sitemap
14
 
15
 
16
  Copyright 2008 Vladimir Prelovac vprelovac@gmail.com
17
 
18
  */
19
 
20
+ $seo_friendly_images_localversion="2.5";
21
  $sfi_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
22
  function seo_friendly_images_add_pages()
23
  {
72
 
73
 
74
  echo <<<END
75
+ <div class="wrap" >
76
  <h2>SEO Friendly Images</h2>
77
 
78
  <div id="poststuff" style="margin-top:10px;">
79
 
80
+ <div id="sideblock" style="float:right;width:270px;margin-left:10px;">
81
+ <iframe width=270 height=800 frameborder="0" src="http://www.prelovac.com/plugin/news.php?id=2&utm_source=plugin&utm_medium=plugin&utm_campaign=SEO%2BFriendly%2BImages"></iframe>
 
 
 
 
 
 
 
 
 
 
82
  </div>
83
  </div>
84
 
95
  <li>%title - replaces post title</li>
96
  <li>%name - replaces image file name (without extension)</li>
97
  <li>%category - replaces post category</li>
98
+ <li>%tags - replaces post tags</li>
99
  </ul>
100
 
101
 
134
 
135
  </div>
136
 
137
+ <h5>Another fine WordPress plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
138
  </div>
139
  END;
140
 
151
  function seo_friendly_images_process($matches) {
152
 
153
  global $post;
154
+
155
 
156
  $title = $post->post_title;
157
 
178
  $pieces = preg_split('/(\w+=)/', $matches[0], -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
179
  ### Add missing pieces.
180
 
181
+ $cats=get_the_category();
182
+
183
+ $posttags = get_the_tags();
184
+
185
+ $tags="";
186
+ if ($posttags) {
187
+ foreach($posttags as $tag) {
188
+ $tags = $tag->name . ' ' . $tags;
189
+ }
190
+ }
191
+
192
+
193
+
194
  if (!in_array('title=', $pieces)) {
195
  $titletext_rep=str_replace("%title", $post->post_title, $titletext_rep);
196
  $titletext_rep=str_replace("%name", $source[0], $titletext_rep);
197
  $titletext_rep=str_replace("%category", $cats[0]->slug, $titletext_rep);
198
+ $titletext_rep=str_replace("%tags", $tags, $titletext_rep);
199
 
200
 
201
  $titletext_rep=str_replace('"', '', $titletext_rep);
204
  $titletext_rep=str_replace("_", " ", $titletext_rep);
205
  $titletext_rep=str_replace("-", " ", $titletext_rep);
206
  //$titletext_rep=ucwords(strtolower($titletext_rep));
 
 
 
207
  array_push($pieces, ' title="' . $titletext_rep . '"');
208
  }
209
+
210
  if (!in_array('alt=', $pieces) ) {
211
  $alttext_rep=str_replace("%title", $post->post_title, $alttext_rep);
212
  $alttext_rep=str_replace("%name", $source[0], $alttext_rep);
213
  $alttext_rep=str_replace("%category", $cats[0]->slug, $alttext_rep);
214
+ $alttext_rep=str_replace("%tags", $tags, $alttext_rep);
215
  $alttext_rep=str_replace("\"", "", $alttext_rep);
216
  $alttext_rep=str_replace("'", "", $alttext_rep);
217
 
218
  $alttext_rep=(str_replace("-", " ", $alttext_rep));
219
  $alttext_rep=(str_replace("_", " ", $alttext_rep));
 
220
  array_push($pieces, ' alt="' . $alttext_rep . '"');
221
  }
222
  else
223
  {
224
 
225
  $key=array_search('alt=',$pieces);
226
+
227
 
228
+ if ($override=="on")
229
  {
 
230
  $alttext_rep=str_replace("%title", $post->post_title, $alttext_rep);
231
  $alttext_rep=str_replace("%name", $source[0], $alttext_rep);
232
  $alttext_rep=str_replace("%category", $cats[0]->slug, $alttext_rep);
233
+ $alttext_rep=str_replace("%tags", $tags, $alttext_rep);
234
+
235
  $alttext_rep=str_replace("\"", "", $alttext_rep);
236
  $alttext_rep=str_replace("'", "", $alttext_rep);
237
 
243
  }
244
  }
245
 
 
246
  return implode('', $pieces).' /';
247
  }
248
 
251
  }
252
 
253
 
254
+ add_filter('the_content', 'seo_friendly_images', 100);
255
 
256
  add_action( 'after_plugin_row', 'seo_friendly_images_check_plugin_version' );
257