shorten up verify_nonces

This commit is contained in:
John Bintz 2010-01-14 16:24:25 -05:00
parent f934e95449
commit e0e830e399
1 changed files with 10 additions and 16 deletions

View File

@ -518,22 +518,16 @@ class ComicPressAdmin {
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
function verify_nonces() { function verify_nonces() {
if (isset($_REQUEST['cp'])) { if (isset($_REQUEST['cp']['_nonce'])) {
if (is_array($_REQUEST['cp'])) { if (wp_verify_nonce($_REQUEST['cp']['_nonce'], 'comicpress')) {
if (isset($_REQUEST['cp']['_nonce'])) { if (isset($_POST['attachments'])) {
if (wp_verify_nonce($_REQUEST['cp']['_nonce'], 'comicpress')) { //coming from media editor
if (isset($_POST['attachments'])) { return 'attachments';
//coming from media editor } else if (isset($_REQUEST['cp']['action'], $_REQUEST['cp']['_action_nonce'])) {
return 'attachments'; $action = $_REQUEST['cp']['action'];
} else if (isset($_REQUEST['cp']['action'])) { if (wp_verify_nonce($_REQUEST['cp']['_action_nonce'], "comicpress-${action}")) {
$action = $_REQUEST['cp']['action']; $method = 'handle_update_' . strtolower(str_replace('-', '_', $action));
if (isset($_REQUEST['cp']['_action_nonce'])) { return $method;
if (wp_verify_nonce($_REQUEST['cp']['_action_nonce'], "comicpress-${action}")) {
$method = 'handle_update_' . strtolower(str_replace('-', '_', $action));
return $method;
}
}
}
} }
} }
} }