Micro Visions, Inc. Description: This plugin displays blog author information */ //setup the main class if (!class_exists("MVIAuthor")) { class MVIAuthor { function __construct() { } function control(){ //get the stored author name and text $aName = get_option('mviAuthorName'); $aBio = get_option('mviAuthorBio'); //if no value has been stored, set the default value if (!is_array($aName)) { $aName = array('mviAuthorName' => 'Name'); } if (!is_array($aBio)) { $aBio = array('mviAuthorBio' => 'about the author'); } //if this function has been called as a result of the user clicking //Save after entering a new value, save it to the WP database if ($_POST['bioSubmit']) { $aName['mviAuthorName'] = htmlspecialchars($_POST['mviAuthorName']); update_option('mviAuthorName', $aName); $aBio['mviAuthorBio'] = htmlspecialchars($_POST['mviAuthorBio']); update_option('mviAuthorBio', $aBio); } //display the control panel with the default or saved value echo '
';
echo '
';
echo '';
echo '
';
echo '
';
echo '';
//this hidden input is used to generate a POST variable,
//signifying that the user has entered a value
echo '';
echo '';
echo '
';
echo ''.$n.' '.$b; } } } //this function is called when the plugin is loaded function widget_MVIAuthor() { if (class_exists("MVIAuthor")) { $a = new MVIAuthor(); $a->displayAuthor(); } } //this function is called to handle the control panel function control_MVIAuthor() { if (class_exists("MVIAuthor")) { $a = new MVIAuthor(); $a->control(); } } function mviAuthor_init() { register_sidebar_widget('MVI Author', 'widget_MVIAuthor'); register_widget_control('MVI Author', 'control_MVIAuthor'); } add_action("plugins_loaded", "mviAuthor_init"); ?>