SEO Friendly Images - Version 2.3

Version Description

Download this release

Release Info

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

Code changes from version 2.2 to 2.3

cafe.gif DELETED
Binary file
help.png → i/help.png RENAMED
File without changes
home.png → i/home.png RENAMED
File without changes
idea.png → i/idea.png RENAMED
File without changes
more.png → i/more.png RENAMED
File without changes
p1.png → i/p1.png RENAMED
File without changes
i/rate.png ADDED
Binary file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=92
4
  Tags: seo, images, Post, admin, google
5
  Requires at least: 2.0
6
  Tested up to: 2.5.1
7
- Stable tag: 2.2
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.
10
 
@@ -18,6 +18,9 @@ ALT attribute is important part of search engine optimization. It describes your
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
 
20
  Changes
 
 
 
21
  v2.2: Fixes an issue with poorly formatted img tag
22
 
23
  v2.0: Fixed compability issue with WordPress 2.5.1 and included %category replacement string.
4
  Tags: seo, images, Post, admin, google
5
  Requires at least: 2.0
6
  Tested up to: 2.5.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.
10
 
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
 
20
  Changes
21
+
22
+ v2.3: Fixes img formatting problem
23
+
24
  v2.2: Fixes an issue with poorly formatted img tag
25
 
26
  v2.0: Fixed compability issue with WordPress 2.5.1 and included %category replacement string.
seo-friendly-images.php CHANGED
@@ -4,7 +4,7 @@
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.2
8
  Author: Vladimir Prelovac
9
  Author URI: http://www.prelovac.com/vladimir
10
 
@@ -12,12 +12,12 @@ To-Do:
12
  - localization
13
 
14
 
15
- Copyright 2008 Vladimir Prelovac
16
 
17
  */
18
 
19
- $seo_friendly_images_localversion="2.2";
20
-
21
  function seo_friendly_images_add_pages()
22
  {
23
  add_options_page('SEO Friendly Images options', 'SEO Friendly Images', 8, __FILE__, 'seo_friendly_images_options_page');
@@ -43,7 +43,7 @@ function seo_friendly_images_options_page()
43
  }
44
 
45
  // If form was submitted
46
- if (isset($_POST['seo_friendly_images_update']))
47
  {
48
  $alt_text=(!isset($_POST['alttext'])? '': $_POST['alttext']);
49
  $title_text=(!isset($_POST['titletext'])? '': $_POST['titletext']);
@@ -58,84 +58,47 @@ function seo_friendly_images_options_page()
58
  _e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
59
 
60
  }
61
- else
62
- {
63
-
64
  // Fetch code from DB
65
  $alt_text = get_option('seo_friendly_images_alt');
66
  $title_text = get_option('seo_friendly_images_title');
67
- $override = get_option('seo_friendly_images_override');
68
 
69
- }
70
- global $wp_version;
71
- if(version_compare($wp_version,"2.5",">=")) {
72
- _e('
73
- <style type="text/css">
74
- .wrap {
75
- max-width:1000px !important;
76
- }
77
-
78
- div#moremeta {
79
- float:right;
80
- width:220px;
81
- margin-left:10px;
82
- }
83
- div#advancedstuff {
84
- width:770px;
85
- }
86
- div#poststuff {
87
- margin-top:10px;
88
- }
89
- fieldset.dbx-box {
90
- margin-bottom:5px;
91
- }
92
-
93
- </style>
94
- <!--[if lt IE 7]>
95
- <style type="text/css">
96
- div#advancedstuff {
97
- width:735px;
98
- }
99
- </style>
100
- <![endif]-->
101
-
102
- ');
103
- }
104
  // Configuration Page
