dependencies(); } public function dependencies() { add_action( 'wp_print_scripts', array( $this, 'dequeue_conflicted_script' ), 100 ); add_action( 'login_headerurl', array( $this, 'remove_conflicted_action' ) ); add_action( 'init', array( $this, 'enqueue_loginpress_compatibility_script') ); /************************************* WebArx Compatibility Fix // v1.2.3 *************************************/ add_filter( 'wp_redirect', array( $this, 'wp_redirect_remove_filter' ), 9 ); add_filter( 'site_url', array( $this, 'site_url_remove_filter' ) , 9 ); add_filter( 'network_site_url', array( $this, 'network_site_url_remove_filter' ), 9 ); add_action( 'plugins_loaded', array( $this, 'plugins_loaded_remove_action' ), 10 ); add_action( 'wp_loaded', array( $this, 'wp_loaded_remove_action' ), 9 ); add_action( 'init', array( $this, 'init_remove_action' ), 9 ); } public function wp_redirect_remove_filter( $location ) { if ( class_exists( 'Webarx' ) ) { if ( ! function_exists( 'is_user_logged_in' ) ) { return $location; } $webarx_login = get_option( 'webarx_mv_wp_login' ); $user_loged_in = is_user_logged_in(); if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { remove_filter( 'wp_redirect', array( webarx()->hide_login, 'wp_redirect' ) ); } } return $location; } public function site_url_remove_filter( $url ) { if ( class_exists( 'Webarx' ) ) { if ( ! function_exists( 'is_user_logged_in' ) ) { return $url; } $webarx_login = get_option( 'webarx_mv_wp_login' ); $user_loged_in = is_user_logged_in(); if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { remove_filter('site_url', array( webarx()->hide_login, 'site_url' ) ) ; } } return $url; } public function network_site_url_remove_filter( $url ) { if ( class_exists( 'Webarx' ) ) { if ( ! function_exists( 'is_user_logged_in' ) ) { return $url; } $webarx_login = get_option( 'webarx_mv_wp_login' ); $user_loged_in = is_user_logged_in(); if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { remove_filter('network_site_url', array( webarx()->hide_login, 'network_site_url' ) ) ; } } return $url; } public function plugins_loaded_remove_action() { if ( class_exists( 'Webarx' ) ) { if ( ! function_exists( 'is_user_logged_in' ) ) { return; } $webarx_login = get_option( 'webarx_mv_wp_login' ); $user_loged_in = is_user_logged_in(); if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { remove_action( 'plugins_loaded', array( webarx()->hide_login, 'plugins_loaded' ), 9999 ) ; } } } public function wp_loaded_remove_action() { if ( class_exists( 'Webarx' ) ) { if ( ! function_exists( 'is_user_logged_in' ) ) { return $url; } $webarx_login = get_option( 'webarx_mv_wp_login' ); $user_loged_in = is_user_logged_in(); if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { remove_action( 'wp_loaded', array( webarx()->hide_login, 'wp_loaded' ) ); } } } public function init_remove_action() { if ( class_exists( 'Webarx' ) ) { if ( ! function_exists( 'is_user_logged_in' ) ) { return $url; } $webarx_login = get_option( 'webarx_mv_wp_login' ); $user_loged_in = is_user_logged_in(); if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { remove_action( 'init', array( webarx()->hide_login, 'denyRequestsToWpLogin' ) ) ; } } } public function enqueue_loginpress_compatibility_script() { /** * Enqueue LoginPress CSS on Password_Protected plugin. * * Hooked to the password_protected_login_head action, * Head URL on logo as well. * * so that it is after the script was enqueued. * @since 1.0.3 */ if ( class_exists( 'Password_Protected' ) ) { add_action( 'password_protected_login_head', array( $this, 'enqueue_loginpress_script' ) ); add_filter('password_protected_login_headerurl', array( $this, 'password_protected_login_headerurl_cb' ) ); } } /** * dequeue_conflicted_script * @since 1.0.3 */ public function dequeue_conflicted_script() { /** * Dequeue the Divi Login script. * * Hooked to the wp_print_scripts action, with a late priority (100), * so that it is after the script was enqueued. * @since 1.0.3 */ if ( class_exists( 'ET_Divi_100_Custom_Login_Page_Config' ) ) { wp_dequeue_style( 'custom-login-pages' ); wp_dequeue_script( 'custom-login-pages-icon-font' ); wp_dequeue_script( 'custom-login-pages-scripts' ); } } /** * remove_conflicted_action * @since 1.0.3 */ public function remove_conflicted_action() { /** * Remove the Divi login_footer hook 'print_styles' *So that confliction is removed. * * @since 1.0.3 */ if ( class_exists( 'ET_Divi_100_Custom_Login_Page_Config' ) ) { remove_action( 'login_footer', array( ET_Divi_100_Custom_Login_Page::instance(), 'print_styles' ) ); } } /** * Include LoginPress CSS for Support with other plugins. * @since 1.0.3 */ public function enqueue_loginpress_script() { include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' ); include( LOGINPRESS_DIR_PATH . 'css/style-login.php' ); } /** * Password protected plugin compatlibility iwth logo url. * @since 1.3.1 */ public function password_protected_login_headerurl_cb() { $logo_url = get_option( 'loginpress_customization' ); $logo_url = $logo_url['customize_logo_hover']; return $logo_url; } } endif; new LoginPress_Compatibility;