Пример #1
0
/**
 * WP Tweets PRO settings
 */
function wpt_pro_functions()
{
    wpt_update_pro_settings();
    wpt_build_filters();
    global $wpdb;
    echo '<div class="ui-sortable meta-box-sortables wp-tweets-pro">';
    echo '<div class="postbox">';
    $class = get_option('wpt_license_valid') == 'true' || get_option('wpt_license_valid') == 'valid' || get_option('wpt_license_valid') == 'active' ? "valid" : "invalid";
    $active = $class == 'valid' ? ' <span class="activated">(' . __('activated', 'wp-tweets-pro') . ')</span>' : '';
    $retweet = get_option('wpt_retweet_after') != '' ? esc_attr(get_option('wpt_retweet_after')) : '39.5';
    $license_key = $class == 'valid' ? __('Update', 'wp-tweets-pro') : __('Activate', 'wp-tweets-pro');
    $button_type = $class == 'valid' ? 'button-secondary' : 'button-primary';
    print '	
		<h3><span>' . __('WP Tweets PRO Settings', 'wp-tweets-pro') . '</span></h3>
		<div class="inside">
			<form action="" method="post">
					<p class="' . $class . '">
						<label for="wpt_license_key">' . __('License Key', 'wp-tweets-pro') . $active . '</label><br/>
						<input type="text" size="38" name="wpt_license_key" id="wpt_license_key" value="' . esc_attr(get_option('wpt_license_key')) . '" /> <input type="submit" value="' . $license_key . '" class="' . $button_type . '" />
					</p>
					' . wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . '					
			</form>
			<form action="" method="post">
				<fieldset>
				<legend>' . __('Scheduling', 'wp-tweets-pro') . '</legend>
					<p>
						<label for="wpt_delay_tweets">' . __('Number of minutes to delay tweets', 'wp-tweets-pro') . '</label>
						<input type="text" size="4" name="wpt_delay_tweets" id="wpt_delay_tweets" value="' . esc_attr(get_option('wpt_delay_tweets')) . '" />
					</p>
					<p>
						<label for="wpt_retweet_after">' . __('Re-post Tweet after how many hours', 'wp-tweets-pro') . '</label>
						<input type="text" size="4" name="wpt_retweet_after" id="wpt_retweet_after" value="' . $retweet . '" />
					</p>
					<p>
						<label for="wpt_retweet_repeat">' . __('Re-post Tweet how many times at this interval?', 'wp-tweets-pro') . '</label>
						<select name="wpt_retweet_repeat" id="wpt_retweet_repeat">';
    $retweet_repeat_count = apply_filters('wpt_tweet_repeat_count', 4);
    for ($i = 0; $i < $retweet_repeat_count; $i++) {
        print '<option value="' . $i . '"' . selected(get_option('wpt_retweet_repeat'), $i, false) . '>' . $i . ' </option>';
    }
    print '
						</select>
					</p>
					<p>' . __('<strong>Blackout Period</strong>: Reschedule Tweets if', 'wp-tweets-pro') . '
						<label for="wpt_blackout_from">' . __('between', 'wp-tweets-pro') . '</label>
						<select name="wpt_blackout_from" id="wpt_blackout_from">
							<option value="0"> -- </option>					
							<optgroup label="' . __('AM', 'wp-tweets-pro') . '">';
    $wpt_blackout = is_array(get_option('wpt_blackout')) ? get_option('wpt_blackout') : array('from' => 0, 'to' => 0);
    for ($i = 1; $i <= 24; $i++) {
        print '<option value="' . $i . '"' . selected($wpt_blackout['from'], $i, false) . '>' . $i . ':00 </option>';
        if ($i == 12) {
            print '</optgroup>
								<optgroup label="' . __('PM', 'wp-tweets-pro') . '">';
        }
    }
    print '</optgroup></select>
						<label for="wpt_blackout_to">' . __('and', 'wp-tweets-pro') . '</label>
						<select name="wpt_blackout_to" id="wpt_blackout_to">
							<option value="0"> -- </option>					
							<optgroup label="' . __('AM', 'wp-tweets-pro') . '">';
    for ($i = 1; $i <= 24; $i++) {
        print '<option value="' . $i . '"' . selected($wpt_blackout['to'], $i, false) . '>' . $i . ':00 </option>';
        if ($i == 12) {
            print '</optgroup>
								<optgroup label="' . __('PM', 'wp-tweets-pro') . '">';
        }
    }
    print '</optgroup></select>';
    if (is_array(get_option('wpt_blackout')) && !($wpt_blackout['to'] == $wpt_blackout['from'])) {
        print "<br /><em>" . sprintf(__('Tweets rescheduled for times between %1$s:00 and %2$s:00.', 'wp-tweets-pro'), $wpt_blackout['from'], $wpt_blackout['to']) . "</em>";
    }
    $custom_type = get_option('wpt_custom_type');
    $prefix = $custom_type == 'prefix' || !$custom_type ? " checked='checked'" : '';
    $template = $custom_type == 'template' ? " checked='checked'" : '';
    print '</p>					
					<fieldset>
					<legend>' . __('Differentiate Re-posted Tweets', 'wp-tweets-pro') . '</legend>
					<p><input type="radio" name="wpt_custom_type" id="wpt_custom_prefix" value="prefix"' . $prefix . ' /> <label for="wpt_custom_prefix">Custom Prefixes</label><br />
					   <input type="radio" name="wpt_custom_type" id="wpt_custom_template" value="template"' . $template . ' /> <label for="wpt_custom_template">Custom Templates</label>
					<p>
						<label for="wpt_prepend_rt">' . __('First Repost', 'wp-tweets-pro') . '</label>
						<input type="text" size="32" name="wpt_prepend_rt" id="wpt_prepend_rt" value="' . esc_attr(stripslashes(get_option('wpt_prepend_rt'))) . '" /> <input type="checkbox" name="wpt_rt_media" id="wpt_rt_media" value="true" ' . checked('true', get_option('wpt_rt_media'), false) . ' /> <label for="wpt_rt_media">' . __('Exclude Media on First Repost', 'wp-tweets-pro') . '</label>
					</p>
					<p>
						<label for="wpt_prepend_rt2">' . __('Second Repost', 'wp-tweets-pro') . '</label>
						<input type="text" size="32" name="wpt_prepend_rt2" id="wpt_prepend_rt2" value="' . esc_attr(stripslashes(get_option('wpt_prepend_rt2'))) . '" /> <input type="checkbox" name="wpt_rt_media2" id="wpt_rt_media2" value="true" ' . checked('true', get_option('wpt_rt_media2'), false) . ' /> ' . __('Exclude Media on Second Repost', 'wp-tweets-pro') . '</label>
					</p>
					<p>
						<label for="wpt_prepend_rt3">' . __('Third Repost', 'wp-tweets-pro') . '</label>
						<input type="text" size="32" name="wpt_prepend_rt3" id="wpt_prepend_rt3" value="' . esc_attr(stripslashes(get_option('wpt_prepend_rt3'))) . '" /> <input type="checkbox" name="wpt_rt_media3" id="wpt_rt_media3" value="true" ' . checked('true', get_option('wpt_rt_media3'), false) . ' /> <label for="wpt_rt_media3">' . __('Exclude Media on Third Repost', 'wp-tweets-pro') . '</label>
					</p>';
    if ($custom_type == 'prefix' || !$custom_type) {
        print '
					<p><input type="checkbox" name="wpt_prepend" id="wpt_prepend" value="on"' . jd_checkCheckbox('wpt_prepend') . ' />
						<label for="wpt_prepend">' . __('Move repost prefixes to end of repost', 'wp-tweets-pro') . '</label>
					</p>';
    }
    $wpt_twitter_card_type = get_option('wpt_twitter_card_type');
    print '
					</fieldset>
					<fieldset>
					<legend>' . __('Co-tweeting and <a href="https://dev.twitter.com/cards">Twitter Cards</a>', 'wp-tweets-pro') . '</legend>
					<p>
						<input type="checkbox" name="wpt_twitter_card" id="wpt_twitter_card" value="on" ' . jd_checkCheckbox('wpt_twitter_card') . ' aria-describedby="tc_validation" />
						<label for="wpt_twitter_card">' . __('Enable Twitter Cards.', 'wp-tweets-pro') . '</label> <span id="tc_validation"><a href="https://cards-dev.twitter.com/validator">' . __('Validate your Twitter Cards', 'wp-tweets-pro') . '</a></span>
					</p>
					<p>
						<label for="wpt_twitter_card_type">' . __('Default Twitter Card type', 'wp-tweets-pro') . '</label>					
						<select name="wpt_twitter_card_type" id="wpt_twitter_card_type" />
							<option value="summary"' . selected($wpt_twitter_card_type, 'summary', false) . '>' . __('Summary', 'wp-tweets-pro') . '</option>
							<option value="summary_large_image"' . selected($wpt_twitter_card_type, 'summary_large_image', false) . '>' . __('Summary, Large Image', 'wp-tweets-pro') . '</option>
						</select>
					</p>					
					<p>
						<label for="wpt_toggle_card">' . __('Auto-enable photo card if post length less than', 'wp-tweets-pro') . '</label>
<input type="text" name="wpt_toggle_card" id="wpt_toggle_card" aria-labelledby="wpt_toggle_card wpt_tc_label" size="4" value="' . (int) get_option('wpt_toggle_card') . '" /> <span id="wpt_tc_label">' . __('characters', 'wp-tweets-pro') . '</span>
					</p>			
					<p>
						<input type="checkbox" name="wpt_cotweet" id="wpt_cotweet" value="on" ' . jd_checkCheckbox('wpt_cotweet') . ' />
						<label for="wpt_cotweet">' . __('Co-Tweet to Main Site account and author\'s account.', 'wp-tweets-pro') . '</label>
					</p>';
    $disabled = get_option('jd_individual_twitter_users') != 1 ? " disabled='disabled'" : '';
    print '
					<p class="indent">
						<label for="wpt_cotweet_lock">' . __('All co-tweets sent to this author', 'wp-tweets-pro') . '</label>
						<select name="wpt_cotweet_lock" id="wpt_cotweet_lock"' . $disabled . '>
							<option value="false">' . __('Post author', 'wp-tweets-pro') . '</option>';
    $args = array('meta_query' => array(array('key' => 'wtt_twitter_username', 'compare' => 'EXISTS')));
    // get all authorized users
    $users = get_users($args);
    $authorized_users = array();
    foreach ($users as $this_user) {
        if (wtt_oauth_test($this_user->ID, 'verify')) {
            $twitter = get_user_meta($this_user->ID, 'wtt_twitter_username', true);
            $authorized_users[] = array('ID' => $this_user->ID, 'name' => $this_user->display_name, 'twitter' => $twitter);
            print '<option value="' . $this_user->ID . '" ' . jd_checkSelect('wpt_cotweet_lock', $this_user->ID) . '>' . $this_user->display_name . " (@{$twitter})</option>";
        }
    }
    update_option('wpt_authorized_users', $authorized_users);
    print '
						</select>
					</p>
					</fieldset>
					<fieldset>
					<legend>' . __('Add hashtag filters', 'wp-tweets-pro') . '</legend>
					<p>
						<input type="checkbox" name="wpt_filter_title" id="wpt_filter_title" value="on" ' . jd_checkCheckbox('wpt_filter_title') . ' />
						<label for="wpt_filter_title">' . __('Filter Post Titles and insert hashtags', 'wp-tweets-pro') . '</label>
					</p>
					<p>
						<input type="checkbox" name="wpt_filter_post" id="wpt_filter_post" value="on"' . jd_checkCheckbox('wpt_filter_post') . ' />
						<label for="wpt_filter_post">' . __('Filter Post excerpts and insert hashtags', 'wp-tweets-pro') . '</label>
					</p>
					</fieldset>';
    ?>
					<fieldset class="comments">
					<legend><?php 
    _e('Tweet Comments', 'wp-tweets-pro');
    ?>