105
- _e('
106
- <div class="wrap" id="options-div">
107
- <form name="form_seo_friendly_images" method="post" action="' . $_SERVER['REQUEST_URI'] . '">
108
- <h2>SEO Friendly Images '.$seo_friendly_images_localversion.'</h2>
109
- <div id="poststuff">
110
- <div id="moremeta">
111
- <div id="sidebarBlocks" class="dbx-group">
112
- <fieldset id="about" class="dbx-box">
113
- <h3 class="dbx-handle">Information</h3>
114
- <div id="dbx-content">
115
- <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-image/home.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/seo-image"> SEO Friendly Images Home</a><br /><br />
116
- <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-image/idea.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/seo-image#comments"> Suggest a Feature</a><br /><br />
117
- <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-image/more.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
 
 
118
  <br />
119
 
120
  <p align="center">
121
- <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-image/p1.png"></p>
122
-
123
- <p> <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/seo-image/help.png"><a href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></p>
124
- </div>
125
- </div>
126
- </div>
127
-
128
- <div id="advancedstuff">
129
- <div id="mainBlocks" class="dbx-group" >
130
- <div class="dbx-b-ox-wrapper">
131
- <fieldset id="block-description" class="dbx-box">
132
 
133
- <div class="dbx-h-andle-wrapper">
134
- <h3 class="dbx-handle">Options</h3>
135
  </div>
136
-
137
- <div class="dbx-c-ontent-wrapper">
138
- <div class="dbx-content">
 
 
 
 
 
 
139
  <p>SEO Friendly Images automatically adds alt and title attributes to all your images in all your posts specified by parameters below.</p>
140
  <p>You can enter any text in the field including two special tags:</p>
141
  <ul>
@@ -146,21 +109,21 @@ function seo_friendly_images_options_page()
146
 
147
 
148
 
149
- <p><strong>SEO Friendly Images options</strong></p>
150
 
151
 
152
  <div>
153
  <label for="alt_text"><b>ALT</b> attribute (example: %name %title)</label><br>
154
- <input style="border:1px solid #D1D1D1; width:165px;" id="alt_text" name="alttext" value="' .$alt_text.'"/>
155
  </div><br>
156
 
157
  <div>
158
  <label for="title_text"><b>TITLE</b> attribute (example: %name photo)</label><br>
159
- <input style="border:1px solid #D1D1D1; width:165px;" id="title_text" name="titletext" value="' .$title_text.'"/>
160
  </div>
161
 
162
  <br />
163
- <div><input id="check1" type="checkbox" name="override"' .($override=="on"?'CHECKED':'').'/>
164
  <label for="check1">Override default Wordpress alt (recommended)</label></div>
165
 
166
 
@@ -171,29 +134,18 @@ In a post titled Car Pictures there is a picture named Ferrari.jpg<br /><br />
171
  Setting alt attribute to "%name %title" will produce alt="Ferrari Car Pictures"<br />
172
  Setting title attribute to "%name photo" will produce title="Ferrari photo"</p>
173
 
 
 
 
 
 
 
174
 
175
- <p class="submit">
176
- <input type="submit" name="seo_friendly_images_update" value="Update Options &raquo;" />
177
- </p>
178
-
179
- </form>
180
-
181
-
182
-
183
-
184
-
185
- </div>
186
- </div>
187
-
188
- </fieldset>
189
-
190
- </div>
191
- </div>
192
- </div>
193
- <h4>plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h4>
194
  </div>
195
-
196
- ');
197
 
198
  }
199
 
