Velvet Blues Update URLs - Version 1.0

Version Description

Download this release

Release Info

Developer VelvetBlues.com
Plugin Icon wp plugin Velvet Blues Update URLs
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (3) hide show
  1. readme.txt +55 -0
  2. screenshot-1.png +0 -0
  3. velvet-blues-update-urls.php +92 -0
readme.txt ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Velvet Blues Update URLs ===
2
+ Contributors: Velvet Blues
3
+ Donate link: http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/
4
+ Tags: permalinks, urls, links, update links, move wordpress, location, update urls, update permalinks
5
+ Requires at least: 2.5
6
+ Tested up to: 2.6.2
7
+ Stable tag: 1.0
8
+
9
+ Updates all urls and content links in your website.
10
+
11
+ == Description ==
12
+
13
+ Updates all urls and content links in your website.
14
+
15
+ Features:
16
+
17
+ * Displays current WordPress url and installation location.
18
+ * Choose whether links embedded in content should be updated.
19
+
20
+ == Installation ==
21
+
22
+ The installation is extremely simple and straightforward. It only takes a second.
23
+
24
+ Installing:
25
+
26
+ 1. Download the package.
27
+
28
+ 2. Extract it to the "plugins" folder of your WordPress directory.
29
+
30
+ 3. In the Admin Panes, go to "Plugins" and activate it.
31
+
32
+ 4. Go to Settings -> Update URLs to use it.
33
+
34
+
35
+ Uninstalling:
36
+
37
+ 1. In the Admin Panes, go to "Plugins" and deactivate the plugin.
38
+
39
+ 2. Go to the "plugins" folder of your WordPress directory and delete the files/folder for this plugin.
40
+
41
+
42
+ == Frequently Asked Questions ==
43
+
44
+ = Where can I get support for the plugin? =
45
+
46
+ Get support for this plugin by going to [Velvet Blues Web Development Blog](http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/). Post all questions as comments.
47
+
48
+ == Usage ==
49
+
50
+ Using this plugin is very simple. Navigate to Settings -> Update and follow the instructions. You will need to enter your old and new urls. Upon submitting, all permalinks and links will be updated.
51
+
52
+
53
+ == Screenshots ==
54
+
55
+ 1. The Admin screen for the plugin.
screenshot-1.png ADDED
Binary file
velvet-blues-update-urls.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Velvet Blues Update URLs
4
+ Plugin URI: http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/
5
+ Description: This plugin updates all urls in your website by replacing the old urls with the new.
6
+ Author: Velvet Blues
7
+ Author URI: http://www.velvetblues.com/
8
+ Version: 1.0
9
+ */
10
+ /* Copyright 2008 Velvet Blues Web Design (email : info@velvetblues.com)
11
+
12
+ This program is free software; you can redistribute it and/or modify
13
+ it under the terms of the GNU General Public License as published by
14
+ the Free Software Foundation; either version 2 of the License, or
15
+ (at your option) any later version.
16
+
17
+ This program is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
+
22
+ You should have received a copy of the GNU General Public License
23
+ along with this program; if not, write to the Free Software
24
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
+ */
26
+
27
+ /* Functions for the options page */
28
+ function VBUU_add_options_page() {
29
+ add_options_page("Update URLs Setings", "Update Urls", "manage_options", __FILE__, "VBUU_options_page");
30
+ }
31
+ function VBUU_options_page() {
32
+
33
+ /* Function which updates urls */
34
+ function VB_update_urls($links,$oldurl,$newurl) {
35
+ global $wpdb;
36
+ //permalinks query
37
+ $permquery = "UPDATE $wpdb->posts SET guid = replace(guid, '".$oldurl."','".$newurl."')";
38
+ $result = $wpdb->query( $permquery );
39
+ if($links == 1){
40
+ //content query
41
+ $contquery = "UPDATE $wpdb->posts SET post_content = replace(post_content, '".$oldurl."','".$newurl."')";
42
+ $result = $wpdb->query( $contquery );
43
+ }
44
+ }
45
+ if( isset( $_POST['VBUU_settings_submit'] ) ) {
46
+
47
+ $vbuu_update_links = attribute_escape($_POST['VBUU_update_links']);
48
+ $vbuu_oldurl = attribute_escape($_POST['VBUU_oldurl']);
49
+ $vbuu_newurl = attribute_escape($_POST['VBUU_newurl']);
50
+ VB_update_urls($vbuu_update_links,$vbuu_oldurl,$vbuu_newurl);
51
+ echo '<div id="message" class="updated fade"><p><strong>URLs have been updated.</p></strong><p>You can now uninstall this plugin.</p></div>';
52
+ }
53
+ ?>
54
+ <div class="wrap">
55
+ <h2>Update URLs Settings</h2>
56
+ <form method="post" action="options-general.php?page=velvet-blues-update-urls/velvet-blues-update-urls.php">
57
+ <input type="hidden" id="_wpnonce" name="_wpnonce" value="abcab64052" />
58
+ <p>These settings let you update both your permalinks and any urls embedded in your content. It will replace all occurences of the old url with the new url.</p>
59
+ <p><b>Current Website Addresss:</b> <?php bloginfo('url'); ?></p>
60
+ <p><b>Current Installation Location:</b> <?php bloginfo('wpurl'); ?></p>
61
+ <p>If the settings above do not reflect the new location or domain, then you will need to <a href="options-general.php">update these settings</a> before or after you run this tool.</p>
62
+ <table class="form-table">
63
+ <tr>
64
+ <th scope="row" style="width:350px;">Update urls AND links in page or post content?</th>
65
+ <td>
66
+ <p><input name="VBUU_update_links" type="radio" id="VBUU_update_true" value="1" checked="checked" /> <label for="VBUU_update_true">Yes</label></p>
67
+ <p><input name="VBUU_update_links" type="radio" id="VBUU_update_false" value="0" /> <label for="VBUU_update_false">No, I only want to update the urls, and not any links.</label></p>
68
+ </td>
69
+
70
+ </tr>
71
+ <tr>
72
+ <th scope="row" style="width:300px;">Old URL</th>
73
+ <td>
74
+ <p>http://<input name="VBUU_oldurl" type="text" id="VBUU_oldurl" value="" style="width:300px;" />/</p>
75
+ </td>
76
+ </tr>
77
+ <tr>
78
+ <th scope="row" style="width:300px;">New URL</th>
79
+ <td>
80
+ <p>http://<input name="VBUU_newurl" type="text" id="VBUU_newurl" value="" style="width:300px;" />/</p>
81
+ </td>
82
+ </tr>
83
+ </table>
84
+ <p class="submit">
85
+ <input name="VBUU_settings_submit" value="Update URLs" type="submit" />
86
+ </p>
87
+ </form>
88
+ <?
89
+ }
90
+
91
+ add_action('admin_menu', 'VBUU_add_options_page');
92
+ ?>