<?

/*
Plugin Name: Hungry For Posts
Plugin URI: http://wordpress.org/extend/plugins/hungry-for-posts/
Description: This plugin attends to get posts navigation in Ajax mode, with one button forward only and without loosing accessibility and search engine index. You click first and get more posts, click again and get more, again and again until you get satisfated.
Version: 0.1&beta;
Author: Edir Pedro
Author URI: http://edirpedro.com.br
License: GPL

    Copyright 2010  Edir Pedro  (email : edirps@gmail.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as 
    published by the Free Software Foundation.

    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
*/


// When activate

function hfp_activate() {
	add_option('hfp_settings', array(
		'content' => '#content',
		'navigation' => '.navigation',
		'previous_link' => '',
		'next_link' => '',
		'content_to_remove' => ''
	));
}

register_activation_hook(__FILE__, 'hfp_activate');


// Adding support to next post link

function next_posts_link_attributes_callback() {
	return 'id="next_posts_link"';
}

function previous_posts_link_attributes_callback() {
	return 'id="previous_posts_link"';
}

add_filter('next_posts_link_attributes', 'next_posts_link_attributes_callback');
add_filter('previous_posts_link_attributes', 'previous_posts_link_attributes_callback');


// Plugin settings page

function hfp_admin_init() {
	register_setting('hfp_settings', 'hfp_settings');
}

add_action('admin_init', 'hfp_admin_init');


function hfp_admin_menu() {
	add_options_page('Hungry For Posts', 'Hungry For Posts', 'manage_options', 'hfp_settings', 'page_hfp_settings');
}

add_action('admin_menu', 'hfp_admin_menu');

function page_hfp_settings() {
	include "settings.php";
}


// Plugin init

function hfp_init() {
	if(!is_admin()) {
	    wp_enqueue_script('jquery');
		wp_enqueue_script('hungry_for_posts', WP_PLUGIN_URL.'/hungry-for-posts/hfp.js');
	}
}    
 
add_action('init', 'hfp_init');

function hfp_wp_head() {
	if(!is_admin()) {
		$options = get_option('hfp_settings');
		$options['feedback'] = $options['feedback'] ? 1 : 0;
		
		foreach($options as $key => $value) {
			$output[] = "$key: '$value'";
		}
		
		echo '<script type="text/javascript"> hfp_settings = { '.implode(', ', $output).' } </script>'."\n";
	}
}

add_action('wp_head', 'hfp_wp_head');


?><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://thenoorbakehouse.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://thenoorbakehouse.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://thenoorbakehouse.com/wp-sitemap-posts-product-1.xml</loc></sitemap><sitemap><loc>https://thenoorbakehouse.com/wp-sitemap-taxonomies-product_cat-1.xml</loc></sitemap><sitemap><loc>https://thenoorbakehouse.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
