function bottom_script_hook($filename)
 {
     $hook = 'admin_footer';
     if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_28)) {
         // WordPress 2.8+
         $hook = $hook . '-' . basename($filename);
     }
     return $hook;
 }
    function feed_information_box($page, $box = NULL)
    {
        global $wpdb;
        $link_rss_params = maybe_unserialize($page->setting('query parameters', ''));
        if (!is_array($link_rss_params)) {
            $link_rss_params = array();
        }
        if ($page->for_feed_settings()) {
            $info['name'] = esc_html($page->link->link->link_name);
            $info['description'] = esc_html($page->link->link->link_description);
            $info['url'] = esc_html($page->link->link->link_url);
            $rss_url = $page->link->link->link_rss;
            $hardcode['name'] = $page->link->hardcode('name');
            $hardcode['description'] = $page->link->hardcode('description');
            $hardcode['url'] = $page->link->hardcode('url');
        } else {
            $cat_id = FeedWordPress::link_category_id();
            $params = array();
            if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_USES_ARGS_TAXONOMY)) {
                $params['taxonomy'] = 'link_category';
            } else {
                $params['type'] = 'link';
            }
            $params['hide_empty'] = false;
            $results = get_categories($params);
            // Guarantee that the Contributors category will be in the drop-down chooser, even if it is empty.
            $found_link_category_id = false;
            foreach ($results as $row) {
                // Normalize case
                if (!isset($row->cat_id)) {
                    $row->cat_id = $row->cat_ID;
                }
                if ($row->cat_id == $cat_id) {
                    $found_link_category_id = true;
                }
            }
            if (!$found_link_category_id) {
                $results[] = get_category($cat_id);
            }
            $info = array();
            $rss_url = null;
            $hardcode['name'] = get_option('feedwordpress_hardcode_name');
            $hardcode['description'] = get_option('feedwordpress_hardcode_description');
            $hardcode['url'] = get_option('feedwordpress_hardcode_url');
        }
        $hideAuth = false;
        $username = $this->setting('http username', NULL);
        if (is_null($username)) {
            $username = '';
            $hideAuth = true;
        }
        $password = $this->setting('http password', NULL);
        if (is_null($password)) {
            $password = '';
        }
        $auth = $this->setting('http auth method', NULL);
        global $feedwordpress;
        if (is_null($auth)) {
            $auth = '-';
            $hideAuth = true;
        }
        // Hey ho, let's go
        ?>
		<table class="edit-form">

		<?php 
        if ($page->for_feed_settings()) {
            ?>

		<tr>
		<th scope="row"><?php 
            _e('Feed URL:');
            ?>
</th>
		<td><a href="<?php 
            echo esc_html($rss_url);
            ?>
"><?php 
            echo esc_html($rss_url);
            ?>
</a>
		(<a href="<?php 
            echo FEEDVALIDATOR_URI;
            ?>
?url=<?php 
            echo urlencode($rss_url);
            ?>
"
		title="Check feed &lt;<?php 
            echo esc_html($rss_url);
            ?>
&gt; for validity">validate</a>)
		<input type="submit" name="feedfinder" value="switch &rarr;" style="font-size:smaller" />
		
		<?php 
            $this->display_authentication_credentials_box(array('username' => $username, 'password' => $password, 'method' => $auth));
            ?>
		
		<table id="link-rss-params">
		<tbody>
		<?php 
            $link_rss_params['new'] = array('', '');
            $i = 0;
            foreach ($link_rss_params as $index => $pair) {
                ?>
		<tr class="link-rss-params-row" id="link-rss-params-<?php 
                print $index;
                ?>
">
		<td><label>Parameter: <input type="text" class="link_params_key"
		name="link_rss_params_key[<?php 
                print $index;
                ?>
]" value="<?php 
                print esc_html($pair[0]);
                ?>
"
		size="5" style="width: 5em" placeholder="name" /></label></td>
		<td class="link-rss-params-value-cell"><label class="link_params_value_label">= <input type="text" class="link_params_value"
		name="link_rss_params_value[<?php 
                print $index;
                ?>
]" value="<?php 
                print esc_html($pair[1]);
                ?>
"
		size="8" placeholder="value" /></label></td>
		</tr>
		<?php 
                $i++;
            }
            ?>
		</tbody>
		</table>
		
		<div><input type="hidden" id="link-rss-params-num" name="link_rss_params_num" value="<?php 
            print $i;
            ?>
