: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/* global redux, tinyMCE, ajaxurl */
$.redux.ajax_save = function( button ) {
var overlay = $( document.getElementById( 'redux_ajax_overlay' ) );
var $notification_bar = $( document.getElementById( 'redux_notification_bar' ) );
var $parent = $( button ).parents( '.redux-wrap-div' ).find( 'form' ).first();
// Add the loading mechanism.
$( '.redux-action_bar .spinner' ).addClass( 'is-active' );
$( '.redux-action_bar input' ).prop( 'disabled', true );
$notification_bar.slideUp();
$( '.redux-save-warn' ).slideUp();
$( '.redux_ajax_save_error' ).slideUp(
// Editor field doesn't auto save. Have to call it. Boo.
if ( redux.optName.hasOwnProperty( 'editor' ) ) {
if ( 'undefined' !== typeof ( tinyMCE ) ) {
editor = tinyMCE.get( $key );
$data = $parent.serialize();
// Add values for checked and unchecked checkboxes fields.
$parent.find( 'input[type=checkbox]' ).each(
if ( 'undefined' !== typeof $( this ).attr( 'name' ) ) {
chkVal = $( this ).is( ':checked' ) ? $( this ).val() : '0';
$data += '&' + $( this ).attr( 'name' ) + '=' + chkVal;
if ( 'redux_save' !== button.attr( 'name' ) ) {
$data += '&' + button.attr( 'name' ) + '=' + button.val();
$nonce = $parent.attr( 'data-nonce' );
action: redux.optName.args.opt_name + '_ajax_save',
'opt_name': redux.optName.args.opt_name,
error: function( response ) {
var input = $( '.redux-action_bar input' );
input.prop( 'disabled', false );
if ( true === redux.optName.args.dev_mode ) {
console.log( response.responseText );
overlay.fadeOut( 'fast' );
$( '.redux-action_bar .spinner' ).removeClass( 'is-active' );
alert( redux.optName.ajax.alert );
redux.optName.args.ajax_save = false;
$( button ).trigger( 'click' );
input.prop( 'disabled', true );
success: function( response ) {
if ( response.action && 'reload' === response.action ) {
} else if ( 'success' === response.status ) {
$( '.redux-action_bar input' ).prop( 'disabled', false );
overlay.fadeOut( 'fast' );
$( '.redux-action_bar .spinner' ).removeClass( 'is-active' );
redux.optName.options = response.options;
redux.optName.errors = response.errors;
redux.optName.warnings = response.warnings;
redux.optName.sanitize = response.sanitize;
$notification_bar.html( response.notification_bar ).slideDown( 'fast' );
if ( null !== response.errors || null !== response.warnings ) {
if ( null !== response.sanitize ) {
$save_notice = $( document.getElementById( 'redux_notification_bar' ) ).find( '.saved_notice' );
$save_notice.slideDown();
$save_notice.delay( 4000 ).slideUp();
$( '.redux-action_bar input' ).prop( 'disabled', false );
$( '.redux-action_bar .spinner' ).removeClass( 'is-active' );
overlay.fadeOut( 'fast' );
$( '.wrap h2:first' ).parent().append( '<div class="error redux_ajax_save_error" style="display:none;"><p>' + response.status + '</p></div>' );
$( '.redux_ajax_save_error' ).slideDown();
$( 'html, body' ).animate(
/* jshint unused:false */
function colorValidate( field ) {
var value = jQuery( field ).val();
var hex = colorNameToHex( value );
if ( hex !== value.replace( '#', '' ) ) {
function colorNameToHex( colour ) {
var tcolour = colour.replace( /^\s+/, '' ).replace( /\s+$/, '' ).replace( '#', '' );
'antiquewhite': '#faebd7',
'blanchedalmond': '#ffebcd',
'cornflowerblue': '#6495ed',
'darkgoldenrod': '#b8860b',
'darkmagenta': '#8b008b',
'darkolivegreen': '#556b2f',
'darkseagreen': '#8fbc8f',
'darkslateblue': '#483d8b',
'darkslategray': '#2f4f4f',
'darkturquoise': '#00ced1',
'deepskyblue': '#00bfff',
'floralwhite': '#fffaf0',
'forestgreen': '#228b22',
'greenyellow': '#adff2f',
'lavenderblush': '#fff0f5',
'lemonchiffon': '#fffacd',
'lightgoldenrodyellow': '#fafad2',
'lightsalmon': '#ffa07a',
'lightseagreen': '#20b2aa',
'lightskyblue': '#87cefa',
'lightslategray': '#778899',
'lightsteelblue': '#b0c4de',
'lightyellow': '#ffffe0',
'mediumaquamarine': '#66cdaa',
'mediumorchid': '#ba55d3',
'mediumpurple': '#9370d8',
'mediumseagreen': '#3cb371',
'mediumslateblue': '#7b68ee',
'mediumspringgreen': '#00fa9a',
'mediumturquoise': '#48d1cc',
'mediumvioletred': '#c71585',
'midnightblue': '#191970',
'navajowhite': '#ffdead',
'palegoldenrod': '#eee8aa',
'paleturquoise': '#afeeee',
'palevioletred': '#d87093',
'saddlebrown': '#8b4513',
'springgreen': '#00ff7f',
if ( 'undefined' !== colours[tcolour.toLowerCase()] ) {
return colours[tcolour.toLowerCase()];
$.redux.expandOptions = function( parent ) {
var trigger = parent.find( '.expand_options' );
var width = parent.find( '.redux-sidebar' ).width() - 1;
var id = $( '.redux-group-menu .active a' ).data( 'rel' ) + '_section_group';
if ( trigger.hasClass( 'expanded' ) ) {
trigger.removeClass( 'expanded' );
parent.find( '.redux-main' ).removeClass( 'expand' );
parent.find( '.redux-sidebar' ).stop().animate(
{ 'margin-left': '0px' },
parent.find( '.redux-main' ).stop().animate(
{ 'margin-left': width },
parent.find( '.redux-main' ).attr( 'style', '' );
parent.find( '.redux-group-tab' ).each(
if ( $( this ).attr( 'id' ) !== id ) {
$( this ).fadeOut( 'fast' );
// Show the only active one.
trigger.addClass( 'expanded' );
parent.find( '.redux-main' ).addClass( 'expand' );
parent.find( '.redux-sidebar' ).stop().animate(
{ 'margin-left': - width - 113 },
parent.find( '.redux-main' ).stop().animate(
{ 'margin-left': '-1px' },
parent.find( '.redux-group-tab' ).fadeIn(
/* global redux, redux_change, jQuery */
$.redux.initEvents = function( el ) {
el.find( '.redux-presets-bar' ).on(
window.onbeforeunload = null;
el.find( '#customize-save-button-wrapper #save' ).on(
el.find( '#toplevel_page_' + redux.optName.args.slug + ' .wp-submenu a, #wp-admin-bar-' + redux.optName.args.slug + ' a.ab-item' ).on(
if ( ( el.find( '#toplevel_page_' + redux.optName.args.slug ).hasClass( 'wp-menu-open' ) ||
$( this ).hasClass( 'ab-item' ) ) &&
! $( this ).parents( 'ul.ab-submenu:first' ).hasClass( 'ab-sub-secondary' ) &&
$( this ).attr( 'href' ).toLowerCase().indexOf( redux.optName.args.slug + '&tab=' ) >= 0 ) {
url = $( this ).attr( 'href' ).split( '&tab=' );
el.find( '#' + url[1] + '_section_group_li_a' ).trigger( 'click' );
$( this ).parents( 'ul:first' ).find( '.current' ).removeClass( 'current' );
$( this ).addClass( 'current' );
$( this ).parent().addClass( 'current' );
el.find( '.redux-action_bar input, #redux-import-action input' ).on(
if ( $( this ).attr( 'name' ) === redux.optName.args.opt_name + '[defaults]' ) {
// Defaults button clicked.
if ( ! confirm( redux.optName.args.reset_confirm ) ) {
} else if ( $( this ).attr( 'name' ) === redux.optName.args.opt_name + '[defaults-section]' ) {
// Default section clicked.
if ( ! confirm( redux.optName.args.reset_section_confirm ) ) {
} else if ( 'import' === $( this ).attr( 'name' ) ) {
if ( ! confirm( redux.optName.args.import_section_confirm ) ) {
window.onbeforeunload = null;
if ( true === redux.optName.args.ajax_save ) {
$.redux.ajax_save( $( this ) );
$( '.expand_options' ).on(
if ( $( container ).hasClass( 'fully-expanded' ) ) {
$( container ).removeClass( 'fully-expanded' );
tab = $.cookie( 'redux_current_tab_' + redux.optName.args.opt_name );
el.find( '#' + tab + '_section_group' ).fadeIn(
if ( 0 !== el.find( '#redux-footer' ).length ) {
$.redux.stickyInfo(); // Race condition fix.
$.redux.expandOptions( $( this ).parents( '.redux-container:first' ) );
if ( el.find( '.saved_notice' ).is( ':visible' ) ) {
el.find( '.saved_notice' ).slideDown();
'.redux-field input, .redux-field textarea, .redux-field select',