</legend>
					<?php 
    if (get_option('comment_moderation') == 1 || get_option('comment_whitelist') == 1) {
        ?>
					<p>
						<input type="checkbox" name="comment-published-update" id="comment-published-update" value="1" <?php 
        echo jd_checkCheckbox('comment-published-update');
        ?>
 />
						<label for="comment-published-update"><strong><?php 
        _e("Update Twitter when new comments are posted", 'wp-tweets-pro');
        ?>
</strong></label><br />				
						<label for="comment-published-text"><?php 
        _e("Template for new comments:", 'wp-tweets-pro');
        ?>
</label> <input aria-labelledby="comment-published-text-label" type="text" class="wpt-template" name="comment-published-text" id="comment-published-text" size="60" maxlength="120" value="<?php 
        echo esc_attr(stripslashes(get_option('comment-published-text')));
        ?>
" /><br />
						<label for="wpt_comment_delay"><?php 
        _e('Delay comment Tweets (minutes)', 'wp-tweets-pro');
        ?>
</label> <input type="number" name="wpt_comment_delay" id="wpt_comment_delay" value="<?php 
        esc_attr_e(get_option('wpt_comment_delay'));
        ?>
" />
					</p>
					<p id='comment-published-text-label'><?php 
        _e('Comments can use <code>#commenter#</code> to post the commenter\'s name in the Tweet, <code>#comment#</code> to post an excerpt of the comment, and <code>#comment_date#</code>. Comments will be Tweeted immediately when approved, or automatically if commenter has the "moderate comments" capability.', 'wp-tweets-pro');
        ?>
					<?php 
    } else {
        $url = admin_url('options-discussion.php#moderation_notify');
        printf(__("<em>Disabled</em>: Require <a href='%s'>administrator moderation of comments</a> or a previously approved comment to enable Tweeting comments.", 'wp-tweets-pro'), $url);
    }
    ?>
					</fieldset>
					<fieldset class="uploads">
					<legend><?php 
    _e('Upload Images to Twitter', 'wp-tweets-pro');
    ?>
