WordPress HTTPS (SSL) - Version 3.0.4

Version Description

  • Fixed multiple bugs for sites using SSL for the entire site.
  • Bug Fix - plugin should no longer try to load hidden files as modules.
Download this release

Release Info

Developer Mvied
Plugin Icon wp plugin WordPress HTTPS (SSL)
Version 3.0.4
Comparing to
See all releases

Code changes from version 3.0.3 to 3.0.4

.htaccess CHANGED
@@ -1 +1 @@
1
- Options -Indexes
1
+ Options -Indexes
admin/templates/metabox/settings.php CHANGED
@@ -83,7 +83,7 @@
83
  </td>
84
  </tr>
85
  <tr valign="top" id="admin_menu_row">
86
- <th scope="row">Admin Menu</th>
87
  <td>
88
  <fieldset>
89
  <label for="admin_menu" class="label-radio">
83
  </td>
84
  </tr>
85
  <tr valign="top" id="admin_menu_row">
86
+ <th scope="row">Admin Menu Location</th>
87
  <td>
88
  <fieldset>
89
  <label for="admin_menu" class="label-radio">
lib/{WordPressHTTPS → Mvied}/Logger/Interface.php RENAMED
@@ -3,11 +3,11 @@
3
  * Logger Interface
4
  *
5
  * @author Mike Ems
6
- * @package WordPressHTTPS
7
  *
8
  */
9
 
