Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

put better checks in place to fix issue with parse_url not having a p…

…roper url to parse
  • Loading branch information...
commit ebebcd7a5058af934549244b89b394ef5bf7f721 1 parent ee0c38c
@farinspace authored
Showing with 19 additions and 16 deletions.
  1. +19 −16 wp-content/wpalchemy/MetaBox.php
View
35 wp-content/wpalchemy/MetaBox.php
@@ -5,7 +5,7 @@
* @copyright Copyright (c) 2009, Dimas Begunoff, http://farinspace.com
* @license http://en.wikipedia.org/wiki/MIT_License The MIT License
* @package WPAlchemy
- * @version 1.4.16
+ * @version 1.4.17
* @link http://github.com/farinspace/wpalchemy
* @link http://farinspace.com
*/
@@ -1017,26 +1017,29 @@ function _get_current_post_type()
{
$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : NULL ;
- $uri_parts = parse_url($uri);
+ if ( isset( $uri ) )
+ {
+ $uri_parts = parse_url($uri);
- $file = basename($uri_parts['path']);
+ $file = basename($uri_parts['path']);
- if ($uri AND in_array($file, array('post.php', 'post-new.php')))
- {
- $post_id = WPAlchemy_MetaBox::_get_post_id();
+ if ($uri AND in_array($file, array('post.php', 'post-new.php')))
+ {
+ $post_id = WPAlchemy_MetaBox::_get_post_id();
- $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : NULL ;
+ $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : NULL ;
- $post_type = $post_id ? get_post_type($post_id) : $post_type ;
+ $post_type = $post_id ? get_post_type($post_id) : $post_type ;
- if (isset($post_type))
- {
- return $post_type;
- }
- else
- {
- // because of the 'post.php' and 'post-new.php' checks above, we can default to 'post'
- return 'post';
+ if (isset($post_type))
+ {
+ return $post_type;
+ }
+ else
+ {
+ // because of the 'post.php' and 'post-new.php' checks above, we can default to 'post'
+ return 'post';
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.