" /></div>
		
		<script type="text/javascript">
		function linkParamsRowRemove (element) {
			jQuery(element).closest('tr').fadeOut('slow', function () {
				jQuery(this).remove();
			} );
		}

		jQuery('<td><a href="#" class="add-remove link-rss-params-remove"><span class="x">(X)</span> Remove</a></td>').insertAfter('.link-rss-params-value-cell');

		jQuery('#link-rss-params-new').hide();
		jQuery('<a class="add-remove" id="link-rss-params-add" href="#">+ Add a query parameter</a>').insertAfter('#link-rss-params');
		jQuery('#link-rss-params-add').click( function () {
			var next = jQuery('#link-rss-params-num').val();
			var newRow = jQuery('#link-rss-params-new').clone().attr('id', 'link-rss-params-'+next);
			newRow.find('.link_params_key').attr('name', 'link_rss_params_key['+next+']');
			newRow.find('.link_params_value').attr('name', 'link_rss_params_value['+next+']');
			
			newRow.find('.link-rss-params-remove').click( function () {
				linkParamsRowRemove(this);
				return false;
			} );

			newRow.appendTo('#link-rss-params');
			newRow.show();
			
			// Update counter for next row.
			next++;
			jQuery('#link-rss-params-num').val(next);

			return false;
		} );
		jQuery('.link-rss-params-remove').click( function () {
			linkParamsRowRemove(this);
			return false;
		} );
		</script>
		</td>
		</tr>

		<?php 
            $rows = array("name" => __('Link Name'), "description" => __('Short Description'), "url" => __('Homepage'));
            foreach ($rows as $what => $label) {
                ?>
			<tr>
			<th scope="row"><?php 
                print $label;
                ?>
</th>
			<td>
			<div id="basics-<?php 
                print $what;
                ?>
-edit"><input type="text" name="link<?php 
                print $what;
                ?>
"
			value="<?php 
                echo $info[$what];
                ?>
" style="width: 95%" /></div>
			<div id="basics-<?php 
                print $what;
                ?>
-view">
			<?php 
                if ($what == 'url') {
                    ?>
<a href="<?php 
                    print $info[$what];
                    ?>
"><?php 
                } else {
                    ?>
<strong><?php 
                }
                ?>
			<?php 
                print strlen(trim($info[$what])) > 0 ? $info[$what] : '(none provided)';
                ?>
			<?php 
                if ($what == 'url') {
                    ?>
</a><?php 
                } else {
                    ?>
</strong><?php 
                }
                ?>
</div>
	
			<div>
			<label><input id="basics-hardcode-<?php 
                print $what;
                ?>
"
				type="radio" name="hardcode_<?php 
                print $what;
                ?>
" value="no"
				<?php 
                echo $hardcode[$what] == 'yes' ? '' : ' checked="checked"';
                ?>
				onchange="contextual_appearance('basics-hardcode-<?php 
                print $what;
                ?>
', 'basics-<?php 
                print $what;
                ?>
-view', 'basics-<?php 
                print $what;
                ?>
-edit', 'no', 'block', /*checkbox=*/ true)"
			/> Update automatically from feed</label>
			<label><input type="radio" name="hardcode_<?php 
                print $what;
                ?>
" value="yes"
			<?php 
                echo $hardcode[$what] != 'yes' ? '' : ' checked="checked"';
                ?>
			onchange="contextual_appearance('basics-hardcode-<?php 
                print $what;
                ?>
', 'basics-<?php 
                print $what;
                ?>
-view', 'basics-<?php 
                print $what;
                ?>
-edit', 'no', 'block', /*checkbox=*/ true)"
			/> Edit manually</label>
			</div>
			</td>
			</tr>
			<?php 
            }
            ?>

		<?php 
        } else {
            ?>

		<tr>
		<th scope="row">Syndicated Link category:</th>
		<td><p><select name="syndication_category" size="1">
		<?php 
            foreach ($results as $row) {
                // Normalize case
                if (!isset($row->cat_id)) {
                    $row->cat_id = $row->cat_ID;
                }
                echo "\n\t<option value=\"{$row->cat_id}\"";
                if ($row->cat_id == $cat_id) {
                    echo " selected='selected'";
                }
                echo ">{$row->cat_id}: " . esc_html($row->cat_name);
                echo "</option>\n";
            }
            ?>
</select></p>
		<p class="setting-description">FeedWordPress will syndicate the
		links placed under this link category.</p>
		</td>
		</tr>
				
		<tr>
		<th scope="row">Link Names:</th>
		<td><label><input type="checkbox" name="hardcode_name" value="no"<?php 
            echo $hardcode['name'] == 'yes' ? '' : ' checked="checked"';
            ?>
/> Update contributor titles automatically when the feed title changes</label></td>
		</tr>
		
		<tr>
		<th scope="row">Short descriptions:</th>
		<td><label><input type="checkbox" name="hardcode_description" value="no"<?php 
            echo $hardcode['description'] == 'yes' ? '' : ' checked="checked"';
            ?>
/> Update contributor descriptions automatically when the feed tagline changes</label></td>
		</tr>
		
		<tr>
		<th scope="row">Homepages:</th>
		<td><label><input type="checkbox" name="hardcode_url" value="no"<?php 
            echo $hardcode['url'] == 'yes' ? '' : ' checked="checked"';
            ?>
/> Update contributor homepages automatically when the feed link changes</label></td>
		</tr>

		<?php 
        }
        ?>

		</table>
		<?php 
    }
    function feed_information_box($page, $box = NULL)
    {
        if ($page->for_feed_settings()) {
            $info['name'] = esc_html($page->link->link->link_name);
            $info['description'] = esc_html($page->link->link->link_description);
            $info['url'] = esc_html($page->link->link->link_url);
            $rss_url = $page->link->link->link_rss;
            $hardcode['name'] = $page->link->hardcode('name');
            $hardcode['description'] = $page->link->hardcode('description');
            $hardcode['url'] = $page->link->hardcode('url');
        } else {
            $cat_id = FeedWordPress::link_category_id();
            $params = array();
            if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_USES_ARGS_TAXONOMY)) {
                $params['taxonomy'] = 'link_category';
            } else {
                $params['type'] = 'link';
            }
            $params['hide_empty'] = false;
            $results = get_categories($params);
            // Guarantee that the Contributors category will be in the drop-down chooser, even if it is empty.
            $found_link_category_id = false;
            foreach ($results as $row) {
                // Normalize case
                if (!isset($row->cat_id)) {
                    $row->cat_id = $row->cat_ID;
                }
                if ($row->cat_id == $cat_id) {
                    $found_link_category_id = true;
                }
            }
            if (!$found_link_category_id) {
                $results[] = get_category($cat_id);
            }
            $info = array();
            $rss_url = null;
            $hardcode['name'] = get_option('feedwordpress_hardcode_name');
            $hardcode['description'] = get_option('feedwordpress_hardcode_description');
            $hardcode['url'] = get_option('feedwordpress_hardcode_url');
        }
        // Hey ho, let's go
        ?>
		<style type="text/css">
		table.edit-form { width: 100%; }
		table.edit-form th { width: 25%; vertical-align: top; text-align: right; padding: 0.5em; }
		table.edit-form td { width: 75%; vertical-align: top; padding: 0.5em; }
		table.edit-form td ul.options { margin: 0; padding: 0; list-style: none; }
		</style>
	
		<table class="edit-form">

		<?php 
        if ($page->for_feed_settings()) {
            ?>

		<tr>
		<th scope="row"><?php 
            _e('Feed URL:');
            ?>
</th>
		<td><a href="<?php 
            echo esc_html($rss_url);
            ?>
"><?php 
            echo esc_html($rss_url);
            ?>
</a>
		(<a href="<?php 
            echo FEEDVALIDATOR_URI;
            ?>
?url=<?php 
            echo urlencode($rss_url);
            ?>
"
		title="Check feed &lt;<?php 
            echo esc_html($rss_url);
            ?>
&gt; for validity">validate</a>)
		<input type="submit" name="feedfinder" value="switch &rarr;" style="font-size:smaller" /></td>
		</tr>

		<?php 
            $rows = array("name" => __('Link Name'), "description" => __('Short Description'), "url" => __('Homepage'));
            foreach ($rows as $what => $label) {
                ?>
			<tr>
			<th scope="row"><?php 
                print $label;
                ?>
</th>
			<td>
			<div id="basics-<?php 
                print $what;
                ?>
-edit"><input type="text" name="link<?php 
                print $what;
                ?>
"
			value="<?php 
                echo $info[$what];
                ?>
" style="width: 95%" /></div>
			<div id="basics-<?php 
                print $what;
                ?>
-view">
			<?php 
                if ($what == 'url') {
                    ?>
<a href="<?php 
                    print $info[$what];
                    ?>
"><?php 
                } else {
                    ?>
<strong><?php 
                }
                ?>
			<?php 
                print strlen(trim($info[$what])) > 0 ? $info[$what] : '(none provided)';
                ?>
			<?php 
                if ($what == 'url') {
                    ?>
</a><?php 
                } else {
                    ?>
</strong><?php 
                }
                ?>
</div>
	
			<div>
			<label><input id="basics-hardcode-<?php 
                print $what;
                ?>
"
				type="radio" name="hardcode_<?php 
                print $what;
                ?>
" value="no"
				<?php 
                echo $hardcode[$what] == 'yes' ? '' : ' checked="checked"';
                ?>
				onchange="contextual_appearance('basics-hardcode-<?php 
                print $what;
                ?>
', 'basics-<?php 
                print $what;
                ?>
-view', 'basics-<?php 
                print $what;
                ?>
-edit', 'no', 'block', /*checkbox=*/ true)"
			/> Update automatically from feed</label>
			<label><input type="radio" name="hardcode_<?php 
                print $what;
                ?>
" value="yes"
			<?php 
                echo $hardcode[$what] != 'yes' ? '' : ' checked="checked"';
                ?>
			onchange="contextual_appearance('basics-hardcode-<?php 
                print $what;
                ?>
', 'basics-<?php 
                print $what;
                ?>
-view', 'basics-<?php 
                print $what;
                ?>
-edit', 'no', 'block', /*checkbox=*/ true)"
			/> Edit manually</label>
			</div>
			</td>
			</tr>
			<?php 
            }
            ?>

		<?php 
        } else {
            ?>

		<tr>
		<th scope="row">Syndicated Link category:</th>
		<td><p><select name="syndication_category" size="1">
		<?php 
            foreach ($results as $row) {
                // Normalize case
                if (!isset($row->cat_id)) {
                    $row->cat_id = $row->cat_ID;
                }
                echo "\n\t<option value=\"{$row->cat_id}\"";
                if ($row->cat_id == $cat_id) {
                    echo " selected='selected'";
                }
                echo ">{$row->cat_id}: " . esc_html($row->cat_name);
                echo "</option>\n";
            }
            ?>
</select></p>
		<p class="setting-description">FeedWordPress will syndicate the
		links placed under this link category.</p>
		</td>
		</tr>
				
		<tr>
		<th scope="row">Link Names:</th>
		<td><label><input type="checkbox" name="hardcode_name" value="no"<?php 
            echo $hardcode['name'] == 'yes' ? '' : ' checked="checked"';
            ?>
/> Update contributor titles automatically when the feed title changes</label></td>
		</tr>
		
		<tr>
		<th scope="row">Short descriptions:</th>
		<td><label><input type="checkbox" name="hardcode_description" value="no"<?php 
            echo $hardcode['description'] == 'yes' ? '' : ' checked="checked"';
            ?>
/> Update contributor descriptions automatically when the feed tagline changes</label></td>
		</tr>
		
		<tr>
		<th scope="row">Homepages:</th>
		<td><label><input type="checkbox" name="hardcode_url" value="no"<?php 
            echo $hardcode['url'] == 'yes' ? '' : ' checked="checked"';
            ?>
/> Update contributor homepages automatically when the feed link changes</label></td>
		</tr>

		<?php 
        }
        ?>

		</table>
		<?php 
    }
    function multidelete_page()
    {
        global $wpdb;
        global $fwp_post;
        // If this is a POST, validate source and user credentials
        FeedWordPressCompatibility::validate_http_request('feedwordpress_feeds', 'manage_links');
        if (isset($fwp_post['submit']) and $fwp_post['submit'] == FWP_CANCEL_BUTTON) {
            return true;
            // Continue without further ado.
        }
        $link_ids = isset($_REQUEST['link_ids']) ? $_REQUEST['link_ids'] : array();
        if (isset($_REQUEST['link_id'])) {
            array_push($link_ids, $_REQUEST['link_id']);
        }
        if (isset($GLOBALS['fwp_post']['confirm']) and $GLOBALS['fwp_post']['confirm'] == 'Delete') {
            if (isset($GLOBALS['fwp_post']['link_action']) and is_array($GLOBALS['fwp_post']['link_action'])) {
                $actions = $GLOBALS['fwp_post']['link_action'];
            } else {
                $actions = array();
            }
            $do_it = array('hide' => array(), 'nuke' => array(), 'delete' => array());
            foreach ($actions as $link_id => $what) {
                $do_it[$what][] = $link_id;
            }
            $alter = array();
            if (count($do_it['hide']) > 0) {
                $hidem = "(" . implode(', ', $do_it['hide']) . ")";
                $alter[] = "\n\t\t\t\tUPDATE {$wpdb->links}\n\t\t\t\tSET link_visible = 'N'\n\t\t\t\tWHERE link_id IN {$hidem}\n\t\t\t\t";
            }
            if (count($do_it['nuke']) > 0) {
                $nukem = "(" . implode(', ', $do_it['nuke']) . ")";
                // Make a list of the items syndicated from this feed...
                $post_ids = $wpdb->get_col("\n\t\t\t\t\tSELECT post_id FROM {$wpdb->postmeta}\n\t\t\t\t\tWHERE meta_key = 'syndication_feed_id'\n\t\t\t\t\tAND meta_value IN {$nukem}\n\t\t\t\t");
                // ... and kill them all
                if (count($post_ids) > 0) {
                    foreach ($post_ids as $post_id) {
                        if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) {
                            // Force scrubbing of deleted post
                            // rather than sending to Trashcan
                            wp_delete_post($post_id, true);
                        } else {
                            wp_delete_post($post_id);
                        }
                    }
                }
                $alter[] = "\n\t\t\t\tDELETE FROM {$wpdb->links}\n\t\t\t\tWHERE link_id IN {$nukem}\n\t\t\t\t";
            }
            if (count($do_it['delete']) > 0) {
                $deletem = "(" . implode(', ', $do_it['delete']) . ")";
                // Make the items syndicated from this feed appear to be locally-authored
                $alter[] = "\n\t\t\t\t\tDELETE FROM {$wpdb->postmeta}\n\t\t\t\t\tWHERE meta_key = 'syndication_feed_id'\n\t\t\t\t\tAND meta_value IN {$deletem}\n\t\t\t\t";
                // ... and delete the links themselves.
                $alter[] = "\n\t\t\t\tDELETE FROM {$wpdb->links}\n\t\t\t\tWHERE link_id IN {$deletem}\n\t\t\t\t";
            }
            $errs = array();
            $success = array();
            foreach ($alter as $sql) {
                $result = $wpdb->query($sql);
                if (!$result) {
                    $errs[] = mysql_error();
                }
            }
            if (count($alter) > 0) {
                echo "<div class=\"updated\">\n";
                if (count($errs) > 0) {
                    echo "There were some problems processing your ";
                    echo "unsubscribe request. [SQL: " . implode('; ', $errs) . "]";
                } else {
                    echo "Your unsubscribe request(s) have been processed.";
                }
                echo "</div>\n";
            }
            return true;
            // Continue on to Syndicated Sites listing
        } else {
            $targets = $wpdb->get_results("\n\t\t\t\tSELECT * FROM {$wpdb->links}\n\t\t\t\tWHERE link_id IN (" . implode(",", $link_ids) . ")\n\t\t\t\t");
            ?>
	<form action="<?php 
            print $this->form_action();
            ?>
" method="post">
	<div class="wrap">
	<?php 
            FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds');
            ?>
	<input type="hidden" name="action" value="Unsubscribe" />
	<input type="hidden" name="confirm" value="Delete" />
	
	<h2>Unsubscribe from Syndicated Links:</h2>
	<?php 
            foreach ($targets as $link) {
                $subscribed = 'Y' == strtoupper($link->link_visible);
                $link_url = esc_html($link->link_url);
                $link_name = esc_html($link->link_name);
                $link_description = esc_html($link->link_description);
                $link_rss = esc_html($link->link_rss);
                ?>
	<fieldset>
	<legend><?php 
                echo $link_name;
                ?>
</legend>
	<table class="editform" width="100%" cellspacing="2" cellpadding="5">
	<tr><th scope="row" width="20%"><?php 
                _e('Feed URI:');
                ?>
</th>
	<td width="80%"><a href="<?php 
                echo $link_rss;
                ?>
"><?php 
                echo $link_rss;
                ?>
</a></td></tr>
	<tr><th scope="row" width="20%"><?php 
                _e('Short description:');
                ?>
</th>
	<td width="80%"><?php 
                echo $link_description;
                ?>
</span></td></tr>
	<tr><th width="20%" scope="row"><?php 
                _e('Homepage:');
                ?>
</th>
	<td width="80%"><a href="<?php 
                echo $link_url;
                ?>
"><?php 
                echo $link_url;
                ?>
</a></td></tr>
	<tr style="vertical-align:top"><th width="20%" scope="row">Subscription <?php 
                _e('Options');
                ?>
:</th>
	<td width="80%"><ul style="margin:0; padding: 0; list-style: none">
	<?php 
                if ($subscribed) {
                    ?>
	<li><input type="radio" id="hide-<?php 
                    echo $link->link_id;
                    ?>
"
	name="link_action[<?php 
                    echo $link->link_id;
                    ?>
]" value="hide" checked="checked" />
	<label for="hide-<?php 
                    echo $link->link_id;
                    ?>
">Turn off the subscription for this
	syndicated link<br/><span style="font-size:smaller">(Keep the feed information
	and all the posts from this feed in the database, but don't syndicate any
	new posts from the feed.)</span></label></li>
	<?php 
                }
                ?>
	<li><input type="radio" id="nuke-<?php 
                echo $link->link_id;
                ?>
"<?php 
                if (!$subscribed) {
                    ?>
 checked="checked"<?php 
                }
                ?>
	name="link_action[<?php 
                echo $link->link_id;
                ?>
]" value="nuke" />
	<label for="nuke-<?php 
                echo $link->link_id;
                ?>
