PluginProbe
Themify Event Post / trunk
Themify Event Post vtrunk
1.3.7 trunk 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6
themify-event-post / includes / tinymce.php

tinymce.php in Themify Event Post trunk, at includes/tinymce.php

76 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * TinyMCE Shortcode Generator
4 *
5 * @package Themify Event Post
6 * @since 1.0.0
7 */
8
9 class Themify_Events_Posts_TinyMCE {
10
11 function __construct() {
12 add_filter( 'mce_external_plugins', array( $this, 'add_plugin' ) );
13 add_filter( 'mce_buttons', array( $this, 'add_button' ) );
14 add_action( 'wp_enqueue_editor', array( $this, 'wp_enqueue_editor' ) );
15 }
16
17 /**
18 * Add button to WP Editor.
19 *
20 * @param array $mce_buttons
21 * @return mixed
22 */
23 function add_button( $mce_buttons ) {
24 $mce_buttons[] = 'separator';
25 $mce_buttons[] = 'btnthemifyEventPosts';
26 return $mce_buttons;
27 }
28
29 /**
30 * Add plugin JS file to list of external plugins.
31 *
32 * @param array $mce_external_plugins
33 * @return mixed
34 */
35 function add_plugin( $mce_external_plugins ) {
36 $mce_external_plugins['btnthemifyEventPosts'] = Themify_Event_Post::get_instance()->url . 'assets/tinymce.js';
37
38 return $mce_external_plugins;
39 }
40
41 /**
42 * Enqueue assets required for tinymce shortcode generator
43 *
44 * @since 1.8.9
45 */
46 function wp_enqueue_editor() {
47 $instance = Themify_Event_Post::get_instance();
48 wp_enqueue_style( $instance->pid . '-tinymce', $instance->url . 'assets/tinymce.css' );
49
50 wp_localize_script( 'editor', 'themifyEventPostsMCE', array(
51 'fields' => include $instance->locate_template( 'config-shortcode-generator' ),
52 'labels' => array(
53 'menuTooltip' => __( 'Themify Event Post Shortcode Generator', 'themify-event-post' ),
54 'menuName' => __( 'Event Posts', 'themify-event-post' ),
55 ),
56 'template' =>
57 '[themify_event_post'
58 . '<# if ( data.style !== "grid3" ) { #> style="{{data.style}}"<# } #>'
59 . '<# if ( data.show !== "upcoming" ) { #> show="{{data.show}}"<# } #>'
60 . '<# if ( data.limit ) { #> limit="{{data.limit}}"<# } #>'
61 . '<# if ( data.category ) { #> category="{{data.category}}"<# } #>'
62 . '<# if ( data.order !== "DESC" ) { #> order="{{data.order}}"<# } #>'
63 . '<# if ( data.orderby !== "event_date" ) { #> orderby="{{data.orderby}}"<# } #>'
64 . '<# if ( data.display !== "excerpt" ) { #> display="{{data.display}}"<# } #>'
65 . '<# if ( data.image !== "yes" ) { #> image="{{data.image}}"<# } #>'
66 . '<# if ( data.image_w ) { #> image_w="{{data.image_w}}"<# } #>'
67 . '<# if ( data.image_h ) { #> image_h="{{data.image_h}}"<# } #>'
68 . '<# if ( data.hide_event_date !== "no" ) { #> hide_event_date="{{data.hide_event_date}}"<# } #>'
69 . '<# if ( data.hide_event_organizer !== "no" ) { #> hide_event_organizer="{{data.hide_event_organizer}}"<# } #>'
70 . '<# if ( data.hide_event_performer !== "no" ) { #> hide_event_performer="{{data.hide_event_performer}}"<# } #>'
71 . '<# if ( data.hide_event_location !== "no" ) { #> hide_event_location="{{data.hide_event_location}}"<# } #>'
72 . '<# if ( data.hide_page_nav !== "no" ) { #> hide_page_nav="{{data.hide_page_nav}}"<# } #>'
73 . ']'
74 ));
75 }
76 }