All pastes #15567 Raw Edit

Something

public text v1 · immutable
#15567 ·published 2005-06-22 18:17 UTC
rendered paste body
<?php
/*
Plugin Name: K2 Options Panel
Plugin URI: http://binarybonsai.com/k2/
Description: Installs an option panel for the K2 theme.
Version: 1.0 alpha
Author: Michael Heilemann
Author URI: http://binarybonsai.com
*/


// This section installs the plugin, quite deviously.
// Code supplied by Turnip: http://binarybonsai.com/archives/2005/06/03/k2-options-panel/#comment-14748

if (empty($plugins)) {

	$write_option = true;

} else {

	foreach ($plugins as $plugin) {
	
		if ($plugin == '../themes/k2/test.php') {
			$write_option = false;
			break;
		} else {
			$write_option = true;
		}
	
		if ($write_option) {
			$plugins[count($plugins)] = '../themes/k2/test.php';
			update_option('active_plugins', $plugins);
		}
	}

}


// Let's add the options page.

add_action ('admin_menu', 'notepad_menu');

function notepad_menu() {
    add_submenu_page( 'k2options.php',"Notes", 'Write Note', 5, __FILE__, "the_notepad");
}





?>