/**
	 * Class Constructor. Sets up the hooks and inititalizes the class.
	 *
	 * @since 1.0
	 */
	public function __construct() {
		// Initialize variables
		$this->meta = WPRSS_FTP_Meta::get_instance();
		$this->settings = WPRSS_FTP_Settings::get_instance();
		$this->images = WPRSS_FTP_Images::get_instance();
		$this->debug = WPRSS_FTP_Debug::get_instance();
		$this->assistant = WPRSS_FTP_Feed_Assistant::get_instance();

		add_action( 'init', array( $this, 'check_request' ) );

		add_filter( 'wprss_register_addon', array($this, 'register_addon') );

		// Activation / Deactivation hooks
		register_activation_hook( __FILE__, array( $this, 'on_activation' ) );

		// Initialization
		add_action( 'plugins_loaded', array( $this, 'check_for_aggregator' ) );
		add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
		add_action( 'admin_init', array( $this, 'check_other_addons' ) );
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_and_styles' ) );
		add_action( 'admin_head', array( $this, 'wprss_ftp_admin_head' ) );
		add_action( 'admin_footer', array( $this, 'wprss_ftp_admin_footer' ) );

		// Adds custom post type arguments for wprss_feed
		add_filter( 'wprss_feed_post_type_args', array( $this, 'custom_post_type_args' ) );

		// Conversion hook
		add_filter( 'wprss_insert_post_item_conditionals', array( 'WPRSS_FTP_Converter', 'convert_to_post' ), 15, 3 );
		add_filter( 'wprss_still_update_import_count', '__return_true' );

		add_filter( 'wprss_feed_tags_to_strip', array( 'WPRSS_FTP_Converter', 'feed_tags_to_strip' ), 10, 2 );

		// Full Text RSS hook
		add_filter( 'wprss_feed_source_url', array( 'WPRSS_FTP_Converter', 'check_force_full_content' ), 10, 2 );

		// Add the truncation post types
		add_filter( 'wprss_truncation_post_types', array( $this, 'truncation_post_types' ) );

		// Add filter to remove unused core settings
		add_filter( 'wprss_settings_array', array( $this, 'remove_unused_core_settings' ) );

		// Remove Imported feeds menu
		add_action( 'admin_menu', array( $this, 'remove_imported_feed_items_menu' ), 20 );

		// Filters that change row action texts and titles
		add_filter( 'wprss_view_feed_items_row_action_link', array( $this, 'view_feed_items_row_action_link' ) );
		add_filter( 'wprss_view_feed_items_row_action_text', array( $this, 'view_feed_items_row_action_text' ) );
		add_filter( 'wprss_fetch_items_row_action_text', array( $this, 'fetch_items_row_action_text' ) );
		add_filter( 'wprss_purge_feeds_row_action_text', array( $this, 'delete_posts_row_action_text' ) );
		add_filter( 'wprss_purge_feeds_row_action_title', array( $this, 'delete_posts_row_action_title' ) );

		// Filter the query that shows the feed items per source
		add_filter( 'wprss_view_feed_items_meta_query', array( $this, 'view_posts_from_source_meta_query' ), 10 , 2 );
		// Filter the query that deletes feed items per source
		add_filter( 'wprss_delete_per_source_query', array( $this, 'delete_posts_from_source_query' ), 10 , 2 );

		// Filter to change post title
		//add_filter( 'the_title', array( $this, 'link_posts_to_external'), 10 , 2 );
		add_filter( 'post_link', array( $this, 'link_posts_to_external'), 10 , 2 );
		add_filter( 'post_type_link', array( $this, 'link_posts_to_external'), 10 , 2 );

		// Override's the core's shortcode output
		add_filter( 'wprss_shortcode_output', array( $this, 'override_shortcode' ) );

		// Change the post type for the wprss_get_feed_items_for_source function
		add_filter( 'wprss_get_feed_items_for_source_args', array( $this, 'get_feed_items_for_source_args' ), 10, 2 );

		// Add columns to the Feed Sources table
		add_filter( 'wprss_set_feed_custom_columns', array( $this, 'add_wprss_feed_columns' ) );
		// Add the action to render the added columns
		add_action( 'manage_wprss_feed_posts_custom_column', array( $this, 'render_wprss_feed_columns' ), 10, 2 );

		// Action to show admin notices for activation hooks
		add_action( 'admin_init', array( $this, 'admin_notices_for_activation_hooks' ) );

		/** Allow local requests. See {@link wp_http_validate_url()} */
		add_filter( 'http_request_host_is_external', '__return_true' );

		// Adds the Feed to Post settings to the exporting mechanism in the core plugin
		add_filter( 'wprss_fields_export', array( $this, 'add_settings_to_export' ) );
		add_action( 'wprss_export_section', array( $this, 'export_section' ) );

		add_filter( 'wprss_item_import_time_limit', array( $this, 'item_import_time_limit' ) );
		add_filter( 'wprss_feed_fetch_time_limit', array( $this, 'feed_fetch_time_limit' ) );

		add_theme_support( 'post-thumbnails', array('wprss_feed') );

		do_action('wprss_ftp_init', $this);
	}
	/**
	 * Returns the singleton instance
	 */
	public static function get_instance() {
		if ( self::$instance === NULL ) {
			self::$instance = new self();
		}
		return self::$instance;
	}