Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/hostinge.../includes
File: DefaultOptions.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Hostinger;
[2] Fix | Delete
[3] Fix | Delete
use Hostinger\Admin\Options\PluginOptions;
[4] Fix | Delete
use Hostinger\Helper;
[5] Fix | Delete
[6] Fix | Delete
defined( 'ABSPATH' ) || exit;
[7] Fix | Delete
[8] Fix | Delete
class DefaultOptions {
[9] Fix | Delete
/**
[10] Fix | Delete
* @return void
[11] Fix | Delete
*/
[12] Fix | Delete
public function add_options(): void {
[13] Fix | Delete
$this->configure_security_settings();
[14] Fix | Delete
[15] Fix | Delete
foreach ( $this->options() as $key => $option ) {
[16] Fix | Delete
update_option( $key, $option );
[17] Fix | Delete
}
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
public function configure_security_settings(): void {
[21] Fix | Delete
$hostinger_plugin_settings = get_option( HOSTINGER_PLUGIN_SETTINGS_OPTION, array() );
[22] Fix | Delete
[23] Fix | Delete
if ( empty( $hostinger_plugin_settings['bypass_code'] ) ) {
[24] Fix | Delete
$hostinger_plugin_settings['bypass_code'] = Helper::generate_bypass_code( 16 );
[25] Fix | Delete
$this->update_plugin_settings( $hostinger_plugin_settings );
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
$this->configure_authentication_password();
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
public function configure_authentication_password(): void {
[32] Fix | Delete
global $wpdb;
[33] Fix | Delete
$hostinger_plugin_settings = get_option( HOSTINGER_PLUGIN_SETTINGS_OPTION, array() );
[34] Fix | Delete
[35] Fix | Delete
$existing_passwords = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->usermeta} WHERE meta_key = %s", '_application_passwords' ) );
[36] Fix | Delete
[37] Fix | Delete
if ( $existing_passwords === 0 ) {
[38] Fix | Delete
$hostinger_plugin_settings['disable_authentication_password'] = true;
[39] Fix | Delete
$this->update_plugin_settings( $hostinger_plugin_settings );
[40] Fix | Delete
}
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
private function update_plugin_settings( array $settings ): void {
[44] Fix | Delete
$plugin_options = new PluginOptions( $settings );
[45] Fix | Delete
update_option( HOSTINGER_PLUGIN_SETTINGS_OPTION, $plugin_options->to_array(), false );
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* @return string[]
[50] Fix | Delete
*/
[51] Fix | Delete
private function options(): array {
[52] Fix | Delete
$options = array(
[53] Fix | Delete
'optin_monster_api_activation_redirect_disabled' => 'true',
[54] Fix | Delete
'wpforms_activation_redirect' => 'true',
[55] Fix | Delete
'aioseo_activation_redirect' => 'false',
[56] Fix | Delete
);
[57] Fix | Delete
[58] Fix | Delete
if ( Helper::is_plugin_active( 'astra-sites' ) ) {
[59] Fix | Delete
$options = array_merge( $options, $this->get_astra_options() );
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
return $options;
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* @return string[]
[67] Fix | Delete
*/
[68] Fix | Delete
private function get_astra_options(): array {
[69] Fix | Delete
return array(
[70] Fix | Delete
'astra_sites_settings' => 'gutenberg',
[71] Fix | Delete
);
[72] Fix | Delete
}
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function