* This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */
// Get the Action String
$request = @$_POST['action'];
// Require the SimpleMash API
require_once 'simplemash.class.php';
// Instatiate the SimpleMash API
$fg = new SimpleMash();
// Switch case for the API Actions
switch ($request) {
    case 'checkfeed':
        $fg->simplemash_ajax_checkfeed($_POST['url']);
        break;
    case 'previewfeed':
        $fg->simplemash_ajax_previewfeed($_POST['url'], $_POST['filter']);
        break;
    case 'addfeed':
        $fg->simplemash_ajax_addfeed($_POST['url'], $_POST['title'], $_POST['filter'], $_POST['category'], $_POST['automatic'], $_POST['source'], $_POST['gather'], $_POST['frequency'], $_POST['keep'], @$_POST['addCategory'], @$_POST['addCategoryXML']);
        break;
    case 'fetchItem':
        $fg->simplemash_ajax_fetchItem($_POST['id']);
        break;
    case 'saveItem':
{
    // PRESERVE DATA
    /**
    global $wpdb;
    $site_table = $wpdb->prefix . "simplemash_sites";
    $sql = "DROP TABLE $site_table;";
    $wpdb->query($sql);
    $entries_table = $wpdb->prefix . "simplemash_entries";	
    $sql = "DROP TABLE $entries_table;";
    $wpdb->query($sql);
    */
}
register_activation_hook(__FILE__, 'simplemash_install');
register_deactivation_hook(__FILE__, 'simplemash_uninstall');
/**
 * require the simplemash class
 */
require_once "simplemash.class.php";
/**
 * initialize the simplemash class
 *
 * this method will check the plugin's requirements and the server's environment.
 */
$sm = new SimpleMash();
/**
 * use the simplemash fangs, i mean hooks
 *
 * this method will call the hooks associated to the simeplmash class. this is the most crucial method
 * for wordpress to use this plugin. *do not delete*
 */
$sm->wp_hook();