</legend>
					<?php 
    if (function_exists('curl_version')) {
        ?>
					<p>
						<input type="checkbox" name="wpt_media" id="wpt_media" value="on" <?php 
        echo jd_checkCheckbox('wpt_media');
        ?>
 /> <label for="wpt_media"><?php 
        _e("Upload images to Twitter (Featured Image first, first other attached image otherwise.)", 'wp-tweets-pro');
        ?>
</label>			
					</p>
					<?php 
    } else {
        _e("<em>Disabled</em>: cURL support not available.", 'wp-tweets-pro');
    }
    ?>
					</fieldset>					
					<?php 
    print '
					<fieldset>
					<legend>' . __('Custom Tweet Filters', 'wp-tweets-pro') . '</legend>
					<p>' . __('Use these filters to set custom rules to block tweeting.', 'wp-tweets-pro') . '</p>
					' . wpt_setup_filters() . '
					</fieldset>
				';
    ?>
					<fieldset class="autopost">
					<legend><?php 
    _e('Automatically Tweet Old Posts', 'wp-tweets-pro');
    ?>
</legend>
					<?php 
    if (get_option('wpt_schedule') != '') {
        ?>
					<p class="wpt-has-schedule">
						<input type='hidden' name='wpt_is_scheduled' value='on' />
						<input type='checkbox' id='wpt_unschedule' name='wpt_unschedule' value="true" /> <label for='wpt_unschedule'><?php 
        _e('Cancel scheduled posting cycle', 'wp-tweets-pro');
        echo ' (' . get_option('wpt_schedule') . ')';
        ?>
					</p>
					<?php 
    }
    ?>
					<p>
						<label for='wpt_schedule'><?php 
    _e('Autopost interval', 'wp-tweets-pro');
    ?>
