lubuntu.me/plugins/all-in-one-wp-migration/lib/controller/class-ai1wm-status-controller.php

52 lines
2.4 KiB
PHP
Raw Normal View History

2018-01-26 15:50:15 +01:00
<?php
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
class Ai1wm_Status_Controller {
public static function status( $params = array() ) {
// Set params
if ( empty( $params ) ) {
$params = stripslashes_deep( $_REQUEST );
}
// Set secret key
$secret_key = null;
if ( isset( $params['secret_key'] ) ) {
$secret_key = trim( $params['secret_key'] );
}
try {
// Ensure that unauthorized people cannot access status action
ai1wm_verify_secret_key( $secret_key );
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
exit;
}
echo json_encode( get_option( AI1WM_STATUS, array() ) );
exit;
}
}