Navigation Menu

Skip to content

Commit

Permalink
Cleaned up possible PHP Notices.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Ems committed Apr 1, 2013
1 parent 6aa0024 commit 3ec003b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/Mvied
Submodule Mvied updated 1 files
+8 −8 Url.php
3 changes: 2 additions & 1 deletion lib/WordPressHTTPS/Module/Core.php
Expand Up @@ -545,10 +545,11 @@ public function set_headers() {
* @return void
*/
public function set_cookie($cookie, $expire, $expiration, $user_id, $scheme) {
$secure = null;
if ( ( $scheme == 'secure_auth' && $this->getPlugin()->isSsl() ) || ( ( ( defined('FORCE_SSL_ADMIN') && constant('FORCE_SSL_ADMIN') ) || $this->getPlugin()->getSetting('ssl_admin') ) && ! $this->getPlugin()->getSetting('ssl_host_subdomain') ) ) {
$secure = true;
}
$secure = apply_filters('secure_auth_cookie', @$secure, $user_id);
$secure = apply_filters('secure_auth_cookie', $secure, $user_id);

if( $scheme == 'logged_in' ) {
$cookie_name = LOGGED_IN_COOKIE;
Expand Down
6 changes: 3 additions & 3 deletions lib/WordPressHTTPS/Module/Post.php
Expand Up @@ -65,7 +65,7 @@ public function post_save( $post_id ) {
return $post_id;
}

if ( @$_POST['post_type'] == 'page' ) {
if ( isset($_POST['post_type']) && $_POST['post_type'] == 'page' ) {
if ( !current_user_can('edit_page', $post_id) ) {
return $post_id;
}
Expand All @@ -75,14 +75,14 @@ public function post_save( $post_id ) {
}
}

$force_ssl = ( @$_POST['force_ssl'] == 1 ? true : false);
$force_ssl = ( isset($_POST['force_ssl']) && $_POST['force_ssl'] == 1 ? true : false);
if ( $force_ssl ) {
update_post_meta($post_id, 'force_ssl', 1);
} else {
delete_post_meta($post_id, 'force_ssl');
}

$force_ssl_children = ( @$_POST['force_ssl_children'] == 1 ? true : false);
$force_ssl_children = ( isset($_POST['force_ssl_children']) && $_POST['force_ssl_children'] == 1 ? true : false);
if ( $force_ssl_children ) {
update_post_meta($post_id, 'force_ssl_children', 1);
} else {
Expand Down
12 changes: 6 additions & 6 deletions lib/WordPressHTTPS/Module/UrlMapping.php
Expand Up @@ -43,11 +43,11 @@ public function init() {
public function map_http_url( $url ) {
if ( is_array($this->getPlugin()->getSetting('ssl_host_mapping')) && sizeof($this->getPlugin()->getSetting('ssl_host_mapping')) > 0 ) {
foreach( $this->getPlugin()->getSetting('ssl_host_mapping') as $mapping ) {
if ( !is_array($mapping) || @$mapping[1]['scheme'] != 'http' ) {
if ( !is_array($mapping) || ( isset($mapping[1]['scheme']) && $mapping[1]['scheme'] != 'http' ) ) {
continue;
}
$http_url = 'http://' . @$mapping[1]['host'];
$https_url = 'https://' . @$mapping[0]['host'];
$http_url = 'http://' . ( isset($mapping[1]['host']) ? $mapping[1]['host'] : '' );
$https_url = 'https://' . ( isset($mapping[0]['host']) ? $mapping[0]['host'] : '' );
preg_match('|' . $https_url . '|', $url, $matches);
if ( sizeof($matches) > 0 ) {
$url = preg_replace('|' . $https_url . '|', $http_url, $url);
Expand All @@ -66,11 +66,11 @@ public function map_http_url( $url ) {
public function map_https_url( $url ) {
if ( is_array($this->getPlugin()->getSetting('ssl_host_mapping')) && sizeof($this->getPlugin()->getSetting('ssl_host_mapping')) > 0 ) {
foreach( $this->getPlugin()->getSetting('ssl_host_mapping') as $mapping ) {
if ( !is_array($mapping) || @$mapping[1]['scheme'] != 'https' ) {
if ( !is_array($mapping) || ( isset($mapping[1]['scheme']) && $mapping[1]['scheme'] != 'https' ) ) {
continue;
}
$http_url = 'http://' . @$mapping[0]['host'];
$https_url = 'https://' . @$mapping[1]['host'];
$http_url = 'http://' . ( isset($mapping[0]['host']) ? $mapping[0]['host'] : '' );
$https_url = 'https://' . ( isset($mapping[1]['host']) ? $mapping[1]['host'] : '' );
preg_match('|' . $http_url . '|', $url, $matches);
if ( sizeof($matches) > 0 ) {
$url = preg_replace('|' . $http_url . '|', $https_url, $url);
Expand Down
12 changes: 6 additions & 6 deletions view/metabox/url_filters.php
Expand Up @@ -11,7 +11,7 @@
<tr valign="top">
<td colspan="2"><h4><?php _e('Secure Filters','wordpress-https'); ?></h4></td>
</tr>
<?php if ( sizeof($this->getSetting('secure_filter')) > 0 ) { foreach ( (array)$this->getSetting('secure_filter') as $filter ) { ?>
<?php if ( sizeof($this->getSetting('secure_filter')) > 0 ) : foreach ( (array)$this->getSetting('secure_filter') as $filter ) : ?>
<tr valign="top" class="secure_url_filters_row">
<td>
<input type="text" name="secure_url_filters[]" value="<?php echo $filter; ?>" />
Expand All @@ -21,7 +21,7 @@
<a class="add" href="#" title="<?php _e('Add URL Filter','wordpress-https'); ?>"><?php _e('Add','wordpress-https'); ?></a>
</td>
</tr>
<?php } } else { ?>
<?php endforeach; else: ?>
<tr valign="top" class="secure_url_filters_row">
<td>
<input type="text" name="secure_url_filters[]" value="" />
Expand All @@ -31,14 +31,14 @@
<a class="add" href="#" title="<?php _e('Add URL Filter','wordpress-https'); ?>"><?php _e('Add','wordpress-https'); ?></a>
</td>
</tr>
<?php } ?>
<?php endif; ?>
</table>

<table class="form-table url_filters" id="unsecure_url_filters">
<tr valign="top">
<td colspan="2"><h4><?php _e('Unsecure Filters','wordpress-https'); ?></h4></td>
</tr>
<?php if ( sizeof($this->getSetting('unsecure_filter')) > 0 ) { foreach ( (array)$this->getSetting('unsecure_filter') as $filter ) { ?>
<?php if ( sizeof($this->getSetting('unsecure_filter')) > 0 ) : foreach ( (array)$this->getSetting('unsecure_filter') as $filter ) : ?>
<tr valign="top" class="unsecure_url_filters_row">
<td>
<input type="text" name="unsecure_url_filters[]" value="<?php echo $filter; ?>" />
Expand All @@ -48,7 +48,7 @@
<a class="add" href="#" title="<?php _e('Add URL Filter','wordpress-https'); ?>"><?php _e('Add','wordpress-https'); ?></a>
</td>
</tr>
<?php } } else { ?>
<?php endforeach; else: ?>
<tr valign="top" class="unsecure_url_filters_row">
<td>
<input type="text" name="unsecure_url_filters[]" value="" />
Expand All @@ -58,7 +58,7 @@
<a class="add" href="#" title="<?php _e('Add URL Filter','wordpress-https'); ?>"><?php _e('Add','wordpress-https'); ?></a>
</td>
</tr>
<?php } ?>
<?php endif; ?>
</table>

<p class="button-controls">
Expand Down
8 changes: 4 additions & 4 deletions view/metabox/url_mapping.php
Expand Up @@ -55,8 +55,8 @@
<tr valign="top" class="url_mapping_row">
<td class="scheme">
<select name="url_mapping[scheme][]">
<option<?php echo @$mapping[0]['scheme'] == 'http' ? ' selected="selected"' : ''; ?>>http</option>
<option<?php echo @$mapping[0]['scheme'] == 'https' ? ' selected="selected"' : ''; ?>>https</option>
<option<?php echo isset($mapping[0]['scheme']) && $mapping[0]['scheme'] == 'http' ? ' selected="selected"' : ''; ?>>http</option>
<option<?php echo isset($mapping[0]['scheme']) && $mapping[0]['scheme'] == 'https' ? ' selected="selected"' : ''; ?>>https</option>
</select>
</td>
<td class="sep">
Expand All @@ -70,8 +70,8 @@
</td>
<td class="scheme">
<select name="url_mapping[scheme][]">
<option<?php echo @$mapping[1]['scheme'] == 'https' ? ' selected="selected"' : ''; ?>>https</option>
<option<?php echo @$mapping[1]['scheme'] == 'http' ? ' selected="selected"' : ''; ?>>http</option>
<option<?php echo isset($mapping[1]['scheme']) && $mapping[1]['scheme'] == 'https' ? ' selected="selected"' : ''; ?>>https</option>
<option<?php echo isset($mapping[1]['scheme']) && $mapping[1]['scheme'] == 'http' ? ' selected="selected"' : ''; ?>>http</option>
</select>
</td>
<td class="sep">
Expand Down

0 comments on commit 3ec003b

Please sign in to comment.