</label> 
						<select name='wpt_schedule' id='wpt_schedule'>
							<option value=''><?php 
    _e('None selected', 'wp-tweets-pro');
    ?>
</option>
							<?php 
    // note: if a schedule is set, show checkbox to delete existing schedule and create new.
    $schedules = wp_get_schedules();
    foreach ($schedules as $key => $schedule) {
        echo "<option value='{$key}'" . selected(get_option('wpt_schedule'), $key) . ">{$schedule['display']}</option>";
    }
    ?>
						</select>
					</p>
					<p>
						<label for='wpt_schedule_template'><?php 
    _e('Template for autoscheduled posts', 'wp-tweets-pro');
    ?>
</label>
						<textarea name='wpt_schedule_template' id='wpt_schedule_template' cols='60' rows='3' class='wpt-template' placeholder="#title# #url#"><?php 
    esc_attr_e(stripslashes(get_option('wpt_schedule_template')));
    ?>
</textarea>
					</p>
					<p>
						<input type="checkbox" id="wpt_schedule_custom" name="wpt_schedule_custom" value="true"<?php 
    checked(get_option('wpt_schedule_custom'), 'true');
    ?>
 /> <label for="wpt_schedule_custom"><?php 
    _e('Use custom Tweet template when available', 'wp-tweets-pro');
    ?>
</label>						
					<p>
						<label for="wpt_minimum_age"><?php 
    _e('Minimum age eligible for automatic Tweeting', 'wp-tweets-pro');
    ?>
</label>
						<select name='wpt_minimum_age' id='wpt_minimum_age'>
							<option value='none'<?php 
    selected(get_option('wpt_minimum_age'), 1);
    ?>
><?php 
    _e('No limit', 'wp-tweets-pro');
    ?>
