Jetpack_Subscriptions_Widget::form PHP Method

form() public method

public form ( $instance )
    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, $this->defaults());
        $title = stripslashes($instance['title']);
        $subscribe_text = stripslashes($instance['subscribe_text']);
        $subscribe_placeholder = stripslashes($instance['subscribe_placeholder']);
        $subscribe_button = stripslashes($instance['subscribe_button']);
        $success_message = stripslashes($instance['success_message']);
        $show_subscribers_total = checked($instance['show_subscribers_total'], true, false);
        $subs_fetch = $this->fetch_subscriber_count();
        if ('failed' == $subs_fetch['status']) {
            printf('<div class="error inline"><p>' . __('%s: %s', 'jetpack') . '</p></div>', esc_html($subs_fetch['code']), esc_html($subs_fetch['message']));
        }
        $subscribers_total = number_format_i18n($subs_fetch['value']);
        ?>
<p>
	<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
		<?php 
        _e('Widget title:', 'jetpack');
        ?>
		<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($title);
        ?>
" />
	</label>
</p>
<p>
	<label for="<?php 
        echo $this->get_field_id('subscribe_text');
        ?>
">
		<?php 
        _e('Optional text to display to your readers:', 'jetpack');
        ?>
		<textarea style="width: 95%" id="<?php 
        echo $this->get_field_id('subscribe_text');
        ?>
" name="<?php 
        echo $this->get_field_name('subscribe_text');
        ?>
" type="text"><?php 
        echo esc_html($subscribe_text);
        ?>
</textarea>
	</label>
</p>
<p>
	<label for="<?php 
        echo $this->get_field_id('subscribe_placeholder');
        ?>
">
		<?php 
        esc_html_e('Subscribe Placeholder:', 'jetpack');
        ?>
		<input class="widefat" id="<?php 
        echo $this->get_field_id('subscribe_placeholder');
        ?>
" name="<?php 
        echo $this->get_field_name('subscribe_placeholder');
        ?>
" type="text" value="<?php 
        echo esc_attr($subscribe_placeholder);
        ?>
" />
	</label>
</p>
<p>
	<label for="<?php 
        echo $this->get_field_id('subscribe_button');
        ?>
">
		<?php 
        _e('Subscribe Button:', 'jetpack');
        ?>
		<input class="widefat" id="<?php 
        echo $this->get_field_id('subscribe_button');
        ?>
" name="<?php 
        echo $this->get_field_name('subscribe_button');
        ?>
" type="text" value="<?php 
        echo esc_attr($subscribe_button);
        ?>
" />
	</label>
</p>
<p>
	<label for="<?php 
        echo $this->get_field_id('success_message');
        ?>
">
		<?php 
        _e('Success Message Text:', 'jetpack');
        ?>
		<textarea style="width: 95%" id="<?php 
        echo $this->get_field_id('success_message');
        ?>
" name="<?php 
        echo $this->get_field_name('success_message');
        ?>
" type="text"><?php 
        echo esc_html($success_message);
        ?>
</textarea>
	</label>
</p>
<p>
	<label for="<?php 
        echo $this->get_field_id('show_subscribers_total');
        ?>
">
		<input type="checkbox" id="<?php 
        echo $this->get_field_id('show_subscribers_total');
        ?>
" name="<?php 
        echo $this->get_field_name('show_subscribers_total');
        ?>
" value="1"<?php 
        echo $show_subscribers_total;
        ?>
 />
		<?php 
        echo esc_html(sprintf(_n('Show total number of subscribers? (%s subscriber)', 'Show total number of subscribers? (%s subscribers)', $subscribers_total, 'jetpack'), $subscribers_total));
        ?>
	</label>
</p>
<?php 
    }