function utw_options()
    {
        global $lzndomain, $utw, $wpdb, $tabletags, $tablepost2tag, $install_directory;
        $siteurl = get_option('siteurl');
        $autoincludedhelp = 'These settings allow displaying tags automatically in a post.  You can choose whether the tags display before or after the text of your post, and you can have up to two sets of tags.  The base format chooses the basic style of the tags,  and the prefix and suffix allow wrapping the tags in additional HTML such as by adding a "tags" label or icon,  or wrapping an HTML list in <ul> tags.';
        echo '<div class="wrap">';
        $configValues = array();
        $configValues[] = array("setting" => "", "label" => __("URL settings", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __("These settings control how tags look.  You can change the base url to just about anything you want,  but it should begin and end with a slash.  By default, tag pages are /tag/sometag.  If you want tag pages to be /tag/sometag/ tick the trailing slashes box.", $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_use_pretty_urls", "label" => __("Use url rewriting for local tag urls (/tag/tag instead of index.php?tag=tag)", $lzndomain), "type" => "boolean");
        $configValues[] = array("setting" => "utw_base_url", "label" => __("Base url", $lzndomain), "type" => "string");
        $configValues[] = array("setting" => "utw_trailing_slash", 'label' => __("Include trailing slash on tag urls", $lzndomain), 'type' => 'boolean');
        $configValues[] = array("setting" => "", "label" => __("Meta Keywords", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __("When enabled, meta keywords will be included in the header of tag pages, and single post pages.  These keywords are sometimes used by search engines.", $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_show_meta_keywords", 'label' => __("Include meta keywords", $lzndomain), 'type' => 'boolean');
        $configValues[] = array("setting" => "", "label" => __("Embedded Tags", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __("Embedded tags are tags which are found in the content body of posts.  They use the format of the <a href=\"http://www.broobles.com/scripts/simpletags/\">Simple Tags</a> plugin, which is as good a choice as any.  Tags that are [tag]like this[/tag] will turn into local tag links in the content,  and will be added to the list of tags for the post and [tags]like this, or this[/tags] will be treated as a list of tags for the post, and be added to the list of tags for the post,  and won't display when you view the post.", $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_use_embedded_tags", "label" => __("Use embedded tags", $lzndomain), "type" => "boolean");
        $configValues[] = array("setting" => "", "label" => __("Debugging", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __("Selecting this option will display some debugging information in HTML comments.  You probably don't need this on (:", $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_debug", 'label' => __("Include debugging information", $lzndomain), 'type' => 'boolean');
        $configValues[] = array("setting" => "", "label" => __("Automatic Feed Tags", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __("Selecting this option will append links to the tags to posts in your feed", $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_append_tag_links_to_feed", 'label' => __("Include local tag links in feeds", $lzndomain), 'type' => 'boolean');
        $configValues[] = array("setting" => "", "label" => __("Primary Content Tags", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __($autoincludedhelp, $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_include_local_links", "label" => __("Automatically include primary tag links", $lzndomain), "type" => "dropdown", options => array('No', 'Before Content', 'After Content'));
        $configValues[] = array("setting" => 'utw_primary_automagically_included_link_format', 'label' => __('Base format for primary tag links'), 'type' => 'dropdown', 'options' => $utw->GetPredefinedFormatNames());
        $configValues[] = array("setting" => 'utw_primary_automagically_included_prefix', 'label' => __('Prefix for primary tag links (optional)'), 'type' => 'string');
        $configValues[] = array("setting" => 'utw_primary_automagically_included_suffix', 'label' => __('Suffix for primary tag links (optional)'), 'type' => 'string');
        $configValues[] = array("setting" => "", "label" => __("Secondary Content Tags", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __($autoincludedhelp, $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_include_technorati_links", "label" => __("Automatically include secondary tag links", $lzndomain), "type" => "dropdown", options => array('No', 'Before Content', 'After Content'));
        $configValues[] = array("setting" => 'utw_secondary_automagically_included_link_format', 'label' => __('Base format for secondary tag links'), 'type' => 'dropdown', 'options' => $utw->GetPredefinedFormatNames());
        $configValues[] = array("setting" => 'utw_secondary_automagically_included_prefix', 'label' => __('Prefix for secondary tag links (optional)'), 'type' => 'string');
        $configValues[] = array("setting" => 'utw_secondary_automagically_included_suffix', 'label' => __('Suffix for secondary tag links (optional)'), 'type' => 'string');
        $configValues[] = array("setting" => "", "label" => __("Global Formatting Settings", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __("The colours are hexadecimal colours,  and need to have the full six digits (#eee is the shorthand version of #eeeeee).  The two font sizes are the size of the largest and smallest tags.  The font size units option determines the units that the two font sizes use.  If you have selected a base format which includes 'icons' in its name,  all of the ticked icon-items will display.", $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_tag_cloud_max_color", "label" => __("Most popular color", $lzndomain), "type" => "color");
        $configValues[] = array("setting" => "utw_tag_cloud_max_font", "label" => __("Most popular font size", $lzndomain), "type" => "color");
        $configValues[] = array("setting" => "utw_tag_cloud_min_color", "label" => __("Least popular color", $lzndomain), "type" => "color");
        $configValues[] = array("setting" => "utw_tag_cloud_min_font", "label" => __("Least popular font size", $lzndomain), "type" => "color");
        $configValues[] = array("setting" => 'utw_tag_cloud_font_units', 'label' => __('Font size units', $lzndomain), "type" => "dropdown", "options" => array('%', 'pt', 'px', 'em'));
        $configValues[] = array("setting" => 'utw_icons', 'label' => __('Icons to display in icon formats', $lzndomain), "type" => "multiselect", "options" => array('Technorati', 'Flickr', 'delicious', 'Wikipedia', 'gadabe', 'Zniff', 'RSS'));
        $configValues[] = array('setting' => 'utw_no_tag_text', 'label' => __('The text to display when there are no tags (can be left blank)'), 'type' => 'string');
        $configValues[] = array("setting" => "", "label" => __("Editing Options", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "", "value" => __("These options are for the editing of tags.  The show existing tags option will include a list of your existing tags on the edit screen for easy addition to posts.  The dropdown option will display an alphabetised dropdown list and the tag list option provides a simple list of tags.  The save categories as tags option will add any selected categories as tags in addition to any tags which are specified.", $lzndomain), "type" => "help");
        $configValues[] = array("setting" => "utw_always_show_links_on_edit_screen", "label" => __("Show existing tags on post editing page", $lzndomain), "type" => "dropdown", "options" => array('none', 'dropdown', 'tag list'));
        $configValues[] = array("setting" => "utw_include_categories_as_tags", "label" => __("Automatically add categories as tags", $lzndomain), "type" => "boolean");
        if ($_POST["action"] == "saveconfiguration") {
            foreach ($configValues as $setting) {
                if ($setting['type'] == 'multiselect') {
                    $options = '|';
                    foreach ($setting['options'] as $option) {
                        $options .= $_POST[$setting['setting'] . ":" . $option] . '|';
                    }
                    update_option($setting['setting'], $options);
                } else {
                    if ($setting['type'] != 'label') {
                        update_option($setting['setting'], $_POST[$setting['setting']]);
                    }
                }
            }
            echo "<div class=\"updated\"><p>Updated settings</p></div>";
        }
        echo "<fieldset class=\"options\"><legend>" . __("Help!", $lzndomain) . "</legend><a href=\"{$siteurl}/wp-content/plugins{$install_directory}/ultimate-tag-warrior-help.html\" target=\"_new\">" . __("Local help", $lzndomain) . "</a> | <a href=\"http://www.neato.co.nz/ultimate-tag-warrior\" target=\"_new\">" . __("Author help", $lzndomain) . "</a> | <a href=\"./edit.php?page=ultimate-tag-warrior-actions.php\">Manage Tags</a></fieldset>";
        echo '<fieldset class="options"><legend>' . __('Configuration', $lzndomain) . '</legend>';
        echo "<form method=\"POST\">";
        echo '<table width="100%" cellpadding="3" cellspacing="0">';
        foreach ($configValues as $setting) {
            if ($setting['type'] == 'boolean') {
                UltimateTagWarriorActions::show_toggle($setting['setting'], $setting['label'], get_option($setting['setting']));
            }
            if ($setting['type'] == 'string') {
                UltimateTagWarriorActions::show_string($setting['setting'], $setting['label'], get_option($setting['setting']));
            }
            if ($setting['type'] == 'color') {
                UltimateTagWarriorActions::show_color($setting['setting'], $setting['label'], get_option($setting['setting']));
            }
            if ($setting['type'] == 'label') {
                UltimateTagWarriorActions::show_label($setting['setting'], $setting['label'], get_option($setting['setting']));
            }
            if ($setting['type'] == 'dropdown') {
                UltimateTagWarriorActions::show_dropdown($setting['setting'], $setting['label'], get_option($setting['setting']), $setting['options']);
            }
            if ($setting['type'] == 'multiselect') {
                UltimateTagWarriorActions::show_multiselect($setting['setting'], $setting['label'], get_option($setting['setting']), $setting['options']);
            }
            if ($setting['type'] == 'help') {
                UltimateTagWarriorActions::show_help($setting['setting'], $setting['label'], $setting['value']);
            }
        }
        echo <<<CONFIGFOOTER
\t</table>
\t\t\t<input type="hidden" name="action" value="saveconfiguration">
\t\t\t<input type="hidden" name="page" value="ultimate-tag-warrior-actions.php">
\t\t\t<input type="submit" value="Save">
\t\t</form>
\t</fieldset>
CONFIGFOOTER;
    }
    function utw_options()
    {
        global $lzndomain, $utw, $wpdb, $tableposts, $tabletags, $tablepost2tag, $install_directory;
        $siteurl = get_option('siteurl');
        echo '<div class="wrap">';
        $configValues = array();
        $configValues[] = array("setting" => "", "label" => __("URL settings", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "utw_use_pretty_urls", "label" => __("Use url rewriting for local tag urls (/tag/tag instead of index.php?tag=tag)", $lzndomain), "type" => "boolean");
        $configValues[] = array("setting" => "utw_base_url", "label" => __("Base url", $lzndomain), "type" => "string");
        $configValues[] = array("setting" => "utw_trailing_slash", 'label' => __("Include trailing slash on tag urls", $lzndomain), 'type' => 'boolean');
        $configValues[] = array("setting" => "", "label" => __("Debugging", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "utw_debug", 'label' => __("Include debugging information", $lzndomain), 'type' => 'boolean');
        $configValues[] = array("setting" => "", "label" => __("Automatic Tag Link Inclusion", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "utw_append_tag_links_to_feed", 'label' => __("Include local tag links in feeds", $lzndomain), 'type' => 'boolean');
        $configValues[] = array("setting" => "utw_include_local_links", "label" => __("Automatically include primary tag links", $lzndomain), "type" => "boolean");
        $configValues[] = array("setting" => 'utw_primary_automagically_included_link_format', 'label' => __('Format for primary tag links'), 'type' => 'dropdown', 'options' => $utw->GetPredefinedFormatNames());
        $configValues[] = array("setting" => "utw_include_technorati_links", "label" => __("Automatically include secondary tag links", $lzndomain), "type" => "boolean");
        $configValues[] = array("setting" => 'utw_secondary_automagically_included_link_format', 'label' => __('Format for secondary tag links'), 'type' => 'dropdown', 'options' => $utw->GetPredefinedFormatNames());
        $configValues[] = array("setting" => "", "label" => __("Global Formatting Settings", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "utw_tag_cloud_max_color", "label" => __("Most popular color", $lzndomain), "type" => "color");
        $configValues[] = array("setting" => "utw_tag_cloud_max_font", "label" => __("Most popular size", $lzndomain), "type" => "color");
        $configValues[] = array("setting" => "utw_tag_cloud_min_color", "label" => __("Least popular color", $lzndomain), "type" => "color");
        $configValues[] = array("setting" => "utw_tag_cloud_min_font", "label" => __("Least popular size", $lzndomain), "type" => "color");
        $configValues[] = array("setting" => 'utw_tag_cloud_font_units', 'label' => __('Font size units', $lzndomain), "type" => "dropdown", "options" => array('%', 'pt', 'px', 'em'));
        $configValues[] = array("setting" => 'utw_icons', 'label' => __('Icons to display in icon formats', $lzndomain), "type" => "multiselect", "options" => array('Technorati', 'Flickr', 'delicious', 'Wikipedia', 'gadabe', 'Zniff', 'RSS'));
        $configValues[] = array("setting" => "", "label" => __("Editing Options", $lzndomain), "type" => "label");
        $configValues[] = array("setting" => "utw_always_show_links_on_edit_screen", "label" => __("Show existing tags on post editing page", $lzndomain), "type" => "dropdown", "options" => array('none', 'dropdown', 'tag list'));
        $configValues[] = array("setting" => "utw_include_categories_as_tags", "label" => __("Automatically add categories as tags", $lzndomain), "type" => "boolean");
        if ($_POST["action"] == "saveconfiguration") {
            foreach ($configValues as $setting) {
                if ($setting['type'] == 'multiselect') {
                    $options = '|';
                    foreach ($setting['options'] as $option) {
                        $options .= $_POST[$setting['setting'] . ":" . $option] . '|';
                    }
                    update_option($setting['setting'], $options);
                } else {
                    if ($setting['type'] != 'label') {
                        update_option($setting['setting'], $_POST[$setting['setting']]);
                    }
                }
            }
            echo "<div class=\"updated\"><p>Updated settings</p></div>";
        }
        echo "<fieldset class=\"options\"><legend>" . __("Help!", $lzndomain) . "</legend><a href=\"{$siteurl}/wp-content/plugins{$install_directory}/ultimate-tag-warrior-help.html\" target=\"_new\">" . __("Local help", $lzndomain) . "</a> | <a href=\"http://www.neato.co.nz/ultimate-tag-warrior\" target=\"_new\">" . __("Author help", $lzndomain) . "</a> | <a href=\"./edit.php?page=ultimate-tag-warrior-actions.php\">Manage Tags</a></fieldset>";
        echo '<fieldset class="options"><legend>' . __('Configuration', $lzndomain) . '</legend>';
        echo "<form method=\"POST\">";
        echo "<table width=\"100%\">";
        foreach ($configValues as $setting) {
            if ($setting['type'] == 'boolean') {
                UltimateTagWarriorActions::show_toggle($setting['setting'], $setting['label'], get_option($setting['setting']));
            }
            if ($setting['type'] == 'string') {
                UltimateTagWarriorActions::show_string($setting['setting'], $setting['label'], get_option($setting['setting']));
            }
            if ($setting['type'] == 'color') {
                UltimateTagWarriorActions::show_color($setting['setting'], $setting['label'], get_option($setting['setting']));
            }
            if ($setting['type'] == 'label') {
                UltimateTagWarriorActions::show_label($setting['setting'], $setting['label'], get_option($setting['setting']));
            }
            if ($setting['type'] == 'dropdown') {
                UltimateTagWarriorActions::show_dropdown($setting['setting'], $setting['label'], get_option($setting['setting']), $setting['options']);
            }
            if ($setting['type'] == 'multiselect') {
                UltimateTagWarriorActions::show_multiselect($setting['setting'], $setting['label'], get_option($setting['setting']), $setting['options']);
            }
        }
        echo <<<CONFIGFOOTER
\t</table>
\t\t\t<input type="hidden" name="action" value="saveconfiguration">
\t\t\t<input type="hidden" name="page" value="ultimate-tag-warrior-actions.php">
\t\t\t<input type="submit" value="Save">
\t\t</form>
\t</fieldset>
CONFIGFOOTER;
    }