| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Clean Login |
| 4 |
Plugin URI: https://codection.com |
| 5 |
Description: Responsive Frontend Login and Registration plugin. A plugin for displaying login, register, editor and restore password forms through shortcodes. [clean-login] [clean-login-edit] [clean-login-register] [clean-login-restore] [clean-login-change-password] [clean-login-logout] |
| 6 |
Author: codection |
| 7 |
Version: 1.18 |
| 8 |
Author URI: https://codection.com |
| 9 |
Text Domain: clean-login |
| 10 |
Domain Path: /lang |
| 11 |
License: GPL-2.0-or-later |
| 12 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
*/ |
| 14 |
|
| 15 |
if ( ! defined( 'ABSPATH' ) ) |
| 16 |
exit; |
| 17 |
|
| 18 |
define( "CLEAN_LOGIN_VERSION", "1.18" ); |
| 19 |
define( "CLEAN_LOGIN_PATH", plugin_dir_path( __FILE__ ) ); |
| 20 |
define( "CLEAN_LOGIN_URL", plugin_dir_url( __FILE__ ) ); |
| 21 |
define( "CLEAN_LOGIN_CAPTCHA_URL", plugins_url( 'content/captcha', __FILE__ ) ); |
| 22 |
|
| 23 |
function clean_login_init(){ |
| 24 |
$clean_login = new CleanLogin(); |
| 25 |
$clean_login->widgets_init(); |
| 26 |
|
| 27 |
add_action( 'plugins_loaded', array( $clean_login, 'on_loaded' ) ); |
| 28 |
} |
| 29 |
add_action('plugins_loaded', 'clean_login_init', 0 ); |
| 30 |
|
| 31 |
class CleanLogin{ |
| 32 |
public function widgets_init(){ |
| 33 |
require_once( plugin_dir_path( __FILE__ ) . "include/widget.php" ); |
| 34 |
|
| 35 |
$widget = new CleanLogin_Widget(); |
| 36 |
$widget->load(); |
| 37 |
} |
| 38 |
|
| 39 |
public function on_loaded(){ |
| 40 |
load_plugin_textdomain( 'clean-login', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); |
| 41 |
|
| 42 |
add_filter( 'plugin_action_links_clean-login/clean-login.php', array( $this, 'settings_link' ) ); |
| 43 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2); |
| 44 |
add_action( 'wp_logout', array( $this, 'maybe_redirect_after_logout' ) ); |
| 45 |
|
| 46 |
if ( ! is_admin() && get_option( 'cl_chooserole' ) ) { |
| 47 |
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' ); |
| 48 |
} |
| 49 |
|
| 50 |
foreach ( glob( plugin_dir_path( __FILE__ ) . "include/*.php" ) as $file ) { |
| 51 |
if ( strpos( $file, 'widget' ) !== false ) |
| 52 |
continue; |
| 53 |
|
| 54 |
include_once( $file ); |
| 55 |
} |
| 56 |
|
| 57 |
$settings = new CleanLogin_Settings(); |
| 58 |
$settings->load(); |
| 59 |
|
| 60 |
$controller = new CleanLogin_Controller(); |
| 61 |
$controller->load(); |
| 62 |
|
| 63 |
$shortcodes = new CleanLogin_Shortcode(); |
| 64 |
$shortcodes->load(); |
| 65 |
|
| 66 |
$roles = new CleanLogin_Roles(); |
| 67 |
$roles->load(); |
| 68 |
|
| 69 |
$frontend = new CleanLogin_Frontend(); |
| 70 |
$frontend->load(); |
| 71 |
|
| 72 |
$nav_menu_links = new CleanLogin_NavMenuLinks(); |
| 73 |
$nav_menu_links->load(); |
| 74 |
} |
| 75 |
|
| 76 |
function settings_link( $links ) { |
| 77 |
$url = "options-general.php?page=clean_login_menu"; |
| 78 |
$settings_link = "<a href='$url'>" . __( 'Settings', 'clean-login' ) . "</a>"; |
| 79 |
array_unshift( $links, $settings_link ); |
| 80 |
|
| 81 |
return $links; |
| 82 |
} |
| 83 |
|
| 84 |
function plugin_row_meta( $links, $file ){ |
| 85 |
if ( strpos( $file, basename( __FILE__ ) ) !== false ) { |
| 86 |
$new_links = array( |
| 87 |
'<a href="https://ko-fi.com/codection" target="_blank">' . __( 'Invite us for a coffee', 'clean-login' ) . '</a>', |
| 88 |
'<a href="mailto:contacto@codection.com" target="_blank">' . __( 'Premium support', 'clean-login' ) . '</a>', |
| 89 |
'<a href="https://codection.com/" target="_blank">' . __( 'RedSys and Ceca Gateways', 'clean-login' ) . '</a>', |
| 90 |
'<a href="https://import-wp.com/" target="_blank" style="color:#d54e21;font-weight:bold">' . __( 'Premium addons and plugins', 'clean-login' ) . '</a>', |
| 91 |
); |
| 92 |
|
| 93 |
$links = array_merge( $links, $new_links ); |
| 94 |
} |
| 95 |
|
| 96 |
return $links; |
| 97 |
} |
| 98 |
|
| 99 |
function maybe_redirect_after_logout(){ |
| 100 |
if( get_option('cl_logout_redirect', false) == '' ) |
| 101 |
return; |
| 102 |
|
| 103 |
$logoutredirect_url = get_option('cl_logout_redirect_url', false) ? esc_url( apply_filters( 'clean_login_logout_redirect_url', CleanLogin_Controller::get_translated_option_page('cl_logout_redirect_url' ) ) ): home_url(); |
| 104 |
wp_safe_redirect( $logoutredirect_url ); |
| 105 |
exit(); |
| 106 |
} |
| 107 |
} |
| 108 |
|