options = get_option('spreadx_options'); } function spreadx_install(){ /** * Installs the plugin by creating the options * @param NULL * @return NULL */ $options = array(); $options["sites"] = array("digg", "stumble", "technorati", "facebook", "delicious"); $options["buttons"] = '
 Digg  Facebook  StumbleUpon  Technorati  Deli.cio.us 
'; $options["scope"] = array("post"); update_option('spreadx_options', $options); } function spreadx_uninstall(){ /** * Uninstalls the plugin by deleting the options * * @param NULL * @return NULL */ delete_option('spreadx_options'); } function spreadx_admin_menu(){ /** * The hook for the admin menu * * @param NULL * @return NULL */ add_management_page('SpreadX', 'SpreadX', 6, __FILE__, array($this, 'spreadx_admin_page')); } function spreadx_admin_page(){ /** * The administration page for updating options * * @param NULL * @return NULL */ clearstatcache(); $scope = array(); $buttons = ''; $sites = array(); if ($_POST["action"] == "update"){ $message = "Websites Updated"; if ($_POST["sites"]){ $buttons = "
"; foreach($_POST["sites"] as $site){ if (in_array($site, array_keys($this->pages))){ $sites[] = $site; $buttons .= " pages[$site][2] . "\" target=\"_new\">"; $buttons .= "pages[$site][0] . "\" border=\"0\" />"; $buttons .= " "; } } $buttons .= "
"; } if ($_POST["scope"]){ foreach($_POST["scope"] as $s){ $scope[] = $s; } } $this->options["sites"] = $sites; $this->options["buttons"] = $buttons; $this->options["scope"] = $scope; //$this->options["twitter_username"] = $_POST["twitter_username"]; update_option("spreadx_options", $this->options); } $text .= "
"; $text .= "

SpreadX

"; if ($message){ $text .= "
$message"; } $text .= "
"; $text .= "
"; $text .= "
"; $text .= "
"; $text .= "

SpreadX General Options

"; $text .= "
"; $text .= "
"; $text .= ""; $text .= ""; foreach(array_keys($this->pages) as $page){ if (in_array($page, $this->options["sites"])){ $c = "checked"; } else { $c = ''; } $text .= ""; $text .= ""; $text .= ""; } if (in_array("post", $this->options["scope"])){ $c = "checked"; } else { $c = ''; } $text .= ""; $text .= ""; $text .= ""; if (in_array("page", $this->options["scope"])){ $c = "checked"; } else { $c = ''; } $text .= ""; $text .= ""; $text .= ""; //$text .= ""; //$text .= ""; //$text .= ""; $text .= "
"; $text .= "
"; $text .= ""; $text .= "
"; $text .= ""; $text .= "
"; //$text .= "options["twitter_username"] . "\" />"; //$text .= "
"; $text .= "

"; $text .= "

"; $text .= "
"; print($text); } } ?>