' . "\n"; $rule .= 'RewriteEngine On' . "\n"; $rule .= 'RewriteBase ' . $home_root . "\n\n"; $rule .= 'RewriteRule ^' . $admin_slug . '(-lzs.{20})?(/?)(.*) wp-admin/$3 [L]' . "\n"; $rule .= '' . "\n"; $rule .= '# END Loginizer'; $htaccess_file = ABSPATH . '/.htaccess'; if(!file_exists($htaccess_file)){ wp_send_json_error(0); } $contents = file_get_contents($htaccess_file); if(strpos($contents, '# BEGIN Loginizer') !== FALSE){ $contents = preg_replace('/# BEGIN Loginizer.*# END Loginizer/ms', '', $contents); } if(!file_put_contents($htaccess_file, trim($rule . "\n" . $contents))){ wp_send_json_error(0); } wp_send_json(array('success' => true)); } function loginizer_pro_dismiss_expired_licenses(){ check_admin_referer('loginizer_expiry_notice', 'security'); if(!current_user_can('activate_plugins')){ wp_send_json_error(__('You do not have required access to do this action', 'loginizer-security')); } update_option('softaculous_expired_licenses', time()); wp_send_json_success(); } function loginizer_pro_quick_social(){ check_ajax_referer('loginizer_quick_social', 'security'); if(!current_user_can('activate_plugins')){ wp_send_json_error(__('You do not have required access to do this action', 'loginizer-security')); } $social_settings = get_option('loginizer_social_settings', []); $social_settings['login']['login_form'] = true; update_option('loginizer_social_settings', $social_settings); $provider_settings = get_option('loginizer_provider_settings', []); $allowed_providers = loginizer_pro_social_auth_providers(); foreach($allowed_providers as $provider){ $provider_settings[$provider]['enabled'] = true; $provider_settings[$provider]['tested'] = true; $provider_settings[$provider]['loginizer_social_key'] = true; } update_option('loginizer_provider_settings', $provider_settings); wp_send_json_success(); } function loginizer_pro_social_auth_notice(){ check_ajax_referer('loginizer_social_auth', 'security'); if(!current_user_can('activate_plugins')){ wp_send_json_error(__('You do not have required access to do this action', 'loginizer-security')); } update_option('loginizer_keyless_social_auth_notice', -time()); wp_send_json_success(); } function loginizer_pro_disable_social(){ check_ajax_referer('loginizer_quick_social', 'security'); if(!current_user_can('activate_plugins')){ wp_send_json_error(__('You do not have required access to do this action', 'loginizer-security')); } // Disabling the view options. $social_settings = get_option('loginizer_social_settings', []); if(!empty($social_settings)){ foreach($social_settings as $key => $setting){ if(!empty($setting['enable_buttons'])){ $social_settings[$key]['enable_buttons'] = false; } if(!empty($setting['login_form'])){ $social_settings[$key]['login_form'] = false; } if(!empty($setting['registration_form'])){ $social_settings[$key]['registration_form'] = false; } } update_option('loginizer_social_settings', $social_settings); } // Disabling the Providers if any is enabled. $provider_settings = get_option('loginizer_provider_settings', []); if(!empty($provider_settings)){ foreach($provider_settings as $provider => $p_settings){ if(!empty($p_settings['enabled'])){ $provider_settings[$provider]['enabled'] = false; } } update_option('loginizer_provider_settings', $provider_settings); } wp_send_json_success(); }