</option>						
							<option value='2592000'<?php 
    selected(get_option('wpt_minimum_age'), 2592000);
    ?>
><?php 
    _e('1 month', 'wp-tweets-pro');
    ?>
</option>
							<option value='7776000'<?php 
    selected(get_option('wpt_minimum_age'), 7776000);
    ?>
><?php 
    _e('3 months', 'wp-tweets-pro');
    ?>
</option>
							<option value='15552000'<?php 
    selected(get_option('wpt_minimum_age'), 15552000);
    ?>
><?php 
    _e('6 months', 'wp-tweets-pro');
    ?>
</option>
							<option value='31536000'<?php 
    selected(get_option('wpt_minimum_age'), 31536000);
    ?>
><?php 
    _e('12 months', 'wp-tweets-pro');
    ?>
</option>
						</select>
					</p>
					<p>
						<label for="wpt_maximum_age"><?php 
    _e('Maximum age eligible for automatic Tweeting', 'wp-tweets-pro');
    ?>
</label>
						<select name='wpt_maximum_age' id='wpt_maximum_age'>
							<option value='none'<?php 
    selected(get_option('wpt_maximum_age'), 1);
    ?>
><?php 
    _e('No limit', 'wp-tweets-pro');
    ?>
</option>		
							<option value='2628000'<?php 
    selected(get_option('wpt_maximum_age'), 2628000);
    ?>
><?php 
    _e('1 month', 'wp-tweets-pro');
    ?>
</option>
							<option value='7884000'<?php 
    selected(get_option('wpt_maximum_age'), 7884000);
    ?>
><?php 
    _e('3 months', 'wp-tweets-pro');
    ?>
</option>
							<option value='15768000'<?php 
    selected(get_option('wpt_maximum_age'), 15768000);
    ?>
><?php 
    _e('6 months', 'wp-tweets-pro');
    ?>
</option>
							<option value='31536000'<?php 
    selected(get_option('wpt_maximum_age'), 31536000);
    ?>
><?php 
    _e('12 months', 'wp-tweets-pro');
    ?>
</option>
							<option value='63072000'<?php 
    selected(get_option('wpt_maximum_age'), 63072000);
    ?>
><?php 
    _e('2 years', 'wp-tweets-pro');
    ?>
</option>	
							<option value='157680000'<?php 
    selected(get_option('wpt_maximum_age'), 157680000);
    ?>
><?php 
    _e('5 years', 'wp-tweets-pro');
    ?>
</option>
							<option value='315360000'<?php 
    selected(get_option('wpt_maximum_age'), 315360000);
    ?>
><?php 
    _e('10 years', 'wp-tweets-pro');
    ?>
</option>
						</select>
					</p>
					<p>
						<label for="wpt_autoretweet_post_types"><?php 
    _e('Automatically Tweet these post types', 'wp-tweets-pro');
    ?>
</label><br />
						<select name='wpt_autoretweet_post_types[]' id='wpt_autoretweet_post_types' multiple='multiple'>
							<?php 
    $post_types = get_post_types(array('public' => true), 'objects');
    $wpt_post_types = get_option('wpt_autoretweet_post_types');
    if (!is_array($wpt_post_types)) {
        $wpt_post_types = array();
    }
    $wpt_post_type_options = '';
    foreach ($post_types as $type) {
        if ($type->name == 'mc-events') {
            continue;
        }
        if (in_array($type->name, $wpt_post_types)) {
            $selected = ' selected="selected"';
        } else {
            $selected = '';
        }
        $wpt_post_type_options .= "<option value='{$type->name}'{$selected}>" . $type->labels->name . "</option>";
    }
    echo $wpt_post_type_options;
    ?>
						</select>
					</p>
					<p>
						<label for='wpt_autopost_notification'><?php 
    _e('Email me about autoposted Tweets', 'wp-tweets-pro');
    ?>
</label>
						<input type='email' name='wpt_autopost_notification' id='wpt_autopost_notification' value='<?php 
    esc_attr_e(get_option('wpt_autopost_notification'));
    ?>
' placeholder="<?php 
    _e('Email address', 'wp-tweets-pro');
    ?>
