/**
  * Disables widget app fields by adding them programmatically
  * @since 0.1.1
  * @param array $app App credentials
  */
 public static function disable_widget_app_settings($app = array())
 {
     // Make sure we have our Twitter class
     if (!class_exists('TwitterWP')) {
         require_once WDS_TWWI_PATH . 'lib/TwitterWP/lib/TwitterWP.php';
     }
     // initiate your app
     $tw = TwitterWP::start($app);
     if (is_wp_error($tw)) {
         self::$error = $tw->show_wp_error($tw, false);
         add_action('all_admin_notices', array($this, 'bad_app'));
         return;
     }
     // Ok, app's good, hide the widget fields
     WDS_Twitter::$hide_app_fields = true;
 }
    /**
     * Echo the settings update form.
     * @since 0.1.0
     * @param array $instance Current settings
     */
    public function form($instance)
    {
        /** Merge with defaults */
        $instance = wp_parse_args((array) $instance, WDS_Twitter::defaults());
        if (!WDS_Twitter::$hide_app_fields) {
            $this->twitter_app_fields($instance);
        }
        ?>
		<h3><?php 
        _e('Widget Options', 'wds_twwi');
        ?>
</h3>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'wds_twwi');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" class="widefat" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('twitter_id');
        ?>
"><?php 
        _e('Twitter Username', 'wds_twwi');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('twitter_id');
        ?>
" name="<?php 
        echo $this->get_field_name('twitter_id');
        ?>
" value="<?php 
        echo esc_attr($instance['twitter_id']);
        ?>
" class="widefat" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('twitter_num');
        ?>
"><?php 
        _e('Number of Tweets to Show', 'wds_twwi');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('twitter_num');
        ?>
" name="<?php 
        echo $this->get_field_name('twitter_num');
        ?>
" value="<?php 
        echo esc_attr($instance['twitter_num']);
        ?>
" size="3" />
		</p>

		<p>
			<input id="<?php 
        echo $this->get_field_id('twitter_hide_replies');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('twitter_hide_replies');
        ?>
" value="1" <?php 
        checked($instance['twitter_hide_replies']);
        ?>
/>
			<label for="<?php 
        echo $this->get_field_id('twitter_hide_replies');
        ?>
"><?php 
        _e('Hide @ Replies', 'wds_twwi');
        ?>
</label>
		</p>

		<p>
			<input id="<?php 
        echo $this->get_field_id('show_time_stamp');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_time_stamp');
        ?>
" value="1" <?php 
        checked($instance['show_time_stamp']);
        ?>
/>
			<label for="<?php 
        echo $this->get_field_id('show_time_stamp');
        ?>
"><?php 
        _e('Show Tweet Timestamp', 'wds_twwi');
        ?>
</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('twitter_duration');
        ?>
"><?php 
        _e('Load new Tweets every', 'wds_twwi');
        ?>
</label>
			<select name="<?php 
        echo $this->get_field_name('twitter_duration');
        ?>
" id="<?php 
        echo $this->get_field_id('twitter_duration');
        ?>
">
				<option value="5" <?php 
        selected(5, $instance['twitter_duration']);
        ?>
><?php 
        _e('5 Min.', 'wds_twwi');
        ?>
</option>
				<option value="15" <?php 
        selected(15, $instance['twitter_duration']);
        ?>
><?php 
        _e('15 Minutes', 'wds_twwi');
        ?>
</option>
				<option value="30" <?php 
        selected(30, $instance['twitter_duration']);
        ?>
><?php 
        _e('30 Minutes', 'wds_twwi');
        ?>
</option>
				<option value="60" <?php 
        selected(60, $instance['twitter_duration']);
        ?>
><?php 
        _e('1 Hour', 'wds_twwi');
        ?>
</option>
				<option value="120" <?php 
        selected(120, $instance['twitter_duration']);
        ?>
><?php 
        _e('2 Hours', 'wds_twwi');
        ?>
</option>
				<option value="240" <?php 
        selected(240, $instance['twitter_duration']);
        ?>
><?php 
        _e('4 Hours', 'wds_twwi');
        ?>
</option>
				<option value="720" <?php 
        selected(720, $instance['twitter_duration']);
        ?>
><?php 
        _e('12 Hours', 'wds_twwi');
        ?>
</option>
				<option value="1440" <?php 
        selected(1440, $instance['twitter_duration']);
        ?>
><?php 
        _e('24 Hours', 'wds_twwi');
        ?>
</option>
			</select>
		</p>

		<p>
			<input id="<?php 
        echo $this->get_field_id('follow_link_show');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('follow_link_show');
        ?>
" value="1" <?php 
        checked($instance['follow_link_show']);
        ?>
/>
			<label for="<?php 
        echo $this->get_field_id('follow_link_show');
        ?>
"><?php 
        _e('Include link to twitter page?', 'wds_twwi');
        ?>
</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('follow_link_text');
        ?>
"><?php 
        _e('Link Text (required)', 'wds_twwi');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('follow_link_text');
        ?>
" name="<?php 
        echo $this->get_field_name('follow_link_text');
        ?>
" value="<?php 
        echo esc_attr($instance['follow_link_text']);
        ?>
" class="widefat" />
		</p>
		<?php 
    }