/**
 * Upgrade routine for v2.0.0
 *
 * @access      private
 * @since       2.0
 * @return      void
 */
function ap_custom_login_v2_0_0_upgrades()
{
    $login = CUSTOMLOGIN();
    $ss = CUSTOM_LOGIN_SCRIPT_STYLES();
    $old_settings = get_option('custom_login_settings');
    $new_settings = get_option($login->id, array());
    $new_settings['active'] = $login->version;
    $new_settings['active'] = true === $old_settings['custom'] ? 'on' : 'off';
    $new_settings['html_background_color'] = $ss->is_rgba($old_settings['html_background_color']) ? $ss->rgba2hex($old_settings['html_background_color']) : $old_settings['html_background_color'];
    $new_settings['html_background_color_checkbox'] = 'off';
    $new_settings['html_background_color_opacity'] = '';
    $new_settings['html_background_url'] = $old_settings['html_background_url'];
    $new_settings['html_background_position'] = 'left top';
    $new_settings['html_background_repeat'] = $old_settings['html_background_repeat'];
    $new_settings['html_background_size'] = $old_settings['html_background_size'];
    $new_settomgs['hide_wp_logo'] = 'on';
    $new_settings['logo_background_url'] = $old_settings['login_form_logo'];
    $new_settings['logo_background_position'] = 'top center';
    $new_settings['logo_background_repeat'] = '';
    $new_settings['logo_background_size'] = '';
    $new_settings['login_form_background_color'] = $ss->is_rgba($old_settings['html_background_color']) ? $ss->rgba2hex($old_settings['login_form_background_color']) : $old_settings['login_form_background_color'];
    $new_settings['login_form_background_color_checkbox'] = 'off';
    $new_settings['login_form_background_color_opacity'] = '';
    $new_settings['login_form_background_url'] = $old_settings['login_form_background'];
    $new_settings['login_form_background_position'] = '';
    $new_settings['login_form_background_repeat'] = '';
    $new_settings['login_form_background_size'] = $old_settings['login_form_background_size'];
    $new_settings['login_form_border_radius'] = $old_settings['login_form_border_radius'];
    $new_settings['login_form_border_size'] = $old_settings['login_form_border'];
    $new_settings['login_form_border_color'] = $ss->is_rgba($old_settings['html_background_color']) ? $ss->rgba2hex($old_settings['login_form_border_color']) : $old_settings['login_form_border_color'];
    $new_settings['login_form_border_color_checkbox'] = 'off';
    $new_settings['login_form_border_color_opacity'] = '';
    $new_settings['login_form_box_shadow'] = $old_settings['login_form_box_shadow_1'] . 'px ' . $old_settings['login_form_box_shadow_2'] . 'px ' . $old_settings['login_form_box_shadow_3'] . 'px';
    $new_settings['login_form_box_shadow_color'] = $ss->is_rgba($old_settings['html_background_color']) ? $ss->rgba2hex($old_settings['login_form_box_shadow_4']) : $old_settings['login_form_box_shadow_4'];
    $new_settings['login_form_box_shadow_color_checkbox'] = 'off';
    $new_settings['login_form_box_shadow_color_opacity'] = '';
    $new_settings['label_color'] = $ss->is_rgba($old_settings['html_background_color']) ? $ss->rgba2hex($old_settings['label_color']) : $old_settings['label_color'];
    $new_settings['label_color_checkbox'] = 'off';
    $new_settings['label_color_opacity'] = '';
    $new_settings['nav_color'] = '';
    $new_settings['nav_color_checkbox'] = 'off';
    $new_settings['nav_color_opacity'] = '';
    $new_settings['nav_text_shadow_color'] = '';
    $new_settings['nav_text_shadow_color_checkbox'] = 'off';
    $new_settings['nav_text_shadow_color_opacity'] = '';
    $new_settings['nav_hover_color'] = '';
    $new_settings['nav_hover_color_checkbox'] = 'off';
    $new_settings['nav_hover_color_opacity'] = '';
    $new_settings['nav_text_shadow_hover_color'] = '';
    $new_settings['nav_text_shadow_hover_color_checkbox'] = 'off';
    $new_settings['nav_text_shadow_hover_color_opacity'] = '';
    $new_settings['custom_css'] = esc_attr($old_settings['custom_css']);
    $new_settings['custom_html'] = wp_specialchars_decode(stripslashes($old_settings['custom_html']), 1, 0, 1);
    $new_settings['custom_jquery'] = esc_html($old_settings['custom_jquery']);
    update_option($login->id, $new_settings);
    delete_option('custom_login_settings');
    return true;
}
 /**
  * Main Instance
  *
  * @staticvar 	array 	$instance
  * @return 		The one true instance
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
         self::$instance->actions();
         self::$instance->parent = CUSTOMLOGIN();
     }
     return self::$instance;
 }
Esempio n. 3
0
 /**
  * Box with a link to output our script.
  *
  * @return	string
  */
 public function settings_sidebar($args)
 {
     $user_agent = $_SERVER['HTTP_USER_AGENT'];
     if (!preg_match('/macintosh|mac os x/i', $user_agent)) {
         return;
     }
     if (!preg_match('/safari/i', $user_agent)) {
         return;
     }
     $content = sprintf(__('Stay up to date with desktop push notifications: <a href="%s">click here</a>, then click "allow".', CUSTOM_LOGIN_DIRNAME), esc_url(add_query_arg('action', sprintf('%s_allow_push', CUSTOM_LOGIN_OPTION), admin_url())));
     CUSTOMLOGIN()->settings_api->postbox('custom-login-roost', sprintf(__('%sPush Notifications', CUSTOM_LOGIN_DIRNAME), '*'), $content);
 }
 public function admin_init()
 {
     $this->settings_api = CUSTOMLOGIN()->settings_api;
     $this->settings_id = CUSTOM_LOGIN_OPTION . '_import_export';
     add_settings_section($this->settings_id, __('Import/Export Custom Login Settings', CUSTOM_LOGIN_DIRNAME), '__return_false', $this->settings_id);
     foreach ($this->settings_fields() as $section => $field) {
         foreach ($field as $option) {
             $type = isset($option['type']) ? $option['type'] : 'text';
             $args = array('id' => $option['name'], 'desc' => isset($option['desc']) ? $option['desc'] : '', 'name' => $option['label'], 'section' => $section, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'default' => isset($option['default']) ? $option['default'] : '', 'sanitize' => isset($option['sanitize']) ? $option['sanitize'] : '');
             $args = wp_parse_args($args, $option);
             add_settings_field($section . '[' . $option['name'] . ']', $option['label'], array($this->settings_api, 'callback_' . $type), $section, $section, $args);
         }
     }
     register_setting($this->settings_id, $this->settings_id, array($this, 'sanitize_options'));
 }
    /**
     * Render About Screen
     *
     * @since      2.0
     */
    public function about_screen()
    {
        list($display_version) = explode('-', CUSTOM_LOGIN_VERSION);
        $login = CUSTOMLOGIN();
        ?>
		<div class="wrap about-wrap">
			<h1><?php 
        printf(__('Welcome to Custom Login %s', $login->domain), $display_version);
        ?>
</h1>
			<div class="about-text"><?php 
        printf(__('Thank you for updating to the latest version! Custom Login %s is ready to make your login page better!', $login->domain), $display_version);
        ?>
</div>
			<div class="cl-badge"><?php 
        printf(__('Version %s', $login->domain), $display_version);
        ?>
</div>

			<h2 class="nav-tab-wrapper">
				<a class="nav-tab nav-tab-active" href="<?php 
        echo esc_url(admin_url(add_query_arg(array('page' => 'custom-login-about'), 'index.php')));
        ?>
">
					<?php 
        _e("What's New", $login->domain);
        ?>
				</a>
			</h2>

			<div class="changelog">
				<h3><?php 
        _e('Improved Settings', $login->domain);
        ?>
</h3>

				<div class="feature-section">

					<h4><?php 
        _e('Load times', $login->domain);
        ?>
</h4>
					<p><?php 
        _e('There were some rare cases in versions 1.x that had the plugin loading on pages it wasn\'t supposted to. Custom Login <strong>2.x</strong> now caches all queries and database calls. Making it over 140% faster.', $login->domain);
        ?>
</p>

					<h4><?php 
        _e('Better features', $login->domain);
        ?>
</h4>
					<p><?php 
        printf(__('With a complete rewrite of the plugin, I have to ability to build custom add-ons (think extensions), like stealth login, email logins and 2-step authentication to name a few of the add-ons you can find on %sExtendd.com%s in the future.', $login->domain), '<a href="https://extendd.com">', '</a>');
        ?>
</p>

				</div>
			</div>

			<div class="changelog">
				<h3><?php 
        _e('Extensions', $login->domain);
        ?>
</h3>

				<div class="feature-section col three-col">
					<div>
						<h4><?php 
        _e('Stealth Login', $login->domain);
        ?>
</h4>
                        <a href="https://extendd.com/plugin/custom-login-stealth-login/?utm_source=wordpressorg&utm_medium=custom-login&utm_campaign=welcome" target="_blank">
                        	<img src="https://i.imgur.com/mhuymPG.jpg">
                        </a>
						<p><?php 
        _e('Protect your wp-login.php page from brute force attacks.', $login->domain);
        ?>
</p>
					</div>

					<div>
						<h4><?php 
        _e('Page Template', $login->domain);
        ?>
</h4>
                        <a href="https://extendd.com/plugin/custom-login-page-template/?utm_source=wordpressorg&utm_medium=custom-login&utm_campaign=welcome" target="_blank">
                        	<img src="https://i.imgur.com/A0rzS9q.jpg">
                        </a>
						<p><?php 
        _e('Add a login form to any WordPress page.', $login->domain);
        ?>
</p>
					</div>

					<div class="last-feature">
						<h4><?php 
        _e('Login Redirects', $login->domain);
        ?>
</h4>
                        <a href="https://extendd.com/plugin/wordpress-login-redirects/?utm_source=wordpressorg&utm_medium=custom-login&utm_campaign=welcome" target="_blank">
                        	<img class="eddri-thumbnail" src="https://i.imgur.com/aNGoyAa.jpg">
                        </a>
						<p><?php 
        _e('Manage redirects after logging in.', $login->domain);
        ?>
</p>
					</div>
				</div>
			</div>

			<div class="return-to-dashboard">
				<a href="<?php 
        echo esc_url(admin_url('options-general.php?page=' . $login->domain));
        ?>
"><?php 
        _e('Go to Custom Login Settings', $login->domain);
        ?>
</a>
			</div>
		</div>
		<?php 
    }
            if (!isset($_GET[$ignore_key])) {
                return;
            }
            // Check nonce
            check_admin_referer($ignore_key, $ignore_key);
            // If user clicks to ignore the notice, add that to their user meta
            add_user_meta(get_current_user_id(), $ignore_key, 1, true);
        }
    }
}
// End if class_exists check
/**
 * The main function responsible for returning the one true
 * Instance to functions everywhere.
 *
 * Use this function like you would a global variable, except without needing
 * to declare the global.
 *
 * Example: <?php $custom_login = CUSTOMLOGIN(); ?>
 *
 * @return Custom_Login
 */
