Browse files

Documentation updates

  • Loading branch information...
1 parent 0faed71 commit d0a0e429813e80afa20eff037020833a3e7e59fb @Cais committed Aug 30, 2012
Showing with 37 additions and 6 deletions.
  1. +22 −0 .idea/webResources.xml
  2. +15 −6 wpfa-sample-widget.php
View
22 .idea/webResources.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="WebResourcesPaths">
+ <contentEntries>
+ <entry url="file://$PROJECT_DIR$/../../../wp-admin">
+ <entryData>
+ <resourceRoots>
+ <path value="file://$PROJECT_DIR$/../../../wp-admin" />
+ </resourceRoots>
+ </entryData>
+ </entry>
+ <entry url="file://$PROJECT_DIR$/../../../wp-includes">
+ <entryData>
+ <resourceRoots>
+ <path value="file://$PROJECT_DIR$/../../../wp-includes" />
+ </resourceRoots>
+ </entryData>
+ </entry>
+ </contentEntries>
+ </component>
+</project>
+
View
21 wpfa-sample-widget.php
@@ -53,6 +53,8 @@
*
* @internal Translation files are expected to be found in the plugin root
* folder / directory.
+ * @internal Using "Textdomain: wpfa-sample" in the plugin header section
+ * excludes the need for this function call.
*/
load_plugin_textdomain( 'wpfa-sample' );
@@ -62,19 +64,23 @@
* @package WPFA_Sample
* @since 0.3
*
+ * @uses (global) wp_version - current version of WordPress
+ *
* @internal Requires WordPress version 2.8
* @internal @uses WP_Widget
*/
global $wp_version;
+/** @var $exit_message - message to be displayed by 'exit' function */
$exit_message = __( 'WPFA Sample Widget requires WordPress version 2.8 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please Update!</a>', 'wpfa-sample' );
+/** Check required version versus current version */
if ( version_compare( $wp_version, "2.8", "<" ) )
exit ( $exit_message );
/** End: Check installed WordPress version */
/**
* Enqueue Plugin Scripts and Styles
- *
- * Adds plugin stylesheet and allows for custom stylesheet to be added by end-user.
+ * Adds plugin stylesheet and allows for custom stylesheet to be added by
+ * end-user. These stylesheets will only affect public facing output.
*
* @package WPFA_Sample
* @since 0.3
@@ -83,23 +89,26 @@
* @uses plugin_dir_url
* @uses wp_enqueue_style
*
- * @internal Used with action: wp_enqueue_scripts
+ * @internal JavaScripts, etc. would be added via this same function call using
+ * wp_enqueue_script functionality
+ * @internal Used with action hook: wp_enqueue_scripts
*/
function WPFA_Sample_Scripts_and_Styles() {
/** Enqueue Scripts */
/** Enqueue Style Sheets */
wp_enqueue_style( 'WPFA-Sample-Style', plugin_dir_url( __FILE__ ) . 'wpfa-sample-style.css', array(), '0.3', 'screen' );
+ /** Check if custom stylesheet is readable (exists) */
if ( is_readable( plugin_dir_path( __FILE__ ) . 'wpfa-sample-custom-style.css' ) ) {
wp_enqueue_style( 'BNSFC-Custom-Style', plugin_dir_url( __FILE__ ) . 'wpfa-sample-custom-style.css', array(), '0.3', 'screen' );
}
}
add_action( 'wp_enqueue_scripts', 'WPFA_Sample_Scripts_and_Styles' );
/** End: Enqueue Plugin Scripts and Styles */
-/** Add function to the widgets_init hook. */
+/** Hook registered widget to the widgets_init action. */
add_action( 'widgets_init', 'load_wpfa_sample_widget' );
-
-/** Function that registers our widget. */
+
+/** Register the WP_Widget extended class. */
function load_wpfa_sample_widget() {
register_widget( 'WPFA_Sample_Widget' );
}

0 comments on commit d0a0e42

Please sign in to comment.