Пример #1
0
/**
 * 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;
}
<?php

// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
if (!defined('SHORTINIT')) {
    define('SHORTINIT', true);
}
/* Setup the plugin */
$login = CUSTOMLOGIN();
$ss = CUSTOM_LOGIN_SCRIPT_STYLES();
if (!$login->is_active()) {
    return;
}
global $cl_css_atts;
/* Extract */
extract($cl_css_atts, EXTR_SKIP);
/* Cache ALL THE THINGS! */
if (false === ($css = get_transient($login->id . '_style'))) {
    $css = '';
    $close_rule = "}\n";
    if (defined('WP_LOCAL_DEV') && WP_LOCAL_DEV) {
        $css .= "/**\n *\n" . print_r($cl_css_atts, true) . " */\n\n";
    }
    $css .= "\n/**\n * Custom Login by Austin Passy\n *\n * Plugin URI\t: http://austin.passy.co/wordpress-plugins/custom-login\n * Version\t\t: {$version}\n * Author URI\t: http://austin.passy.co\n * Extensions\t: https://extendd.com/plugins/tag/custom-login-extension/\n */\n\n";
    /* Custom user input */
    if (!empty($custom_css)) {
        $custom_css = wp_specialchars_decode(stripslashes($custom_css), 1, 0, 1);
        $css .= "/* START Custom CSS */\n";
        $css .= str_replace(array('%%BSLASH%%'), array('\\'), $custom_css);