'', 'advanceId' => '', 'layout' => 'layout1', 'reverseSwitcher' => false, 'enableText' => false, 'textAppears' => 'both', 'lightText' => 'Light Mode', 'darkText' => 'Dark Mode', 'iconType' => 'solid', 'iconSize' => '24', ); } public function register() { register_block_type( 'ultimate-post/dark-light', array( 'editor_script' => 'ultp-blocks-editor-script', 'editor_style' => 'ultp-blocks-editor-css', 'render_callback' => array( $this, 'content' ), ) ); } public function content( $attr ) { $is_visible = false; if ( isset( $attr['blockPubDate'] ) && $attr['blockPubDate'] != 'empty' ) { $is_visible = ultimate_post()->is_pro_feature_visible( $attr['blockPubDate'] ); } $is_active = ultimate_post()->is_lc_active(); if ( $is_active || $is_visible ) { $attr = wp_parse_args( $attr, $this->get_attributes() ); $attr['className'] = isset( $attr['className'] ) && $attr['className'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['className'] ) : ''; $attr['align'] = isset( $attr['align'] ) && $attr['align'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['align'] ) : ''; $layout = isset( $attr['layout'] ) ? sanitize_html_class( $attr['layout'] ) : 'layout1'; $reverseSwitcher = isset( $attr['reverseSwitcher'] ) && $attr['reverseSwitcher'] ? 'ultp-dl-reverse' : ''; $enableText = isset( $attr['enableText'] ) ? $attr['enableText'] == true : false; $textAppears = isset( $attr['textAppears'] ) ? sanitize_html_class( $attr['textAppears'] ) : 'both'; $iconType = isset( $attr['iconType'] ) ? sanitize_html_class( $attr['iconType'] ) : 'solid'; $iconSize = isset( $attr['iconSize'] ) ? sanitize_html_class( $attr['iconSize'] ) : '24'; $allowed_html_tags = ultimate_post()->ultp_allowed_html_tags(); $lightText = isset( $attr['lightText'] ) ? wp_kses( $attr['lightText'], $allowed_html_tags ) : 'Light Mode'; $darkText = isset( $attr['darkText'] ) ? wp_kses( $attr['darkText'], $allowed_html_tags ) : 'Dark Mode'; $dlMode = isset( $_COOKIE['ultplocalDLMode'] ) ? $_COOKIE['ultplocalDLMode'] : ultimate_post()->get_dl_mode(); $dlIcons = array(); $dlIcons['moon'] = ''; $dlIcons['moon_line'] = ''; $dlIcons['sun'] = ''; $dlIcons['sun_line'] = ''; $wraper_before = ''; $block_name = 'dark-light'; $wraper_before .= '
'; $wraper_before .= '
'; ob_start(); ?>
'; $wraper_before .= '
'; return $wraper_before; } } }