Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
query(
$wpdb->prepare(
"
DELETE FROM $wpdb->sitemeta
WHERE meta_key LIKE %s
AND site_id = %d
",
'%wp_2fa_%',
$network_id
)
);
} else {
$wpdb->query(
$wpdb->prepare(
"
DELETE FROM $wpdb->options
WHERE option_name LIKE %s
",
'%wp_2fa_%'
)
);
}
$wpdb->query(
$wpdb->prepare(
"
DELETE FROM $wpdb->usermeta
WHERE meta_key LIKE %s
",
WP_2FA_PREFIX . 'wp_2fa_%'
)
);
}
}
/**
* The list of known contexts for enqueuing scripts/styles.
*
* @return array
*/
function get_enqueue_contexts() {
return array( 'admin', 'frontend', 'shared' );
}
/**
* Generate an URL to a script, taking into account whether SCRIPT_DEBUG is enabled.
*
* @param string $script Script file name (no .js extension).
* @param string $context Context for the script ('admin', 'frontend', or 'shared').
*
* @return string|\WP_Error URL
*/
function script_url( $script, $context ) {
if ( ! in_array( $context, get_enqueue_contexts(), true ) ) {
return new \WP_Error( 'invalid_enqueue_context', 'Invalid $context specified in WP2FA script loader.' );
}
return WP_2FA_URL . 'dist/js/' . sanitize_file_name( $script ) . '.js';
}
/**
* Generate an URL to a stylesheet, taking into account whether SCRIPT_DEBUG is enabled.
*
* @param string $stylesheet Stylesheet file name (no .css extension).
* @param string $context Context for the script ('admin', 'frontend', or 'shared').
*
* @return string|\WP_Error URL
*/
function style_url( $stylesheet, $context ) {
if ( ! in_array( $context, get_enqueue_contexts(), true ) ) {
return new \WP_Error( 'invalid_enqueue_context', 'Invalid $context specified in WP2FA stylesheet loader.' );
}
return WP_2FA_URL . 'dist/css/' . sanitize_file_name( $stylesheet ) . '.css';
}
/**
* Enqueue scripts for admin.
*
* @return void
*/
function admin_scripts() {
global $pagenow;
// Get page argument from $_GET array.
$page = ( isset( $_GET['page'] ) ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore
if ( ( empty( $page ) || false === strpos( $page, 'wp-2fa' ) ) && 'profile.php' !== $pagenow ) {
return;
}
\wp_enqueue_script(
'wp_2fa_admin',
script_url( 'admin', 'admin' ),
array( 'jquery-ui-widget', 'jquery-ui-core', 'jquery-ui-autocomplete', 'wp_2fa_micro_modals', 'select2' ),
WP_2FA_VERSION,
true
);
\wp_enqueue_script(
'wp_2fa_micro_modals',
script_url( 'micromodal', 'admin' ),
array(),
WP_2FA_VERSION,
true
);
enqueue_select2_scripts();
// Data array.
$data_array = array(
'ajaxURL' => \admin_url( 'admin-ajax.php' ),
'roles' => WP_Helper::get_roles_wp(),
'nonce' => wp_create_nonce( 'wp-2fa-settings-nonce' ),
'codeValidatedHeading' => esc_html__( 'Congratulations', 'wp-2fa' ),
'codeValidatedText' => esc_html__( 'Your account just got more secure', 'wp-2fa' ),
'codeValidatedButton' => esc_html__( 'Close Wizard & Refresh', 'wp-2fa' ),
'processingText' => esc_html__( 'Processing Update', 'wp-2fa' ),
'email_sent_success' => esc_html__( 'Email successfully sent', 'wp-2fa' ),
'email_sent_failure' => esc_html__( 'Email delivery failed', 'wp-2fa' ),
'invalidEmail' => esc_html__( 'Please use a valid email address', 'wp-2fa' ),
'license_validation_in_progress' => esc_html__( 'Validating your license, please wait...', 'wp-2fa' ),
);
wp_localize_script( 'wp_2fa_admin', 'wp2faData', $data_array );
$re_login = Settings_Utils::get_setting_role( User_Helper::get_user_role(), Re_Login_2FA::RE_LOGIN_SETTINGS_NAME );
$data_array = array(
'ajaxURL' =>\admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'wp2fa-verify-wizard-page' ),
'codesPreamble' => esc_html__( 'These are the 2FA backup codes for the user', 'wp-2fa' ),
'readyText' => esc_html__( 'I\'m ready', 'wp-2fa' ),
'codeReSentText' => esc_html__( 'New code sent', 'wp-2fa' ),
'backupCodesSent' => esc_html__( 'Backup codes sent', 'wp-2fa' ),
'reLoginEnabled' => Re_Login_2FA::ENABLED_SETTING_VALUE,
'reLogin' => $re_login,
);
wp_localize_script( 'wp_2fa_admin', 'wp2faWizardData', $data_array );
}
/**
* Enqueue Select2 jQuery library
*
* @return void
*/
function enqueue_select2_scripts() {
wp_enqueue_style( 'select2', style_url( 'select2.min', 'admin' ), array(), WP_2FA_VERSION );
wp_enqueue_script( 'select2', script_url( 'select2.min', 'admin' ), array( 'jquery' ), WP_2FA_VERSION, false );
}
/**
* Enqueue styles for admin.
*
* @return void
*/
function admin_styles() {
wp_enqueue_style(
'wp_2fa_admin',
style_url( 'admin-style', 'admin' ),
array(),
WP_2FA_VERSION
);
}
/**
* Add async/defer attributes to enqueued scripts that have the specified script_execution flag.
*
* @link https://core.trac.wordpress.org/ticket/12009
* @param string $tag The script tag.
* @param string $handle The script handle.
* @return string
*/
function script_loader_tag( $tag, $handle ) {
$script_execution = wp_scripts()->get_data( $handle, 'script_execution' );
if ( ! $script_execution ) {
return $tag;
}
if ( 'async' !== $script_execution && 'defer' !== $script_execution ) {
return $tag;
}
// Abort adding async/defer for scripts that have this script as a dependency. _doing_it_wrong()?
foreach ( wp_scripts()->registered as $script ) {
if ( in_array( $handle, $script->deps, true ) ) {
return $tag;
}
}
// Add the attribute if it hasn't already been added.
if ( ! preg_match( ":\s$script_execution(=|>|\s):", $tag ) ) {
$tag = preg_replace( ':(?=>):', " $script_execution", $tag, 1 );
}
return $tag;
}
/**
* Generates random string used to salt the key
*
* @return string
*
* @since 2.3.0
*/
function wp_salt(): string {
return WP2FA::get_secret_key();
}