1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-05-10 07:12:09 +03:00

completing the initial round of PHP documentation as per the WPCS

http://make.wordpress.org/core/handbook/inline-documentation-standards/php-documentation-standards/#1-functions-and-class-methods
This commit is contained in:
Tom McFarlin 2014-06-26 16:19:57 -04:00
parent 9f5ffbf597
commit 23235f94d7
6 changed files with 152 additions and 22 deletions

View file

@ -23,8 +23,22 @@
*/ */
class Plugin_Name_Admin { class Plugin_Name_Admin {
/**
* Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $var Description.
*/
private $version; private $version;
/**
* Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $var Description.
*/
public function __construct( $version ) { public function __construct( $version ) {
$this->version = $version; $this->version = $version;
} }

View file

@ -23,6 +23,13 @@
*/ */
class Plugin_Name_i18n { class Plugin_Name_i18n {
/**
* Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $domain Description.
*/
private $domain; private $domain;
/** /**
@ -41,7 +48,12 @@ class Plugin_Name_i18n {
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @param float $domain TODO
*/ */
public function set_domain( $domain ) { public function set_domain( $domain ) {
$this->domain = $domain; $this->domain = $domain;

View file

@ -24,17 +24,28 @@
class Plugin_Name_Loader { class Plugin_Name_Loader {
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $var Description.
*/ */
protected $actions; protected $actions;
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $var Description.
*/ */
protected $filters; protected $filters;
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access private
*/ */
public function __construct() { public function __construct() {
@ -44,21 +55,43 @@ class Plugin_Name_Loader {
} }
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $var Description.
* @var type $var Description.
* @var type $var Description.
* @var type Optional $var Description.
*/ */
public function add_action( $hook, $component, $callback, $priority = 10 ) { public function add_action( $hook, $component, $callback, $priority = 10 ) {
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority ); $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority );
} }
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $var Description.
* @var type $var Description.
* @var type $var Description.
* @var type Optional $var Description.
*/ */
public function add_filter( $hook, $component, $callback, $priority = 10 ) { public function add_filter( $hook, $component, $callback, $priority = 10 ) {
$this->filters = $this->add( $this->filters, $hook, $component, $callback $priority ); $this->filters = $this->add( $this->filters, $hook, $component, $callback $priority );
} }
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $var Description.
* @var type $var Description.
* @var type $var Description.
* @var type $var Description.
* @var type Optional $var Description.
*/ */
private function add( $hooks, $hook, $component, $callback, $priority ) { private function add( $hooks, $hook, $component, $callback, $priority ) {
@ -83,12 +116,11 @@ class Plugin_Name_Loader {
public function run() { public function run() {
/** /**
* TODO:
* This function is used to define the various hooks that are shared in the * This function is used to define the various hooks that are shared in the
* both the dashboard and the public-facing areas of the plugin. This is * both the dashboard and the public-facing areas of the plugin. This is
* achieved via dependency injection by passing an instance of Plugin_Name * achieved via dependency injection by passing an instance of Plugin_Name
* into this class. * into this class.
*
* TODO
*/ */
foreach ( $this->filters as $hook ) { foreach ( $this->filters as $hook ) {

View file

@ -24,22 +24,36 @@
class Plugin_Name { class Plugin_Name {
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access protected
* @var type $var Description.
*/ */
protected $loader; protected $loader;
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access protected
* @var type $var Description.
*/ */
protected $plugin_slug; protected $plugin_slug;
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
* @access protected
* @var type $var Description.
*/ */
protected $version; protected $version;
/** /**
* TODO * Short description. (use period)
*
* @since 1.0.0
*/ */
public function __construct() { public function __construct() {
@ -54,7 +68,12 @@ class Plugin_Name {
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @access (for functions: only use if private)
*/ */
private function load_dependencies() { private function load_dependencies() {
@ -86,7 +105,12 @@ class Plugin_Name {
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @access (for functions: only use if private)
*/ */
private function set_locale() { private function set_locale() {
@ -97,7 +121,12 @@ class Plugin_Name {
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @access (for functions: only use if private)
*/ */
private function define_admin_hooks() { private function define_admin_hooks() {
@ -108,7 +137,12 @@ class Plugin_Name {
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @access (for functions: only use if private)
*/ */
private function define_public_hooks() { private function define_public_hooks() {
@ -119,28 +153,47 @@ class Plugin_Name {
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
*/ */
public function run() { public function run() {
$this->loader->run(); $this->loader->run();
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @return type Description
*/ */
public function get_slug() { public function get_slug() {
return $this->plugin_slug; return $this->plugin_slug;
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @return type Description
*/ */
public function get_loader() { public function get_loader() {
return $this->loader; return $this->loader;
} }
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @return type Description
*/ */
public function get_version() { public function get_version() {
return $this->version; return $this->version;

View file

@ -52,7 +52,11 @@ register_activation_hook( __FILE__, array( 'Plugin_Name_Deactivator', 'deactivat
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name.php';
/** /**
* TODO * Short description. (use period)
*
* Long description.
*
* @since 1.0.0
*/ */
function run_plugin_name() { function run_plugin_name() {

View file

@ -23,8 +23,23 @@
*/ */
class Plugin_Name_Public { class Plugin_Name_Public {
/**
* Short description. (use period)
*
* @since 1.0.0
* @access private
* @var type $var Description.
*/
private $version; private $version;
/**
* Short description. (use period)
*
* Long description.
*
* @since 1.0.0
* @param float $version TODO
*/
public function __construct( $version ) { public function __construct( $version ) {
$this->version = $version; $this->version = $version;
} }