protected static function get_tinymce_dialog_params()
 {
     ob_start();
     require dirname(__FILE__) . '/tools.php';
     ob_end_clean();
     $sets = TT_Tools::get_tinymce_dialog_settings();
     echo json_encode($sets);
 }
Esempio n. 2
0
        public static function hooks_helper_admin_header()
        {
            //	Output the information for the dialog box and setup the dialog box.
            //	We need to be in the admin, editing a post or page for the plugin to be
            //	initialized, so we don't want to add the jQuery dialog unless the same
            //	conditions apply.  So are we?
            global $current_screen;
            $type = $current_screen->post_type;
            if (is_admin() && ($type == 'post' || $type == 'page')) {
                ?>
					<script type='text/javascript'>
						<?php 
                // Get the URL to the AJAX handler file and save it
                ?>
						var ajaxurl = "<?php 
                echo admin_url('admin-ajax.php');
                ?>
";
						
						jQuery(document).ready(function() {
							<?php 
                // Output the dialog boxes data as a JavaScript variable
                //	Strategy Cribbed From Here: http://stackoverflow.com/a/4935684/2523144
                //
                //	Encode the PHP variable as JSON.  Use native JavaScript to parse the JSON
                //	if the necessary fuction is available.  If not, use the slower jQuery
                //	version.
                $json = json_encode(TT_Tools::get_tinymce_dialog_settings());
                ?>
							window.TT_Data = <?php 
                echo $json;
                ?>
;


							<?php 
                // Turn the dialog box code included above into a jQuery dialog
                ?>
						
							var scDialog = jQuery('#TT-shortcode-creator-dialog').dialog({
								autoOpen: false,
								modal: true,
								maxHeight: 950,
								resizable: false,
								width: 650,
								open: function() {
									//	Fix Random jQuery UI CSS Scoping Issues	//
									jQuery('div.ui-widget-overlay, div.ui-dialog').wrap('<div class="tt-jqui" />');
								}
							});
							scDialog.parent('.ui-dialog').addClass( 'tt-jqui' );	//	jQuery UI Theme Scope

							jQuery('#tt-dialog-launcher').click(function(event) {
								event.preventDefault();
								jQuery('#TT-shortcode-creator-dialog').dialog("open");
							});
						});						
					</script>
					<?php 
            }
        }