" />
					</p>
					</fieldset>	
	<?php 
    echo '		<p class="submit">
					<input type="submit" name="submit" class="button-primary" value="' . __('Update WP Tweets PRO Settings', 'wp-tweets-pro') . '" />
				</p>
				<input type="hidden" name="wp_pro_settings" value="set" class="hidden" />
				' . wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . '
			</form>
			</div>';
    echo "</div>";
    echo "</div>";
}
Пример #2
0
function wpt_pro_functions()
{
    wpt_update_pro_settings();
    wpt_build_filters();
    global $wpdb;
    echo '<div class="ui-sortable meta-box-sortables wp-tweets-pro">';
    echo '<div class="postbox">';
    $class = get_option('wpt_license_valid') == 'true' ? "" : " style='padding: 3px; background: #ffc; border: 2px solid #c22; border-radius: 3px;'";
    $retweet = get_option('wpt_retweet_after') != '' ? esc_attr(get_option('wpt_retweet_after')) : '39.5';
    print '	
		<div class="handlediv"><span class="screen-reader-text">Click to toggle</span></div>
		<h3 class="hndle"><span>' . __('WP Tweets PRO Settings', 'wp-tweets-pro') . '</span></h3>
		<div class="inside">
			<form action="" method="post">
					<p' . $class . '>
						<label for="wpt_license_key">' . __('License Key', 'wp-tweets-pro') . '</label>
						<input type="text" size="38" name="wpt_license_key" id="wpt_license_key" value="' . esc_attr(get_option('wpt_license_key')) . '" />
					</p>
				<fieldset>
				<legend>' . __('Scheduling', 'wp-tweets-pro') . '</legend>
					<p>
						<label for="wpt_delay_tweets">' . __('Number of minutes to delay tweets', 'wp-tweets-pro') . '</label>
						<input type="text" size="4" name="wpt_delay_tweets" id="wpt_delay_tweets" value="' . esc_attr(get_option('wpt_delay_tweets')) . '" />
					</p>
					<p>
						<label for="wpt_retweet_after">' . __('Re-post Tweet after how many hours', 'wp-tweets-pro') . '</label>
						<input type="text" size="4" name="wpt_retweet_after" id="wpt_retweet_after" value="' . $retweet . '" />
					</p>
					<p>
						<label for="wpt_retweet_repeat">' . __('Re-post Tweet how many times at this interval?', 'wp-tweets-pro') . '</label>
						<select name="wpt_retweet_repeat" id="wpt_retweet_repeat">
							<option value="0"' . wtt_option_selected(get_option('wpt_retweet_repeat'), '0', 'option') . '>0 </option>						
							<option value="1"' . wtt_option_selected(get_option('wpt_retweet_repeat'), '1', 'option') . '>1 </option>
							<option value="2"' . wtt_option_selected(get_option('wpt_retweet_repeat'), '2', 'option') . '>2 </option>
							<option value="3"' . wtt_option_selected(get_option('wpt_retweet_repeat'), '3', 'option') . '>3 </option>
						</select>
					</p>
					<p>' . __('Blackout Period: Reschedule Tweets if', 'wp-tweets-pro') . '
						<label for="wpt_blackout_from">' . __('between', 'wp-tweets-pro') . '</label>
						<select name="wpt_blackout_from" id="wpt_blackout_from">
							<option value="0"> -- </option>					
							<optgroup label="' . __('AM', 'wp-tweets-pro') . '">';
    $wpt_blackout = is_array(get_option('wpt_blackout')) ? get_option('wpt_blackout') : array('from' => 0, 'to' => 0);
    for ($i = 1; $i <= 24; $i++) {
        print '<option value="' . $i . '"' . wtt_option_selected($wpt_blackout['from'], $i, 'option') . '>' . $i . ':00 </option>';
        if ($i == 12) {
            print '</optgroup>
								<optgroup label="' . __('PM', 'wp-tweets-pro') . '">';
        }
    }
    print '</optgroup></select>
						<label for="wpt_blackout_to">' . __('and', 'wp-tweets-pro') . '</label>
						<select name="wpt_blackout_to" id="wpt_blackout_to">
							<option value="0"> -- </option>					
							<optgroup label="' . __('AM', 'wp-tweets-pro') . '">';
    for ($i = 1; $i <= 24; $i++) {
        print '<option value="' . $i . '"' . wtt_option_selected($wpt_blackout['to'], $i, 'option') . '>' . $i . ':00 </option>';
        if ($i == 12) {
            print '</optgroup>
								<optgroup label="' . __('PM', 'wp-tweets-pro') . '">';
        }
    }
    print '</optgroup></select>';
    if (is_array(get_option('wpt_blackout')) && !($wpt_blackout['to'] == $wpt_blackout['from'])) {
        print "<br /><em>" . sprintf(__('Tweets rescheduled for times between %1$s:00 and %2$s:00.', 'wp-tweets-pro'), $wpt_blackout['from'], $wpt_blackout['to']) . "</em>";
    }
    $custom_type = get_option('wpt_custom_type');
    $prefix = $custom_type == 'prefix' || !$custom_type ? " checked='checked'" : '';
    $template = $custom_type == 'template' ? " checked='checked'" : '';
    print '</p>					
					<fieldset>
					<legend>' . __('Differentiate Re-posted Tweets', 'wp-tweets-pro') . '</legend>
					<p><input type="radio" name="wpt_custom_type" id="wpt_custom_prefix" value="prefix"' . $prefix . ' /> <label for="wpt_custom_prefix">Custom Prefixes</label><br />
					   <input type="radio" name="wpt_custom_type" id="wpt_custom_template" value="template"' . $template . ' /> <label for="wpt_custom_template">Custom Templates</label>
					<p>
						<label for="wpt_prepend_rt">' . __('First Repost', 'wp-tweets-pro') . '</label>
						<input type="text" size="32" name="wpt_prepend_rt" id="wpt_prepend_rt" value="' . esc_attr(get_option('wpt_prepend_rt')) . '" />
					</p>
					<p>
						<label for="wpt_prepend_rt2">' . __('Second Repost', 'wp-tweets-pro') . '</label>
						<input type="text" size="32" name="wpt_prepend_rt2" id="wpt_prepend_rt2" value="' . esc_attr(get_option('wpt_prepend_rt2')) . '" />
					</p>
					<p>
						<label for="wpt_prepend_rt3">' . __('Third Repost', 'wp-tweets-pro') . '</label>
						<input type="text" size="32" name="wpt_prepend_rt3" id="wpt_prepend_rt3" value="' . esc_attr(get_option('wpt_prepend_rt3')) . '" />
					</p>';
    if ($custom_type == 'prefix' || !$custom_type) {
        print '
					<p><input type="checkbox" name="wpt_prepend" id="wpt_prepend" value="on"' . jd_checkCheckbox('wpt_prepend') . ' />
						<label for="wpt_prepend">' . __('Move repost prefixes to end of repost', 'wp-tweets-pro') . '</label>
					</p>';
    }
    print '
					</fieldset>
					<fieldset>
					<legend>' . __('Co-tweeting and <a href="https://dev.twitter.com/docs/cards">Twitter Cards</a>', 'wp-tweets-pro') . '</legend>
					<p>
						<input type="checkbox" name="wpt_twitter_card" id="wpt_twitter_card" value="on" ' . jd_checkCheckbox('wpt_twitter_card') . ' />
						<label for="wpt_twitter_card">' . __('Enable Twitter Cards.', 'wp-tweets-pro') . '</label>
					</p>
					<p>
						<label for="wpt_toggle_card">' . __('Auto-enable photo card if post length less than', 'wp-tweets-pro') . '</label>
<input type="text" name="wpt_toggle_card" id="wpt_toggle_card" aria-labelledby="wpt_toggle_card wpt_tc_label" size="4" value="' . (int) get_option('wpt_toggle_card') . '" /> <span id="wpt_tc_label">' . __('characters', 'wp-tweets-pro') . '</span>
					</p>					
					<p>
						<input type="checkbox" name="wpt_cotweet" id="wpt_cotweet" value="on" ' . jd_checkCheckbox('wpt_cotweet') . ' />
						<label for="wpt_cotweet">' . __('Co-Tweet to Main Site account and author\'s account.', 'wp-tweets-pro') . '</label>
					</p>';
    $disabled = get_option('jd_individual_twitter_users') != 1 ? " disabled='disabled'" : '';
    print '
					<p class="indent">
						<label for="wpt_cotweet_lock">' . __('All co-tweets sent to this author', 'wp-tweets-pro') . '</label>
						<select name="wpt_cotweet_lock" id="wpt_cotweet_lock"' . $disabled . '>
							<option value="false">' . __('Post author', 'wp-tweets-pro') . '</option>';
    $count = count_users('time');
    $users = $count['total_users'] > 100 ? get_users(array('role' => 'administrator')) : ($users = get_users());
    $authorized_users = array();
    foreach ($users as $this_user) {
        if (wtt_oauth_test($this_user->ID, 'verify')) {
            $twitter = get_user_meta($this_user->ID, 'wtt_twitter_username', true);
            $authorized_users[] = array('ID' => $this_user->ID, 'name' => $this_user->display_name, 'twitter' => $twitter);
            print '<option value="' . $this_user->ID . '" ' . jd_checkSelect('wpt_cotweet_lock', $this_user->ID) . '>' . $this_user->display_name . " (@{$twitter})</option>";
        }
    }
    update_option('wpt_authorized_users', $authorized_users);
    print '
						</select>
					</p>
					</fieldset>
					<fieldset>
					<legend>' . __('Add hashtag filters', 'wp-tweets-pro') . '</legend>
					<p>
						<input type="checkbox" name="wpt_filter_title" id="wpt_filter_title" value="on" ' . jd_checkCheckbox('wpt_filter_title') . ' />
						<label for="wpt_filter_title">' . __('Filter Post Titles and insert hashtags', 'wp-tweets-pro') . '</label>
					</p>
					<p>
						<input type="checkbox" name="wpt_filter_post" id="wpt_filter_post" value="on"' . jd_checkCheckbox('wpt_filter_post') . ' />
						<label for="wpt_filter_post">' . __('Filter Post excerpts and insert hashtags', 'wp-tweets-pro') . '</label>
					</p>
					</fieldset>';
    ?>
					<fieldset class="comments">
					<legend><?php 
    _e('Tweet Comments', 'wp-tweets-pro');
    ?>
