</td>
					</tr>
				</tbody>
			</table>

			<p class="submit">
				<input type="submit" class="button-primary" value="<?php 
_e('Save Changes');
?>
" />
			</p>

		</form>

		<?php 
if (rfbp_valid_config()) {
    ?>
			<h3 class="rfbp-title">Test Configuration</h3>
			<p><?php 
    _e('Test your plugin configuration using the button below.', 'recent-facebook-posts');
    ?>
</p>
			<form action="<?php 
    echo admin_url('options-general.php?page=rfbp');
    ?>
" method="post">
				<input type="hidden" name="rfbp-test-config" value="1" />
				<input type="submit" class="button-primary" value="<?php 
    _e('Test Configuration', 'recent-facebook-posts');
    ?>
" />
    public function form($instance)
    {
        $instance = array_merge($this->defaults, $instance);
        $opts = rfbp_get_settings();
        if (!rfbp_valid_config()) {
            ?>
 			<p style="color:red;"><?php 
            printf(__('You need to <a href="%s">configure Recent Facebook Posts</a> first.', 'recent-facebook-posts'), admin_url('options-general.php?page=rfbp'));
            ?>
</p>
 		<?php 
        }
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'recent-facebook-posts');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('number_of_posts');
        ?>
"><?php 
        _e('Number of posts:', 'recent-facebook-posts');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('number_of_posts');
        ?>
" name="<?php 
        echo $this->get_field_name('number_of_posts');
        ?>
" type="number" min="1" max="99" value="<?php 
        echo esc_attr($instance['number_of_posts']);
        ?>
" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('excerpt_length');
        ?>
"><?php 
        _e('Excerpt length:', 'recent-facebook-posts');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('excerpt_length');
        ?>
" name="<?php 
        echo $this->get_field_name('excerpt_length');
        ?>
" type="number" min="1" max="9999"value="<?php 
        echo esc_attr($instance['excerpt_length']);
        ?>
" />
		</p>

		<p>
			<input type="checkbox" id="<?php 
        echo $this->get_field_id('show_like_count');
        ?>
" name="<?php 
        echo $this->get_field_name('show_like_count');
        ?>
" value="1" <?php 
        checked($instance['show_like_count'], 1);
        ?>
  />
			<label for="<?php 
        echo $this->get_field_id('show_like_count');
        ?>
"><?php 
        _e('Show like count?', 'recent-facebook-posts');
        ?>
</label>
		</p>

		<p>
			<input type="checkbox" id="<?php 
        echo $this->get_field_id('show_comment_count');
        ?>
" name="<?php 
        echo $this->get_field_name('show_comment_count');
        ?>
" value="1" <?php 
        checked($instance['show_comment_count'], 1);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_comment_count');
        ?>
"><?php 
        _e('Show comment count?', 'recent-facebook-posts');
        ?>
</label>
		</p>

		<p>
			<input type="checkbox" id="<?php 
        echo $this->get_field_id('show_page_link');
        ?>
" name="<?php 
        echo $this->get_field_name('show_page_link');
        ?>
" value="1" <?php 
        if ($instance['show_page_link']) {
            ?>
checked="1"<?php 
        }
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_page_link');
        ?>
"><?php 
        _e('Show link to Facebook page?', 'recent-facebook-posts');
        ?>
</label>
		</p>

		<p>
			<input type="checkbox" id="<?php 
        echo $this->get_field_id('show_link_previews');
        ?>
" name="<?php 
        echo $this->get_field_name('show_link_previews');
        ?>
" value="1" <?php 
        if ($instance['show_link_previews']) {
            ?>
checked="1"<?php 
        }
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_link_previews');
        ?>
"><?php 
        _e('Show link previews?', 'recent-facebook-posts');
        ?>
</label>
		</p>

		<?php 
    }