Files
dostavka_vodi/wp-content/plugins/all-in-one-wp-security-and-firewall/classes/updraftcentral-wp-security-commands.php
User A0264400 a766acdc90 first commit
2026-04-01 23:20:16 +03:00

39 lines
1.1 KiB
PHP

<?php
if (!defined('ABSPATH')) die('Access denied.');
/**
* This is a small glue class, which makes available all the commands in AIOWPSecurity_Commands, and translates the response from AIOWPSecurity_Commands (which is either data to return, or a WP_Error) into the format used by UpdraftCentral.
*/
class UpdraftCentral_WP_Security_Commands extends UpdraftCentral_Commands {
private $commands;
/**
* Class constructor
*/
public function __construct() {
$this->commands = new AIOWPSecurity_Commands();
}
/**
* Magic method to pass on the command to AIOWPSecurity_Commands
*
* @param string $name - command name
* @param array $arguments - command parameters
*
* @return array - response
*/
public function __call($name, $arguments) {
if (!is_callable(array($this->commands, $name))) {
return $this->_generic_error_response('aios_no_such_command', $name);
}
$result = call_user_func_array(array($this->commands, $name), $arguments);
if (is_wp_error($result)) {
return $this->_generic_error_response($result->get_error_code(), $result->get_error_data());
} else {
return $this->_response($result);
}
}
}