</legend>
					<?php 
    if (get_option('comment_moderation') == 1 || get_option('comment_whitelist') == 1) {
        ?>
					<p>
						<input type="checkbox" name="comment-published-update" id="comment-published-update" value="1" <?php 
        echo jd_checkCheckbox('comment-published-update');
        ?>
 />
						<label for="comment-published-update"><strong><?php 
        _e("Update Twitter when new comments are posted", 'wp-tweets-pro');
        ?>
</strong></label><br />				
						<label for="comment-published-text"><?php 
        _e("Template for new comments:", 'wp-tweets-pro');
        ?>
</label> <input aria-labelledby="comment-published-text-label" type="text" class="wpt-template" name="comment-published-text" id="comment-published-text" size="60" maxlength="120" value="<?php 
        echo esc_attr(stripslashes(get_option('comment-published-text')));
        ?>
" />
					</p>
					<p id='comment-published-text-label'><?php 
        _e('Comments can use <code>#commenter#</code> to post the commenter\'s name in the Tweet, <code>#comment#</code> to post an excerpt of the comment, and <code>#comment_date#</code>. Comments will be Tweeted immediately when approved, or automatically if commenter has the "moderate comments" capability.', 'wp-tweets-pro');
        ?>
					<?php 
    } else {
        $url = admin_url('options-discussion.php#moderation_notify');
        printf(__("<em>Disabled</em>: Require <a href='%s'>administrator moderation of comments</a> or a previously approved comment to enable Tweeting comments.", 'wp-tweets-pro'), $url);
    }
    ?>
					</fieldset>
					<fieldset class="uploads">
					<legend><?php 
    _e('Upload Images to Twitter', 'wp-tweets-pro');
    ?>
