PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 1.9.7.2
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v1.9.7.2
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
← All changes | admin/class-convertkit-admin-tinymce.php +13 -61 2.2.81.9.7.2 View file →
@@ -48,9 +48,8 @@
48 48 $shortcodes = convertkit_get_shortcodes();
49 49
50 50 // Get requested shortcode name.
51 51 $shortcode_name = sanitize_text_field( $_REQUEST['shortcode'] );
52 - $editor_type = sanitize_text_field( $_REQUEST['editor_type'] );
53 52
54 53 // If the shortcode is not registered, return a view in the modal to tell the user.
55 54 if ( ! isset( $shortcodes[ $shortcode_name ] ) ) {
56 55 require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal-missing.php';
@@ -59,30 +58,10 @@
59 58
60 59 // Define shortcode.
61 60 $shortcode = $shortcodes[ $shortcode_name ];
62 61
63 - // Show a message in the modal if no API Key is specified.
64 - if ( array_key_exists( 'has_api_key', $shortcode ) && ! $shortcode['has_api_key'] ) {
65 - $notice = $shortcode['no_api_key'];
66 - require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal-notice.php';
67 - die();
68 - }
69 -
70 - // Show a message in the modal if no resources exist.
71 - if ( array_key_exists( 'has_resources', $shortcode ) && ! $shortcode['has_resources'] ) {
72 - $notice = $shortcode['no_resources'];
73 - require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal-notice.php';
74 - die();
75 - }
76 -
77 - // If we have less than two panels defined in the shortcode properties, output a basic modal.
78 - if ( count( $shortcode['panels'] ) < 2 ) {
79 - require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal.php';
80 - die();
81 - }
82 -
83 - // Output tabbed view.
84 - require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal-tabbed.php';
62 + // Output the modal.
63 + require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal.php';
85 64 die();
86 65
87 66 }
88 67
@@ -102,8 +81,9 @@
102 81 }
103 82
104 83 // Enqueue Quicktag JS.
105 84 wp_enqueue_script( 'convertkit-admin-quicktags', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/quicktags.js', array( 'jquery', 'quicktags' ), CONVERTKIT_PLUGIN_VERSION, true );
85 + wp_enqueue_script( 'convertkit-admin-modal', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/modal.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true );
106 86
107 87 // Make shortcodes available as convertkit_quicktags JS variable.
108 88 wp_localize_script( 'convertkit-admin-quicktags', 'convertkit_quicktags', $shortcodes );
109 89
@@ -116,17 +96,19 @@
116 96 )
117 97 );
118 98
119 99 // Enqueue Quicktag CSS.
120 - wp_enqueue_style( 'convertkit-admin-quicktags', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/quicktags.css', array(), CONVERTKIT_PLUGIN_VERSION );
100 + wp_enqueue_style( 'convertkit-admin-quicktags', CONVERTKIT_PLUGIN_URL . '/resources/backend/css/quicktags.css', array(), CONVERTKIT_PLUGIN_VERSION );
121 101
122 - // Enqueue WordPress JS and CSS.
123 - wp_enqueue_script( 'wp-color-picker' );
124 - wp_enqueue_style( 'wp-color-picker' );
125 -
126 102 // Output Backbone View Template.
127 - add_action( 'wp_print_footer_scripts', array( $this, 'output_quicktags_modal' ) );
128 - add_action( 'admin_print_footer_scripts', array( $this, 'output_quicktags_modal' ) );
103 + ?>
104 + <script type="text/template" id="tmpl-convertkit-quicktags-modal">
105 + <div id="convertkit-quicktags-modal">
106 + <div class="media-frame-title"><h1>Title</h1></div>
107 + <div class="media-frame-content">Content</div>
108 + </div>
109 + </script>
110 + <?php
129 111
130 112 }
131 113
132 114 /**
@@ -147,12 +129,11 @@
147 129 return $plugins;
148 130 }
149 131
150 132 // Enqueue TinyMCE CSS and JS.
151 - wp_enqueue_script( 'convertkit-admin-tabs', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/tabs.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true );
152 133 wp_enqueue_script( 'convertkit-admin-tinymce', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/tinymce.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true );
153 134 wp_enqueue_script( 'convertkit-admin-modal', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/modal.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true );
154 - wp_enqueue_style( 'convertkit-admin-tinymce', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/tinymce.css', array(), CONVERTKIT_PLUGIN_VERSION );
135 + wp_enqueue_style( 'convertkit-admin-tinymce', CONVERTKIT_PLUGIN_URL . '/resources/backend/css/tinymce.css', array(), CONVERTKIT_PLUGIN_VERSION );
155 136
156 137 // Register JS variable convertkit_admin_tinymce.nonce for AJAX calls.
157 138 wp_localize_script(
158 139 'convertkit-admin-tinymce',
@@ -197,37 +178,8 @@
197 178 $buttons[] = 'convertkit_' . $shortcode;
198 179 }
199 180
200 181 return $buttons;
201 -
202 - }
203 -
204 - /**
205 - * Outputs the QuickTags modal view in the footer of the site, which is
206 - * used when using the Text editor button to insert a shortcode.
207 - *
208 - * @since 1.9.7.5
209 - */
210 - public function output_quicktags_modal() {
211 -
212 - ?>
213 - <script type="text/template" id="tmpl-convertkit-quicktags-modal">
214 - <div id="convertkit-quicktags-modal">
215 - <div class="media-frame-title"><h1></h1></div>
216 - <div class="media-frame-content"></div>
217 - <div class="media-frame-toolbar">
218 - <div class="media-toolbar">
219 - <div class="media-toolbar-secondary">
220 - <button type="button" class="button button-large cancel"><?php esc_html_e( 'Cancel', 'convertkit' ); ?></button>
221 - </div>
222 - <div class="media-toolbar-primary">
223 - <button type="button" class="button button-primary button-large"><?php esc_html_e( 'Insert', 'convertkit' ); ?></button>
224 - </div>
225 - </div>
226 - </div>
227 - </div>
228 - </script>
229 - <?php
230 182
231 183 }
232 184
233 185 }