Udinra All Image Sitemap - Version 1.1

Version Description

Download this release

Release Info

Developer Udinra
Plugin Icon 128x128 Udinra All Image Sitemap
Version 1.1
Comparing to
See all releases

Version 1.1

Files changed (2) hide show
  1. readme.txt +70 -0
  2. udinra-all-image-sitemap.php +170 -0
readme.txt ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: Udinra
3
+ Tags: xml sitemaps, google sitemaps, image sitemap, seo, search engines , wordpress image sitemap
4
+ Requires at least: 2.9.2
5
+ Tested up to: 3.2.1
6
+ Stable tag: 1.1
7
+
8
+ Automatically generate Image Sitemaps (XML) from all images after adding new images in post/page.
9
+
10
+ == Description ==
11
+
12
+ The plugin generates a XML Image Sitemap from the images used in your post excluding the images of advertising networks.The sitemap contains only your images.The images from advertising networks,affiliate programs are not part of sitemap.
13
+
14
+ New Feature in 1.1
15
+
16
+ 1.Automatically creates image sitemap if post/page is published.Only Image Sitemap with this feature.
17
+
18
+ 2.SEO enhanced image caption (available only in free version downloadable from http://udinra.com/blog/udinra-image-sitemap)
19
+
20
+ The sitemap contains all the important tags like
21
+
22
+ 1.image location (available in both versions downloadable from wordpress and Udinra)
23
+
24
+ 2.image caption (available only in free version downloadable from http://udinra.com/blog/udinra-image-sitemap)
25
+
26
+ 3.image title (available only in free version downloadable from http://udinra.com/blog/udinra-image-sitemap)
27
+
28
+ Thus increasing the chances of your image ranking high in search engine results.If you have not mentioned title of the image while using in post or pages the plugin uses your alt text for title else title mentioned by you is used.
29
+
30
+ Udinra is using this plugin to generate image sitemap.To see the sitemap use http://udinra.com/sitemap-image.xml
31
+
32
+ For updates, you can follow the [author] at (http://udinra.com/blog/udinra-image-sitemap).All information about the plugin will be updated on Wordpress as well as the link shared above.If you find any bugs then report it either on wordpress or on the link shared above.
33
+
34
+ == Installation ==
35
+
36
+ Here's how you can install the plugin:
37
+
38
+ 1. Upload the plugins folder to the /wp-content/plugins/ directory.
39
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
40
+ 3. Expand the Tools menu from WordPress dashboard sidebar and select "Udinra Image Sitemap."
41
+ 4. Create a blank file sitemap-image.xml with permission 666 in root directory.
42
+ 5. Click the "Generate Sitemap" button to create your XML Sitemap for Images.
43
+ 6. Once you have created your Sitemap, you can submit it to Google using Webmaster Tools.
44
+
45
+ == Frequently Asked Questions ==
46
+
47
+ = How can I submit my image sitemap to Google? =
48
+
49
+ Once you have created your Sitemap, you can submit it to Google using Webmaster Tools.
50
+
51
+ = Where's the sitemap file stored? =
52
+
53
+ You can find the sitemap-image.xml file in your blog's root folder.
54
+
55
+ = My sitemap is not getting created =
56
+
57
+ Please create sitemap-image.xml in your Wordpress installation root directory and set the permissions to 666.
58
+
59
+ == Screenshots ==
60
+
61
+ http://udinra.com/sitemap-image.xml
62
+
63
+ == Changelog ==
64
+
65
+ Version 1.1 on August 23rd 2011
66
+ Version 1.0 on August 17th 2011
67
+
68
+ == Upgrade Notice ==
69
+
70
+ Version 1.1 on August 23rd 2011
udinra-all-image-sitemap.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Udinra All Image Sitemap
4
+ Plugin URI: http://udinra.com/blog/udinra-image-sitemap
5
+ Description: The plugin generates a XML Image Sitemap from all the images in the post except the Advertisement images.
6
+ Author: Udinra
7
+ Version: 1.1
8
+ Author URI: http://udinra.com/
9
+ */
10
+
11
+ add_action ('admin_menu', 'udinra_all_image_sitemap');
12
+ add_action ('publish_post','udinra_image_sitemap_loop');
13
+ add_action ('publish_page','udinra_image_sitemap_loop');
14
+
15
+ function udinra_all_image_sitemap () {
16
+ if (function_exists ('add_submenu_page'))
17
+ add_submenu_page ('tools.php', __('Udinra Image Sitemap'), __('Udinra Image Sitemap'),
18
+ 'manage_options', 'image-sitemap-generate-page', 'image_sitemap_generate');
19
+ }
20
+
21
+ /**
22
+ * Checks if a file is writable.
23
+ *
24
+ * @since 3.05b
25
+ * @access private
26
+ * @author VJTD3 <http://www.VJTD3.com>
27
+ * @return bool true if writable
28
+ */
29
+ function IsImageSitemapWritable($filename) {
30
+ //can we write?
31
+ if(!is_writable($filename)) {
32
+ //no we can't.
33
+ return false;
34
+ }
35
+ //we can write, return 1/true/happy dance.
36
+ return true;
37
+ }
38
+
39
+ function image_sitemap_generate () {
40
+
41
+ if ($_POST ['submit']) {
42
+ $st = udinra_image_sitemap_loop ();
43
+ if (!$st) {
44
+ echo '<br /><div class="error"><h2>Oops!</h2><p>The XML sitemap was generated successfully but the plugin was unable to save the xml to your WordPress root folder at <strong>' . $_SERVER["DOCUMENT_ROOT"] . '</strong>.</p><p>Please create a blank file sitemap-image.xml with write permissions 666 in the root directory of your wordpress installation or Ping Google';
45
+ exit();
46
+ }
47
+
48
+ ?>
49
+
50
+ <div class="wrap">
51
+ <h2>Udinra Image Sitemap</h2>
52
+ <?php $sitemapurl = get_bloginfo('url') . "/sitemap-image.xml"; ?>
53
+ <p>The XML Sitemap was generated successfully. Please open the <a target="_blank" href="<?php echo $sitemapurl; ?>">Sitemap file</a> in your favorite web browser to confirm that there are no errors.</p>
54
+ <p>You can submit your Image XML Sitemap through <a href="http://www.google.com/webmasters/tools/" target="_blank">Webmaster Tools</a> or you can directly <a target="_blank" href="http://www.google.com/webmasters/sitemaps/ping?sitemap=<?php echo $sitemapurl; ?>">ping Google</a>.</p>
55
+ <h3>Suggestions?</h3>
56
+ <p>Please email your suggestions to Udinra at pitaji@udinra.com.</p>
57
+ <p>Are You Making Money With Your Images then Donate Us a small share.</p>
58
+ <p>
59
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
60
+ <input type="hidden" name="business" value="pitaji@udinra.com">
61
+ <input type="hidden" name="cmd" value="_donations">
62
+ <input type="hidden" name="item_name" value="udinra">
63
+ <input type="hidden" name="item_number" value="Udinra Image Sitemap plugin">
64
+ <input type="hidden" name="currency_code" value="USD">
65
+ <input type="image" name="submit" border="0"
66
+ src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif"
67
+ alt="PayPal - The safer, easier way to pay online">
68
+ <img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
69
+ </form>
70
+ </p>
71
+ <?php } else { ?>
72
+ <div class="wrap">
73
+ <h2>Udinra Image Sitemap</h2>
74
+ <p>Creating image sitemap will allow search engines find your images and increases traffic.</p>
75
+ <h4>Create blank file sitemap-image.xml in the root directory of your Wordpress installation.</h4>
76
+ <h3>Create Image Sitemap</h3>
77
+ <form id="options_form" method="post" action="">
78
+ <div class="submit">
79
+ <input type="submit" name="submit" id="sb_submit" value="Generate Image Sitemap" />
80
+ </div>
81
+ </form>
82
+ <p>You can click the button above to generate a Image Sitemap for your website. Once you have created your Sitemap, you should submit it to Google using Webmaster Tools. </p>
83
+ <h3>Suggestions?</h3>
84
+ <p>Please email your suggestions to Udinra at pitaji@udinra.com.</p>
85
+ <p>Are You Making Money With Your Images then Donate Us a small share.</p>
86
+ <p>
87
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
88
+ <input type="hidden" name="business" value="pitaji@udinra.com">
89
+ <input type="hidden" name="cmd" value="_donations">
90
+ <input type="hidden" name="item_name" value="udinra">
91
+ <input type="hidden" name="item_number" value="Udinra Image Sitemap plugin">
92
+ <input type="hidden" name="currency_code" value="USD">
93
+ <input type="image" name="submit" border="0"
94
+ src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif"
95
+ alt="PayPal - The safer, easier way to pay online">
96
+ <img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
97
+ </form>
98
+ </p>
99
+ </div>
100
+ <?php }
101
+ }
102
+
103
+ function udinra_image_sitemap_loop () {
104
+ global $wpdb;
105
+
106
+ $posts = $wpdb->get_results ("SELECT id, post_content FROM $wpdb->posts
107
+ WHERE post_status = 'publish'
108
+ AND (post_type = 'post' OR post_type = 'page')
109
+ ORDER BY post_date DESC");
110
+
111
+ if (empty ($posts)) {
112
+ return false;
113
+
114
+ } else {
115
+ $xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
116
+ $xml .= '<!-- Generated-by = Udinra Image Sitemap (http://udinra.com) -->' . "\n";
117
+ $xml .= '<!-- Generated-on="' . date("F j, Y, g:i a") .'" -->' . "\n";
118
+ $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">' . "\n";
119
+ $tempurl = get_bloginfo('url');
120
+ $tempurl = substr($tempurl,8);
121
+
122
+ foreach ($posts as $post) {
123
+ if (preg_match_all ("/src=[\'\"](http:\/\/.[^\'\"]+\.(?:jpe?g|png|gif))[\'\"]/ui",
124
+ $post->post_content, $matches, PREG_SET_ORDER)) {
125
+ $i = 1;$k=1;
126
+ $permalink = get_permalink($post->id);
127
+ $xml .= "<url>\n";
128
+ $xml .= " <loc>$permalink</loc>\n";
129
+ $ret_code = preg_match_all ("/alt=[\'\"](.*?)[\'\"]/ui",
130
+ $post->post_content, $matches1, PREG_SET_ORDER);
131
+ $ret_code = preg_match_all ("/title=[\'\"](.*?)[\'\"]/ui",
132
+ $post->post_content, $matches2, PREG_SET_ORDER);
133
+
134
+ foreach ($matches as $match) {
135
+ $loc[$i] = $match[1]; $i = $i + 1;}
136
+ $i = 1;
137
+ foreach ($matches1 as $match1) {
138
+ $loc1[$i] = $match1[1]; $i = $i + 1;}
139
+ $i = 1;
140
+ foreach ($matches2 as $match2) {
141
+ if($match2[1] == ""){
142
+ $match2[1] = $loc1[$i];
143
+ }
144
+ $loc2[$i] = $match2[1]; $i = $i + 1;}
145
+
146
+ while($k < $i) {
147
+ $temp_cmp = $loc[$k];
148
+ if(strpos($temp_cmp,$tempurl)){
149
+ $loc1_temp = str_replace(" ","-",$loc1[$k]);
150
+ $xml .= " <image:image>\n";
151
+ $xml .= " <image:loc>$loc[$k]</image:loc>\n";
152
+ // $xml .= " <image:caption>$loc1_temp</image:caption>\n";
153
+ // $xml .= " <image:title>$loc2[$k]</image:title>\n";
154
+ $xml .= " </image:image>\n";}
155
+ $k = $k + 1; }
156
+ $xml .= "</url>\n";}
157
+ }
158
+
159
+ $xml .= "</urlset>";
160
+ }
161
+
162
+ $image_sitemap_url = $_SERVER["DOCUMENT_ROOT"] . '/sitemap-image.xml';
163
+ if (IsImageSitemapWritable($_SERVER["DOCUMENT_ROOT"]) || IsImageSitemapWritable($image_sitemap_url)) {
164
+ if (file_put_contents ($image_sitemap_url, $xml)) {
165
+ return true;
166
+ }
167
+ }
168
+ return false;
169
+ }
170
+ ?>