</legend>
					<?php 
    if (function_exists('curl_version')) {
        ?>
					<p>
						<input type="checkbox" name="wpt_media" id="wpt_media" value="on" <?php 
        echo jd_checkCheckbox('wpt_media');
        ?>
 /> <label for="wpt_media"><?php 
        _e("Upload images to Twitter (Featured Image first, first other attached image otherwise.)", 'wp-tweets-pro');
        ?>
</label>			
					</p>
					<?php 
    } else {
        _e("<em>Disabled</em>: cURL support not available.", 'wp-tweets-pro');
    }
    ?>
					</fieldset>					
					<?php 
    print '
					<fieldset>
					<legend>' . __('Custom Tweet Filters', 'wp-tweets-pro') . '</legend>
					<p>' . __('Use these filters to set custom rules to block tweeting.', 'wp-tweets-pro') . '</p>
					' . wpt_setup_filters() . '
					</fieldset>
				<p class="submit">
					<input type="submit" name="submit" class="button-primary" value="' . __('Update WP Tweets PRO Settings', 'wp-tweets-pro') . '" />
				</p>
				<input type="hidden" name="wp_pro_settings" value="set" class="hidden" style="display: none;" />
				' . wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false) . '
			</form>
			</div>	
				';
    echo "</div>";
    echo "</div>";
}