Skip to content

Commit

Permalink
More scrutinizer cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsternberg committed Feb 15, 2015
1 parent bc48c1b commit 259eb35
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 1 addition & 3 deletions includes/CMB2.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,8 @@ public function object_id( $object_id = 0 ) {
// Try to get our object ID from the global space
switch ( $this->object_type() ) {
case 'user':
if ( ! isset( $this->new_user_page ) ) {
$object_id = isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id;
}
$object_id = isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id;
$object_id = ! $object_id && isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id;
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2_Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* CMB field class
*
* @since 1.1.0
*
* @method string _id()
Expand Down
10 changes: 5 additions & 5 deletions includes/CMB2_Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ public function get_file_ext( $file ) {
/**
* Get the file name from a url
* @since 2.0.0
* @param string $value File url or path
* @return string File name
* @param string $value File url or path
* @return string File name
*/
public function get_file_name_from_path( $url ) {
$parts = explode( '/', $url );
return is_array( $parts ) ? end( $parts ) : $url;
public function get_file_name_from_path( $value ) {
$parts = explode( '/', $value );
return is_array( $parts ) ? end( $parts ) : $value;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion includes/CMB2_hookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ public function post_metabox() {
*/
public function user_new_metabox( $section ) {
if ( $section == $this->cmb->prop( 'new_user_section' ) ) {
$this->cmb->new_user_page = true;
$object_id = $this->cmb->object_id();
$this->cmb->object_id( isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id );
$this->user_metabox();
}
}
Expand Down

0 comments on commit 259eb35

Please sign in to comment.