@@ -49,8 +49,9 @@ discard block |
||
49 | 49 | if( !in_array($id, $this->metaboxes) ) |
50 | 50 | { |
51 | 51 | $this->metaboxes[$id] = array_merge($this->default_args(), $args); |
52 | + } else { |
|
53 | + throw new \RuntimeException("A metabox with id '$id' has already been registered."); |
|
52 | 54 | } |
53 | - else throw new \RuntimeException("A metabox with id '$id' has already been registered."); |
|
54 | 55 | } |
55 | 56 | |
56 | 57 | /** |
@@ -120,11 +121,14 @@ discard block |
||
120 | 121 | // Check the user's permissions. |
121 | 122 | if( array_key_exists('post_type', $_POST) && 'page' == filter_input(INPUT_POST, 'post_type') ) |
122 | 123 | { |
123 | - if( !current_user_can('edit_page', $post_id) ) return $post_id; |
|
124 | - } |
|
125 | - else |
|
124 | + if( !current_user_can('edit_page', $post_id) ) { |
|
125 | + return $post_id; |
|
126 | + } |
|
127 | + } else |
|
126 | 128 | { |
127 | - if( !current_user_can('edit_post', $post_id) ) return $post_id; |
|
129 | + if( !current_user_can('edit_post', $post_id) ) { |
|
130 | + return $post_id; |
|
131 | + } |
|
128 | 132 | } |
129 | 133 | |
130 | 134 | // Update the meta fields. |