get_version(), true ); wp_localize_script( 'black-studio-tinymce-widget-pointer', 'bstw_pointers', $pointers ); } /** * Load admin pointer(s) * * @uses get_current_screen() * @uses apply_filters() * * @return void * @since 2.1.0 */ public function load() { $screen = get_current_screen(); $pointers = apply_filters( 'black_studio_tinymce_admin_pointers-' . $screen->id, array() ); if ( ! empty( $pointers ) ) { $this->enqueue( $pointers ); } } /** * Remove dismissed pointer(s) * * @uses get_user_meta() * @uses get_current_user_id() * * @param mixed[] $pointers * @return mixed[] * @since 2.1.0 */ public function filter_dismissed( $pointers ) { $valid_pointers = array(); if ( is_array( $pointers ) && function_exists( 'get_user_meta' ) ) { $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); foreach ( $pointers as $pointer_id => $pointer ) { if ( ! in_array( $pointer_id, $dismissed ) ) { $pointer['pointer_id'] = $pointer_id; $valid_pointers['pointers'][] = $pointer; } } } return $valid_pointers; } /** * Register admin pointer(s) * * @param mixed[] $pointers * @return mixed[] * @since 2.1.0 */ public function register( $pointers ) { $pointers['black_studio_tinymce_widget'] = array( 'target' => 'div[id$=black-studio-tinymce-__i__] .widget-top', 'options' => array( 'content' => sprintf( '
%s
', /* translators: title for the dismissable admin pointer tooltip (same as plugin name) */ __( 'Black Studio TinyMCE Widget', 'black-studio-tinymce-widget' ), /* translators: text for the dismissable admin pointer tooltip */ __( 'The Visual Editor widget allows you to insert rich text and media objects in your sidebars', 'black-studio-tinymce-widget' ) ), 'position' => array( 'edge' => 'left', 'align' => 'middle' ) ) ); return $pointers; } } // END class Black_Studio_TinyMCE_Admin_Pointer } // END class_exists check