Permalink
Browse files

Fixed upload_path check in unsecureElement in Parser.

  • Loading branch information...
1 parent 551d872 commit 67ad7cdcf2880a0a5d81e8508f25b8a3c8376e85 @mvied committed Feb 17, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/WordPressHTTPS/Module/Parser.php
@@ -112,6 +112,9 @@ public function secureElement( $url, $type = '' ) {
*/
public function unsecureElement( $url, $type = '' ) {
$updated = false;
+ $result = false;
+ $upload_dir = wp_upload_dir();
+ $upload_path = str_replace($this->getPlugin()->getHttpsUrl()->getPath(), $this->getPlugin()->getHttpUrl()->getPath(), parse_url($upload_dir['baseurl'], PHP_URL_PATH));
if ( ! is_admin() || ( is_admin() && strpos($url, $upload_path) === false ) ) {
$updated = $this->getPlugin()->makeUrlHttp($url);
@@ -121,10 +124,13 @@ public function unsecureElement( $url, $type = '' ) {
// Add log entry if this change hasn't been logged
if ( $updated && $url != $updated ) {
$log = '[FIXED] Element: ' . ( $type != '' ? '<' . $type . '> ' : '' ) . $url . ' => ' . $updated;
+ $result = true;
}
if ( isset($log) && ! in_array($log, $this->getPlugin()->getLogger()->getLog()) ) {
$this->getPlugin()->getLogger()->log($log);
}
+
+ return $result;
}
/**

0 comments on commit 67ad7cd

Please sign in to comment.