/** * Add all the required actions for the TinyMCE widget. */ function siteorigin_panels_black_studio_tinymce_admin_init() { global $pagenow; if (in_array($pagenow, array('post-new.php', 'post.php')) || $pagenow == 'themes.php' && isset($_GET['page']) && $_GET['page'] == 'so_panels_home_page') { if (function_exists('bstw')) { add_filter('tiny_mce_before_init', array(bstw(), 'tiny_mce_before_init'), 20); add_action('admin_head', array(bstw(), 'enqueue_media')); add_action('admin_print_scripts', array(bstw(), 'admin_print_scripts')); add_action('admin_print_styles', array(bstw(), 'admin_print_styles')); add_action('admin_print_footer_scripts', array(bstw(), 'admin_print_footer_scripts')); } else { add_filter('tiny_mce_before_init', 'black_studio_tinymce_init_editor', 20); add_action('admin_head', 'black_studio_tinymce_load_tiny_mce'); add_action('admin_print_scripts', 'black_studio_tinymce_scripts'); add_action('admin_print_styles', 'black_studio_tinymce_styles'); add_action('admin_print_footer_scripts', 'black_studio_tinymce_footer_scripts'); } } }
// END class Black_Studio_TinyMCE_Plugin } // END class_exists check if (!function_exists('bstw')) { /** * Return the main instance to prevent the need to use globals * * @return object * @since 2.0.0 */ function bstw() { return Black_Studio_TinyMCE_Plugin::instance(); } /* Create the main instance */ bstw(); } else { /* Check for multiple plugin instances */ if (!function_exists('bstw_multiple_notice')) { /** * Show admin notice when multiple instances of the plugin are detected * * @return void * @since 2.1.0 */ function bstw_multiple_notice() { global $pagenow; if ('widgets.php' == $pagenow) { echo '<div class="error">'; /* translators: error message shown when multiple instance of the plugin are detected */
/** * Initialize compatibility for Page Builder (SiteOrigin Panels) * * @uses add_filter() * @uses add_action() * @uses remove_filter() * @uses add_action() * @uses is_plugin_active() * * @return void * @since 2.0.0 */ public function siteorigin_panels_admin_init() { if (is_admin() && is_plugin_active('siteorigin-panels/siteorigin-panels.php')) { add_filter('siteorigin_panels_widget_object', array($this, 'siteorigin_panels_widget_object'), 10); add_filter('black_studio_tinymce_container_selectors', array($this, 'siteorigin_panels_container_selectors')); add_filter('black_studio_tinymce_activate_events', array($this, 'siteorigin_panels_activate_events')); add_filter('black_studio_tinymce_deactivate_events', array($this, 'siteorigin_panels_deactivate_events')); add_filter('black_studio_tinymce_enable_pages', array($this, 'siteorigin_panels_enable_pages')); remove_filter('widget_text', array(bstw()->text_filters(), 'wpautop'), 8); } }
/** * @since 1.4.5 * @deprecated 2.0.0 */ function black_studio_tinymce_siteorigin_panels_widget_object($the_widget) { _deprecated_function(__FUNCTION__, '2.0.0', 'bstw()-compatibility()->plugins()->siteorigin_panels_widget_object( ... )'); bstw()->compatibility()->plugins()->siteorigin_panels_widget_object($the_widget); }
/** * Compatibility for WordPress prior to 3.9 * * @uses add_action() * @uses remove_action() * @uses add_filter() * @uses get_bloginfo() * @uses Black_Studio_TinyMCE_Admin::enabled() * * @return void * @since 2.0.0 */ public function wp_pre_39() { $wp_version = get_bloginfo('version'); if (bstw()->admin()->enabled()) { add_filter('black-studio-tinymce-widget-script', array($this, 'wp_pre_39_handle'), 61); add_filter('tiny_mce_before_init', array($this, 'wp_pre_39_tiny_mce_before_init'), 61); add_action('admin_print_footer_scripts', array($this, 'wp_pre_39_admin_print_footer_scripts')); remove_action('admin_print_footer_scripts', array(bstw()->admin(), 'admin_print_footer_scripts')); if (!version_compare($wp_version, '3.2', '<')) { remove_action('admin_print_footer_scripts', array($this, 'wp_pre_32_admin_print_footer_scripts')); } if (!version_compare($wp_version, '3.3', '<')) { remove_action('admin_print_footer_scripts', array($this, 'wp_pre_33_admin_print_footer_scripts')); } add_action('black_studio_tinymce_editor', array($this, 'wp_pre_39_editor'), 10, 4); remove_action('black_studio_tinymce_editor', array(bstw()->admin(), 'editor'), 10, 3); } }
/** * Helper function to enqueue script * * @uses wp_enqueue_style() * @uses wp_enqueue_script() * @uses plugins_url() * @uses wp_localize_script() * @uses SCRIPT_DEBUG * * @param mixed[] $pointers * @return void * @since 2.1.0 */ public function enqueue($pointers) { $script = 'black-studio-tinymce-widget-pointer'; $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_style('wp-pointer'); wp_enqueue_script($script, plugins_url('js/' . $script . $suffix . '.js', dirname(__FILE__)), array('wp-pointer'), bstw()->get_version(), true); wp_localize_script('black-studio-tinymce-widget-pointer', 'bstw_pointers', $pointers); }
/** * Show row meta on the plugin screen * * @uses esc_html() * @uses esc_url() * * @param string[] $links * @param string $file * @return string[] * @since 2.0.0 */ public function plugin_row_meta($links, $file) { if ($file == bstw()->get_basename()) { foreach ($this->links as $url => $label) { $links[$label] = '<a href="' . esc_url($url) . '" target="_blank">' . esc_html($label) . '</a>'; } } return $links; }
/** * Initialize compatibility for Page Builder ( SiteOrigin Panels ) * * @uses add_filter() * @uses add_action() * @uses remove_filter() * @uses add_action() * @uses is_plugin_active() * * @return void * @since 2.0.0 */ public function siteorigin_panels_admin_init() { // if ( is_admin() && // ( is_plugin_active( 'siteorigin-panels/siteorigin-panels.php' ) || // is_plugin_active( 'page-builder-for-canvas-master/page-builder-for-canvas.php' ) ) // This VE2 is bundled in Page Builder, so don't need to check for Page Builder if (is_admin()) { add_filter('siteorigin_panels_widget_object', array($this, 'siteorigin_panels_widget_object'), 10); add_filter('black_studio_tinymce_container_selectors', array($this, 'siteorigin_panels_container_selectors')); add_filter('black_studio_tinymce_activate_events', array($this, 'siteorigin_panels_activate_events')); add_filter('black_studio_tinymce_deactivate_events', array($this, 'siteorigin_panels_deactivate_events')); add_filter('black_studio_tinymce_enable_pages', array($this, 'siteorigin_panels_enable_pages')); remove_filter('widget_text', array(bstw()->text_filters(), 'wpautop'), 8); } }
/** * 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; }
function kt_remove_bstw_do_shortcode() { if (function_exists('bstw')) { remove_filter('widget_text', array(bstw()->text_filters(), 'do_shortcode'), 10); } }
/** * Remove WordPress formatting and adding page specific CSS * * WordPress auto formatting makes it difficult to design static pages. This function * stops WP from adding <p> tags and removing line breaks. * * Second part of this function pulls the CSS added through the page through custom fields * and adds it to the head * * @since Swift 6.0 */ function swift_cms_mode() { if (!is_singular()) { return; } global $wp_query, $swift_post_meta; $swift_post_meta = get_post_meta($wp_query->post->ID, '_swift_post_meta', true); // Removing wpautop if (isset($swift_post_meta['disable_oversmart_tinymce']) && (bool) $swift_post_meta['disable_oversmart_tinymce']) { remove_filter('the_content', 'wpautop'); //remove_filter('widget_text', 'wpautop'); if (function_exists('bstw')) { remove_filter('widget_text', array(bstw()->text_filters(), 'wpautop'), 8); } } echo '<style>'; if (isset($swift_post_meta['page_css']) && $swift_post_meta['page_css'] != '') { echo $swift_post_meta['page_css']; } if (isset($swift_post_meta['page_css_desktops']) && $swift_post_meta['page_css_desktops'] != '') { echo '@media screen and (min-width: 768px){' . $swift_post_meta['page_css_desktops'] . '}'; } if (isset($swift_post_meta['page_css_tablets']) && $swift_post_meta['page_css_tablets'] != '') { echo '@media screen and (min-width:580px) and (max-width: 768px){' . $swift_post_meta['page_css_tablets'] . '}'; } if (isset($swift_post_meta['page_css_mobiles']) && $swift_post_meta['page_css_mobiles'] != '') { echo '@media screen and (max-width: 580px){' . $swift_post_meta['page_css_mobiles'] . '}'; } echo '</style>'; }