Skip to content

Commit

Permalink
* Minor documentation updates and code formatting to meet current Wor…
Browse files Browse the repository at this point in the history
…dPress Coding Standards
  • Loading branch information
Cais committed Mar 22, 2014
1 parent 9e0c869 commit 3b7c43f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Please stay current with your WordPress installation, your active theme, and you
* Moved widget load hook call into constructor class
* Moved all functions into class for better containment
* Updated required version to 3.6 to use `shortcode_atts` optional filter
* Minor documentation updates and code formatting to meet current WordPress Coding Standards

= 0.3.1 =
* Added additional comments to better indicate sections within the code
Expand Down
48 changes: 31 additions & 17 deletions wpfa-sample-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,12 @@ function plugin_data() {
* @uses plugin_dir_url
* @uses wp_enqueue_style
*
* @internal JavaScripts, etc. would be added via this same function call using
* wp_enqueue_script functionality
* @internal JavaScripts, etc. would be added via this same function call using wp_enqueue_script functionality
* @internal Used with action hook: wp_enqueue_scripts
*
* @version 0.4
* @date March 20, 2014
* Added call to `plugin_data` method to make versions dynamic in the enqueue calls
* Added call to `plugin_data` method for dynamic version numbering
*/
function Scripts_and_Styles() {
/** Get plugin data and save in its own variable */
Expand Down Expand Up @@ -203,9 +202,9 @@ function Scripts_and_Styles() {
* @var $before_title string
* @var $after_title string
* @var $title string
* @internal above vars are either drawn from the theme register_sidebar
* definition, or are drawn from the defaults in WordPress core.
* @internal above vars are either drawn from the theme register_sidebar definition, or are drawn from the defaults in WordPress core.
*
* @uses __
* @uses apply_filters
*/
function widget( $args, $instance ) {
Expand Down Expand Up @@ -240,6 +239,7 @@ function widget( $args, $instance ) {
}
/** End: widget method override ----------------------------------------- */


/** ------------------------------------------------------------------------
* Update a particular instance of the widget.
*
Expand Down Expand Up @@ -269,6 +269,7 @@ function update( $new_instance, $old_instance ) {
}
/** End: update override ------------------------------------------------ */


/** ------------------------------------------------------------------------
* This function displays the widget option panel form used to update the
* widget settings.
Expand All @@ -284,6 +285,7 @@ function update( $new_instance, $old_instance ) {
* @uses _e - used to echo text to screen
* @uses checked
* @uses get_field_id
* @uses get_field_name
* @uses selected
*
* @return string|void
Expand Down Expand Up @@ -313,7 +315,7 @@ function form( $instance ) {
<label for="<?php echo $this->get_field_id( 'show_choices' ); ?>"><?php _e( 'Show your choices?', 'wpfa-sample' ); ?></label>
</p>

<p><!-- This (dropdown menu) is used to choose "right" or "left" -->
<p><!-- This (drop down menu) is used to choose "right" or "left" -->
<label for="<?php echo $this->get_field_id( 'optionals' ); ?>"><?php _e( 'Options:', 'wpfa-sample' ); ?></label>
<select id="<?php echo $this->get_field_id( 'optionals' ); ?>" name="<?php echo $this->get_field_name( 'optionals' ); ?>" class="widefat" style="width:100%;">
<option <?php selected( 'right', $instance['optionals'], true ); ?>>right</option>
Expand All @@ -326,11 +328,11 @@ function form( $instance ) {
/** End: form override -------------------------------------------------- */


/** ----------------------------------------------------------------------------
/** ------------------------------------------------------------------------
* WPFA Sample Shortcode
* Adds shortcode functionality by using the PHP output buffer methods to
* capture `the_widget` output and return the data to be displayed via the use
* of the `wpfa_sample` shortcode.
* capture `the_widget` output and return the data to be displayed via the
* use of the `wpfa_sample` shortcode.
*
* @package WPFA_Sample
* @since 0.2
Expand Down Expand Up @@ -386,6 +388,7 @@ function wpfa_sample_shortcode( $atts ) {
'after_widget' => ''
)
); ?>

</div><!-- .wpfa-sample-shortcode -->

<?php
Expand All @@ -402,20 +405,31 @@ function wpfa_sample_shortcode( $atts ) {
} /** End function - sample shortcode */


/** ----------------------------------------------------------------------------
/** ------------------------------------------------------------------------
*/

/**
* Register the WP_Widget extended class.
*
* We need to take the widget code (read: the class WPFA_Sample_Widget that
* extends the WP_Widget class) and register it as a widget. Once the widget is
* registered it can be added to the widget initialization action.
* extends the WP_Widget class) and register it as a widget. Once the widget
* is registered it can be added to the widget initialization action.
*
* The following is more common practice than intuitive; the add_action call
* and the function used to 'register_widget' can be placed after the actual
* class code and it will still work correctly.
*
* @package WPFA_Sample_Widget
* @since 0.1
*
* The following is more common practice than intuitive; the add_action call and
* the function used to 'register_widget' can be placed after the actual class
* code and it will still work correctly.
* @uses register_widget
*/

/** Register the WP_Widget extended class. */
function load_wpfa_sample_widget() {

register_widget( 'WPFA_Sample_Widget' );

}
/** End function - load sample widget */


}
Expand Down

0 comments on commit 3b7c43f

Please sign in to comment.