WP Downgrade | Specific Core Version - Version 1.1.3

Version Description

  • bugfix on downloading certain languages
  • compatibility with WordPress 4.7
Download this release

Release Info

Developer Reisetiger
Plugin Icon 128x128 WP Downgrade | Specific Core Version
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.3

Files changed (2) hide show
  1. readme.txt +13 -3
  2. wp-downgrade.php +39 -5
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Reisetiger
3
  Donate link: http://www.reisetiger.net
4
  Tags: Downgrade, Core, WP-Core, Version, Rollback, Upgrade, Update, Release, Versionskontrolle
5
  Requires at least: 3.0.1
6
- Tested up to: 4.5
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -22,7 +22,8 @@ Das klappt wie gewohnt per Update-Button im Admin-Bereich oder per Auto-Update.
22
  WP-Downgrade funktioniert normalerweise prima. Trotzdem ist ein Versionswechsel immer ein riskanter Eingriff! Du solltest auf jeden Fall vorher ein Backup deiner Dateien und der Datenbank anlegen! Ich übernehme keinerlei Gewähr für deine Installation und werde auch keinen Support leisten.
23
 
24
  = Plugin hilfreich? Sag Danke! =
25
- Ich stelle das Plugin kostenlos zur Verfügung und möchte auch keine Spenden. Aber: Ich freu mich sehr, wenn du auf meinen Reiseblog [https://www.reisetiger.net](https://www.reisetiger.net "Reisetiger") Verlinkst oder mal für deine Reiseplanung vorbeischaust! :-)
 
26
 
27
  == Installation ==
28
  = Der einfachste Weg: =
@@ -53,8 +54,17 @@ A: Weil es bisher keine Fragen gab! :-)
53
 
54
 
55
  == Changelog ==
 
 
 
 
 
 
 
 
 
56
  = 1.1.1 =
57
- * Englische Sprachdateien hinzugef&ueml;gt. Vielen Dank an Gahapati!!
58
 
59
  = 1.1.0 =
60
  * Fehler bei Sprachen ungleich "de_DE" behoben. Danke an Gahapati!!
3
  Donate link: http://www.reisetiger.net
4
  Tags: Downgrade, Core, WP-Core, Version, Rollback, Upgrade, Update, Release, Versionskontrolle
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.7
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
22
  WP-Downgrade funktioniert normalerweise prima. Trotzdem ist ein Versionswechsel immer ein riskanter Eingriff! Du solltest auf jeden Fall vorher ein Backup deiner Dateien und der Datenbank anlegen! Ich übernehme keinerlei Gewähr für deine Installation und werde auch keinen Support leisten.
23
 
24
  = Plugin hilfreich? Sag Danke! =
