should_display_progressbar() ) { return; } wp_enqueue_style( 'easy-progress-bar', EASYELEMENTS_DIR_URL . 'includes/Extensions/ProgressBar/assets/css/progress-bar.css', [], EASYELEMENTS_VER ); $settings = get_option( 'easyel_reading_progressbar_settings', [] ); $height = !empty( $settings['reading_progressbar_height'] ) ? absint( $settings['reading_progressbar_height'] ) : 5; $color = !empty( $settings['reading_progressbar_color'] ) ? $settings['reading_progressbar_color'] : '#7400c1'; $position = isset( $settings['reading_progressbar_position'] ) ? $settings['reading_progressbar_position'] : 'top'; $pos_css = ( $position === 'bottom' ) ? 'bottom:0; top:auto;' : 'top:0; bottom:auto;'; $custom_css = " .easyel-progress-wrapper { height: {$height}px; {$pos_css} } .easyel-reading-progress-bar { height: {$height}px; --easyel-progress-color: {$color}; } "; wp_add_inline_style( 'easy-progress-bar', $custom_css ); if ( ! did_action( 'elementor/loaded' ) ) { return; } wp_enqueue_script( 'easyel-editor-script', EASYELEMENTS_DIR_URL . 'includes/Extensions/ProgressBar/assets/js/progress-bar.js', [ 'jquery' ], EASYELEMENTS_VER, true ); } private function should_display_progressbar() { $settings = get_option( 'easyel_reading_progressbar_settings', [] ); if ( empty( $settings ) ) { return false; } $display_on = isset( $settings['reading_progressbar_display'] ) ? (array) $settings['reading_progressbar_display'] : []; $should_show = in_array( 'global', $display_on ); return apply_filters( 'easyel/reading_progressbar_should_show', $should_show, $settings, $display_on ); } public function easyel_render_progressbar_html() { if ( $this->should_display_progressbar() ) { $this->render_progressbar_html(); } } private function render_progressbar_html() { echo '
'; } }