[wp-hackers] extra plugin hooks for admin interface?

Jamie Talbot wphackers at jamietalbot.com
Tue Nov 16 13:30:01 UTC 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tara Star wrote:
| I've seen there is a plugin hook to add things in the admin footer --
|  but are there any which would let plugin authors add things in the
| form itself? If not, could such hooks be made available?

At the moment, you can add the form objects in the admin_footer and then
use Javascript DOM scripting to push it to the correct place.  It's not
ideal I guess, but here's an attached example (modified from stuff
originally by Owen Winkler).

Cheers,

Jamie.


| Thanks a bunch,
|
| Steph aka bunny -- http://climbtothestars.org/
|
| _______________________________________________ hackers mailing list
|  hackers at wordpress.org
| http://wordpress.org/mailman/listinfo/hackers_wordpress.org
|
|
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBmgDZrovxfShShFARAvHbAKCJ7Fwohed1zBirpxA6HHdrjlAIGgCeIC4V
i+zSpja3Ys5ettk/7YNVfHk=
=h/UA
-----END PGP SIGNATURE-----
-------------- next part --------------
// http://www.asymptomatic.net/wp-hacks.
/**
 * xvalid_admin_footer()
 * 
 * @param string $ignored Unused.
 * @return 
 **/
function xvalid_admin_footer($ignored)
{
	// Check we are on the post page, and not editing a comment (ie, we are on the main writing page).
	if(preg_match('|post.php|i', $_SERVER['SCRIPT_NAME']) && $_GET['action'] != "editcomment")
	{
		// Parse a configuration file...
		@preg_match("|Show Output:(.*)|i", implode('', file(ABSPATH . 'wp-content/xvalid.cfg')), $xv_show_output);
?>	
		<div id="xv_options">
<?php
		// Populate my plugin-specific DIV here...
		if (is_writable(ABSPATH . 'wp-content/')) 
		{ 
?>			<label style="float: right; padding: 5px; margin: 0 0 0 5px;"><input type="checkbox" name="xv_verbose"<?php if ("true" == trim($xv_show_output[1])) echo " checked=\"checked\""; ?> /> Show Results</label>
<?php		}
		else
		{
?>			<p style="float: right; padding: 5px; margin: 0;"><i>but feedback is not available because <a href="<?php echo get_settings('site_url') . '../wp-content/' ?>">wp-content</a> is not writable.</i></p>
<?php		}
?>		<p id="xvalid" style="text-align: right; padding: 5px; margin: 0;">
		<i>This text will be processed by <a href="http://www.jamietalbot.com/wp-hacks/">X-Valid 0.91</a></i>
		</p>
		</div>
<?php
		// This is the line that moves the checkbox to the correct place (just under the main entry box)
		// Admin placement code gratefully cribbed and tweaked from Owen Winkler's Adhesive Plugin!
		echo '<script language="JavaScript" type="text/javascript">var placement = document.getElementById("postdiv"); 
			var substitution = document.getElementById("xv_options"); 
			placement.appendChild(substitution);</script>';

		// Extra plugin-specific stuff.
		if (file_exists("../wp-content/xv_output.php")) echo "<script language=\"JavaScript\" type=\"text/javascript\">window.open('../wp-content/xv_output.php','_blank','width=600,height=600,resizable=0,scrollbars=yes');</script>";
	}
}

then...

add_filter('admin_footer', 'xvalid_admin_footer', 8);


More information about the hackers mailing list