check_widget( $widget ) && ! empty( $instance ) ) { $text = wp_kses_post( $text ); } return $text; } /** * Apply auto_embed to widget text * * @param string $text * @return string * @since 2.0.0 */ public function autoembed( $text, $instance = null, $widget = null ) { if ( bstw()->check_widget( $widget ) && ! empty( $instance ) ) { global $wp_embed; $text = $wp_embed->run_shortcode( $text ); $text = $wp_embed->autoembed( $text ); } return $text; } /** * Apply smilies conversion to widget text * * @uses convert_smilies() * * @param string $text * @return string * @since 2.0.0 */ public function convert_smilies( $text, $instance = null, $widget = null ) { if ( bstw()->check_widget( $widget ) && ! empty( $instance ) ) { $text = convert_smilies( $text ); } return $text; } /** * Check if automatic addition of paragraphs in widget text is needed * * @uses apply_filters() * * @param mixed[] $instance * @return boolean * @since 2.1.0 */ public function need_wpautop( $instance ) { // Widgets created with previous plugin versions do not have the filter parameter set so we base the choice on the type and text fields $need_wpautop = $instance['type'] == 'visual' && substr( $instance['text'], 0, 3 ) != '

'; if ( isset( $instance['filter'] ) ) { $need_wpautop = $instance['filter'] == 1; } $need_wpautop = apply_filters( 'black_studio_tinymce_need_wpautop', $need_wpautop, $instance ); return $need_wpautop; } /** * Apply automatic paragraphs in widget text * * @uses wpautop() * * @param string $text * @param mixed[]|null $instance * @param object|null $widget * @return string * @since 2.0.0 */ public function wpautop( $text, $instance = null, $widget = null ) { if ( bstw()->check_widget( $widget ) && ! empty( $instance ) ) { if ( $this->need_wpautop( $instance ) ) { $text = wpautop( $text ); } } return $text; } /** * Process shortcodes in widget text * * @uses do_shortcode() * * @param string $text * @return string * @since 2.0.0 */ public function do_shortcode( $text, $instance = null, $widget = null ) { if ( bstw()->check_widget( $widget ) && ! empty( $instance ) ) { $text = do_shortcode( $text ); } return $text; } } // END class Black_Studio_TinyMCE_Text_Filters } // END class_exists check