: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( ! class_exists( 'PPW_Customizer_Service' ) ) {
class PPW_Customizer_Service {
* Instance of PPW_Pro_Shortcode class.
* @var PPW_Customizer_Service
protected static $instance = null;
* Constructor for PPW_Customizer
public function __construct() {
add_action( 'customize_register', array( $this, 'customize_register' ) );
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) );
add_action( 'wp_head', array( $this, 'dynamic_styles' ) );
* Get instance of PPW_Customizer
* @return PPW_Customizer_Service
public static function get_instance() {
if ( is_null( self::$instance ) ) {
// Use static instead of self due to the inheritance later.
// For example: ChildSC extends this class, when we call get_instance
// it will return the object of child class. On the other hand, self function
// will return the object of base class.
self::$instance = new static();
public function get_below_text_style() {
if ( defined( 'PPW_PRO_VERSION' ) ) {
$desc_font_size = get_theme_mod( 'ppwp_form_instructions_below_text_font_size' );
$desc_font_weight = get_theme_mod( 'ppwp_form_instructions_below_text_font_weight' );
$desc_color = get_theme_mod( 'ppwp_form_instructions_below_text_color' );
font-size: " . $desc_font_size . "px!important;
font-weight: " . $desc_font_weight . "!important;
color: " . $desc_color . "!important;
return $customizer_style;
* Add below description customize.
public function add_below_desc( $wp_customize ) {
if ( defined( 'PPW_PRO_VERSION' ) ) {
$wp_customize->add_setting( 'ppwp_form_instructions_description_below_title' );
$wp_customize->add_control(
new PPW_Title_Group_Control(
'ppwp_form_instructions_description_below_title',
'label' => __( 'Description Below Form', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_description_below_title',
'type' => 'control_title',
$wp_customize->add_setting( 'ppwp_form_instructions_below_text' );
$wp_customize->add_control(
new PPW_Text_Editor_Custom_Control(
'ppwp_form_instructions_below_text',
'label' => __( 'Description', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_below_text',
/* instructions font size */
$wp_customize->add_setting( 'ppwp_form_instructions_below_text_font_size' );
$wp_customize->add_control(
'ppwp_form_instructions_below_text_font_size_control',
'label' => __( 'Font Size', PPW_Constants::DOMAIN ),
'description' => __( 'Font size in px', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_below_text_font_size',
/* instructions font weight */
$wp_customize->add_setting( 'ppwp_form_instructions_below_text_font_weight' );
$wp_customize->add_control(
'ppwp_form_instructions_below_text_font_weight_control',
'label' => __( 'Font Weight', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_below_text_font_weight',
/* text color - form instructions */
$wp_customize->add_setting( 'ppwp_form_instructions_below_text_color' );
$wp_customize->add_control(
new \WP_Customize_Color_Control(
'ppwp_form_instructions_below_text_color_control',
'label' => __( 'Text Color', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_below_text_color',
* Register customizer fields
* @param object $wp_customize customizer object.
public function customize_register( $wp_customize ) {
if ( ! class_exists( 'PPW_Title_Group_Control' ) ) {
include PPW_DIR_PATH . 'includes/customizers/class-ppw-title-group-control.php';
if ( ! class_exists( 'PPW_Toggle_Control' ) ) {
include PPW_DIR_PATH . 'includes/customizers/class-ppw-toggle-control.php';
if ( ! class_exists( 'PPW_Text_Editor_Custom_Control' ) ) {
include PPW_DIR_PATH . 'includes/customizers/class-ppw-text-editor-control.php';
/* register toggle control */
$wp_customize->register_control_type( 'PPW_Toggle_Control' );
$wp_customize->register_control_type( 'PPW_Title_Group_Control' );
$wp_customize->register_control_type( 'PPW_Text_Editor_Custom_Control' );
$wp_customize->add_panel( 'ppwp',
'capability' => 'edit_theme_options',
'title' => __( 'PPWP Single Password Form', PPW_Constants::DOMAIN ),
/* form instructions section */
$wp_customize->add_section( 'ppwp_form_instructions', array(
'title' => __( 'Password Form', PPW_Constants::DOMAIN ),
$wp_customize->add_setting( 'ppwp_form_instructions_background_title' );
$wp_customize->add_control(
new PPW_Title_Group_Control(
'ppwp_form_instructions_background_title', array(
'label' => __( 'Background', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_background_title',
'type' => 'control_title',
/* form background color */
$wp_customize->add_setting( 'ppwp_form_instructions_background_color', array(
'default' => PPW_Constants::DEFAULT_FORM_BACKGROUND_COLOR,
$wp_customize->add_control(
new \WP_Customize_Color_Control(
'ppwp_form_instructions_background_color_control', array(
'label' => __( 'Background Color', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_background_color',
/* form background padding */
$wp_customize->add_setting( 'ppwp_form_instructions_padding', array(
'default' => PPW_Constants::DEFAULT_FORM_PADDING,
$wp_customize->add_control( 'ppwp_form_instructions_padding_control', array(
'label' => __( 'Padding', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'description' => 'Padding in px',
'settings' => 'ppwp_form_instructions_padding',
/* form background border radius */
$wp_customize->add_setting( 'ppwp_form_instructions_border_radius', array(
'default' => PPW_Constants::DEFAULT_FORM_BORDER_RADIUS,
$wp_customize->add_control( 'ppwp_form_instructions_border_radius_control', array(
'label' => __( 'Border Radius', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'description' => 'Border Radius in px',
'settings' => 'ppwp_form_instructions_border_radius',
$wp_customize->add_setting( 'ppwp_form_instructions_headline_title' );
$wp_customize->add_control(
new PPW_Title_Group_Control(
'ppwp_form_instructions_headline_title', array(
'label' => __( 'Headline', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_headline_title',
'type' => 'control_title',
/* instructions headline */
$wp_customize->add_setting( 'ppwp_form_instructions_headline', array(
'default' => __( PPW_Constants::DEFAULT_HEADLINE_TEXT, PPW_Constants::DOMAIN ),
$wp_customize->add_control(
new PPW_Text_Editor_Custom_Control(
'ppwp_form_instructions_headline',
'label' => __( 'Headline', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_headline',
$wp_customize->add_setting( 'ppwp_form_instructions_headline_font_size', array(
'default' => PPW_Constants::DEFAULT_HEADLINE_FONT_SIZE,
$wp_customize->add_control( 'ppwp_form_instructions_headline_font_size_control', array(
'label' => __( 'Font Size', PPW_Constants::DOMAIN ),
'description' => __( 'Font size in px', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_headline_font_size',
/* headline font weight */
$wp_customize->add_setting( 'ppwp_form_instructions_headline_font_weight', array(
'default' => PPW_Constants::DEFAULT_HEADLINE_FONT_WEIGHT,
$wp_customize->add_control( 'ppwp_form_instructions_headline_font_weight_control', array(
'label' => __( 'Font Weight', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_headline_font_weight',
$wp_customize->add_setting( 'ppwp_form_instructions_headline_color', array(
'default' => PPW_Constants::DEFAULT_HEADLINE_FONT_COLOR,
$wp_customize->add_control(
new \WP_Customize_Color_Control(
'ppwp_form_instructions_headline_color_control', array(
'label' => __( 'Text Color', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_headline_color',
$wp_customize->add_setting( 'ppwp_form_instructions_description_title' );
$wp_customize->add_control(
new PPW_Title_Group_Control(
'ppwp_form_instructions_description_title', array(
'label' => __( 'Description Above Form', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_description_title',
'type' => 'control_title',
$wp_customize->add_setting( 'ppwp_form_instructions_text', array(
'default' => __( apply_filters( PPW_Constants::HOOK_MESSAGE_PASSWORD_FORM, PPW_Constants::DEFAULT_FORM_MESSAGE ), PPW_Constants::DOMAIN ),
$wp_customize->add_control(
new PPW_Text_Editor_Custom_Control(
'ppwp_form_instructions_text',
'label' => __( 'Description', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_text',
/* instructions font size */
$wp_customize->add_setting( 'ppwp_form_instructions_text_font_size', array(
'default' => PPW_Constants::DEFAULT_TEXT_FONT_SIZE,
$wp_customize->add_control( 'ppwp_form_instructions_text_font_size_control', array(
'label' => __( 'Font Size', PPW_Constants::DOMAIN ),
'description' => __( 'Font size in px', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_text_font_size',
/* instructions font weight */
$wp_customize->add_setting( 'ppwp_form_instructions_text_font_weight', array(
'default' => PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT,
$wp_customize->add_control( 'ppwp_form_instructions_text_font_weight_control', array(
'label' => __( 'Font Weight', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_text_font_weight',
/* text color - form instructions */
$wp_customize->add_setting( 'ppwp_form_instructions_text_color', array(
'default' => PPW_Constants::DEFAULT_TEXT_FONT_COLOR,
$wp_customize->add_control(
new \WP_Customize_Color_Control(
'ppwp_form_instructions_text_color_control', array(
'label' => __( 'Text Color', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_text_color',
$this->add_below_desc( $wp_customize );
// Add one more tab below "Description Text Color" control.
do_action( 'ppw_customize_after_text_color', $wp_customize );
$wp_customize->add_setting( 'ppwp_form_instructions_label_title' );
$wp_customize->add_control(
new PPW_Title_Group_Control(
'ppwp_form_instructions_label_title', array(
'label' => __( 'Password Field', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_label_title',
'type' => 'control_title',
$wp_customize->add_setting( 'ppwp_form_instructions_password_label', array(
'default' => PPW_Constants::DEFAULT_PASSWORD_LABEL,
$wp_customize->add_control( 'ppwp_form_instructions_password_label_control', array(
'label' => __( 'Password Label', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_password_label',
/* instructions font size */
$wp_customize->add_setting( 'ppwp_form_instructions_password_label_font_size', array(
'default' => PPW_Constants::DEFAULT_TEXT_FONT_SIZE,
$wp_customize->add_control( 'ppwp_form_instructions_password_label_font_size_control', array(
'label' => __( 'Font Size', PPW_Constants::DOMAIN ),
'description' => __( 'Font size in px', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_password_label_font_size',
/* instructions font weight */
$wp_customize->add_setting( 'ppwp_form_instructions_password_label_font_weight', array(
'default' => PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT,
$wp_customize->add_control( 'ppwp_form_instructions_password_label_font_weight_control', array(
'label' => __( 'Font Weight', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_password_label_font_weight',
/* text color - form instructions */
$wp_customize->add_setting( 'ppwp_form_instructions_password_label_color', array(
'default' => PPW_Constants::DEFAULT_TEXT_FONT_COLOR,
$wp_customize->add_control(
new \WP_Customize_Color_Control(
'ppwp_form_instructions_password_label_color_control', array(
'label' => __( 'Text Color', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_password_label_color',
$wp_customize->add_setting( 'ppwp_form_instructions_placeholder', array(
'default' => __( PPW_Constants::DEFAULT_PLACEHOLDER, PPW_Constants::DOMAIN ),
$wp_customize->add_control( 'ppwp_form_instructions_placeholder_control', array(
'label' => __( 'Placeholder', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_placeholder',
$wp_customize->add_setting( 'ppwp_form_instructions_show_password_title' );
$wp_customize->add_control(
new PPW_Title_Group_Control(
'ppwp_form_instructions_show_password_title', array(
'label' => __( 'Show Password', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_show_password_title',
'type' => 'control_title',
/* password typing - form instructions */
$wp_customize->add_setting( 'ppwp_form_instructions_is_show_password', array(
'default' => PPW_Constants::DEFAULT_IS_SHOW_PASSWORD,
$wp_customize->add_control(
'ppwp_form_instructions_is_show_password_control', array(
'label' => __( 'Show Password Reveal Button', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_is_show_password',
$wp_customize->add_setting( 'ppwp_form_instructions_show_password_text', array(
'default' => PPW_Constants::DEFAULT_SHOW_PASSWORD_TEXT,
$wp_customize->add_control( 'ppwp_form_instructions_show_password_text_control', array(
'label' => __( 'Button Text', PPW_Constants::DOMAIN ),
'section' => 'ppwp_form_instructions',
'settings' => 'ppwp_form_instructions_show_password_text',
do_action('ppw_customize_after_form_instructions', $wp_customize);
/* form error message section */
$wp_customize->add_section( 'ppwp_form_error_message', array(
'title' => __( 'Error Messages', PPW_Constants::DOMAIN ),