10
- interface WordPressHTTPS_Logger_Interface {
11
 
12
  /**
13
  * Get singleton instance
3
  * Logger Interface
4
  *
5
  * @author Mike Ems
6
+ * @package Mvied
7
  *
8
  */
9
 
10
+ interface Mvied_Logger_Interface {
11
 
12
  /**
13
  * Get singleton instance
lib/Mvied/Module.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module Class for a WordPress plugin.
4
+ *
5
+ * Each Module in the project will extend this base Module class.
6
+ * Modules can be treated as independent plugins. Think of them as sub-plugins.
7
+ *
8
+ * @author Mike Ems
9
+ * @package Mvied
10
+ */
11
+ class Mvied_Module {
12
+
13
+ /**
14
+ * Plugin object that this module extends
15
+ *
16
+ * @var Mvied
17
+ */
18
+ protected $_plugin;
19
+
20
+ /**
21
+ * Set Plugin
22
+ *
23
+ * @param Mvied_Plugin $plugin
24
+ * @return object $this
25
+ * @uses Mvied_Plugin
26
+ */
27
+ public function setPlugin( Mvied_Plugin $plugin ) {
28
+ $this->_plugin = $plugin;
29
+ return $this;
30
+ }
31
+
32
+ /**
33
+ * Get Plugin
34
+ *
35
+ * @param none
36
+ * @return Mvied_Plugin
37
+ */
38
+ public function getPlugin() {
39
+ if ( ! isset($this->_plugin) ) {
40
+ die('Module ' . __CLASS__ . ' missing Plugin dependency.');
41
+ }
42
+
43
+ return $this->_plugin;
44
+ }
45
+
46
+ }
lib/{WordPressHTTPS → Mvied}/Module/Interface.php RENAMED
@@ -3,11 +3,11 @@
3
  * Module Interface
4
  *
5
  * @author Mike Ems
6
- * @package WordPressHTTPS
7
  *
8
  */
9
 
10
- interface WordPressHTTPS_Module_Interface {
11
 
12
  /**
13
  * Initializes the module
3
  * Module Interface
4
  *
5
  * @author Mike Ems
6
+ * @package Mvied
7
  *
8
  */
9
 
10
+ interface Mvied_Module_Interface {
11
 
12
  /**
13
  * Initializes the module
lib/{WordPressHTTPS → Mvied}/Plugin.php RENAMED
@@ -1,14 +1,11 @@
1
  <?php
2
  /**
3
- * Plugin Class for the WordPress plugin WordPress HTTPS
4
- *
5
- * This is a re-usable base class for a WordPress plugin.
6
  *
7
  * @author Mike Ems
8
- * @package WordPressHTTPS
9
- *
10
  */
11
- class WordPressHTTPS_Plugin {
12
 
13
  /**
14
  * Base directory
@@ -34,7 +31,7 @@ class WordPressHTTPS_Plugin {
34
  /**
35
  * Logger
36
  *
37
- * @var WordPressHTTPS_Logger
38
  */
39
  protected $_logger;
40
 
@@ -120,7 +117,7 @@ class WordPressHTTPS_Plugin {
120
  $modules = array();
121
  if ( is_dir($this->getModuleDirectory()) && $module_directory = opendir($this->getModuleDirectory()) ) {
122
  while ( false !== ($entry = readdir($module_directory)) ) {
123
- if ( $entry != '.' && $entry != '..' ) {
124
  $module = str_replace('.php', '', $entry);
125
  if ( $module != 'Interface' ) {
126
  $modules[] = $module;
@@ -190,7 +187,7 @@ class WordPressHTTPS_Plugin {
190
  * @param object $logger
191
  * @return object $this
192
  */
193
- public function setLogger( WordPressHTTPS_Logger_Interface $logger ) {
194
  $this->_logger = $logger;
195
  return $this;
196
  }
@@ -369,10 +366,10 @@ class WordPressHTTPS_Plugin {
369
  $base_class = get_class($this);
370
  }
371
  $module_full = 'Module\\' . $module;
372
- $filename = str_replace('\\', '/', $module_full);
373
  $filename = $filename . '.php';
374
 
375
- require_once($filename);
376
 
377
  $class = $base_class . '_' . str_replace('\\', '_', $module_full);
378
  if ( ! isset($this->_modules[$class]) || ! is_object($this->_modules[$class]) || get_class($this->_modules[$class]) != $class ) {
1
  <?php
2
  /**
3
+ * Base class for a WordPress plugin.
 
 
4
  *
5
  * @author Mike Ems
6
+ * @package Mvied
 
7
  */
8
+ class Mvied_Plugin {
9
 
10
  /**
11
  * Base directory
31
  /**
32
  * Logger
33
  *
34
+ * @var Mvied_Logger_Interface
35
  */
36
  protected $_logger;
37
 
117
  $modules = array();
118
  if ( is_dir($this->getModuleDirectory()) && $module_directory = opendir($this->getModuleDirectory()) ) {
119
  while ( false !== ($entry = readdir($module_directory)) ) {
120
+ if ( strpos($entry, '.') !== 0 ) {
121
  $module = str_replace('.php', '', $entry);
122
  if ( $module != 'Interface' ) {
123
  $modules[] = $module;
187
  * @param object $logger
188
  * @return object $this
189
  */
190
+ public function setLogger( Mvied_Logger_Interface $logger ) {
191
  $this->_logger = $logger;
192
  return $this;
193
  }
366
  $base_class = get_class($this);
367
  }
368
  $module_full = 'Module\\' . $module;
369
+ $filename = str_replace('\\', '/', $module);
370
  $filename = $filename . '.php';
371
 
372
+ require_once($this->getModuleDirectory() . $filename);
373
 
374
  $class = $base_class . '_' . str_replace('\\', '_', $module_full);
375
  if ( ! isset($this->_modules[$class]) || ! is_object($this->_modules[$class]) || get_class($this->_modules[$class]) != $class ) {
lib/Mvied/README.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ Mvied
2
+ =============
3
+
4
+ This library was created by Mvied for quickly creating Plugins and Themes with WordPress.
5
+
6
+ Tutorial
7
+ -------
8
+
lib/WordPressHTTPS.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
- * WordPressHTTPS Class for the WordPress plugin WordPress HTTPS
4
  *
5
  * @author Mike Ems
6
  * @package WordPressHTTPS
7
  *
8
  */
9
 
10
- class WordPressHTTPS extends WordPressHTTPS_Plugin {
11
 
12
  /**
13
  * HTTP URL
@@ -108,6 +108,7 @@ class WordPressHTTPS extends WordPressHTTPS_Plugin {
108
  $this->setSetting('ssl_host_diff', 0);
109
  }
110
 
 
111
  if ( strpos($this->getHttpsUrl()->getPath(), $this->getHttpUrl()->getPath()) === false ) {
112
  $this->getHttpsUrl()->setPath( $this->getHttpsUrl()->getPath() . $this->getHttpUrl()->getPath() );
113
  }
1
  <?php
2
  /**
3
+ * WordPress HTTPS
4
  *
5
  * @author Mike Ems
6
  * @package WordPressHTTPS
7
  *
8
  */
9
 
10
+ class WordPressHTTPS extends Mvied_Plugin {
11
 
12
  /**
13
  * HTTP URL
108
  $this->setSetting('ssl_host_diff', 0);
109
  }
110
 
111
+ // Prepend SSL Host path
112
  if ( strpos($this->getHttpsUrl()->getPath(), $this->getHttpUrl()->getPath()) === false ) {
113
  $this->getHttpsUrl()->setPath( $this->getHttpsUrl()->getPath() . $this->getHttpUrl()->getPath() );
114
  }
lib/WordPressHTTPS/Logger.php CHANGED
@@ -7,9 +7,9 @@
7
  *
8
  */
9
 
10
- require_once('Logger/Interface.php');
11
 
12
- class WordPressHTTPS_Logger implements WordPressHTTPS_Logger_Interface {
13
 
14
  /**
15
  * Instance
7
  *
8
  */
9
 
10
+ require_once('Mvied/Logger/Interface.php');
11
 
12
+ class WordPressHTTPS_Logger implements Mvied_Logger_Interface {
13
 
14
  /**
15
  * Instance
lib/WordPressHTTPS/Module.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Module Class for the WordPress plugin WordPress HTTPS.
4
- *
5
- * Each Module in the project will extend this base Module class.
6
- * Modules can be treated as an independent plugins. Think of them as sub-plugins.
7
- *
8
- * If you need to unload a module, just place something like this:
9
- * $wordpress_https->unloadModule('Hooks');
10
- * In wordpress-https.php, immediately after:
11
- * $wordpress_https->loadModules();
12
- *
13
- * @author Mike Ems
14
- * @package WordPressHTTPS
15
- *
16
- */
17
- class WordPressHTTPS_Module {
18
-
19
- /**
20
- * Plugin object that this module extends
21
- *
22
- * @var WordPressHTTPS
23
- */
24
- protected $_plugin;
25
-
26
- /**
27
- * Set Plugin
28
- *
29
- * @param WordPressHTTPS_Plugin $plugin
30
- * @return object $this
31
- */
32
- public function setPlugin( WordPressHTTPS_Plugin $plugin ) {
33
- $this->_plugin = $plugin;
34
- return $this;
35
- }
36
-
37
- /**
38
- * Get Plugin
39
- *
40
- * @param none
41
- * @return WordPressHTTPS_Plugin
42
- */
43
- public function getPlugin() {
44
- if ( ! isset($this->_plugin) ) {
45
- die('Module ' . __CLASS__ . ' missing Plugin dependency.');
46
- }
47
-
48
- return $this->_plugin;
49
- }
50
-
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/WordPressHTTPS/Module/Admin.php CHANGED
@@ -9,10 +9,10 @@
9
  *
10
  */
11
 
12
- require_once('WordPressHTTPS/Module.php');
13
- require_once('WordPressHTTPS/Module/Interface.php');
14
 
15
- class WordPressHTTPS_Module_Admin extends WordPressHTTPS_Module implements WordPressHTTPS_Module_Interface {
16
 
17
  /**
18
  * Initialize Module
9
  *
10
  */
11
 
12
+ require_once('Mvied/Module.php');
13
+ require_once('Mvied/Module/Interface.php');
14
 
15
+ class WordPressHTTPS_Module_Admin extends Mvied_Module implements Mvied_Module_Interface {
16
 
17
  /**
18
  * Initialize Module
lib/WordPressHTTPS/Module/Admin/Post.php CHANGED
@@ -9,10 +9,10 @@
9
  *
10
  */
11
 
12
- require_once('WordPressHTTPS/Module.php');
13
- require_once('WordPressHTTPS/Module/Interface.php');
14
 
15
- class WordPressHTTPS_Module_Admin_Post extends WordPressHTTPS_Module implements WordPressHTTPS_Module_Interface {
16
 
17
  /**
18
  * Initialize Module
9
  *
10
  */
11
 
12
+ require_once('Mvied/Module.php');
13
+ require_once('Mvied/Module/Interface.php');
14
 
15
+ class WordPressHTTPS_Module_Admin_Post extends Mvied_Module implements Mvied_Module_Interface {
16
 
17
  /**
18
  * Initialize Module
lib/WordPressHTTPS/Module/Admin/Settings.php CHANGED
@@ -9,10 +9,10 @@
9
  *
10
  */
11
 
12
- require_once('WordPressHTTPS/Module.php');
13
- require_once('WordPressHTTPS/Module/Interface.php');
14
 
15
- class WordPressHTTPS_Module_Admin_Settings extends WordPressHTTPS_Module implements WordPressHTTPS_Module_Interface {
16
 
17
  /**
18
  * Initialize Module
9
  *
10
  */
11
 
12
+ require_once('Mvied/Module.php');
13
+ require_once('Mvied/Module/Interface.php');
14
 
15
+ class WordPressHTTPS_Module_Admin_Settings extends Mvied_Module implements Mvied_Module_Interface {
16
 
17
  /**
18
  * Initialize Module
lib/WordPressHTTPS/Module/Filters.php CHANGED
@@ -7,10 +7,10 @@
7
  *
8
  */
9
 
10
- require_once('WordPressHTTPS/Module.php');
11
- require_once('WordPressHTTPS/Module/Interface.php');
12
 
13
- class WordPressHTTPS_Module_Filters extends WordPressHTTPS_Module implements WordPressHTTPS_Module_Interface {
14
 
15
  /**
16
  * Initialize
@@ -37,7 +37,7 @@ class WordPressHTTPS_Module_Filters extends WordPressHTTPS_Module implements Wor
37
  add_filter('force_ssl', array(&$this, 'secure_child_post'), 10, 2);
38
  add_filter('force_ssl', array(&$this, 'secure_post'), 9, 2);
39
 
40
- // Filter site_url in admin panel
41
  if ( $this->getPlugin()->isSsl() ) {
42
  add_filter('site_url', array($this->getPlugin(), 'makeUrlHttps'), 10);
43
  add_filter('template_directory_uri', array($this->getPlugin(), 'makeUrlHttps'), 10);
@@ -45,7 +45,7 @@ class WordPressHTTPS_Module_Filters extends WordPressHTTPS_Module implements Wor
45
  }
46
 
47
  // Filter HTTPS from links
48
- if ( ! is_admin() && WordPressHTTPS_Url::fromString( home_url('/') )->getScheme() != 'https' ) {
49
  $filters = array('page_link', 'post_link', 'category_link', 'archives_link', 'tag_link', 'search_link');
50
  foreach( $filters as $filter ) {
51
  add_filter($filter, array($this->getPlugin(), 'makeUrlHttp'), 10);
@@ -55,7 +55,7 @@ class WordPressHTTPS_Module_Filters extends WordPressHTTPS_Module implements Wor
55
  add_filter('bloginfo_url', array(&$this, 'bloginfo'), 10, 2);
56
 
57
  // If the whole site is not HTTPS, set links to the front-end to HTTP from within the admin panel
58
- } else if ( is_admin() && $this->getPlugin()->isSsl() && WordPressHTTPS_Url::fromString( home_url('/') )->getScheme() != 'https' ) {
59
  $filters = array('page_link', 'post_link', 'category_link', 'get_archives_link', 'tag_link', 'search_link');
60
  foreach( $filters as $filter ) {
61
  add_filter($filter, array($this->getPlugin(), 'makeUrlHttp'), 10);
@@ -64,8 +64,8 @@ class WordPressHTTPS_Module_Filters extends WordPressHTTPS_Module implements Wor
64
 
65
  // Change all page and post links to HTTPS in the admin panel when using different SSL Host
66
  if ( $this->getPlugin()->getSetting('ssl_host_diff') && $this->getPlugin()->getSetting('ssl_host_subdomain') == 0 && is_admin() && $this->getPlugin()->isSsl() ) {
67
- add_filter('page_link', array($this->getPlugin(), 'makeUrlHttps'), 10);
68
- add_filter('post_link', array($this->getPlugin(), 'makeUrlHttps'), 10);
69
  }
70
  }
71
 
@@ -108,7 +108,9 @@ class WordPressHTTPS_Module_Filters extends WordPressHTTPS_Module implements Wor
108
  */
109
  public function bloginfo( $result = '', $show = '' ) {
110
  if ( $show == 'stylesheet_url' || $show == 'template_url' || $show == 'wpurl' || $show == 'home' || $show == 'siteurl' || $show == 'Url' ) {
111
- $result = $this->getPlugin()->makeUrlHttp($result);
 
 
112
  }
113
  return $result;
114
  }
7
  *
8
  */
9
 
10
+ require_once('Mvied/Module.php');
11
+ require_once('Mvied/Module/Interface.php');
12
 
13
+ class WordPressHTTPS_Module_Filters extends Mvied_Module implements Mvied_Module_Interface {
14
 
15
  /**
16
  * Initialize
37
  add_filter('force_ssl', array(&$this, 'secure_child_post'), 10, 2);
38
  add_filter('force_ssl', array(&$this, 'secure_post'), 9, 2);
39
 
40
+ // Filter URL's on SSL pages
41
  if ( $this->getPlugin()->isSsl() ) {
42
  add_filter('site_url', array($this->getPlugin(), 'makeUrlHttps'), 10);
43
  add_filter('template_directory_uri', array($this->getPlugin(), 'makeUrlHttps'), 10);
45
  }
46
 
47
  // Filter HTTPS from links
48
+ if ( ! is_admin() && WordPressHTTPS_Url::fromString(get_option('home'))->getScheme() != 'https' ) {
49
  $filters = array('page_link', 'post_link', 'category_link', 'archives_link', 'tag_link', 'search_link');
50
  foreach( $filters as $filter ) {
51
  add_filter($filter, array($this->getPlugin(), 'makeUrlHttp'), 10);
55
  add_filter('bloginfo_url', array(&$this, 'bloginfo'), 10, 2);
56
 
57
  // If the whole site is not HTTPS, set links to the front-end to HTTP from within the admin panel
58
+ } else if ( is_admin() && $this->getPlugin()->getSetting('ssl_admin') == 0 && $this->getPlugin()->isSsl() && WordPressHTTPS_Url::fromString(get_option('home'))->getScheme() != 'https' ) {
59
  $filters = array('page_link', 'post_link', 'category_link', 'get_archives_link', 'tag_link', 'search_link');
60
  foreach( $filters as $filter ) {
61
  add_filter($filter, array($this->getPlugin(), 'makeUrlHttp'), 10);
64
 
65
  // Change all page and post links to HTTPS in the admin panel when using different SSL Host
66
  if ( $this->getPlugin()->getSetting('ssl_host_diff') && $this->getPlugin()->getSetting('ssl_host_subdomain') == 0 && is_admin() && $this->getPlugin()->isSsl() ) {
67
+ add_filter('page_link', array($this->getPlugin(), 'makeUrlHttps'), 9);
68
+ add_filter('post_link', array($this->getPlugin(), 'makeUrlHttps'), 9);
69
  }
70
  }
71
 
108
  */
109
  public function bloginfo( $result = '', $show = '' ) {
110
  if ( $show == 'stylesheet_url' || $show == 'template_url' || $show == 'wpurl' || $show == 'home' || $show == 'siteurl' || $show == 'Url' ) {
111
+ if ( WordPressHTTPS_Url::fromString(get_option('home'))->getScheme() != 'https' ) {
112
+ $result = $this->getPlugin()->makeUrlHttp($result);
113
+ }
114
  }
115
  return $result;
116
  }
lib/WordPressHTTPS/Module/Hooks.php CHANGED
@@ -7,10 +7,10 @@
7
  *
8
  */
9
 
10
- require_once('WordPressHTTPS/Module.php');
11
- require_once('WordPressHTTPS/Module/Interface.php');
12
 
13
- class WordPressHTTPS_Module_Hooks extends WordPressHTTPS_Module implements WordPressHTTPS_Module_Interface {
14
 
15
  /**
16
  * Initialize
@@ -85,6 +85,11 @@ class WordPressHTTPS_Module_Hooks extends WordPressHTTPS_Module implements WordP
85
  public function redirect_check() {
86
  global $post;
87
 
 
 
 
 
 
88
  if ( ! (is_single() || is_page() || is_front_page() || is_home()) ) {
89
  return false;
90
  }
@@ -107,11 +112,6 @@ class WordPressHTTPS_Module_Hooks extends WordPressHTTPS_Module implements WordP
107
  $force_ssl = false;
108
  }
109
 
110
- // Force SSL Admin
111
- if ( is_admin() && $this->getPlugin()->getSetting('ssl_admin') && ! $this->getPlugin()->isSsl() ) {
112
- $force_ssl = true;
113
- }
114
-
115
  if ( ! $this->getPlugin()->isSsl() && isset($force_ssl) && $force_ssl ) {
116
  $scheme = 'https';
117
  } else if ( $this->getPlugin()->isSsl() && isset($force_ssl) && ! $force_ssl ) {
@@ -184,7 +184,6 @@ class WordPressHTTPS_Module_Hooks extends WordPressHTTPS_Module implements WordP
184
  $cookie_path_admin = $cookie_path_site . 'wp-admin';
185
  }
186
 
187
- // Cookie paths defined to accomodate different SSL Host
188
  if ( $scheme == 'logged_in' ) {
189
  setcookie($cookie_name, $cookie, $expire, $cookie_path, $cookie_domain, $secure, true);
190
  if ( $cookie_path != $cookie_path_site ) {
7
  *
8
  */
9
 
10
+ require_once('Mvied/Module.php');
11
+ require_once('Mvied/Module/Interface.php');
12
 
13
+ class WordPressHTTPS_Module_Hooks extends Mvied_Module implements Mvied_Module_Interface {
14
 
15
  /**
16
  * Initialize
85
  public function redirect_check() {
86
  global $post;
87
 
88
+ // Force SSL Admin
89
+ if ( ( is_admin() || $GLOBALS['pagenow'] == 'wp-login.php' ) && $this->getPlugin()->getSetting('ssl_admin') && ! $this->getPlugin()->isSsl() ) {
90
+ $this->getPlugin()->redirect('https');
91
+ }
92
+
93
  if ( ! (is_single() || is_page() || is_front_page() || is_home()) ) {
94
  return false;
95
  }
112
  $force_ssl = false;
113
  }
114
 
 
 
 
 
 
115
  if ( ! $this->getPlugin()->isSsl() && isset($force_ssl) && $force_ssl ) {
116
  $scheme = 'https';
117
  } else if ( $this->getPlugin()->isSsl() && isset($force_ssl) && ! $force_ssl ) {
184
  $cookie_path_admin = $cookie_path_site . 'wp-admin';
185
  }
186
 
 
187
  if ( $scheme == 'logged_in' ) {
188
  setcookie($cookie_name, $cookie, $expire, $cookie_path, $cookie_domain, $secure, true);
189
  if ( $cookie_path != $cookie_path_site ) {
lib/WordPressHTTPS/Module/Parser.php CHANGED
@@ -7,10 +7,10 @@
7
  *
8
  */
9
 
10
- require_once('WordPressHTTPS/Module.php');
11
- require_once('WordPressHTTPS/Module/Interface.php');
12
 
13
- class WordPressHTTPS_Module_Parser extends WordPressHTTPS_Module implements WordPressHTTPS_Module_Interface {
14
 
15
  /**
16
  * HTML
@@ -208,9 +208,11 @@ class WordPressHTTPS_Module_Parser extends WordPressHTTPS_Module implements Word
208
  preg_match_all('/(' . str_replace('/', '\/', preg_quote($url->toString())) . '[^\'"]*)[\'"]?/im', $this->_html, $httpsMatches);
209
  }
210
 
211
- $url = clone $this->getPlugin()->getHttpUrl();
212
- $url->setScheme('https');
213
- preg_match_all('/(' . str_replace('/', '\/', preg_quote($url->toString())) . '[^\'"]*)[\'"]?/im', $this->_html, $httpMatches);
 
 
214
  $matches = array_merge($httpMatches, $httpsMatches);
215
  for ($i = 0; $i < sizeof($matches[0]); $i++) {
216
  if ( isset($matches[1][$i]) ) {
@@ -378,7 +380,7 @@ class WordPressHTTPS_Module_Parser extends WordPressHTTPS_Module implements Word
378
 
379
  if ( $this->getPlugin()->isUrlLocal($url) && preg_match("/page_id=([\d]+)/", parse_url($url, PHP_URL_QUERY), $postID) ) {
380
  $post = $postID[1];
381
- } else if ( $this->getPlugin()->isUrlLocal($url) && $url_parts['path'] == '' ) {
382
  if ( get_option('show_on_front') == 'posts' ) {
383
  $post = true;
384
  } else {
@@ -416,7 +418,7 @@ class WordPressHTTPS_Module_Parser extends WordPressHTTPS_Module implements Word
416
  $force_ssl = apply_filters('force_ssl', $force_ssl, $post );
417
  }
418
 
419
- if ( $force_ssl == true ) {
420
  $updated = $this->getPlugin()->makeUrlHttps($url);
421
  $this->_html = str_replace($html, str_replace($url, $updated, $html), $this->_html);
422
  } else if ( $this->getPlugin()->getSetting('exclusive_https') ) {
7
  *
8
  */
9
 
10
+ require_once('Mvied/Module.php');
11
+ require_once('Mvied/Module/Interface.php');
12
 
13
+ class WordPressHTTPS_Module_Parser extends Mvied_Module implements Mvied_Module_Interface {
14
 
15
  /**
16
  * HTML
208
  preg_match_all('/(' . str_replace('/', '\/', preg_quote($url->toString())) . '[^\'"]*)[\'"]?/im', $this->_html, $httpsMatches);
209
  }
210
 
211
+ if ( WordPressHTTPS_Url::fromString(get_option('home'))->getScheme() != 'https' ) {
212
+ $url = clone $this->getPlugin()->getHttpUrl();
213
+ $url->setScheme('https');
214
+ preg_match_all('/(' . str_replace('/', '\/', preg_quote($url->toString())) . '[^\'"]*)[\'"]?/im', $this->_html, $httpMatches);
215
+ }
216
  $matches = array_merge($httpMatches, $httpsMatches);
217
  for ($i = 0; $i < sizeof($matches[0]); $i++) {
218
  if ( isset($matches[1][$i]) ) {
380
 
381
  if ( $this->getPlugin()->isUrlLocal($url) && preg_match("/page_id=([\d]+)/", parse_url($url, PHP_URL_QUERY), $postID) ) {
382
  $post = $postID[1];
383
+ } else if ( $this->getPlugin()->isUrlLocal($url) && ( $url_parts['path'] == '' || $url_parts['path'] == '/' ) ) {
384
  if ( get_option('show_on_front') == 'posts' ) {
385
  $post = true;
386
  } else {
418
  $force_ssl = apply_filters('force_ssl', $force_ssl, $post );
419
  }
420
 
421
+ if ( $force_ssl == true || WordPressHTTPS_Url::fromString(get_option('home'))->getScheme() == 'https' ) {
422
  $updated = $this->getPlugin()->makeUrlHttps($url);
423
  $this->_html = str_replace($html, str_replace($url, $updated, $html), $this->_html);
424
  } else if ( $this->getPlugin()->getSetting('exclusive_https') ) {
lib/WordPressHTTPS/Url.php CHANGED
@@ -441,8 +441,8 @@ class WordPressHTTPS_Url {
441
  /**
442
  * Factory object from an array provided by the parse_url function
443
  *
444
- * Example of usage from within the plugin or modules:
445
- * WordPressHTTPS::factory('Url')->fromArray( parse_url( site_url() ) );
446
  *
447
  * @param array $array
448
  * @return $url WordPressHTTPS_Url
@@ -467,6 +467,9 @@ class WordPressHTTPS_Url {
467
 
468
  /**
469
  * Factory object from a string that contains a URL
 
 
 
470
  *
471
  * @param string $string
472
  * @return $url WordPressHTTPS_Url
441
  /**
442
  * Factory object from an array provided by the parse_url function
443
  *
444
+ * Example of usage:
445
+ * $site_url = WordPressHTTPS_Url::fromArray( parse_url( site_url() ) );
446
  *
447
  * @param array $array
448
  * @return $url WordPressHTTPS_Url
467
 
468
  /**
469
  * Factory object from a string that contains a URL
470
+ *
471
+ * Example of usage:
472
+ * $site_url = WordPressHTTPS_Url::fromString( site_url() );
473
  *
474
  * @param string $string
475
  * @return $url WordPressHTTPS_Url
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: security, encryption, ssl, shared ssl, private ssl, public ssl, private ssl, http, https
5
  Requires at least: 3.0
6
  Tested up to: 3.4
7
- Stable tag: 3.0.3
8
 
9
  WordPress HTTPS is intended to be an all-in-one solution to using SSL on WordPress sites.
10
 
@@ -16,18 +16,18 @@ If you're having partially encrypted/mixed content errors or other problems, ple
16
  1. Activate the plugin through the 'Plugins' menu in WordPress.
17
 
18
  == Frequently Asked Questions ==
 
 
 
 
19
  = How do I make my whole website secure? =
20
- To make your entire website secure, you simply need to change your home url and site url to use HTTPS instead of HTTP. Please read <a href="http://codex.wordpress.org/Changing_The_Site_URL" target="_blank">how to change the site url</a>.
21
 
22
  = How do I make only certain pages secure? =
23
- In the Publish box on the add/edit post screen, a checkbox for 'Force SSL' has been added to make this process easy. See Screenshots if you're having a hard time finding it.
24
-
25
- = I changed my SSL Host and now I can't get into my admin panel! =
26
- Go to /wp-content/plugins/wordpress-https/wordpress-https.php and uncomment (remove the two forward slashes before) the line below, or go to your wp-config.php file and add this line. Hit any page on your site, and then remove it or comment it out again.
27
- `define('WPHTTPS_RESET', true);`
28
 
29
  = I'm getting 404 errors on all of my pages. Why? =
30
- If you're using a public/shared SSL, try disabling your custom permalink structure. Some public/shared SSL's have issues with WordPress' permalinks because of the way they are configured.
31
 
32
  = How do I fix partially encrypted/mixed content errors? =
33
  To identify what is causing your page(s) to be insecure, please follow the instructions below.
@@ -48,8 +48,7 @@ Most insecure content warnings can generally be resolved by changing absolute re
48
  </ul>
49
 
50
  = Is there a hook or filter to force pages to be secure? =
51
-
52
- Yes! Here is an example of how to use the 'force_ssl' hook to force a page to be secure.
53
  `function custom_force_ssl( $force_ssl, $post_id ) {
54
  if ( $post_id == 5 ) {
55
  return true
@@ -73,7 +72,14 @@ add_filter('force_ssl', 'store_force_ssl', 10, 2);`
73
  1. WordPress HTTPS Settings screen
74
  2. Force SSL checkbox added to add/edit posts screen
75
 
 
 
 
 
76
  == Changelog ==
 
 
 
77
  = 3.0.3 =
78
  * Any element on an HTTP page that is set to HTTPS should be auto-corrected.
79
  * Added support for domain mapper plugin.
4
  Tags: security, encryption, ssl, shared ssl, private ssl, public ssl, private ssl, http, https
5
  Requires at least: 3.0
6
  Tested up to: 3.4
7
+ Stable tag: 3.0.4
8
 
9
  WordPress HTTPS is intended to be an all-in-one solution to using SSL on WordPress sites.
10
 
16
  1. Activate the plugin through the 'Plugins' menu in WordPress.
17
 
18
  == Frequently Asked Questions ==
19
+ = I can't get into my admin panel after updating. How do I fix it? =
20
+ Go to /wp-content/plugins/wordpress-https/wordpress-https.php and uncomment (remove the two forward slashes before) the line below, or go to your wp-config.php file and add this line. Hit any page on your site, and then remove it or comment it out again.
21
+ `define('WPHTTPS_RESET', true);`
22
+
23
  = How do I make my whole website secure? =
24
+ To make your entire website secure, you simply need to change your site url to use HTTPS instead of HTTP. Please read <a href="http://codex.wordpress.org/Changing_The_Site_URL" target="_blank">how to change the site url</a>.
25
 
26
  = How do I make only certain pages secure? =
27
+ The plugin adds a meta box to the add/edit post screen entitled HTTPS. In that meta box, a checkbox for 'Secure Post' has been added to make this process easy. See Screenshots if you're having a hard time finding it.
 
 
 
 
28
 
29
  = I'm getting 404 errors on all of my pages. Why? =
30
+ If you're using a public/shared SSL, try disabling your custom permalink structure. Some public/shared SSL's have issues with WordPress' permalinks because of the way they are configured. If you continue to recieve 404 errors, there is no way to use WordPress with that particular public/shared SSL with WordPress.
31
 
32
  = How do I fix partially encrypted/mixed content errors? =
33
  To identify what is causing your page(s) to be insecure, please follow the instructions below.
48
  </ul>
49
 
50
  = Is there a hook or filter to force pages to be secure? =
51
+ Yes! Here is an example of how to use the 'force_ssl' filter to force a page to be secure.
 
52
  `function custom_force_ssl( $force_ssl, $post_id ) {
53
  if ( $post_id == 5 ) {
54
  return true
72
  1. WordPress HTTPS Settings screen
73
  2. Force SSL checkbox added to add/edit posts screen
74
 
75
+ == To Do ==
76
+ * qTranslate Support
77
+ * SSL Domain Mapping
78
+
79
  == Changelog ==
80
+ = 3.0.4 =
81
+ * Fixed multiple bugs for sites using SSL for the entire site.
82
+ * Bug Fix - plugin should no longer try to load hidden files as modules.
83
  = 3.0.3 =
84
  * Any element on an HTTP page that is set to HTTPS should be auto-corrected.
85
  * Added support for domain mapper plugin.
uninstall.php CHANGED
@@ -11,6 +11,7 @@ delete_option('wordpress-https_external_urls');
11
  delete_option('wordpress-https_secure_external_urls');
12
  delete_option('wordpress-https_unsecure_external_urls');
13
  delete_option('wordpress-https_ssl_host');
 
14
  delete_option('wordpress-https_ssl_port');
15
  delete_option('wordpress-https_exclusive_https');
16
  delete_option('wordpress-https_frontpage');
@@ -19,6 +20,7 @@ delete_option('wordpress-https_ssl_proxy');
19
  delete_option('wordpress-https_ssl_host_subdomain');
20
  delete_option('wordpress-https_version');
21
  delete_option('wordpress-https_debug');
 
22
 
23
  // Delete force_ssl custom_field from posts and pages
24
  delete_metadata('post', null, 'force_ssl', null, true);
11
  delete_option('wordpress-https_secure_external_urls');
12
  delete_option('wordpress-https_unsecure_external_urls');
13
  delete_option('wordpress-https_ssl_host');
14
+ delete_option('wordpress-https_ssl_host_diff');
15
  delete_option('wordpress-https_ssl_port');
16
  delete_option('wordpress-https_exclusive_https');
17
  delete_option('wordpress-https_frontpage');
20
  delete_option('wordpress-https_ssl_host_subdomain');
21
  delete_option('wordpress-https_version');
22
  delete_option('wordpress-https_debug');
23
+ delete_option('wordpress-https_admin_menu');
24
 
25
  // Delete force_ssl custom_field from posts and pages
26
  delete_metadata('post', null, 'force_ssl', null, true);
wordpress-https.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://mvied.com/projects/wordpress-https/
5
  Description: WordPress HTTPS is intended to be an all-in-one solution to using SSL on WordPress sites.
6
  Author: Mike Ems
7
- Version: 3.0.3
8
  Author URI: http://mvied.com/
9
  */
10
 
@@ -32,6 +32,12 @@ $include_paths = array(
32
  );
33
  set_include_path(implode(PATH_SEPARATOR, $include_paths));
34
 
 
 
 
 
 
 
35
  /*
36
  * WordPress HTTPS Reset
37
  * Uncomment the line below (remove the two forward slashes) to reset the plugin to its default settings.
@@ -39,16 +45,10 @@ set_include_path(implode(PATH_SEPARATOR, $include_paths));
39
  */
40
  //define('WPHTTPS_RESET', true);
41
 
42
- require_once('WordPressHTTPS/Url.php');
43
- require_once('WordPressHTTPS/Logger.php');
44
- require_once('WordPressHTTPS/Module.php');
45
- require_once('WordPressHTTPS/Plugin.php');
46
- require_once('WordPressHTTPS.php');
47
-
48
  if ( function_exists('get_bloginfo') && ! defined('WP_UNINSTALL_PLUGIN') ) {
49
  $wordpress_https = new WordPressHTTPS;
50
  $wordpress_https->setSlug('wordpress-https');
51
- $wordpress_https->setVersion('3.0.3');
52
  $wordpress_https->setLogger(WordPressHTTPS_Logger::getInstance());
53
  $wordpress_https->setPluginUrl(plugins_url('', __FILE__));
54
  $wordpress_https->setDirectory(dirname(__FILE__));
4
  Plugin URI: http://mvied.com/projects/wordpress-https/
5
  Description: WordPress HTTPS is intended to be an all-in-one solution to using SSL on WordPress sites.
6
  Author: Mike Ems
7
+ Version: 3.0.4
8
  Author URI: http://mvied.com/
9
  */
10
 
32
  );
33
  set_include_path(implode(PATH_SEPARATOR, $include_paths));
34
 
35
+ function wphttps_autoloader($class) {
36
+ $filename = str_replace('_', '/', $class) . '.php';
37
+ @include $filename;
38
+ }
39
+ spl_autoload_register('wphttps_autoloader');
40
+
41
  /*
42
  * WordPress HTTPS Reset
43
  * Uncomment the line below (remove the two forward slashes) to reset the plugin to its default settings.
45
  */
46
  //define('WPHTTPS_RESET', true);
47
 
 
 
 
 
 
 
48
  if ( function_exists('get_bloginfo') && ! defined('WP_UNINSTALL_PLUGIN') ) {
49
  $wordpress_https = new WordPressHTTPS;
50
  $wordpress_https->setSlug('wordpress-https');
51
+ $wordpress_https->setVersion('3.0.4');
52
  $wordpress_https->setLogger(WordPressHTTPS_Logger::getInstance());
53
  $wordpress_https->setPluginUrl(plugins_url('', __FILE__));
54
  $wordpress_https->setDirectory(dirname(__FILE__));