if (!function_exists('CUSTOMLOGIN')) {
    function CUSTOMLOGIN()
    {
        return Custom_Login::instance();
    }
}
// Out of the frying pan, and into the fire.
CUSTOMLOGIN();
Esempio n. 7
0
<?php

// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
if (!defined('SHORTINIT')) {
    define('SHORTINIT', true);
}
/* Setup the plugin */
$login = CUSTOMLOGIN();
if (!$login->is_active()) {
    return;
}
global $cl_js_atts;
extract($cl_js_atts, EXTR_SKIP);
/* Cache ALL THE THINGS! */
if (false === ($js = get_transient($login->id . '_script'))) {
    $js = '';
    if (defined('WP_LOCAL_DEV') && WP_LOCAL_DEV) {
        $js .= "/**\n *\n" . print_r($cl_js_atts, true) . " */\n\n";
    }
    $js .= "\n\t/**\n\t * Custom Login by Austin Passy\n\t *\n\t * Plugin URI\t: http://austin.passy.co/wordpress-plugins/custom-login\n\t * Version\t\t: {$version}\n\t * Author URI\t: http://austin.passy.co\n\t * Pro Version\t: http://extendd.com/plugin/custom-login-pro\n\t */\n\n";
    $js .= 'jQuery(document).ready(function($) {';
    /* Custom user input */
    if (!empty($custom_jquery)) {
        $js .= "\n\t/* Custom JS */\n\t";
        $js .= wp_specialchars_decode(stripslashes($custom_jquery), 1, 0, 1);
        $js .= "\n";
    }
    $js .= '});';
Esempio n. 8
0
/**
 * Add Options Link
 *
 * Creates the admin submenu pages.
 *
 * @access      private
 * @since       1.0
 * @return      void
 */
function ap_custom_login_upgrades_page()
{
    $login = CUSTOMLOGIN();
    add_submenu_page(null, __('Custom Login Upgrades', $login->domain), __('Custom Login Upgrades', $login->domain), 'update_plugins', 'custom-login-upgrades', 'ap_custom_login_upgrades_screen');
}
 /**
  * Box with a link to the extensions page.
  */
 function settings_sidebar($args)
 {
     $content = sprintf(__('Install Custom Login extensions on <a href="%s">this page</a> with a valid license key. <small>Purchase your license key by clicking the appropriate link below</small>.', CUSTOM_LOGIN_DIRNAME), sprintf(admin_url('options-general.php?page=%s/extensions'), CUSTOM_LOGIN_DIRNAME));
     CUSTOMLOGIN()->settings_api->postbox('custom-login-extensions', __('Extensions Installer', CUSTOM_LOGIN_DIRNAME), $content);
 }
Esempio n. 10
0
 /**
  * Helper function check if we're on our settings page.
  *
  * @since		3.0.9
  */
 public static function is_settings_page($page = '')
 {
     $return = true;
     $screen = get_current_screen();
     if (null !== $screen) {
         if ($screen->id != CUSTOMLOGIN()->menu_page) {
             $return = false;
         }
     } else {
         global $pagenow;
         if ('options-general.php' != $pagenow) {
             $return = false;
         }
         if (!isset($_GET['page']) || CUSTOM_LOGIN_DIRNAME != $_GET['page']) {
             $return = false;
         }
     }
     return $return;
 }