if (class_exists('WPRP_Log')) { WPRP_Log::get_instance()->disable_logging(); } // Disable error_reporting so they don't break the json request if (!defined('WP_DEBUG') || !WP_DEBUG) { error_reporting(0); } // Temp hack so our requests to verify file size are signed. global $wprp_noauth_nonce; $wprp_noauth_nonce = wp_create_nonce('wprp_calculate_backup_size'); // Log in as admin // TODO what about if admin use doesn't exists? wp_set_current_user(1); include_once ABSPATH . 'wp-admin/includes/admin.php'; $actions = array(); foreach (WPR_API_Request::get_actions() as $action) { // TODO Instead should just fire actions which we hook into. // TODO should namespace api methods? switch ($action) { // TODO should be dynamic case 'get_plugin_version': $actions[$action] = '1.1'; break; case 'get_filesystem_method': $actions[$action] = get_filesystem_method(); break; case 'get_supported_filesystem_methods': $actions[$action] = array(); if (extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen')) { $actions[$action][] = 'ftp'; }