In my editor I would like to use a TinyMCE generated popup to insert in the textarea some complex shortcodes. I use the TinyMCE API to show the popup (bottom of this question). The popup is a PHP file inside my theme. I would like:
- To protect this file from external access (
if ( ! defined( 'ABSPATH' ) )
does not work). - Use some WP functions inside this popup.
Which is the way you could suggest?
TinyMCE API call
init : function(ed, url) {
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mcecax_webnews');
ed.addCommand('mcecax_webnews', function() {
ed.windowManager.open({
file : url + '/dialog.php',
width : 650 + ed.getLang('cax_webnews.delta_width', 0),
height : 500 + ed.getLang('cax_webnews.delta_height', 0),
inline : 1
}, {
plugin_url : url, // Plugin absolute URL
some_custom_arg : 'custom arg' // Custom argument
});
});
[...] CUTTED