25
+ Ich stelle das Plugin kostenlos zur Verfügung und möchte auch keine Spenden. Aber: Ich freu mich sehr, wenn du auf meinen Reiseblog [https://www.reisetiger.net](https://www.reisetiger.net "Reisetiger") verlinkst oder mal für deine Reiseplanung vorbeischaust! :-)
26
+ **Bitte bewerte WP Downgrade, wenn es für dich nützlich ist!**
27
 
28
  == Installation ==
29
  = Der einfachste Weg: =
54
 
55
 
56
  == Changelog ==
57
+ = 1.1.3 =
58
+ * bugfix on downloading certain languages
59
+ * compatibility with WordPress 4.7
60
+
61
+ = 1.1.2 =
62
+ * cleaned up code
63
+ * small design change
64
+ * added version number check
65
+
66
  = 1.1.1 =
67
+ * Englische Sprachdateien hinzugefügt. Vielen Dank an Gahapati!!
68
 
69
  = 1.1.0 =
70
  * Fehler bei Sprachen ungleich "de_DE" behoben. Danke an Gahapati!!
wp-downgrade.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Downgrade | Specific Core Version
4
  Plugin URI: https://www.reisetiger.net
5
  Description: WP Downgrade allows you to either downgrade or update WordPress Core to an arbitrary version of your choice. The version you choose is downloaded directly from wordpress.org and installed just like any regular update. The target version WordPress allows you to update to remains constant until you enter a different one or deactivate the plugin either completely or by leaving the target version field empty.
6
- Version: 1.1.1
7
  Author: Reisetiger
8
  Author URI: https://www.reisetiger.net
9
  License: GPL2
@@ -56,7 +56,7 @@ function wp_downgrade_settings_page() {
56
  <table class="form-table">
57
  <tr valign="top">
58
  <th scope="row"><?php _e('WordPress Target Version', 'wp-downgrade'); ?>:</th>
59
- <td><input type="text" maxlength="6" placeholder="<?php echo $wp_version; ?>" name="wpdg_specific_version_name" value="<?php echo esc_attr( get_option('wpdg_specific_version_name') ); ?>" /> (<?php _e('Exact version number from', 'wp-downgrade'); ?> <a href="https://de.wordpress.org/releases/" target="_blank"><?php _e('WP Releases', 'wp-downgrade'); ?></a>, <?php _e('e.g. "4.4.3". Leave empty to deactivate.', 'wp-downgrade'); ?>)</td>
60
  </tr>
61
 
62
  <tr valign="top">
@@ -77,7 +77,21 @@ function wp_downgrade_settings_page() {
77
  </form>
78
 
79
  <?php if (get_option('wpdg_specific_version_name')) { ?>
80
- <p><?php _e('In order to perform the upgrade/downgrade to WP', 'wp-downgrade'); ?> <?php echo get_option('wpdg_specific_version_name'); ?> <?php _e('please go to', 'wp-downgrade'); ?> <a href="<?php echo get_admin_url( null, '/update-core.php' ) ;?>"><?php _e('Update Core', 'wp-downgrade'); ?></a>. </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  <?php }; ?>
82
 
83
  </div>
@@ -88,7 +102,7 @@ add_filter('site_transient_update_core','wpdg_specific_version' );
88
  function wpdg_specific_version($updates){
89
 
90
  $sprache = get_locale().'/';
91
- if ($sprache == 'en_US/'){
92
  $sprache = '';
93
  };
94
  $dg_version = get_option('wpdg_specific_version_name');
@@ -96,7 +110,7 @@ if ($dg_version < 1)
96
  return $updates;
97
 
98
  global $wp_version;
99
- // If current version is 3.7.8 or higher then stop
100
  if ( version_compare( $wp_version, $dg_version ) == 0 ) {
101
  return;
102
  } //https://downloads.wordpress.org/release/de_DE/wordpress-4.5.zip
@@ -108,4 +122,24 @@ if ($dg_version < 1)
108
 
109
  return $updates;
110
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  ?>
3
  Plugin Name: WP Downgrade | Specific Core Version
4
  Plugin URI: https://www.reisetiger.net
5
  Description: WP Downgrade allows you to either downgrade or update WordPress Core to an arbitrary version of your choice. The version you choose is downloaded directly from wordpress.org and installed just like any regular update. The target version WordPress allows you to update to remains constant until you enter a different one or deactivate the plugin either completely or by leaving the target version field empty.
6
+ Version: 1.1.3
7
  Author: Reisetiger
8
  Author URI: https://www.reisetiger.net
9
  License: GPL2
56
  <table class="form-table">
57
  <tr valign="top">
58
  <th scope="row"><?php _e('WordPress Target Version', 'wp-downgrade'); ?>:</th>
59
+ <td><input type="text" maxlength="6" pattern="[-+]?[0-9]*[.]?[0-9]?[.]?[0-9]+" placeholder="<?php echo $wp_version; ?>" name="wpdg_specific_version_name" value="<?php echo esc_attr( get_option('wpdg_specific_version_name') ); ?>" /> (<?php _e('Exact version number from', 'wp-downgrade'); ?> <a href="https://de.wordpress.org/releases/" target="_blank"><?php _e('WP Releases', 'wp-downgrade'); ?></a>, <?php _e('e.g. "4.4.3". Leave empty to deactivate.', 'wp-downgrade'); ?>)</td>
60
  </tr>
61
 
62
  <tr valign="top">
77
  </form>
78
 
79
  <?php if (get_option('wpdg_specific_version_name')) { ?>
80
+
81
+ <p><strong><?php _e('In order to perform the upgrade/downgrade to WP', 'wp-downgrade'); ?> <?php echo get_option('wpdg_specific_version_name'); ?> <?php _e('please go to', 'wp-downgrade'); ?> <a href="<?php echo get_admin_url( null, '/update-core.php' ) ;?>"><?php _e('Update Core', 'wp-downgrade'); ?></a>. </strong></p>
82
+ <p><a href="<?php echo get_admin_url( null, '/update-core.php' ) ;?>" class="button"><?php _e('Up-/Downgrade Core', 'wp-downgrade'); ?></a></p>
83
+
84
+ <?php if (wpdg_urlcheck(wpdg_get_url(get_option('wpdg_specific_version_name'))) == false){ ?>
85
+ <span style="color: red;"> <?php _e('Attention! The target version does not seem to exist!', 'wp-downgrade'); ?> </span><br>
86
+ <span style="color: red;"> URL: <?php echo wpdg_get_url(get_option('wpdg_specific_version_name')); ?></span><br>
87
+ <span style="color: red;"> <?php _e('The update could fail. Are you sure that the version number is correct?', 'wp-downgrade'); echo " <strong>". get_option('wpdg_specific_version_name'); ?> </strong></span><br>
88
+ <?php }
89
+
90
+ //echo wpdg_get_url(get_option('wpdg_specific_version_name'));
91
+ //echo wpdg_urlcheck(wpdg_get_url(get_option('wpdg_specific_version_name')));
92
+
93
+ ?>
94
+
95
  <?php }; ?>
96
 
97
  </div>
102
  function wpdg_specific_version($updates){
103
 
104
  $sprache = get_locale().'/';
105
+ if ($sprache == 'en_US/' OR $sprache == 'en'){
106
  $sprache = '';
107
  };
108
  $dg_version = get_option('wpdg_specific_version_name');
110
  return $updates;
111
 
112
  global $wp_version;
113
+ // If current version is target version then stop
114
  if ( version_compare( $wp_version, $dg_version ) == 0 ) {
115
  return;
116
  } //https://downloads.wordpress.org/release/de_DE/wordpress-4.5.zip
122
 
123
  return $updates;
124
  }
125
+
126
+ function wpdg_urlcheck($url) {
127
+ if (($url == '') || ($url == null)) { return false; }
128
+ $response = wp_remote_head( $url, array( 'timeout' => 5 ) );
129
+ $accepted_status_codes = array( 200, 301, 302 );
130
+ if ( ! is_wp_error( $response ) && in_array( wp_remote_retrieve_response_code( $response ), $accepted_status_codes ) ) {
131
+ return true;
132
+ }
133
+ return false;
134
+ }
135
+
136
+ function wpdg_get_url($version) {
137
+ $sprache = get_locale().'/';
138
+ if ($sprache == 'en_US/'){
139
+ $sprache = '';
140
+ };
141
+ $url = "https://downloads.wordpress.org/release/".$sprache."wordpress-".$version.".zip";
142
+ return $url;
143
+ }
144
+
145
  ?>