/**
 * Prints the checkbox settings for enabling the legacy feed item.
 * 
 * @since 2.9.5
 */
function wprss_ftp_legacy_enable_option() {
	$legacy_enabled = WPRSS_FTP_Settings::get_instance()->get('legacy_enabled');
	echo WPRSS_FTP_Utils::boolean_to_checkbox(
		WPRSS_FTP_Utils::multiboolean( $legacy_enabled ),
		array(
			'id'	=>	'wprss-ftp-legacy-enabled',
			'name'	=>	WPRSS_FTP_Settings::OPTIONS_NAME . '[legacy_enabled]',
			'value'	=>	'true',
		)
	);
	echo WPRSS_Help::get_instance()->do_tooltip( WPRSS_FTP_HELP_PREFIX.'legacy_enabled' );
}
function wprss_metaboxes_add_tooltips()
{
    if (class_exists('WPRSS_Help')) {
        $help = WPRSS_Help::get_instance();
        // Feed source setting fields
        $prefix = 'field_';
        $tooltips = array('wprss_url' => __('The URL of the feed source. In most cases, the URL of the site will also work, but for best results we recommend trying to find the URL of the RSS feed.

' . 'Also include the <code>http://</code> prefix in the URL.', WPRSS_TEXT_DOMAIN), 'wprss_limit' => __('The maximum number of imported items from this feed to keep stored.

' . 'When new items are imported and the limit is exceeded, the oldest feed items will be deleted to make room for new ones.

' . 'If you already have items imported from this feed source, setting this option now may delete some of your items, in order to comply with the limit.', WPRSS_TEXT_DOMAIN), 'wprss_enclosure' => __('Tick this box to make feed items link to the URL in the enclosure tag, rather than link to the original article.

' . 'Enclosure tags are RSS tags that may be included with a feed items. These tags typically contain links to images, audio, videos, attachment files or even flash content.

' . 'If you are not sure leave this setting blank.', WPRSS_TEXT_DOMAIN), 'wprss_unique_titles' => __('Whether to allow multiple feed items to have the same title. When checked, if a feed item has the same title as a previously-imported feed item, it will not be imported.

' . 'This can be useful in cases where permalinks change, or where multiple permalinks refer to the same item.', WPRSS_TEXT_DOMAIN), 'wprss_state' => __('State of the feed, active or paused.

' . 'If active, the feed source will fetch items periodically, according to the settings below.

' . 'If paused, the feed source will not fetch feed items periodically.', WPRSS_TEXT_DOMAIN), 'wprss_activate_feed' => __('You can set a time, in UTC, in the future when the feed source will become active, if it is paused.

' . 'Leave blank to activate immediately.', WPRSS_TEXT_DOMAIN), 'wprss_pause_feed' => __('You can set a time, in UTC, in the future when the feed source will become paused, if it is active.

' . 'Leave blank to never pause.', WPRSS_TEXT_DOMAIN), 'wprss_update_interval' => __('How frequently the feed source should check for new items and fetch if needed.

' . 'If left as <em>Default</em>, the interval in the global settings is used.', WPRSS_TEXT_DOMAIN), 'wprss_age_limit' => __('The maximum age allowed for feed items. Very useful if you are only concerned with, say, last week\'s news.

' . 'Items already imported will be deleted if they eventually exceed this age limit.

' . 'Also, items in the RSS feed that are already older than this age will not be imported at all.

' . 'Leaving empty to use the <em>Limit feed items by age</em> option in the general settings.', WPRSS_TEXT_DOMAIN), 'wprss_force_feed' => __('Use this option if you are seeing an <q>Invalid feed URL</q> error in the Feed Preview above, but you are sure that the URL is correct.

' . 'Note, however, that this will disable auto-discovery, meaning that the given URL must be an RSS feed URL. Using the site\'s URL will not work.', WPRSS_TEXT_DOMAIN));
        $help->add_tooltips($tooltips, $prefix);
    }
}
function wprss_settings_add_tooltips()
{
    if (class_exists('WPRSS_Help')) {
        $help = WPRSS_Help::get_instance();
        // Feed source setting fields
        $prefix = 'setting-';
        $tooltips = array('limit-feed-items-by-age' => __('The maximum age allowed for feed items.
' . '<hr/>

' . 'Items already imported will be deleted if they eventually exceed this age limit.

' . 'Also, items in the RSS feed that are already older than this age will not be imported at all.
' . '<hr/>

' . '<em>Leave empty for no limit.</em>', WPRSS_TEXT_DOMAIN), 'limit-feed-items-imported' => __('The maximum number of imported items to keep stored, for feed sources that do not have their own limit.
' . '<hr/>

' . 'When new items are imported and the limit for a feed source is exceeded, the oldest feed items for that feed source will be deleted to make room for the new ones.

' . 'If you already have items imported from this feed source, setting this option now may delete some of your items, in order to comply with the limit.
' . '<hr/>

' . '<em>Use 0 or leave empty for no limit.</em>', WPRSS_TEXT_DOMAIN), 'cron-interval' => __('How frequently should the feed sources (that do not have their own update interval) check for updates and fetch items accordingly.

' . 'It is recommended to not have more than 20 feed sources that use this global update interval. Having too many feed sources updating precisely at the same time can cause the WP Cron System to crash.', WPRSS_TEXT_DOMAIN), 'unique-titles' => __('Whether to allow multiple feed items to have the same title. When checked, if a feed item has the same title as a previously-imported feed item from any feed source, it will not be imported.

' . 'This can be useful in cases where permalinks change, or where multiple permalinks refer to the same item.

' . 'Since this feature requires checking every post title, WordPress installs with a significant amount of posts may notice a slight slowdown of the post import process.', WPRSS_TEXT_DOMAIN), 'custom-feed-url' => __('The URL of the custom feed, located at <code>http://yoursite.com/[custom feed url]</code>.
' . '<hr/>

' . 'WP RSS Aggregator allows you to create a custom RSS feed, that contains all of your imported feed items. This setting allows you to change the URL of this custom feed.

' . '<hr/>

' . '<strong>Note:</strong> You may be required to refresh you Permalinks after you change this setting, by going to <em>Settings <i class="fa fa-angle-right"></i> Permalinks</e> and clicking <em>Save</em>.', WPRSS_TEXT_DOMAIN), 'custom-feed-title' => __('The title of the custom feed.

' . 'This title will be included in the RSS source of the custom feed, in a <code>&lt;title&gt;</code> tag.', WPRSS_TEXT_DOMAIN), 'custom-feed-limit' => __('The maximum number of feed items in the custom feed.', WPRSS_TEXT_DOMAIN), 'link-enable' => __('Check this box to make the feed item titles link to the original article.', WPRSS_TEXT_DOMAIN), 'title-limit' => __('Set the maximum number of characters to show for feed item titles.
' . '<hr/>

' . '<em>Leave empty for no limit.</em>', WPRSS_TEXT_DOMAIN), 'authors-enable' => __('Check this box to show the author for each feed item, if it is available.', WPRSS_TEXT_DOMAIN), 'video-links' => __('For feed items from YouTube, Vimeo or Dailymotion, you can choose whether you want to have the items link to the original page link, or a link to the embedded video player only.', WPRSS_TEXT_DOMAIN), 'pagination' => __('The type of pagination to use when showing feed items on multiple pages.

' . 'The first shows two links, "Older" and "Newer", which allow you to navigate through the pages.

' . 'The second shows links for all the pages, together with links for the next and previous pages.', WPRSS_TEXT_DOMAIN), 'feed-limit' => __('The maximum number of feed items to display when using the shortcode.

' . 'This enables pagination if set to a number smaller than the number of items to be displayed.', WPRSS_TEXT_DOMAIN), 'open-dd' => __('Choose how you want links to be opened. This applies to the feed item title and the source link.', WPRSS_TEXT_DOMAIN), 'follow-dd' => __('Enable this option to set all links displayed as "NoFollow".
' . '<hr/>

' . '"Nofollow" provides a way to tell search engines to <em>not</em> follow certain links, such as links to feed items in this case.', WPRSS_TEXT_DOMAIN), 'source-enable' => __('Enable this option to show the feed source name for each feed item.', WPRSS_TEXT_DOMAIN), 'text-preceding-source' => __('Enter the text that you want to show before the source name. A space is automatically added between this text and the feed source name.', WPRSS_TEXT_DOMAIN), 'source-link' => __('Enable this option to link the feed source name to the RSS feed\'s source site.', WPRSS_TEXT_DOMAIN), 'date-enable' => __('Enable this to show the feed item\'s date.', WPRSS_TEXT_DOMAIN), 'text-preceding-date' => __('Enter the text that you want to show before the feed item date. A space is automatically added between this text and the date.', WPRSS_TEXT_DOMAIN), 'date-format' => __('The format to use for the feed item dates, as a PHP date format.', WPRSS_TEXT_DOMAIN), 'time-ago-format-enable' => __('Enable this option to show the elapsed time from the feed item\'s date and time to the present time.
' . '<em>Eg. 2 hours ago</em>', WPRSS_TEXT_DOMAIN), 'styles-disable' => __('Check this box to disable all plugin styles used for displaying feed items.

' . 'This will allow you to provide your own custom CSS styles for displaying the feed items.', WPRSS_TEXT_DOMAIN), 'certificate-path' => __('Path to the file containing one or more certificates.

' . 'These will be used to verify certificates over secure connection, such as when fetching a remote resource over HTTPS.

' . 'Relative path will be relative to the WordPress root.

' . '<strong>Default:</strong> path to certificate file bundled with WordPress.', WPRSS_TEXT_DOMAIN));
        $help->add_tooltips($tooltips, $prefix);
    }
}
예제 #4
0
 /**
  * Retrieve the singleton instance
  * 
  * @return WPRSS_Help
  */
 public static function get_instance()
 {
     if (is_null(self::$_instance)) {
         $class_name = __CLASS__;
         // Late static bindings not allowed
         self::$_instance = new $class_name();
     }
     return self::$_instance;
 }
<?php

if (class_exists('WPRSS_Help')) {
    $help = WPRSS_Help::get_instance();
    // Feed source setting fields
    $prefix = 'setting-';
    $tooltips = array('limit-feed-items-by-age' => 'The maximum age allowed for feed items.
                                            <hr/>

                                            Items already imported will be deleted if they eventually exceed this age limit.

                                            Also, items in the RSS feed that are already older than this age will not be imported at all.
                                            <hr/>

                                            <em>Leave empty for no limit.</em>', 'limit-feed-items-imported' => 'The maximum number of imported items to keep stored, for feed sources that do not have their own limit.
                                            <hr/>

                                            When new items are imported and the limit for a feed source is exceeded, the oldest feed items for that feed source will be deleted to make room for the new ones.

                                            If you already have items imported from this feed source, setting this option now may delete some of your items, in order to comply with the limit.
                                            <hr/>
                                            
                                            <em>Use 0 or leave empty for no limit.</em>', 'cron-interval' => 'How frequently should the feed sources (that do not have their own update interval) check for updates and fetch items accordingly.

                                            It is recommended to not have more than 20 feed sources that use this global update interval. Having too many feed sources updating precisely at the same time can cause the WP Cron System to crash.', 'custom-feed-url' => 'The URL of the custom feed, located at <code>http://yoursite.com/[custom feed url]</code>.
                                            <hr/>

                                            WP RSS Aggregator allows you to create a custom RSS feed, that contains all of your imported feed items. This setting allows you to change the URL of this custom feed.

                                            <hr/>
예제 #6
0
/**
 * Renders the Feed Processing metabox
 *
 * @since 3.7
 */
function wprss_feed_processing_meta_box_callback()
{
    global $post;
    // Get the post meta
    $state = get_post_meta($post->ID, 'wprss_state', TRUE);
    $activate = get_post_meta($post->ID, 'wprss_activate_feed', TRUE);
    $pause = get_post_meta($post->ID, 'wprss_pause_feed', TRUE);
    $update_interval = get_post_meta($post->ID, 'wprss_update_interval', TRUE);
    $age_limit = get_post_meta($post->ID, 'wprss_age_limit', FALSE);
    $age_unit = get_post_meta($post->ID, 'wprss_age_unit', FALSE);
    $age_limit = count($age_limit) === 0 ? wprss_get_general_setting('limit_feed_items_age') : $age_limit[0];
    $age_unit = count($age_unit) === 0 ? wprss_get_general_setting('limit_feed_items_age_unit') : $age_unit[0];
    // Set default strings for activate and pause times
    $default_activate = 'immediately';
    $default_pause = 'never';
    // Prepare the states
    $states = array('active' => __('Active', WPRSS_TEXT_DOMAIN), 'paused' => __('Paused', WPRSS_TEXT_DOMAIN));
    // Prepare the schedules
    $default_interval = __('Default', WPRSS_TEXT_DOMAIN);
    $wprss_schedules = apply_filters('wprss_schedules', wprss_get_schedules());
    $default_interval_key = wprss_get_default_feed_source_update_interval();
    $schedules = array_merge(array($default_interval_key => array('display' => $default_interval, 'interval' => $default_interval)), $wprss_schedules);
    // Inline help
    $help = WPRSS_Help::get_instance();
    $help_options = array('tooltip_handle_class_extra' => $help->get_options('tooltip_handle_class_extra') . ' ' . $help->get_options('tooltip_handle_class') . '-side');
    ?>

        <div class="wprss-meta-side-setting">
            <label for="wprss_state">Feed state:</label>
            <select id="wprss_state" name="wprss_state">
                <?php 
    foreach ($states as $value => $label) {
        ?>
                    <option value="<?php 
        echo $value;
        ?>
" <?php 
        selected($state, $value);
        ?>
 ><?php 
        echo $label;
        ?>
</option>
                <?php 
    }
    ?>
            </select>
			<?php 
    echo $help->tooltip('field_wprss_state', null, $help_options);
    ?>
        </div>

        <div class="wprss-meta-side-setting">
            <p>
                <label for="">Activate feed: </label>
                <strong id="wprss-activate-feed-viewer"><?php 
    echo $activate !== '' ? $activate : $default_activate;
    ?>
</strong>
                <a href="#">Edit</a>
				<?php 
    echo $help->tooltip('field_wprss_activate_feed', null, $help_options);
    ?>
            </p>
            <div class="wprss-meta-slider" data-collapse-viewer="wprss-activate-feed-viewer" data-default-value="<?php 
    echo $default_activate;
    ?>
">
                <input id="wprss_activate_feed" class="wprss-datetimepicker-from-today" name="wprss_activate_feed" value="<?php 
    echo $activate;
    ?>
" />
                <span class="description">
                    Current UTC time is:<br/><code><?php 
    echo date('d/m/Y H:i:s', current_time('timestamp', 1));
    ?>
</code>
                </span>
            </div>
        </div>

        <div class="wprss-meta-side-setting">
            <p>
                <label for="">Pause feed: </label>
                <strong id="wprss-pause-feed-viewer"><?php 
    echo $pause !== '' ? $pause : $default_pause;
    ?>
</strong>
                <a href="#">Edit</a>
				<?php 
    echo $help->tooltip('field_wprss_pause_feed', null, $help_options);
    ?>
            </p>
            <div class="wprss-meta-slider" data-collapse-viewer="wprss-pause-feed-viewer" data-default-value="<?php 
    echo $default_pause;
    ?>
">
                <input id="wprss_pause_feed" class="wprss-datetimepicker-from-today" name="wprss_pause_feed" value="<?php 
    echo $pause;
    ?>
" />
                <span class="description">
                    Current UTC time is:<br/><code><?php 
    echo date('d/m/Y H:i:s', current_time('timestamp', 1));
    ?>
</code>
                </span>
            </div>
        </div>


        <div class="wprss-meta-side-setting">
            <p>
                <label for="">Update interval: </label>
                <strong id="wprss-feed-update-interval-viewer">
                    <?php 
    if ($update_interval === '' || $update_interval === wprss_get_default_feed_source_update_interval()) {
        echo $default_interval;
    } else {
        echo wprss_interval($schedules[$update_interval]['interval']);
    }
    ?>
                </strong>
                <a href="#">Edit</a>
				<?php 
    echo $help->tooltip('field_wprss_update_interval', null, $help_options);
    ?>
            </p>
            <div class="wprss-meta-slider" data-collapse-viewer="wprss-feed-update-interval-viewer" data-default-value="<?php 
    echo $default_interval;
    ?>
">
                <select id="feed-update-interval" name="wprss_update_interval">
                <?php 
    foreach ($schedules as $value => $schedule) {
        ?>
                    <?php 
        $text = $value === wprss_get_default_feed_source_update_interval() ? $default_interval : wprss_interval($schedule['interval']);
        ?>
                    <option value="<?php 
        echo $value;
        ?>
" <?php 
        selected($update_interval, $value);
        ?>
 ><?php 
        echo $text;
        ?>
</option>
                <?php 
    }
    ?>
                </select>
            </div>
        </div>


        <div class="wprss-meta-side-setting">
            <p>
                <label id="wprss-age-limit-feed-label" for="" data-when-empty="Delete old feed items:">Delete feed items older than: </label>
                <strong id="wprss-age-limit-feed-viewer"><?php 
    echo $age_limit . ' ' . $age_unit;
    ?>
</strong>
                <a href="#">Edit</a>
				<?php 
    echo $help->tooltip('field_wprss_age_limit', null, $help_options);
    ?>
            </p>
            <div class="wprss-meta-slider" data-collapse-viewer="wprss-age-limit-feed-viewer" data-label="#wprss-age-limit-feed-label" data-default-value="" data-empty-controller="#limit-feed-items-age" data-hybrid="#limit-feed-items-age, #limit-feed-items-age-unit">
                <input id="limit-feed-items-age" name="wprss_age_limit" type="number" min="0" class="wprss-number-roller" placeholder="No limit" value="<?php 
    echo $age_limit;
    ?>
" />

                <select id="limit-feed-items-age-unit" name="wprss_age_unit">
                <?php 
    foreach (wprss_age_limit_units() as $unit) {
        ?>
                    <option value="<?php 
        echo $unit;
        ?>
" <?php 
        selected($age_unit, $unit);
        ?>
 ><?php 
        echo $unit;
        ?>
</option>
                <?php 
    }
    ?>
                </select>
            </div>
        </div>


        <?php 
}
<?php

/**
 * Template for WP RSS Aggregator tooltip JavaScript for the footer.
 * 
 * @package   WPRSSAggregator
 * @author    Jean Galea <*****@*****.**>
 * @copyright Copyright (c) 2012-2014, Jean Galea
 * @link      http://www.wprssaggregator.com/
 * @license   http://www.gnu.org/licenses/gpl.html
 */
?>
<script type="text/javascript" id="<?php 
echo WPRSS_Help::get_instance()->prefix('footer-js');
?>
">
	(function($, document, window) {
		$(function() {
			var tooltipHandleClass = '<?php 
echo isset($vars['tooltip_handle_class']) ? $vars['tooltip_handle_class'] : '';
?>
';
			
			// If class defined
			tooltipHandleClass.length && (function() {
				$('.'+tooltipHandleClass).tooltip({
					items: '*',
					tooltipClass: '<?php 
echo $vars['tooltip_class'];
?>
',
	/**
	 * Renders the field for the 'google_api_key' in the backend.
	 * 
	 * @since 2.8.6
	 * @param null|array $args The array of arguments passed to {@link add_settings_field()} that registered this function.
	 */
	public static function render_google_api_key( $args ) {
		$api_key = WPRSS_FTP_Settings::get_instance()->get( 'google_api_key' ); ?>
		<input type="text" id="google-api-key" name="<?php echo WPRSS_FTP_Settings::OPTIONS_NAME ?>[google_api_key]" value="<?php echo $api_key ?>" />
		<?php echo WPRSS_Help::get_instance()->do_tooltip( WPRSS_FTP_HELP_PREFIX.'google_api_key' ); ?>
		<p class="description">
			<?php
				$url = sprintf( 'href="%1$s"', esc_attr( 'https://developers.google.com/url-shortener/v1/getting_started' ) );
				printf( __( 'Learn more about the <a %s target="_blank">Google URL Shortener API</a>', WPRSS_TEXT_DOMAIN ), $url );
			?>
		</p>
		<?php
	}
예제 #9
0
/**
 * Returns the HTML of a tooltip handle.
 * 
 * Filters used:
 * - `wprss_settings_inline_help_default_options` - The default options for "Settings" page's tooltips
 * - `wprss_settings_inline_help_id_prefix` - The prefix for all tooltip IDs for the "Settings" page.
 * 
 * @param string $id The ID of the tooltip
 * @param string|null $text Text for this tooltip, if any.
 * @param array $options Any options for this setting.
 * @return string Tooltip handle HTML. See {@link WPRSS_Help::tooltip()}.
 */
function wprss_settings_inline_help($id, $text = null, $options = array())
{
    $help = WPRSS_Help::get_instance();
    // Default options, entry point
    $defaults = apply_filters('wprss_settings_inline_help_default_options', array('tooltip_handle_class_extra' => $help->get_options('tooltip_handle_class_extra') . ' ' . $help->get_options('tooltip_handle_class') . '-setting'));
    $options = $help->array_merge_recursive_distinct($defaults, $options);
    // ID Prefix
    $id = apply_filters('wprss_settings_inline_help_id_prefix', 'setting-') . $id;
    return $help->tooltip($id, $text, $options);
}
	/**
	 * Calls the function of this command with the given arguments.
	 * 
	 * @param array $args_override A different set of arguments that will override the original.
	 * @return mixed The return value of the function of the command.
	 * @throws Exception If the function of the command is not callable.
	 */
	public function call( $args_override = array() ) {
		$args = $this->get_args();
		$args = WPRSS_Help::get_instance()->array_merge_recursive_distinct( $args, $args_override );

		if ( !is_callable( $callable = $this->get_function() ) )
				throw new Exception( 'Could not call function: function must be callable.' );

		$result = call_user_func_array( $callable, $args);
		return $result;
	}
	/**
	 * Renders the post site dropdown.
	 *
	 * @since 1.7
	 */
	public function render_post_site_dropdown( $post, $field_id, $field, $meta ) {
		$id = self::META_PREFIX . $field_id;
		$desc = isset( $field['desc'] )? $field['desc'] : '';
		$multisite_and_main_site = WPRSS_FTP_Utils::is_multisite_and_main_site();
		$input = '';
		// If the return value of WPRSS_FTP_Utils::is_multisite_and_main_site()
		// is a string, then it is an error message. Set the description to it.
		if ( is_string( $multisite_and_main_site ) ) {
			$desc = $multisite_and_main_site;
		}
		// Otherwise, if it is boolean TRUE
		elseif ( $multisite_and_main_site === TRUE) {
			// Get the sites and generate a dropdown
			$sites = WPRSS_FTP_Utils::get_sites();
			$input = WPRSS_FTP_Utils::array_to_select(
				$sites,
				array(
					'id'		=> $id,
					'name'		=> $id,
					'selected'	=> $meta,
				)
			);
		}
		// If using multisite but not the main site, simply show the site name.
		elseif ( $multisite_and_main_site === FALSE && is_multisite() ) {
			$current_site = get_bloginfo('name');
			$meta = get_current_blog_id();
			$input = "<input type='hidden' name='$id' id='$id' value='$meta' /><b>{$current_site}</b>";
			$desc = '';
		}
		// If neither multisite nor main site, do not show the row
		else return '';

		// Show the field row
		ob_start(); ?>
			<tr>
				<th><label for="<?php echo $id; ?>"><?php echo $field['label']; ?></label></th>
				<td>
					<?php echo $input; ?>
					<?php
						if ( class_exists( 'WPRSS_Help' ) ) {
							echo WPRSS_Help::get_instance()->do_tooltip( WPRSS_FTP_HELP_PREFIX.$field_id );
						}
					?>
					<br/><label class="description" for="<?php echo $id; ?>"><?php echo $desc; ?></label>
				</td>
			</tr>
		<?php
		return ob_get_clean();
	}
	/**
	 * Renders the author settings
	 * 
	 * @since 1.9.3
	 */
	public function render_author_options( $post_id = NULL, $meta_row_title = '', $meta_label_for = '' ) {
		// Get the options
		$options = WPRSS_FTP_Settings::get_instance()->get_computed_options( $post_id );
		$def_author = ( $post_id !== NULL ) ? $options['def_author'] : $this->get( 'def_author' );
		$author_fallback_method = ( $post_id !== NULL ) ? $options['author_fallback_method'] : $this->get( 'author_fallback_method' );
		$author_fallback_method = ( strtolower( $author_fallback_method ) === 'use_existing' )? 'existing' : $author_fallback_method;
		$fallback_author = ( $post_id !== NULL ) ? $options['fallback_author'] : $this->get( 'fallback_author' );
		$no_author_found = ( $post_id !== NULL ) ? $options['no_author_found'] : $this->get( 'no_author_found' );
		
		// Set the HTML tag ids
		$ids = array(
			'def_author'				=>	'ftp-def-author',
			'author_fallback_method'	=>	'ftp-author-fallback-method',
			'fallback_author'			=>	'ftp-fallback-author',
			'no_author_found'			=>	'ftp-no-author-skip'
		);
		// If in meta, copy the keys into the values
		if ( $post_id !== NULL ) {
			foreach ( $ids as $field => $id ) {
				$ids[$field] = $field;
			}
		}
		// Set the HTML tag names
		$names = array(
			'def_author'				=>	'def_author',
			'author_fallback_method'	=>	'author_fallback_method',
			'fallback_author'			=>	'fallback_author',
			'no_author_found'			=>	'no_author_found',
		);
		// Set the names appropriately according to the page, meta or settings
		foreach( $names as $field => $name) {
			$names[$field] = ( $post_id !== NULL )? WPRSS_FTP_Meta::META_PREFIX . $name : self::OPTIONS_NAME . "[$name]";
		}

		// If in meta, print the table row
		if ( $post_id !== NULL ) : ?>
			<tr>
				<th>
					<label for="<?php echo $meta_label_for; ?>">
						<?php echo $meta_row_title; ?>
					</label>
				</th>
				<td>
		<?php endif; ?>

		<!-- Author to use -->
		<span id="wprss-ftp-authors-options">
			<label for="<?php echo $ids['def_author']; ?>">Use </label>
			<?php $users = WPRSS_FTP_Meta::get_users_array( WPRSS_FTP_Admin_User_Ajax::get_instance()->is_over_threshold() ? (array)$def_author : false ) ?>
			<?php echo WPRSS_FTP_Utils::array_to_select( $users, array(
					'id'		=>	$ids['def_author'],
					'name'		=>	$names['def_author'],
					'selected'	=>	$def_author,
			));
			?>
			<script type="text/javascript">
				top.wprss.f2p.userAjax.addElement('#<?php echo $ids['def_author'] ?>');
			</script>
			<?php
			echo WPRSS_Help::get_instance()->do_tooltip( WPRSS_FTP_HELP_PREFIX.'post_author' ); ?>
		</span>
		
		<!-- Separator -->
		<?php if ( $post_id !== NULL ) : ?>
			</td></tr>
			<tr class="wprss-tr-hr wprss-ftp-authors-hide-if-using-existing">
				<th>
				</th>
				<td>
		<?php endif; ?>
		
		<!-- Section that hides when using an existing user -->
		<span class="wprss-ftp-authors-hide-if-using-existing">
			
			<!-- Radio group if author has no user -->
			<span class="ftp-author-using-in-feed">
				<label for="<?php echo $ids['author_fallback_method']; ?>">
					<?php _e( 'If the author in the feed is not an existing user', WPRSS_TEXT_DOMAIN ); ?>:
				</label>
				<br/>
				<?php
					echo implode( '', WPRSS_FTP_Utils::array_to_radio_buttons(
						array(
							'existing'	=> __( 'Use the fallback user', WPRSS_TEXT_DOMAIN ),
							'create'	=> __( 'Create a user for the author', WPRSS_TEXT_DOMAIN )
						),
						array(
							'id'		=>	$ids['author_fallback_method'],
							'name'		=>	$names['author_fallback_method'],
							'checked'	=>	$author_fallback_method,
						)
					));
				?>
			</span>
			
			<!-- Radio group if author not found in feed -->
			<span class="ftp-author-using-in-feed">
				<label for="<?php echo $ids['no_author_found']; ?>">
					<?php _e( 'If the author is missing from the feed', WPRSS_TEXT_DOMAIN ); ?>
				</label>
				<br/>
				<?php
					echo implode( WPRSS_FTP_Utils::array_to_radio_buttons(
						array(
							'fallback'	=>	__( 'Use the fallback user', WPRSS_TEXT_DOMAIN ),
							'skip'		=>	__( 'Do not import the post', WPRSS_TEXT_DOMAIN )
						),
						array(
							'id'		=>	$ids['no_author_found'],
							'name'		=>	$names['no_author_found'],
							'checked'	=>	$no_author_found,
						)
					));
				?>
			</span>
		</span>
		
		
		<?php if ( $post_id !== NULL ) : ?>
			</td></tr>
			<tr class="wprss-tr-hr wprss-ftp-authors-hide-if-using-existing">
				<th>
					<label for="<?php echo $ids['fallback_author']; ?>">
						<?php _e( 'Fallback User', WPRSS_TEXT_DOMAIN ); ?>
					</label>
				</th>
				<td>
		<?php endif; ?>
		
		<!-- Section that hides when using an existing user -->
		<span class="wprss-ftp-authors-hide-if-using-existing">
			<?php if ( $post_id === NULL ) : ?>
			<label for="<?php echo $ids['fallback_author']; ?>">
				<?php _e( 'Fallback user:'******'id'		=>	$ids['fallback_author'],
					'name'		=>	$names['fallback_author'],
					'selected'	=>	$fallback_author,
				));
			?>
			<script type="text/javascript">
				top.wprss.f2p.userAjax.addElement('#<?php echo $ids['fallback_author'] ?>', {<?php echo WPRSS_FTP_Admin_User_Ajax::REQUEST_VAR_EXISTING_USERS_ONLY ?>: true, <?php echo WPRSS_FTP_Admin_User_Ajax::REQUEST_VAR_LOGIN_NAMES ?>: true});
			</script>
			<?php echo WPRSS_Help::get_instance()->do_tooltip( WPRSS_FTP_HELP_PREFIX.'fallback_author' ); ?>
		</span>
					
		<?php // Add scripts ?>

		<script type="text/javascript">
			(function($){
				$(document).ready( function(){

					// Set a pointer to the dropdowns
					var dropdown1 = $('#<?php echo $ids['def_author']; ?>');

					// Create the function that shows/hides the second section
					var authorsSection2UI = function(){
						// Show second section only if the option to use the author in the feed is chosen
						$('.wprss-ftp-authors-hide-if-using-existing').toggle( dropdown1.val() === '.' );
					}

					// Set the on change handlers
					dropdown1.change( authorsSection2UI );

					// Run the function at least once
					authorsSection2UI();

				});
			})(jQuery);
		</script>
		<?php // End of scripts

		// If in meta, close the table row
		if ( $post_id !== NULL ) {
			?></td></tr><?php
		}
	}