Version Description
- Confirmed compatibility with WordPress 4.3.x releases.
- Updated readme file.
- Wrapped plugin functions in conditional statement to avoid issues with 3rd Party themes that include our functionality.
Download this release
Release Info
Developer | VelvetBlues.com |
Plugin | ![]() |
Version | 3.2.4 |
Comparing to | |
See all releases |
Code changes from version 3.2.3 to 3.2.4
- readme.txt +7 -2
- velvet-blues-update-urls.php +65 -61
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: VelvetBlues.com
|
|
3 |
Donate link: http://www.velvetblues.com/go/updateurlsdonate/
|
4 |
Tags: permalinks, urls, links, update links, move wordpress, location, update urls, update permalinks, move, link, url, permalink, excerpt, content links, excerpt links, custom field links, meta, post meta
|
5 |
Requires at least: 2.5
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 3.2.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Updates all urls and content links in your website.
|
@@ -74,6 +74,11 @@ Get support for this plugin by going to the [Velvet Blues Update URLs plugin pag
|
|
74 |
|
75 |
== Change Log ==
|
76 |
|
|
|
|
|
|
|
|
|
|
|
77 |
= 3.2.3 =
|
78 |
* Confirmed compatibility with WordPress 4.0.x releases.
|
79 |
* Updated readme file.
|
3 |
Donate link: http://www.velvetblues.com/go/updateurlsdonate/
|
4 |
Tags: permalinks, urls, links, update links, move wordpress, location, update urls, update permalinks, move, link, url, permalink, excerpt, content links, excerpt links, custom field links, meta, post meta
|
5 |
Requires at least: 2.5
|
6 |
+
Tested up to: 4.3
|
7 |
+
Stable tag: 3.2.4
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Updates all urls and content links in your website.
|
74 |
|
75 |
== Change Log ==
|
76 |
|
77 |
+
= 3.2.4 =
|
78 |
+
* Confirmed compatibility with WordPress 4.3.x releases.
|
79 |
+
* Updated readme file.
|
80 |
+
* Wrapped plugin functions in conditional statement to avoid issues with 3rd Party themes that include our functionality.
|
81 |
+
|
82 |
= 3.2.3 =
|
83 |
* Confirmed compatibility with WordPress 4.0.x releases.
|
84 |
* Updated readme file.
|
velvet-blues-update-urls.php
CHANGED
@@ -6,11 +6,11 @@ Description: This plugin <strong>updates all urls in your website</strong> by re
|
|
6 |
Author: VelvetBlues.com
|
7 |
Author URI: http://www.velvetblues.com/
|
8 |
Author Email: info@velvetblues.com
|
9 |
-
Version: 3.2.
|
10 |
License: GPLv2 or later
|
11 |
Text Domain: velvet-blues-update-urls
|
12 |
*/
|
13 |
-
/* Copyright
|
14 |
|
15 |
This program is free software; you can redistribute it and/or
|
16 |
modify it under the terms of the GNU General Public License
|
@@ -41,75 +41,79 @@ function VelvetBluesUU_load_textdomain(){
|
|
41 |
load_plugin_textdomain( 'velvet-blues-update-urls', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
42 |
}
|
43 |
function VelvetBluesUU_management_page(){
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
$
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
for( $page = 0; $page < $pages; $page++ ) {
|
63 |
-
$current_row = 0;
|
64 |
-
$start = $page * $page_size;
|
65 |
-
$end = $start + $page_size;
|
66 |
-
$pmquery = "SELECT * FROM $wpdb->postmeta WHERE meta_value <> ''";
|
67 |
-
$items = $wpdb->get_results( $pmquery );
|
68 |
-
foreach( $items as $item ){
|
69 |
-
$value = $item->meta_value;
|
70 |
-
if( trim($value) == '' )
|
71 |
-
continue;
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
}
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
-
$results[$option] = array($n, $queries[$option][1]);
|
83 |
-
}
|
84 |
-
else{
|
85 |
-
$result = $wpdb->query( $wpdb->prepare( $queries[$option][0], $oldurl, $newurl) );
|
86 |
-
$results[$option] = array($result, $queries[$option][1]);
|
87 |
}
|
|
|
88 |
}
|
89 |
-
return $results;
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
$data
|
95 |
-
|
96 |
-
elseif ( is_array( $data ) ) {
|
97 |
-
$_tmp = array( );
|
98 |
-
foreach ( $data as $key => $value ) {
|
99 |
-
$_tmp[ $key ] = VB_unserialize_replace( $from, $to, $value, false );
|
100 |
}
|
101 |
-
$data
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
$data =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
-
|
109 |
-
return serialize( $data );
|
110 |
-
} catch( Exception $error ) {
|
111 |
}
|
112 |
-
return $data;
|
113 |
}
|
114 |
if ( isset( $_POST['VBUU_settings_submit'] ) && !check_admin_referer('VBUU_submit','VBUU_nonce')){
|
115 |
if(isset($_POST['VBUU_oldurl']) && isset($_POST['VBUU_newurl'])){
|
6 |
Author: VelvetBlues.com
|
7 |
Author URI: http://www.velvetblues.com/
|
8 |
Author Email: info@velvetblues.com
|
9 |
+
Version: 3.2.4
|
10 |
License: GPLv2 or later
|
11 |
Text Domain: velvet-blues-update-urls
|
12 |
*/
|
13 |
+
/* Copyright 2015 Velvet Blues Web Design (email : info@velvetblues.com)
|
14 |
|
15 |
This program is free software; you can redistribute it and/or
|
16 |
modify it under the terms of the GNU General Public License
|
41 |
load_plugin_textdomain( 'velvet-blues-update-urls', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
42 |
}
|
43 |
function VelvetBluesUU_management_page(){
|
44 |
+
if ( !function_exists( 'VB_update_urls' ) ) {
|
45 |
+
function VB_update_urls($options,$oldurl,$newurl){
|
46 |
+
global $wpdb;
|
47 |
+
$results = array();
|
48 |
+
$queries = array(
|
49 |
+
'content' => array("UPDATE $wpdb->posts SET post_content = replace(post_content, %s, %s)", __('Content Items (Posts, Pages, Custom Post Types, Revisions)','velvet-blues-update-urls') ),
|
50 |
+
'excerpts' => array("UPDATE $wpdb->posts SET post_excerpt = replace(post_excerpt, %s, %s)", __('Excerpts','velvet-blues-update-urls') ),
|
51 |
+
'attachments' => array("UPDATE $wpdb->posts SET guid = replace(guid, %s, %s) WHERE post_type = 'attachment'", __('Attachments','velvet-blues-update-urls') ),
|
52 |
+
'links' => array("UPDATE $wpdb->links SET link_url = replace(link_url, %s, %s)", __('Links','velvet-blues-update-urls') ),
|
53 |
+
'custom' => array("UPDATE $wpdb->postmeta SET meta_value = replace(meta_value, %s, %s)", __('Custom Fields','velvet-blues-update-urls') ),
|
54 |
+
'guids' => array("UPDATE $wpdb->posts SET guid = replace(guid, %s, %s)", __('GUIDs','velvet-blues-update-urls') )
|
55 |
+
);
|
56 |
+
foreach($options as $option){
|
57 |
+
if( $option == 'custom' ){
|
58 |
+
$n = 0;
|
59 |
+
$row_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta" );
|
60 |
+
$page_size = 10000;
|
61 |
+
$pages = ceil( $row_count / $page_size );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
+
for( $page = 0; $page < $pages; $page++ ) {
|
64 |
+
$current_row = 0;
|
65 |
+
$start = $page * $page_size;
|
66 |
+
$end = $start + $page_size;
|
67 |
+
$pmquery = "SELECT * FROM $wpdb->postmeta WHERE meta_value <> ''";
|
68 |
+
$items = $wpdb->get_results( $pmquery );
|
69 |
+
foreach( $items as $item ){
|
70 |
+
$value = $item->meta_value;
|
71 |
+
if( trim($value) == '' )
|
72 |
+
continue;
|
73 |
+
|
74 |
+
$edited = VB_unserialize_replace( $oldurl, $newurl, $value );
|
75 |
+
|
76 |
+
if( $edited != $value ){
|
77 |
+
$fix = $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '".$edited."' WHERE meta_id = ".$item->meta_id );
|
78 |
+
if( $fix )
|
79 |
+
$n++;
|
80 |
+
}
|
81 |
}
|
82 |
}
|
83 |
+
$results[$option] = array($n, $queries[$option][1]);
|
84 |
+
}
|
85 |
+
else{
|
86 |
+
$result = $wpdb->query( $wpdb->prepare( $queries[$option][0], $oldurl, $newurl) );
|
87 |
+
$results[$option] = array($result, $queries[$option][1]);
|
88 |
}
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
+
return $results;
|
91 |
}
|
|
|
92 |
}
|
93 |
+
if ( !function_exists( 'VB_unserialize_replace' ) ) {
|
94 |
+
function VB_unserialize_replace( $from = '', $to = '', $data = '', $serialised = false ) {
|
95 |
+
try {
|
96 |
+
if ( is_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
|
97 |
+
$data = VB_unserialize_replace( $from, $to, $unserialized, true );
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
+
elseif ( is_array( $data ) ) {
|
100 |
+
$_tmp = array( );
|
101 |
+
foreach ( $data as $key => $value ) {
|
102 |
+
$_tmp[ $key ] = VB_unserialize_replace( $from, $to, $value, false );
|
103 |
+
}
|
104 |
+
$data = $_tmp;
|
105 |
+
unset( $_tmp );
|
106 |
+
}
|
107 |
+
else {
|
108 |
+
if ( is_string( $data ) )
|
109 |
+
$data = str_replace( $from, $to, $data );
|
110 |
+
}
|
111 |
+
if ( $serialised )
|
112 |
+
return serialize( $data );
|
113 |
+
} catch( Exception $error ) {
|
114 |
}
|
115 |
+
return $data;
|
|
|
|
|
116 |
}
|
|
|
117 |
}
|
118 |
if ( isset( $_POST['VBUU_settings_submit'] ) && !check_admin_referer('VBUU_submit','VBUU_nonce')){
|
119 |
if(isset($_POST['VBUU_oldurl']) && isset($_POST['VBUU_newurl'])){
|