/**
	 * Returns the append placeholders for post_append
	 *
	 * @since 1.6
	 */
	public function get_append_placeholders() {
		$placeholders = WPRSS_FTP_Appender::get_placeholders();
		$s = ceil( count( $placeholders ) / 3 );
		$i = 0;
		?>
		<table id="wprss-ftp-placeholders-table" cellpadding="1">
			<tbody>
				<tr>
					<?php foreach ($placeholders as $placeholder => $desc) : ?>
						<td title="<?php echo esc_attr($desc); ?>"><?php echo $placeholder; ?></td>
						<?php if ( (++$i % $s) === 0 ) echo '</tr><tr>'; ?>
					<?php endforeach; ?>
				</tr>
				<tr>
					<?php
						$meta_title = __( "The custom meta field 'xyz' of the imported post. Change 'xyz' to the name of any meta field you want.", WPRSS_TEXT_DOMAIN );
						$source_meta_title = __( "The custom meta field 'xyz' of this feed source. Change 'xyz' to the name of any meta field you want.", WPRSS_TEXT_DOMAIN );
					?>
					<td title="<?php echo $meta_title; ?>">{{meta : xyz}}</td>
					<td title="<?php echo $source_meta_title; ?>">{{source_meta : xyz}}</td>
				</tr>
			</tbody>
		</table>
		<?php
	}
	/**
	 * This filter function adds the source link text to the end of the given content, if the 
	 * feed source has source_link enabled. It also checks for phrases wrapped in asteriks, 
	 * and converts them into links.
	 * 
	 * @since 1.0
	 */
	public static function post_content( $content ) {
		global $post;
		$source = WPRSS_FTP_Meta::get_instance()->get_meta( $post->ID, 'feed_source' );

		// IF AN IMPORTED POST
		if ( $source !== '' ) {

			$options = WPRSS_FTP_Settings::get_instance()->get();

			$core_settings = get_option( 'wprss_settings_general' );
			$display_settings = wprss_get_display_settings( $core_settings );

			$link = WPRSS_FTP_Meta::get_instance()->get_meta( $post->ID, 'wprss_item_permalink', false );
			$feed_link = get_post_meta( $source, 'wprss_site_url', true );

			// Check the prepend/append text
			$append = WPRSS_FTP_Meta::get_instance()->get_meta( $source, 'post_append' );
			$prepend = WPRSS_FTP_Meta::get_instance()->get_meta( $source, 'post_prepend' );

			// Add any prepend text
			if ( $prepend !== '' && WPRSS_FTP_Display::show_appended_text('prepend', $source) ) {
				$content = do_shortcode( WPRSS_FTP_Appender::handle_appended_data( $post, $prepend ) ) . $content;
			}
			// Add any append text
			if ( $append !== '' && WPRSS_FTP_Display::show_appended_text('append', $source) ) {
				$content .= do_shortcode( WPRSS_FTP_Appender::handle_appended_data( $post, $append ) );
			}


			// If the post's feed source has source_link enabled ...
			if ( WPRSS_FTP_Display::show_appended_text('source_link', NULL, $options) ) {
				// Prepare to data
				$text = $options['source_link_text'];
				// Search for an asterisk sign
				$search = stripos( $text, '*');

				// If an asterisk is found, use regex to generate the linked phrase
				if ( $search !== FALSE ) {
					$link_open = "<a ${display_settings['open']} ${display_settings['follow']} href=\"";
					$link_close = "</a>";
					$linked_text = preg_replace(
						'/\*\*(.*?)\*\*/',									// The regex pattern to search for
						$link_open . esc_attr( $feed_link ) . "\">$1</a>",	// The replacement text
						$text												// The text to which to search in
					);
					$linked_text = preg_replace(
						'/\*(.*?)\*/',										// The regex pattern to search for
						$link_open . esc_attr( $link ) . "\">$1</a>",		// The replacement text
						$linked_text										// The text to which to search in
					);
				}
				// If no asterisk is found, use as preceding text
				else $linked_text = $text . ' <a href="' . esc_attr( $link ) . '" target="_blank">' . $link . '</a>';
				// Add the generated text to the content
				if ( $linked_text !== '' ) {
                    $linkMethod = apply_filters('wprss_ftp_add_source_link_method', 'before');
                    if( $linkMethod === 'before' ) {
                        $content = $linked_text . '</br>' . $content;
                    }
                    elseif( $linkMethod === 'after' ) {
                        $content = $content . '</br>' . $linked_text;
                    }
                    elseif( is_callable($linkMethod) ) {
                        $content = call_user_func_array($linkMethod, array($content, $linked_text));
                    }
				}
			}

		} // end of imported post check

		return $content;
	}