@@ -43,35 +43,35 @@ public function __construct()
4343 * Check if the current user can edit Posts or Pages, and is using the Visual Editor
4444 * If so, add some filters so we can register our plugin
4545 */
46- public function setupTinymcePlugin ()
46+ public function setupTinyMcePlugin ()
4747 {
4848 if (! current_user_can ('edit_posts ' ) && ! current_user_can ('edit_pages ' )) {
4949 return ;
5050 }
51-
51+
5252 // Check if the logged in WordPress User has the Visual Editor enabled
5353 // If not, don't register our TinyMCE plugin
5454 if (get_user_option ('rich_editing ' ) !== 'true ' ) {
5555 return ;
5656 }
57-
57+
5858 $ this ->init ();
59-
60- if (!$ this ->pluginSlug || ! $ this -> pluginSlug ) {
59+
60+ if (!$ this ->pluginSlug ) {
6161 return ;
6262 }
63-
63+
6464 //Change button row placement if buttonRow is defined
6565 if (isset ($ this ->buttonRow ) && is_numeric ($ this ->buttonRow ) && $ this ->buttonRow > 1 ) {
6666 $ this ->buttonFilter .= '_ ' . $ this ->buttonRow ;
6767 }
68-
68+
6969 //LocalizeData (if any)
7070 if (is_array ($ this ->data ) && !empty ($ this ->data )) {
7171 add_action ('admin_head ' , array ($ this , 'localizeScript ' ));
7272 }
7373
74- add_filter ('mce_external_plugins ' , array ($ this , 'addTinyMcePlugin ' ));
74+ add_filter ('mce_external_plugins ' , array ($ this , 'addTinyMcePlugin ' ), 20 , 1 );
7575 add_filter ($ this ->buttonFilter , array ($ this , 'addTinymceToolbarButton ' ));
7676 }
7777
@@ -84,7 +84,7 @@ public function setupTinymcePlugin()
8484 public function addTinyMcePlugin ($ plugins )
8585 {
8686 $ plugins [$ this ->pluginSlug ] = get_template_directory_uri () . '/assets/dist/ ' .
87- \Municipio \Helper \CacheBust::name ('js/mce.js ' );
87+ \Municipio \Helper \CacheBust::name ('js/mce-buttons .js ' );
8888
8989 return $ plugins ;
9090 }
@@ -98,13 +98,14 @@ public function addTinyMcePlugin($plugins)
9898 */
9999 public function addTinymceToolbarButton ($ buttons )
100100 {
101- array_push ($ buttons , '' , $ this ->pluginSlug );
101+ array_push ($ buttons , $ this ->pluginSlug );
102+
102103 return $ buttons ;
103104 }
104105
105106 public function localizeScript ()
106107 {
107- $ output = '<script type="text/javascript" atr="lol" > ' ;
108+ $ output = '<script type="text/javascript"> ' ;
108109 $ output .= 'var ' . $ this ->pluginSlug . ' = { ' ;
109110
110111 foreach ($ this ->data as $ key => $ value ) {
0 commit comments