#3715 closed defect (bug) (worksforme)
admin_footer doesn't work in post-new.php
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.1 |
| Component: | Administration | Keywords: | |
| Focuses: | Cc: |
Description
admin_footer hook doesn't seem to work in post-new.php.
It works fine in page-new.php and post.php
I've been trying to add a button using the edit button template. The button used to get added perfectly in versions prior to 2.1. With 2.1 onwards, the button is not added only on the post-new.php page. There is no change in behavior in the page-new.php and post.php pages.
IImage Browser is one such plugin that adds a button. It has been updated for 2.1 and displaying the behavior I explained above.
Change History (3)
Note: See
TracTickets for help on using
tickets.
The code being used is:
add_filter('admin_footer', 'callback_iimagebrowser'); function callback_iimagebrowser() { if(strpos($_SERVER['REQUEST_URI'], 'post.php') || strpos($_SERVER['REQUEST_URI'], 'comment.php') || strpos($_SERVER['REQUEST_URI'], 'page.php') || strpos($_SERVER['REQUEST_URI'], 'post-new.php') || strpos($_SERVER['REQUEST_URI'], 'page-new.php') || strpos($_SERVER['REQUEST_URI'], 'bookmarklet.php')) { ?> <script language="JavaScript" type="text/javascript"><!-- var toolbar = document.getElementById("ed_toolbar"); <?php edit_insert_button("IImage Browser", "iimagebrowser", "IImage Browser"); ?> function iimagebrowser() { window.open("../wp-admin/iimage-browser.php", "IImageBrowser", "width=700,height=600,scrollbars=yes"); } //--></script> <?php } } if(!function_exists('edit_insert_button')) { //edit_insert_button: Inserts a button into the editor function edit_insert_button($caption, $js_onclick, $title = '') { ?> if(toolbar) { var theButton = document.createElement('input'); theButton.type = 'button'; theButton.value = '<?php echo $caption; ?>'; theButton.onclick = <?php echo $js_onclick; ?>; theButton.className = 'ed_button'; theButton.title = "<?php echo $title; ?>"; theButton.id = "<?php echo "ed_{$caption}"; ?>"; toolbar.appendChild(theButton); } <?php } }