@@ -209,13 +161,19 @@ function seo_friendly_images_process($matches) {
209
 
210
  global $post;
211
 
 
 
212
  $title = $post->post_title;
213
 
214
  $alttext_rep = get_option('seo_friendly_images_alt');
215
  $titletext_rep = get_option('seo_friendly_images_title');
216
  $override= get_option('seo_friendly_images_override');
217
-
218
- $matches=preg_replace('|"/$|', '" /', $matches);
 
 
 
 
219
  ### Normalize spacing around attributes.
220
  $matches[0] = preg_replace('/\s*=\s*/', '=', substr($matches[0],0,strlen($matches[0])-2));
221
  ### Get source.
@@ -238,6 +196,11 @@ function seo_friendly_images_process($matches) {
238
  $titletext_rep=str_replace('"', '', $titletext_rep);
239
  $titletext_rep=str_replace("'", "", $titletext_rep);
240
 
 
 
 
 
 
241
 
242
  array_push($pieces, ' title="' . $titletext_rep . '"');
243
  }
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.3
8
  Author: Vladimir Prelovac
9
  Author URI: http://www.prelovac.com/vladimir
10
 
12
  - localization
13
 
14
 
15
+ Copyright 2008 Vladimir Prelovac vprelovac@gmail.com
16
 
17
  */
18
 
19
+ $seo_friendly_images_localversion="2.3";
20
+ $sfi_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
21
  function seo_friendly_images_add_pages()
22
  {
23
  add_options_page('SEO Friendly Images options', 'SEO Friendly Images', 8, __FILE__, 'seo_friendly_images_options_page');
43
  }
44
 
45
  // If form was submitted
46
+ if (isset($_POST['submitted']))
47
  {
48
  $alt_text=(!isset($_POST['alttext'])? '': $_POST['alttext']);
49
  $title_text=(!isset($_POST['titletext'])? '': $_POST['titletext']);
58
  _e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
59
 
60
  }
61
+
 
 
62
  // Fetch code from DB
63
  $alt_text = get_option('seo_friendly_images_alt');
64
  $title_text = get_option('seo_friendly_images_title');
65
+ $override =( get_option('seo_friendly_images_override')=='on' ) ? "checked":"";
66
 
67
+ global $sfi_plugin_url;
68
+ $imgpath=$sfi_plugin_url.'/i';
69
+ $actionurl=$_SERVER['REQUEST_URI'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  // Configuration Page
71
+
72
+
73
+ echo <<<END
74
+ <div class="wrap" style="max-width:950px !important;">
75
+ <h2>SEO Friendly Images $seo_friendly_images_localversion</h2>
76
+
77
+ <div id="poststuff" style="margin-top:10px;">
78
+
79
+ <div id="sideblock" style="float:right;width:220px;margin-left:10px;">
80
+ <h3>Information</h3>
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/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins/seo-image#comments"> Suggest a Feature</a><br /><br />
84
+ <img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/seo-image/"> Rate SEO Friendly Images</a><br /><br />
85
+ <img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
86
  <br />
87
 
88
  <p align="center">
89
+ <img src="$imgpath/p1.png"></p>
 
 
 
 
 
 
 
 
 
 
90
 
91
+ <p> <img src="$imgpath/idea.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></p>
 
92
  </div>
93
+ </div>
94
+
95
+ <div id="mainblock" style="width:710px">
96
+
97
+ <div class="dbx-content">
98
+ <form name="sfiform" action="$action_url" method="post">
99
+ <input type="hidden" name="submitted" value="1" />
100
+ <h3>General Options</h3>
101
+
102
  <p>SEO Friendly Images automatically adds alt and title attributes to all your images in all your posts specified by parameters below.</p>
103
  <p>You can enter any text in the field including two special tags:</p>
104
  <ul>
109
 
110
 
111
 
112
+ <h4>Images options</h4>
113
 
114
 
115
  <div>
116
  <label for="alt_text"><b>ALT</b> attribute (example: %name %title)</label><br>
117
+ <input style="border:1px solid #D1D1D1; width:165px;" id="alt_text" name="alttext" value="$alt_text"/>
118
  </div><br>
119
 
120
  <div>
121
  <label for="title_text"><b>TITLE</b> attribute (example: %name photo)</label><br>
122
+ <input style="border:1px solid #D1D1D1; width:165px;" id="title_text" name="titletext" value="$title_text"/>
123
  </div>
124
 
125
  <br />
126
+ <div><input id="check1" type="checkbox" name="override" $override />
127
  <label for="check1">Override default Wordpress alt (recommended)</label></div>
128
 
129
 
134
  Setting alt attribute to "%name %title" will produce alt="Ferrari Car Pictures"<br />
135
  Setting title attribute to "%name photo" will produce title="Ferrari photo"</p>
136
 
137
+ <div class="submit"><input type="submit" name="Submit" value="Update options" /></div>
138
+ </form>
139
+ </div>
140
+
141
+ <br/><br/><h3>&nbsp;</h3>
142
+ </div>
143
 
144
+ </div>
145
+
146
+ <h5>WordPress plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  </div>
148
+ END;
 
149
 
150
  }
151
 
161
 
162
  global $post;
163
 
164
+ //$matches=' '.$matches.' ';
165
+
166
  $title = $post->post_title;
167
 
168
  $alttext_rep = get_option('seo_friendly_images_alt');
169
  $titletext_rep = get_option('seo_friendly_images_title');
170
  $override= get_option('seo_friendly_images_override');
171
+
172
+
173
+ $matches[0]=preg_replace('|"/$|', '" /', $matches[0]);
174
+ $matches[0]=preg_replace('|"$|', '" /', $matches[0]);
175
+ $matches[0]=preg_replace('|" $|', '" /', $matches[0]);
176
+
177
  ### Normalize spacing around attributes.
178
  $matches[0] = preg_replace('/\s*=\s*/', '=', substr($matches[0],0,strlen($matches[0])-2));
179
  ### Get source.
196
  $titletext_rep=str_replace('"', '', $titletext_rep);
197
  $titletext_rep=str_replace("'", "", $titletext_rep);
198
 
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
  }