diff --git a/.zipignore b/.zipignore index d410737..2e2cd71 100644 --- a/.zipignore +++ b/.zipignore @@ -3,7 +3,7 @@ .git/* wordpress/* tests/* -compose* +compose.yml Dockerfile test.sh xdebug.ini diff --git a/PluginPage/AdminNotices.php b/PluginPage/AdminNotices.php index 9167ed5..f5bdf2f 100644 --- a/PluginPage/AdminNotices.php +++ b/PluginPage/AdminNotices.php @@ -19,11 +19,11 @@ public static function add_notice( $text ) { } public function save_notices() { - update_option('GdataAntivirusMenuNotices', self::$notices); + update_option('gdatacyberdefenseag_antivirus_notices', self::$notices); } public function output_notices() { - $notices = maybe_unserialize(get_option('GdataAntivirusMenuNotices')); + $notices = maybe_unserialize(get_option('gdatacyberdefenseag_antivirus_notices')); if (! empty($notices)) { echo '
'; @@ -34,7 +34,7 @@ public function output_notices() { echo '
'; - delete_option('GdataAntivirusMenuNotices'); + delete_option('gdatacyberdefenseag_antivirus_notices'); } } } diff --git a/PluginPage/Findings/FindingsMenuPage.php b/PluginPage/Findings/FindingsMenuPage.php index 1fe9037..6ac1d8a 100644 --- a/PluginPage/Findings/FindingsMenuPage.php +++ b/PluginPage/Findings/FindingsMenuPage.php @@ -28,8 +28,8 @@ public function __construct( $this->logger = $logger; $this->admin_notices = $admin_notices; - register_activation_hook(WORDPRESS_GDATA_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__, array( $this, 'create_findings_table' )); - register_deactivation_hook(WORDPRESS_GDATA_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__, array( $this, 'remove_findings_table' )); + register_activation_hook(GDATACYBERDEFENCEAG_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__, array( $this, 'create_findings_table' )); + register_deactivation_hook(GDATACYBERDEFENCEAG_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__, array( $this, 'remove_findings_table' )); if ($this->get_findings_count() === 0) { return; @@ -41,7 +41,7 @@ public function __construct( private function get_table_name(): string { $this->logger->debug('FindingsMenuPage::get_table_name'); - return $this->database->get_prefix(). WORDPRESS_GDATA_ANTIVIRUS_MENU_FINDINGS_TABLE_NAME; + return $this->database->get_prefix(). GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FINDINGS_TABLE_NAME; } public function create_findings_table() { @@ -134,11 +134,11 @@ public function get_findings_count(): int { public function setup_menu(): void { \add_submenu_page( - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, 'Scan Findings', 'Scan Findings ' . $this->get_findings_count() . '', 'manage_options', - WORDPRESS_GDATA_ANTIVIRUS_MENU_FINDINGS_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FINDINGS_SLUG, array( $this, 'findings_list' ) ); } diff --git a/PluginPage/FullScan/FullScanMenuPage.php b/PluginPage/FullScan/FullScanMenuPage.php index e1e11f2..ca0c9bd 100644 --- a/PluginPage/FullScan/FullScanMenuPage.php +++ b/PluginPage/FullScan/FullScanMenuPage.php @@ -32,8 +32,8 @@ public function __construct( $this->logger = $logger; $this->database = $database; - register_activation_hook(WORDPRESS_GDATA_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__, array( $this, 'create_full_scan_operations_table' )); - register_deactivation_hook(WORDPRESS_GDATA_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__, array( $this, 'remove_full_scan_operations_table' )); + register_activation_hook(GDATACYBERDEFENCEAG_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__, array( $this, 'create_full_scan_operations_table' )); + register_deactivation_hook(GDATACYBERDEFENCEAG_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__, array( $this, 'remove_full_scan_operations_table' )); if (! $vaas_options->credentials_configured()) { return; @@ -44,9 +44,9 @@ public function __construct( \add_action('init', array( $this, 'setup_fields' )); \add_action('admin_menu', array( $this, 'setup_menu' )); \add_action('admin_post_full_scan', array( $this, 'full_scan_interactive' )); - \add_action('wordpress_gdata_antivirus_scheduled_full_scan', array( $this, 'full_scan' )); + \add_action('gdatacyberdefenseag_antivirus_scheduled_full_scan', array( $this, 'full_scan' )); \add_action( - 'wordpress_gdata_antivirus_scan_batch', + 'gdatacyberdefenseag_antivirus_scan_batch', array( $this, 'scan_batch' ), ); @@ -54,26 +54,26 @@ public function __construct( } private function setup_scheduled_scan() { - $full_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_full_scan_schedule_enabled', false); - $schedule_start = \get_option('wordpress_gdata_antivirus_options_full_scan_schedule_start', '01:00'); - $next = wp_next_scheduled('wordpress_gdata_antivirus_scheduled_full_scan'); + $full_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_enabled', false); + $schedule_start = \get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', '01:00'); + $next = wp_next_scheduled('gdatacyberdefenseag_antivirus_scheduled_full_scan'); if (! $full_scan_enabled && $next) { - \wp_unschedule_event($next, 'wordpress_gdata_antivirus_scheduled_full_scan'); + \wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan'); return; } if ($full_scan_enabled && ! $next) { $timestamp = strtotime($schedule_start); $this->logger->debug('schedule start timestamp: ' . $timestamp); - \wp_schedule_event($timestamp, 'daily', 'wordpress_gdata_antivirus_scheduled_full_scan'); + \wp_schedule_event($timestamp, 'daily', 'gdatacyberdefenseag_antivirus_scheduled_full_scan'); return; } $nextschedule_start = gmdate('H:i', $next); if ($nextschedule_start !== $schedule_start) { - \wp_unschedule_event($next, 'wordpress_gdata_antivirus_scheduled_full_scan'); + \wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan'); $timestamp = strtotime($schedule_start); - \wp_schedule_event($timestamp, 'daily', 'wordpress_gdata_antivirus_scheduled_full_scan'); + \wp_schedule_event($timestamp, 'daily', 'gdatacyberdefenseag_antivirus_scheduled_full_scan'); } } @@ -91,7 +91,7 @@ public function create_full_scan_operations_table() { } private function get_table_name(): string { - return $this->database->get_prefix() . WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS_TABLE_NAME; + return $this->database->get_prefix() . GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS_TABLE_NAME; } public function lock_scan_operations_table() { @@ -128,26 +128,26 @@ public function reset_scan_operations(): void { public function setup_fields(): void { \register_setting( - 'wordpress_gdata_antivirus_options_full_scan_run', - 'wordpress_gdata_antivirus_options_full_scan_batch_size', + 'gdatacyberdefenseag_antivirus_options_full_scan_run', + 'gdatacyberdefenseag_antivirus_options_full_scan_batch_size', array( 'type' => 'number', 'default' => 100, - 'sanitize_callback' => array( $this, 'wordpress_gdata_antivirus_options_full_scan_batch_size_validation' ), + 'sanitize_callback' => array( $this, 'gdatacyberdefenseag_antivirus_options_full_scan_batch_size_validation' ), ) ); \register_setting( - 'wordpress_gdata_antivirus_options_full_scan_run', - 'wordpress_gdata_antivirus_options_full_scan_schedule_start', + 'gdatacyberdefenseag_antivirus_options_full_scan_run', + 'gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', array( 'type' => 'string', 'default' => '01:00', - 'sanitize_callback' => array( $this, 'wordpress_gdata_antivirus_options_full_scan_schedule_start_validation' ), + 'sanitize_callback' => array( $this, 'gdatacyberdefenseag_antivirus_options_full_scan_schedule_start_validation' ), ) ); \register_setting( - 'wordpress_gdata_antivirus_options_full_scan_run', - 'wordpress_gdata_antivirus_options_full_scan_schedule_enabled', + 'gdatacyberdefenseag_antivirus_options_full_scan_run', + 'gdatacyberdefenseag_antivirus_options_full_scan_schedule_enabled', array( 'type' => 'boolean', 'default' => false, @@ -157,70 +157,70 @@ public function setup_fields(): void { public function setup_menu(): void { \add_settings_section( - 'wordpress_gdata_antivirus_options_full_scan', + 'gdatacyberdefenseag_antivirus_options_full_scan', esc_html__('Full Scan', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_full_scan_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_SLUG + array( $this, 'gdatacyberdefenseag_antivirus_options_full_scan_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_SLUG ); \add_settings_field( - 'wordpress_gdata_antivirus_options_full_scan_batch_size', + 'gdatacyberdefenseag_antivirus_options_full_scan_batch_size', esc_html__('Batch Size', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_full_scan_batch_size_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_SLUG, - 'wordpress_gdata_antivirus_options_full_scan' + array( $this, 'gdatacyberdefenseag_antivirus_options_full_scan_batch_size_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_SLUG, + 'gdatacyberdefenseag_antivirus_options_full_scan' ); \add_settings_field( - 'wordpress_gdata_antivirus_options_full_scan_schedule_enabled', + 'gdatacyberdefenseag_antivirus_options_full_scan_schedule_enabled', esc_html__('Scheduled Scan enabled', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_full_scan_schedule_enabled_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_SLUG, - 'wordpress_gdata_antivirus_options_full_scan' + array( $this, 'gdatacyberdefenseag_antivirus_options_full_scan_schedule_enabled_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_SLUG, + 'gdatacyberdefenseag_antivirus_options_full_scan' ); \add_settings_field( - 'wordpress_gdata_antivirus_options_full_scan_schedule_start', + 'gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', esc_html__('Scheduled Scan starting Hour', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_full_scan_schedule_start_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_SLUG, - 'wordpress_gdata_antivirus_options_full_scan' + array( $this, 'gdatacyberdefenseag_antivirus_options_full_scan_schedule_start_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_SLUG, + 'gdatacyberdefenseag_antivirus_options_full_scan' ); \add_submenu_page( - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, 'Full scan', 'Full scan', 'manage_options', - WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_SLUG, array( $this, 'full_scan_menu' ) ); } - public function wordpress_gdata_antivirus_options_full_scan_batch_size_validation( $value ) { - $option = get_option('wordpress_gdata_antivirus_options_full_scan_batch_size', 100); + public function gdatacyberdefenseag_antivirus_options_full_scan_batch_size_validation( $value ) { + $option = get_option('gdatacyberdefenseag_antivirus_options_full_scan_batch_size', 100); if (0 === $value) { $value = $option; add_settings_error( - 'wordpress_gdata_antivirus_options_full_scan_batch_size', - 'wordpress_gdata_antivirus_options_full', - __('batch_size cannot be 0') + 'gdatacyberdefenseag_antivirus_options_full_scan_batch_size', + 'gdatacyberdefenseag_antivirus_options_full', + __('batch_size cannot be 0', 'gdata-antivirus') ); } if ($value < 100) { $value = $option; add_settings_error( - 'wordpress_gdata_antivirus_options_full_scan_batch_size', - 'wordpress_gdata_antivirus_options_full', - __('batch_size should be at least 100') + 'gdatacyberdefenseag_antivirus_options_full_scan_batch_size', + 'gdatacyberdefenseag_antivirus_options_full', + __('batch_size should be at least 100', 'gdata-antivirus') ); } return $value; } - public function wordpress_gdata_antivirus_options_full_scan_schedule_start_validation( $value ) { - $option = get_option('wordpress_gdata_antivirus_options_full_scan_schedule_start', '01:00'); - $full_scan_enabled = get_option('wordpress_gdata_antivirus_options_full_scan_schedule_enabled', false); + public function gdatacyberdefenseag_antivirus_options_full_scan_schedule_start_validation( $value ) { + $option = get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', '01:00'); + $full_scan_enabled = get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_enabled', false); if (! $full_scan_enabled) { return $option; @@ -228,35 +228,35 @@ public function wordpress_gdata_antivirus_options_full_scan_schedule_start_valid if (preg_match('#^[0-9]{2}:[0-9]{2}$#', $value) !== 1) { $value = $option; add_settings_error( - 'wordpress_gdata_antivirus_options_full_scan_schedule_start', - 'wordpress_gdata_antivirus_options_full_scan', - __('schedule start must be of format H:i') + 'gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', + 'gdatacyberdefenseag_antivirus_options_full_scan', + __('schedule start must be of format H:i', 'gdata-antivirus') ); } return $value; } - public function wordpress_gdata_antivirus_options_full_scan_text() { + public function gdatacyberdefenseag_antivirus_options_full_scan_text() { echo '

' . esc_html__('Here you can set options for the full scan', 'gdata-antivirus') . '

'; } - public function wordpress_gdata_antivirus_options_full_scan_schedule_enabled_text() { - $full_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_full_scan_schedule_enabled', false); - echo ""; + public function gdatacyberdefenseag_antivirus_options_full_scan_schedule_enabled_text() { + $full_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_enabled', false); + echo ""; } - public function wordpress_gdata_antivirus_options_full_scan_batch_size_text() { - $batch_size = \get_option('wordpress_gdata_antivirus_options_full_scan_batch_size', 100); - echo ""; + public function gdatacyberdefenseag_antivirus_options_full_scan_batch_size_text() { + $batch_size = \get_option('gdatacyberdefenseag_antivirus_options_full_scan_batch_size', 100); + echo ""; } - public function wordpress_gdata_antivirus_options_full_scan_schedule_start_text() { - $schedule_start = \get_option('wordpress_gdata_antivirus_options_full_scan_schedule_start', '01:00'); + public function gdatacyberdefenseag_antivirus_options_full_scan_schedule_start_text() { + $schedule_start = \get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', '01:00'); $full_scan_enabled = - (bool) \get_option('wordpress_gdata_antivirus_options_full_scan_schedule_enabled', false); + (bool) \get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_enabled', false); $this->logger->debug('schedule_start: ' . $schedule_start); - echo "'; + echo "'; } public function full_scan_interactive(): void { @@ -285,7 +285,7 @@ public function full_scan_interactive(): void { public function full_scan(): void { $this->admin_notices->add_notice(__('Full Scan started', 'gdata-antivirus')); - $batch_size = \get_option('wordpress_gdata_antivirus_options_full_scan_batch_size', 100); + $batch_size = \get_option('gdatacyberdefenseag_antivirus_options_full_scan_batch_size', 100); $it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ABSPATH, \FilesystemIterator::SKIP_DOTS)); $files = array(); foreach ($it as $file_path) { @@ -300,13 +300,13 @@ public function full_scan(): void { if (count($files) >= $batch_size) { $this->increase_scheduled_scans(); - \wp_schedule_single_event(time(), 'wordpress_gdata_antivirus_scan_batch', array( 'files' => $files )); + \wp_schedule_single_event(time(), 'gdatacyberdefenseag_antivirus_scan_batch', array( 'files' => $files )); $files = array(); } } if (count($files) > 0) { $this->increase_scheduled_scans(); - \wp_schedule_single_event(time(), 'wordpress_gdata_antivirus_scan_batch', array( 'files' => $files )); + \wp_schedule_single_event(time(), 'gdatacyberdefenseag_antivirus_scan_batch', array( 'files' => $files )); } } @@ -339,14 +339,14 @@ public function scan_batch( array $files ): void { } public function full_scan_menu(): void { - settings_errors('wordpress_gdata_antivirus_options_full_scan_schedule_start'); - settings_errors('wordpress_gdata_antivirus_options_full_scan_batch_size'); + settings_errors('gdatacyberdefenseag_antivirus_options_full_scan_schedule_start'); + settings_errors('gdatacyberdefenseag_antivirus_options_full_scan_batch_size'); ?>

Full Scan Settings

diff --git a/PluginPage/GdataAntivirusMenuPage.php b/PluginPage/GdataAntivirusMenuPage.php index 704c0ec..b09234e 100644 --- a/PluginPage/GdataAntivirusMenuPage.php +++ b/PluginPage/GdataAntivirusMenuPage.php @@ -27,59 +27,59 @@ public function __construct( public function setup_menu(): void { \add_settings_section( - 'wordpress_gdata_antivirus_options_credentials', + 'gdatacyberdefenseag_antivirus_options_credentials', esc_html__('Credentials', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_credentials_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG + array( $this, 'gdatacyberdefenseag_antivirus_credentials_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG ); \add_settings_field( - 'wordpress_gdata_antivirus_credentials_authentication_method', + 'gdatacyberdefenseag_antivirus_credentials_authentication_method', esc_html__('Authentication Method', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_credentials_authentication_method_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, - 'wordpress_gdata_antivirus_options_credentials' + array( $this, 'gdatacyberdefenseag_antivirus_credentials_authentication_method_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, + 'gdatacyberdefenseag_antivirus_options_credentials' ); \add_settings_field( - 'wordpress_gdata_antivirus_credentials_client_id', + 'gdatacyberdefenseag_antivirus_credentials_client_id', esc_html__('Client ID', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_credentials_client_id_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, - 'wordpress_gdata_antivirus_options_credentials' + array( $this, 'gdatacyberdefenseag_antivirus_credentials_client_id_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, + 'gdatacyberdefenseag_antivirus_options_credentials' ); \add_settings_field( - 'wordpress_gdata_antivirus_credentials_client_secret', + 'gdatacyberdefenseag_antivirus_credentials_client_secret', esc_html__('Client Secret', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_credentials_client_secret_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, - 'wordpress_gdata_antivirus_options_credentials' + array( $this, 'gdatacyberdefenseag_antivirus_credentials_client_secret_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, + 'gdatacyberdefenseag_antivirus_options_credentials' ); \add_settings_field( - 'wordpress_gdata_antivirus_credentials_username', + 'gdatacyberdefenseag_antivirus_credentials_username', esc_html__('Username', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_credentials_username_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, - 'wordpress_gdata_antivirus_options_credentials' + array( $this, 'gdatacyberdefenseag_antivirus_credentials_username_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, + 'gdatacyberdefenseag_antivirus_options_credentials' ); \add_settings_field( - 'wordpress_gdata_antivirus_credentials_password', + 'gdatacyberdefenseag_antivirus_credentials_password', esc_html__('Password', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_credentials_password_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, - 'wordpress_gdata_antivirus_options_credentials' + array( $this, 'gdatacyberdefenseag_antivirus_credentials_password_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, + 'gdatacyberdefenseag_antivirus_options_credentials' ); \add_settings_field( - 'wordpress_gdata_antivirus_credentials_vaas_url', + 'gdatacyberdefenseag_antivirus_credentials_vaas_url', esc_html__('VaaS-Url', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_credentials_vaas_url_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, - 'wordpress_gdata_antivirus_options_credentials' + array( $this, 'gdatacyberdefenseag_antivirus_credentials_vaas_url_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, + 'gdatacyberdefenseag_antivirus_options_credentials' ); \add_settings_field( - 'wordpress_gdata_antivirus_credentials_token_endpoint', + 'gdatacyberdefenseag_antivirus_credentials_token_endpoint', esc_html__('Token-Endpoint', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_credentials_token_endpoint_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, - 'wordpress_gdata_antivirus_options_credentials' + array( $this, 'gdatacyberdefenseag_antivirus_credentials_token_endpoint_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, + 'gdatacyberdefenseag_antivirus_options_credentials' ); $count = $this->findings_menu_page->get_findings_count(); @@ -89,16 +89,16 @@ public function setup_menu(): void { 'G DATA VaaS', $menu_title, 'manage_options', - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, array( $this, 'credentials_menu_item' ), \plugin_dir_url(__FILE__) . '../PluginPage/assets/gdata16.png' ); \add_submenu_page( - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, $menu_title, 'Credentials', 'manage_options', - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, array( $this, 'credentials_menu_item' ) ); } else { @@ -106,16 +106,16 @@ public function setup_menu(): void { 'G DATA VaaS', 'VaaS', 'manage_options', - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, array( $this, 'credentials_menu_item' ), \plugin_dir_url(__FILE__) . '../PluginPage/assets/gdata16.png' ); \add_submenu_page( - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, 'VaaS', 'Credentials', 'manage_options', - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, array( $this, 'credentials_menu_item' ) ); } @@ -123,7 +123,7 @@ public function setup_menu(): void { public function enqueue_scripts( $hook_suffix ): void { \wp_enqueue_script( - 'wordpress_gdata_antivirus_options_credentials_authentication_method_toggle', + 'gdatacyberdefenseag_antivirus_options_credentials_authentication_method_toggle', \plugin_dir_url(__FILE__) . '/js/authentication-method-toggle.js', array(), "1.0.0", @@ -131,60 +131,60 @@ public function enqueue_scripts( $hook_suffix ): void { ); } - public function wordpress_gdata_antivirus_credentials_text() { + public function gdatacyberdefenseag_antivirus_credentials_text() { ?>

vaas_options->get_options(); ?> - "; "; "; vaas_options->get_options(); ?> - ' /> + ' /> vaas_options->get_options(); ?> - ' /> + ' /> vaas_options->get_options(); ?> - ' /> + ' /> vaas_options->get_options(); ?> - ' /> + ' /> vaas_options->get_options(); ?> - ' /> + ' /> vaas_options->get_options(); ?> - ' /> + ' /> VaaS Settings
diff --git a/PluginPage/OnDemandScan/OnDemandScan.php b/PluginPage/OnDemandScan/OnDemandScan.php index 9da56e2..fd48677 100644 --- a/PluginPage/OnDemandScan/OnDemandScan.php +++ b/PluginPage/OnDemandScan/OnDemandScan.php @@ -21,132 +21,132 @@ public function __construct( public function setup_fields(): void { \register_setting( - 'wordpress_gdata_antivirus_options_on_demand_scan', - 'wordpress_gdata_antivirus_options_on_demand_scan_media_upload_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_media_upload_scan_enabled', array( 'type' => 'boolean', - 'default' => false, + 'default' => true, ) ); \register_setting( - 'wordpress_gdata_antivirus_options_on_demand_scan', - 'wordpress_gdata_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', array( 'type' => 'boolean', - 'default' => false, + 'default' => true, ) ); \register_setting( - 'wordpress_gdata_antivirus_options_on_demand_scan', - 'wordpress_gdata_antivirus_options_on_demand_scan_comment_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_comment_scan_enabled', array( 'type' => 'boolean', - 'default' => false, + 'default' => true, ) ); \register_setting( - 'wordpress_gdata_antivirus_options_on_demand_scan', - 'wordpress_gdata_antivirus_options_on_demand_scan_pingback_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_pingback_scan_enabled', array( 'type' => 'boolean', - 'default' => false, + 'default' => true, ) ); \register_setting( - 'wordpress_gdata_antivirus_options_on_demand_scan', - 'wordpress_gdata_antivirus_options_on_demand_scan_post_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_post_scan_enabled', array( 'type' => 'boolean', - 'default' => false, + 'default' => true, ) ); } public function setup_menu(): void { \add_settings_section( - 'wordpress_gdata_antivirus_options_on_demand_scan', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan', esc_html__('OnDemand scans', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_on_demand_scans_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG + array( $this, 'gdatacyberdefenseag_antivirus_options_on_demand_scans_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG ); \add_settings_field( - 'wordpress_gdata_antivirus_options_on_demand_scan_media_upload_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_media_upload_scan_enabled', esc_html__('Media upload scan enabled', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_media_upload_scan_enabled_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, - 'wordpress_gdata_antivirus_options_on_demand_scan' + array( $this, 'gdatacyberdefenseag_antivirus_options_media_upload_scan_enabled_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, + 'gdatacyberdefenseag_antivirus_options_on_demand_scan' ); \add_settings_field( - 'wordpress_gdata_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', esc_html__('Plugin upload scan enabled', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_plugin_upload_scan_enabled_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, - 'wordpress_gdata_antivirus_options_on_demand_scan' + array( $this, 'gdatacyberdefenseag_antivirus_options_plugin_upload_scan_enabled_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, + 'gdatacyberdefenseag_antivirus_options_on_demand_scan' ); \add_settings_field( - 'wordpress_gdata_antivirus_options_on_demand_scan_comment_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_comment_scan_enabled', esc_html__('Comment scan enabled', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_comment_scan_enabled_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, - 'wordpress_gdata_antivirus_options_on_demand_scan' + array( $this, 'gdatacyberdefenseag_antivirus_options_comment_scan_enabled_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, + 'gdatacyberdefenseag_antivirus_options_on_demand_scan' ); \add_settings_field( - 'wordpress_gdata_antivirus_options_on_demand_scan_pingback_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_pingback_scan_enabled', esc_html__('Pingback scan enabled', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_pingback_scan_enabled_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, - 'wordpress_gdata_antivirus_options_on_demand_scan' + array( $this, 'gdatacyberdefenseag_antivirus_options_pingback_scan_enabled_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, + 'gdatacyberdefenseag_antivirus_options_on_demand_scan' ); \add_settings_field( - 'wordpress_gdata_antivirus_options_on_demand_scan_post_scan_enabled', + 'gdatacyberdefenseag_antivirus_options_on_demand_scan_post_scan_enabled', esc_html__('Post scan enabled', 'gdata-antivirus'), - array( $this, 'wordpress_gdata_antivirus_options_post_scan_enabled_text' ), - WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, - 'wordpress_gdata_antivirus_options_on_demand_scan' + array( $this, 'gdatacyberdefenseag_antivirus_options_post_scan_enabled_text' ), + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, + 'gdatacyberdefenseag_antivirus_options_on_demand_scan' ); \add_submenu_page( - WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG, 'OnDemandScan', 'OnDemandScan', 'manage_options', - WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, + GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG, array( $this, 'on_demand_scan_menu' ) ); } - public function wordpress_gdata_antivirus_options_on_demand_scans_text() { + public function gdatacyberdefenseag_antivirus_options_on_demand_scans_text() { echo '

' . esc_html__('Here you can set options for the on demand scans', 'gdata-antivirus') . '

'; } - public function wordpress_gdata_antivirus_options_media_upload_scan_enabled_text() { - $media_upload_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_media_upload_scan_enabled', false); - echo ''; + public function gdatacyberdefenseag_antivirus_options_media_upload_scan_enabled_text() { + $media_upload_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_media_upload_scan_enabled', false); + echo ''; } - public function wordpress_gdata_antivirus_options_plugin_upload_scan_enabled_text() { - $plugin_upload_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', false); - echo ''; + public function gdatacyberdefenseag_antivirus_options_plugin_upload_scan_enabled_text() { + $plugin_upload_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', false); + echo ''; } - public function wordpress_gdata_antivirus_options_comment_scan_enabled_text() { - $comment_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_comment_scan_enabled', false); - echo ''; + public function gdatacyberdefenseag_antivirus_options_comment_scan_enabled_text() { + $comment_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_comment_scan_enabled', false); + echo ''; } - public function wordpress_gdata_antivirus_options_pingback_scan_enabled_text() { - $pingback_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_pingback_scan_enabled', false); - echo ''; + public function gdatacyberdefenseag_antivirus_options_pingback_scan_enabled_text() { + $pingback_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_pingback_scan_enabled', false); + echo ''; } - public function wordpress_gdata_antivirus_options_post_scan_enabled_text() { - $post_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_post_scan_enabled', false); - echo ''; + public function gdatacyberdefenseag_antivirus_options_post_scan_enabled_text() { + $post_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_post_scan_enabled', false); + echo ''; } public function on_demand_scan_menu(): void { @@ -154,8 +154,8 @@ public function on_demand_scan_menu(): void {

OnDenamns Scan Settings

diff --git a/PluginPage/js/authentication-method-toggle.js b/PluginPage/js/authentication-method-toggle.js index 257257d..1ee7a6b 100644 --- a/PluginPage/js/authentication-method-toggle.js +++ b/PluginPage/js/authentication-method-toggle.js @@ -1,11 +1,11 @@ document.addEventListener( 'DOMContentLoaded', function () { - const authMethodSelect = document.getElementById('wordpress_gdata_antivirus_credentials_authentication_method'); - const clientCredentialsClientIdField = document.getElementById('wordpress_gdata_antivirus_credentials_client_id').parentElement.parentElement; - const clientCredentialsClientSecretField = document.getElementById('wordpress_gdata_antivirus_credentials_client_secret').parentElement.parentElement; - const resourceOwnerUsernameField = document.getElementById('wordpress_gdata_antivirus_credentials_username').parentElement.parentElement; - const resourceOwnerPasswordField = document.getElementById('wordpress_gdata_antivirus_credentials_password').parentElement.parentElement; + const authMethodSelect = document.getElementById('gdatacyberdefenseag_antivirus_credentials_authentication_method'); + const clientCredentialsClientIdField = document.getElementById('gdatacyberdefenseag_antivirus_credentials_client_id').parentElement.parentElement; + const clientCredentialsClientSecretField = document.getElementById('gdatacyberdefenseag_antivirus_credentials_client_secret').parentElement.parentElement; + const resourceOwnerUsernameField = document.getElementById('gdatacyberdefenseag_antivirus_credentials_username').parentElement.parentElement; + const resourceOwnerPasswordField = document.getElementById('gdatacyberdefenseag_antivirus_credentials_password').parentElement.parentElement; function toggleAuthFields() { console.log(authMethodSelect.value); diff --git a/Readme.md b/Readme.md index e618aff..a9bc40c 100644 --- a/Readme.md +++ b/Readme.md @@ -41,11 +41,11 @@ The scheduled scan feature of the WordPress Antivirus Plugin with G DATA VaaS In ## Support and Feedback -For any issues, questions, or feedback we have two channels [our vaas e-mail contact](oem@gdata.de) or leave us an issue on our [gitub-repository](https://github.com/GDATASoftwareAG/gdata-antivirus/issues). We appreciate your input and are committed to continually improving the plugin to meet your security needs. +For any issues, questions, or feedback we have two channels [our vaas e-mail contact](oem@gdata.de) or leave us an issue on our [gitub-repository](https://github.com/GDATASoftwareAG/wordpress-gdata-antivirus/issues). We appreciate your input and are committed to continually improving the plugin to meet your security needs. ## License -This WordPress Antivirus Plugin is released under the [GNU General Public License v3.0](https://github.com/GDATASoftwareAG/gdata-antivirus/blob/main/LICENSE). Feel free to contribute, share, and modify the plugin within the terms of the license. +This WordPress Antivirus Plugin is released under the [GNU General Public License v3.0](https://github.com/GDATASoftwareAG/wordpress-gdata-antivirus/blob/main/LICENSE). Feel free to contribute, share, and modify the plugin within the terms of the license. ## Contribution diff --git a/Vaas/ScanClient.php b/Vaas/ScanClient.php index 455f027..15b920d 100644 --- a/Vaas/ScanClient.php +++ b/Vaas/ScanClient.php @@ -2,8 +2,8 @@ namespace Gdatacyberdefenseag\GdataAntivirus\Vaas; -use Gdatacyberdefenseag\GdataAntivirus\Infrastructure\Database\IGdataAntivirusDatabase; use Gdatacyberdefenseag\GdataAntivirus\Infrastructure\FileSystem\IGdataAntivirusFileSystem; +use Gdatacyberdefenseag\GdataAntivirus\PluginPage\AdminNotices; use Psr\Log\LoggerInterface; use VaasSdk\Vaas; use VaasSdk\Authentication\ClientCredentialsGrantAuthenticator; @@ -11,38 +11,49 @@ use VaasSdk\Message\Verdict; use VaasSdk\VaasOptions as VaasParameters; -use function Amp\ByteStream\Internal\tryToCreateReadableStreamFromResource; - if (! class_exists('ScanClient')) { class ScanClient { private Vaas $vaas; private LoggerInterface $logger; private VaasOptions $vaas_options; private IGdataAntivirusFileSystem $file_system; - - public function __construct( LoggerInterface $logger, VaasOptions $vaas_options, IGdataAntivirusFileSystem $file_system ) { + private AdminNotices $admin_notices; + + public function __construct( + LoggerInterface $logger, + VaasOptions $vaas_options, + IGdataAntivirusFileSystem $file_system, + AdminNotices $admin_notices + ) { $logger->info('ScanClient::__construct'); $this->logger = $logger; $this->vaas_options = $vaas_options; $this->file_system = $file_system; + $this->admin_notices = $admin_notices; - $this->Connect(); - $plugin_upload_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', false); - $media_upload_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_media_upload_scan_enabled', false); + try { + $this->Connect(); + } catch (\Exception $e) { + $this->admin_notices->add_notice($e->getMessage()); + $this->logger->error("VaaS connection failed. Please verify if the VaaS-Url is correct."); + return; + } + $plugin_upload_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', false); + $media_upload_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_media_upload_scan_enabled', false); // We don't need to add the filters if both plugin and media upload scan are disabled. if ($plugin_upload_scan_enabled === true || $media_upload_scan_enabled === true) { \add_filter('wp_handle_upload_prefilter', array( $this, 'scan_single_upload' )); \add_filter('wp_handle_sideload_prefilter', array( $this, 'scan_single_upload' )); } - $comment_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_comment_scan_enabled', false); - $pingback_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_pingback_scan_enabled', false); + $comment_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_comment_scan_enabled', false); + $pingback_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_pingback_scan_enabled', false); // We don't need to add the filter if both comment and pingback scan are disabled. if ($comment_scan_enabled === true || $pingback_scan_enabled === true) { \add_filter('preprocess_comment', array( $this, 'scan_comment' )); } - $post_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_post_scan_enabled', false); + $post_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_post_scan_enabled', false); if ($post_scan_enabled === true) { \add_filter('wp_insert_post_data', array( $this, 'scan_post' )); } @@ -78,7 +89,7 @@ public function scan_post( $data, $postarr, $unsanitized_postarr ) { return $data; } - $post_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_post_scan_enabled', false); + $post_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_post_scan_enabled', false); if ($post_scan_enabled === false) { return $data; } @@ -95,16 +106,16 @@ public function scan_post( $data, $postarr, $unsanitized_postarr ) { // phpcs:ignore if (\VaasSdk\Message\Verdict::MALICIOUS === $verdict->Verdict) { $this->logger->debug('gdata-antivirus: virus found in post'); - wp_die(esc_html__('virus found')); + wp_die(esc_html__('virus found', 'gdata-antivirus')); } return $postdata; } public function scan_comment( $commentdata ) { - $comment_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_comment_scan_enabled', false); - $pingback_scan_enabled = (bool) \get_option('wordpress_gdata_antivirus_options_on_demand_scan_pingback_scan_enabled', false); + $comment_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_comment_scan_enabled', false); + $pingback_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_pingback_scan_enabled', false); - $comment_scan_enabled = \get_option('wordpress_gdata_antivirus_options_on_demand_scan_comment_scan_enabled', false); + $comment_scan_enabled = \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_comment_scan_enabled', false); if ($comment_scan_enabled === false) { return $commentdata; } @@ -133,14 +144,14 @@ public function scan_comment( $commentdata ) { // phpcs:ignore if (\VaasSdk\Message\Verdict::MALICIOUS === $verdict->Verdict) { $this->logger->debug('gdata-antivirus: virus found in comment'); - wp_die(\esc_html__('virus found')); + wp_die(\esc_html__('virus found', 'gdata-antivirus')); } return $commentdata; } public function scan_single_upload( $file ) { - $plugin_upload_scan_enabled = \get_option('wordpress_gdata_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', false); - $media_upload_scan_enabled = \get_option('wordpress_gdata_antivirus_options_on_demand_scan_media_upload_scan_enabled', false); + $plugin_upload_scan_enabled = \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', false); + $media_upload_scan_enabled = \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_media_upload_scan_enabled', false); /** * When this is a plugin uplaod but the plugin upload scan is disabled, @@ -175,7 +186,7 @@ public function scan_single_upload( $file ) { $verdict = $this->scan_file($file['tmp_name']); if (\VaasSdk\Message\Verdict::MALICIOUS === $verdict) { - $file['error'] = __('virus found'); + $file['error'] = __('virus found', 'gdata-antivirus'); } return $file; } diff --git a/Vaas/VaasOptions.php b/Vaas/VaasOptions.php index 11143f1..f888483 100644 --- a/Vaas/VaasOptions.php +++ b/Vaas/VaasOptions.php @@ -19,8 +19,8 @@ public function __construct() { public function setup_fields(): void { \register_setting( - 'wordpress_gdata_antivirus_options_credentials', - 'wordpress_gdata_antivirus_options_credentials ', + 'gdatacyberdefenseag_antivirus_options_credentials', + 'gdatacyberdefenseag_antivirus_options_credentials ', array( 'type' => 'array', 'default ' => self::$option_defaults, @@ -29,7 +29,7 @@ public function setup_fields(): void { } public function get_options(): array { - $options = \get_option('wordpress_gdata_antivirus_options_credentials', self::$option_defaults); + $options = \get_option('gdatacyberdefenseag_antivirus_options_credentials', self::$option_defaults); $options = array_merge(self::$option_defaults, $options); return $options; } diff --git a/gdata-antivirus.php b/gdata-antivirus.php index fb8b634..92d737c 100644 --- a/gdata-antivirus.php +++ b/gdata-antivirus.php @@ -14,7 +14,7 @@ * Requires at least: 6.2 * Tested up to: 6.6 * Requires PHP: 8.1 - * Plugin URI: https://github.com/GDATASoftwareAG/gdata-antivirus + * Plugin URI: https://github.com/GDATASoftwareAG/wordpress-gdata-antivirus * Description: Vaas is a virus scanner for your WordPress installation. * License: GNU General Public License v3.0 * License URI: https://github.com/GDATASoftwareAG/vaas/blob/main/LICENSE @@ -30,13 +30,13 @@ use Gdatacyberdefenseag\GdataAntivirus\GdataAntivirusPlugin; use Psr\Log\LoggerInterface; -define('WORDPRESS_GDATA_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__', __FILE__); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG', 'gdata-antivirus-menu'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_FINDINGS_SLUG', WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG . '-findings'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_FINDINGS_TABLE_NAME', 'WORDPRESS_GDATA_ANTIVIRUS_MENU_FINDINGS_TABLE'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_SLUG', WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG . '-full-scan'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS_TABLE_NAME', 'WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG', WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG . '-on-demand-scan'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__', __FILE__); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG', 'gdata-antivirus-menu'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FINDINGS_SLUG', GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG . '-findings'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FINDINGS_TABLE_NAME', 'GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FINDINGS_TABLE'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_SLUG', GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG . '-full-scan'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS_TABLE_NAME', 'GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG', GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG . '-on-demand-scan'); $app = new GdataAntivirusPlugin(); $app->singleton( diff --git a/tests/unittests/GdataAntivirusTest.php b/tests/unittests/GdataAntivirusTest.php index fc418a4..f8f8142 100644 --- a/tests/unittests/GdataAntivirusTest.php +++ b/tests/unittests/GdataAntivirusTest.php @@ -12,7 +12,7 @@ * Plugin Name: G DATA Antivirus * Version: 0.0.1 * Requires PHP: 8.1 - * Plugin URI: https://github.com/GDATASoftwareAG/gdata-antivirus + * Plugin URI: https://github.com/GDATASoftwareAG/wordpress-gdata-antivirus * Description: Vaas is a virus scanner for your WordPress installation. * License: GNU General Public License v3.0 * License URI: https://github.com/GDATASoftwareAG/vaas/blob/main/LICENSE @@ -61,13 +61,13 @@ // include __DIR__ . '/wordpress/wp-includes/formatting.php';. -define('WORDPRESS_GDATA_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__', __FILE__); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG', 'gdata-antivirus-menu'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_FINDINGS_SLUG', WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG . '-findings'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_FINDINGS_TABLE_NAME', 'WORDPRESS_GDATA_ANTIVIRUS_MENU_FINDINGS_TABLE'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_SLUG', WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG . '-full-scan'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS_TABLE_NAME', 'WORDPRESS_GDATA_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS'); -define('WORDPRESS_GDATA_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG', WORDPRESS_GDATA_ANTIVIRUS_MENU_SLUG . '-on-demand-scan'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_PLUGIN_WITH_CLASSES__FILE__', __FILE__); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG', 'gdata-antivirus-menu'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FINDINGS_SLUG', GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG . '-findings'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FINDINGS_TABLE_NAME', 'GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FINDINGS_TABLE'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_SLUG', GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG . '-full-scan'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS_TABLE_NAME', 'GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_FULL_SCAN_OPERATIONS'); +define('GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_ON_DEMAND_SCAN_SLUG', GDATACYBERDEFENCEAG_ANTIVIRUS_MENU_SLUG . '-on-demand-scan'); class GdataAntivirusTest extends TestCase { public function testDependencyInjection() {