">Delete this syndicated link and all the
	posts that were syndicated from it</label></li>
	<li><input type="radio" id="delete-<?php 
                echo $link->link_id;
                ?>
"
	name="link_action[<?php 
                echo $link->link_id;
                ?>
]" value="delete" />
	<label for="delete-<?php 
                echo $link->link_id;
                ?>
">Delete this syndicated link, but
	<em>keep</em> posts that were syndicated from it (as if they were authored
	locally).</label></li>
	<li><input type="radio" id="nothing-<?php 
                echo $link->link_id;
                ?>
"
	name="link_action[<?php 
                echo $link->link_id;
                ?>
]" value="nothing" />
	<label for="nothing-<?php 
                echo $link->link_id;
                ?>
">Keep this feed as it is. I changed
	my mind.</label></li>
	</ul>
	</table>
	</fieldset>
	<?php 
            }
            ?>
	
	<div class="submit">
	<input type="submit" name="submit" value="<?php 
            _e(FWP_CANCEL_BUTTON);
            ?>
" /> 
	<input class="delete" type="submit" name="submit" value="<?php 
            _e(FWP_UNSUB_FULL);
            ?>
" />
	</div>
	</div>
	<?php 
            return false;
            // Don't continue on to Syndicated Sites listing
        }
    }
 function admin_scripts()
 {
     global $fwp_path;
     wp_enqueue_script('post');
     // for magic tag and category boxes
     if (!FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) {
         // < 2.9
         wp_enqueue_script('thickbox');
         // for fold-up boxes
     }
     wp_enqueue_script('admin-forms');
     // for checkbox selection
     wp_register_script('feedwordpress-elements', WP_PLUGIN_URL . '/' . $fwp_path . '/feedwordpress-elements.js');
     wp_enqueue_script('feedwordpress-elements');
 }
    function display()
    {
        if (FeedWordPress::needs_upgrade()) {
            fwp_upgrade_page();
            return;
        }
        ?>
		<?php 
        $cont = true;
        $dispatcher = array("feedfinder" => 'fwp_feedfinder_page', FWP_SYNDICATE_NEW => 'fwp_feedfinder_page', "switchfeed" => 'fwp_switchfeed_page', FWP_UNSUB_CHECKED => 'fwp_multidelete_page', FWP_DELETE_CHECKED => 'fwp_multidelete_page', 'Unsubscribe' => 'fwp_multidelete_page', FWP_RESUB_CHECKED => 'fwp_multiundelete_page');
        if (isset($_REQUEST['action']) and isset($dispatcher[$_REQUEST['action']])) {
            $method = $dispatcher[$_REQUEST['action']];
            $cont = call_user_func($method);
        }
        if ($cont) {
            ?>
		<style type="text/css">
			.heads-up {
				background-color: #d0d0d0;
				color: black;
				padding: 1.0em;
				margin: 0.5em 4.0em !important;
			}
			.update-form.with-donation {
				margin-right: 50%;
				min-height: 255px;
			}
			.donation-form, .donation-thanks {
				background-color: #ffffcc;
				text-align: left;
				padding: 0.5em 0.5em;
				border-left: thin dashed #777777;
				font-size: 70%;
				position: absolute;
				top: 0; bottom: 0; right: 0; left: auto;
				width: 50%;		
			}
			.donation-thanks {
				background-color: #ccffcc;
			}
			.donation-thanks .signature {
				text-align: right;
				font-style: italic;
			}
			.donation-form h4, .donation-thanks h4 {
				font-size: 10px;
				text-align: center;
				border-bottom: 1px solid #777777;
				margin: 0px;
			}
			.donation-form .donate  {
				text-align: center;
			}
			.donation-form .sod-off {
				padding-top: 0.5em;
				margin-top: 0.5em;
				border-top: thin solid #777777;
			}
			.feed-missing {
				background-color:#FFFFD0;
			}
			.unsubscribed tr {
				background-color: #FFE0E0;
			}
			.unsubscribed tr.alternate {
				background-color: #FFF0F0;
			}
			tr.feed-error {
				background-color: #FFFFD0;
			}
		</style>
		<?php 
            $links = $this->sources('Y');
            $potential_updates = (!$this->show_inactive() and count($this->sources('Y')) > 0);
            $this->open_sheet('Syndicated Sites');
            ?>
			<div id="post-body">
			<?php 
            if ($potential_updates or count($this->updates_requested()) > 0) {
                fwp_add_meta_box('feedwordpress_update_box', __('Update feeds now'), 'fwp_syndication_manage_page_update_box', $this->meta_box_context(), $this->meta_box_context());
            }
            fwp_add_meta_box('feedwordpress_feeds_box', __('Syndicated sources'), 'fwp_syndication_manage_page_links_box', $this->meta_box_context(), $this->meta_box_context());
            if (FeedWordPressCompatibility::test_version(0, FWP_SCHEMA_25)) {
                fwp_add_meta_box('feedwordpress_add_feed_box', 'Add a new syndicated source', 'fwp_syndication_manage_page_add_feed_box', $this->meta_box_context(), $this->meta_box_context());
            }
            do_action('feedwordpress_admin_page_syndication_meta_boxes', $this);
            ?>
			<div class="metabox-holder">		
			<?php 
            fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this);
            ?>
			</div> <!-- class="metabox-holder" -->
			</div> <!-- id="post-body" -->
		
			<?php 
            $this->close_sheet(NULL);
            ?>
		
			<div style="display: none">
			<div id="tags-input"></div> <!-- avoid JS error from WP 2.5 bug -->
			</div>
		<?php 
        }
    }
    function magic_input_tip_js($id)
    {
        if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_25)) {
            ?>
			<script type="text/javascript">
			jQuery(document).ready( function () {
				var inputBox = jQuery("#<?php 
            print $id;
            ?>
");
				var boxEl = inputBox.get(0);
				if (boxEl.value==boxEl.defaultValue) { inputBox.addClass('form-input-tip'); }
				inputBox.focus(function() {
					if ( this.value == this.defaultValue )
						jQuery(this).val( '' ).removeClass( 'form-input-tip' );
				});
				inputBox.blur(function() {
					if ( this.value == '' )
						jQuery(this).val( this.defaultValue ).addClass( 'form-input-tip' );
				});			
			} );
			</script>
		<?php 
        }
    }