Changeset 766157
- Timestamp:
- 09/03/2013 08:38:30 AM (12 years ago)
- Location:
- blogger-301-redirect
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
blogger-301-redirect/trunk/bloggerredirect.php
r764495 r766157 3 3 Plugin Name: Blogger 301 Redirect 4 4 Plugin URI: http://techxt.com/blogger-301-redirect-plugin-for-wordpress/ 5 Description: Redirect from blogger to wordpress 5 Description: Redirect from blogger to wordpress. Helps you keep your blog traffic and Pagerank after migration from Blogger to WordPress. 6 6 Author URI: http://techxt.com 7 7 Author: Sudipto Pratap Mahato 8 Version: 2.2 9 Requires at least: 3.0 10 Tested up to: 3.6 8 Version: 2.3 11 9 */ 12 10 … … 77 75 if($new_url == "") 78 76 { 79 $q = "SELECT guidFROM $wpdb->posts LEFT JOIN $wpdb->postmeta ".77 $q = "SELECT ID FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ". 80 78 "ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE ". 81 79 "$wpdb->postmeta.meta_key='blogger_permalink' AND ". 82 "$wpdb->postmeta.meta_value='$permalink[1]' ";80 "$wpdb->postmeta.meta_value='$permalink[1]' LIMIT 1"; 83 81 if($wpdb->get_var($q)) 84 82 { 85 $new_url = $wpdb->get_var($q);83 $new_url = get_permalink($wpdb->get_var($q)); 86 84 $stat1[0]=$stat1[0]+1; 87 85 } … … 92 90 $si = explode("/", $permalink[1]); 93 91 $si[3] = '%'.str_replace($vrs, "%", $si[3]).'%'; 94 $q="SELECT guid FROM $wpdb->posts WHERE year(`post_date`) = $si[1] and month(`post_date`) = $si[2] and `post_name` like '$si[3]' and `post_type` = 'post'";92 $q="SELECT ID FROM $wpdb->posts WHERE year(`post_date`) = $si[1] and month(`post_date`) = $si[2] and `post_name` like '$si[3]' and `post_type` = 'post' and `post_status` = 'publish' LIMIT 1"; 95 93 if($wpdb->get_var($q)) 96 94 { 97 $new_url = $wpdb->get_var($q);95 $new_url = get_permalink($wpdb->get_var($q)); 98 96 $stat1[0]=$stat1[0]+1; 99 97 } 98 } 99 if($new_url != "") 100 { 101 $new_url=str_replace("//","",$new_url); 102 $pos = strpos($new_url, "/"); 103 if ($pos !== false) 104 { 105 $new_url=site_url().str_replace( substr($new_url,0,$pos),"",$new_url); 106 } 100 107 } 101 108 if(get_option('home_re')=="checked" && $new_url == "") … … 129 136 <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Ftechxt&layout=standard&show_faces=false&width=450&action=like&font=verdana&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br />And if you are too generous then you can always <b>DONATE</b> by clicking the donation button.<br/>If you like the plugin then <b>write a review</b> of it pointing out the plus and minus points. 130 137 <p><b>Necessary steps before post migration from Blogger</b></p> 131 1. Set the Timezone (Setting > General > Timezone)<br/>2. Change the Permalinks Structure to Custom [ <b>/%year%/%monthnum%/%postname%.html</b>] <br/> (without brackets [] from Settings > Permalinks > Custom Structure)<br/>3. Import Posts using <a href="/wp-admin/admin.php?import=blogger">Blogger Import Plugin</a><br/> (Tools > Import > Blogger)138 1. Set the Timezone (Setting > General > Timezone)<br/>2. Change the Permalinks Structure to Custom [ <b>/%year%/%monthnum%/%postname%.html</b> ]<br/> (without brackets [ ] from Settings > Permalinks > Custom Structure)<br/> <i>(Note: Permalink change is recommended but not required. You can keep your own custom permalink structure)</i><br/>3. Import Posts using <a href="/wp-admin/admin.php?import=blogger">Blogger Import Plugin</a><br/> (Tools > Import > Blogger) 132 139 <form method="post" action="options.php"> 133 140 <?php wp_nonce_field('update-options'); ?> … … 140 147 </tr> 141 148 <tr valign="top"> 142 <td><input type="checkbox" name="adv_ser" value="checked" <?php echo get_option('adv_ser'); ?> />Activate Advance search<br />Rarely used but sometimes very useful if you migrated without using Blogger import plugin </td>149 <td><input type="checkbox" name="adv_ser" value="checked" <?php echo get_option('adv_ser'); ?> />Activate Advance search<br />Rarely used but sometimes very useful if you migrated without using Blogger import plugin. <br/>Only works if post publish dates and post titles are same on both blogs.</td> 143 150 </tr> 144 151 <tr valign="top"> … … 167 174 <div style="background: #6699FF; padding-left: 20px;"> 168 175 <h2> Method 1: Using New Blogger Template </h2> 169 <textarea onclick="this.select()" cols="80" rows="16" readonly="true" ><?xml version="1.0" encoding="UTF-8" ?>176 <textarea onclick="this.select()" cols="80" rows="16" readonly="true" style="width:95%"><?xml version="1.0" encoding="UTF-8" ?> 170 177 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 171 178 <html expr:dir='data:blog.languageDirection' lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr' xmlns:fb='http://ogp.me/ns/fb#' xmlns:og='http://ogp.me/ns#'> … … 174 181 <b:if cond='data:blog.pageType == "index"'> 175 182 <link rel='canonical' href='<?php echo site_url()."/"; ?>' /> 183 <meta content='0;url=<?php echo site_url()."/"; ?>' http-equiv='refresh'/> 176 184 <b:else/> 177 <link rel='canonical' expr:href='"<?php echo site_url()."/"; ?>?br=" + data:blog.url' /> 185 <link rel='canonical' expr:href='"<?php echo site_url()."/"; ?>?br=" + data:blog.url' /> 186 <meta expr:content='"0;url=<?php echo site_url()."/"; ?>?br=" + data:blog.url' http-equiv='refresh'/> 178 187 </b:if> 179 188 <script type='text/javascript'> … … 199 208 </b:section> 200 209 201 <div style='border:#ccc 1px solid; background:#eee; padding:20px; margin:80px;'>202 <p>This page has moved to a new address.</p>210 <div> 211 <p>This page has found a new home </p> 203 212 <a href='<?php echo site_url()."/"; ?>'><data:blog.title/></a> 204 213 <a expr:href='"<?php echo site_url()."/"; ?>br=" + data:blog.url' /> 205 214 </div> 206 <a href='http://techxt.com '>Blogger 301 Redirect Plugin</a>215 <a href='http://techxt.com/?'>Blogger 301 Redirect Plugin</a> 207 216 </body> 208 217 </html></textarea> … … 222 231 <h2> Method 2: Using Classic Template </h2> 223 232 The Template that you are required to copy to your Blogger blog<br /> 224 <textarea onclick="this.select()" cols="80" rows="16" readonly="true"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="<$BlogLanguageDirection$>"><head><title><$BlogPageTitle$></title><script type="text/javascript"><MainorArchivePage>window.location.href="<?php echo site_url()."/"; ?>"</MainOrArchivePage><Blogger><ItemPage>window.location.href="<?php echo site_url()."/"; ?>?br=<$BlogItemPermalinkURL$>"</ItemPage></Blogger></script><MainPage><link rel="canonical" href="<?php echo site_url()."/"; ?>" /></MainPage><Blogger><ItemPage><link rel="canonical" href="<?php echo site_url()."/"; ?>?br=<$BlogItemPermalinkURL$>" /></ItemPage></Blogger></head><body><div style="border: #ccc 1px solid; background: #eee; padding: 20px; margin: 80px;"><p>This page has moved to a new address.</p><h1><MainOrArchivePage><a href="<?php echo site_url()."/"; ?>"><$BlogTitle$></a></MainOrArchivePage><Blogger><ItemPage><a href="<?php echo site_url()."/"; ?>?br=<$BlogItemPermalinkURL$>"><$BlogItemTitle$></a></ItemPage></Blogger></h1></div><a href='http://techxt.com'>Blogger 301 Redirect Plugin</a></body></html></textarea> 233 <textarea onclick="this.select()" cols="80" rows="16" readonly="true" style="width:95%"> 234 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 235 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="<$BlogLanguageDirection$>"> 236 <head><title><$BlogPageTitle$></title> 237 <script type="text/javascript"> 238 <MainorArchivePage>window.location.href="<?php echo site_url()."/"; ?>"</MainOrArchivePage> 239 <Blogger><ItemPage>window.location.href="<?php echo site_url()."/"; ?>?br=<$BlogItemPermalinkURL$>"</ItemPage></Blogger> 240 </script> 241 <MainPage><link rel="canonical" href="<?php echo site_url()."/"; ?>" /></MainPage> 242 <Blogger><ItemPage><link rel="canonical" href="<?php echo site_url()."/"; ?>?br=<$BlogItemPermalinkURL$>" /></ItemPage></Blogger> 243 <MainorArchivePage><meta content='0;url=<?php echo site_url()."/"; ?>' http-equiv='refresh'/></MainOrArchivePage> 244 <Blogger><ItemPage><meta content='0;url=<?php echo site_url()."/"; ?>?br=<$BlogItemPermalinkURL$>' http-equiv='refresh'/></ItemPage></Blogger> 245 </head> 246 <body> 247 <div> 248 <p>This page has found a new home </p> 249 <h1><MainOrArchivePage><a href="<?php echo site_url()."/"; ?>"><$BlogTitle$></a></MainOrArchivePage> 250 <Blogger><ItemPage><a href="<?php echo site_url()."/"; ?>?br=<$BlogItemPermalinkURL$>"><$BlogItemTitle$></a></ItemPage></Blogger></h1> 251 </div> 252 <a href='http://techxt.com/?'>Blogger 301 Redirect Plugin</a> 253 </body></html> 254 </textarea> 225 255 226 256 <p><b>Where to copy the above Template</b></p> … … 254 284 <tr><td width="255"><p/><b>Total Hits </b></td><td><b><?php echo $stat1[0]+$stat1[1]+$stat1[2]+$stat1[3]+$stat1[4]+$stat1[5];?></b></td> 255 285 </tr><tr><td width="255"><a href="<?php echo site_url(); ?>/wp-admin/options-general.php?page=bloggerredirect&clearstat=true" onclick = "if (! confirm('Do you really want to clear all Stats?')) return false;">Clear All Statistics</a></td><td></td></tr></table> 256 </td><td width="2%"> </td><td width="20%">< b>Follow us on</b><br/><a href="http://twitter.com/techxt" target="_blank"><img src="http://a0.twimg.com/a/1303316982/images/twitter_logo_header.png" /></a><br/><a href="http://facebook.com/techxt" target="_blank"><img src="https://secure-media-sf2p.facebook.com/ads3/creative/pressroom/jpg/b_1234209334_facebook_logo.jpg" height="38px" width="118px"/></a><p></p><b>Feeds and News</b><br /><?php get_feeds() ?>286 </td><td width="2%"> </td><td width="20%"><a href="http://techxt.com/blogger301_ad" target="_blank"><img src="http://techxt.com/blogger301_ad.png" /></a><br/><b>Follow us on</b><br/><a href="http://twitter.com/techxt" target="_blank"><img src="http://a0.twimg.com/a/1303316982/images/twitter_logo_header.png" /></a><br/><a href="http://facebook.com/techxt" target="_blank"><img src="https://secure-media-sf2p.facebook.com/ads3/creative/pressroom/jpg/b_1234209334_facebook_logo.jpg" height="38px" width="118px"/></a><p></p><b>Feeds and News</b><br /><?php get_feeds() ?> 257 287 <p></p> 258 288 <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> -
blogger-301-redirect/trunk/readme.txt
r764495 r766157 5 5 Requires at least: 3.0 6 6 Tested up to: 3.6 7 Stable tag: 2. 27 Stable tag: 2.3 8 8 9 9 Useful for mapping your Blogger post and feeds to Wordpress posts and feeds after blogger to wordpress migration.
Note: See TracChangeset
for help on using the changeset viewer.