1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2025-04-19 05:35:36 +03:00
related #42
This commit is contained in:
Tom McFarlin 2013-05-12 08:03:14 -04:00
parent e4fe4e964d
commit 828b21ce54
2 changed files with 290 additions and 625 deletions

View file

@ -8,8 +8,8 @@ Author: TODO
Author URI: TODO
Author Email: TODO
Text Domain: plugin-name-locale
License: GNU General Public License Unversioned
License URI: http://www.gnu.org/licenses/gpl.txt
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Copyright 2013 TODO (email@domain.com)
*/
@ -41,7 +41,7 @@ if ( ! defined('PLUGIN_NAME_VERSION' ) ) {
}
/**
* TODO:
* TODO:
*
* Rename this class to a proper name for your plugin. Give a proper description of
* the plugin, it's purpose, and any dependencies it has.
@ -55,19 +55,19 @@ if ( ! defined('PLUGIN_NAME_VERSION' ) ) {
class PluginName {
/**
* Refers to a single instance of this class.
* Refers to a single instance of this class.
*
* @var object
*/
protected static $instance = null;
/**
/**
* Refers to the slug of the plugin screen.
*
* @var string
*/
protected $plugin_screen_slug = null;
/**
* Creates or returns an instance of this class.
*
@ -105,7 +105,7 @@ class PluginName {
* Register admin styles and scripts
* If the Settings page has been activated using the above hook, the scripts and styles
* will only be loaded on the settings page. If not, they will be loaded for all
* admin pages.
* admin pages.
*
* add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_styles' ) );
* add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
@ -121,7 +121,7 @@ class PluginName {
/*
* TODO:
*
*
* Define the custom functionality for your plugin. The first parameter of the
* add_action/add_filter calls are the hooks into which your code should fire.
*
@ -133,7 +133,7 @@ class PluginName {
*/
add_action( 'TODO', array( $this, 'action_method_name' ) );
add_filter(' TODO', array( $this, 'filter_method_name' ) );
}
/**
@ -166,7 +166,7 @@ class PluginName {
load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
}
/**
@ -192,9 +192,9 @@ class PluginName {
if ( $screen->id == $this->plugin_screen_slug ) {
wp_enqueue_style( 'plugin-name-admin-styles', plugins_url( 'css/admin.css', __FILE__ ), PLUGIN_NAME_VERSION );
}
}
}
/**
@ -210,7 +210,7 @@ class PluginName {
*/
if ( isset( $this->plugin_screen_slug ) ) {
/*
* Check if current screen is the admin page for this plugin
* Don't enqueue stylesheet or JavaScript if it's not
@ -220,9 +220,9 @@ class PluginName {
if ( $screen->id == $this->plugin_screen_slug ) {
wp_enqueue_script( 'plugin-name-admin-script', plugins_url('js/admin.js', __FILE__), array( 'jquery' ), PLUGIN_NAME_VERSION );
}
}
}
/**
@ -249,22 +249,22 @@ class PluginName {
* @since 1.0.0
*/
public function add_plugin_admin_menu() {
/*
* TODO:
*
* Change 'Page Title' to the title of your plugin admin page
* Change 'Menu Text' to the text for menu item for the plugin settings page
* Change 'Menu Text' to the text for menu item for the plugin settings page
* Change 'plugin-name' to the name of your plugin
*/
$this->plugin_screen_slug = add_plugins_page(
__('Page Title', 'plugin-name-locale'),
__('Menu Text', 'plugin-name-locale'),
'read',
__('Page Title', 'plugin-name-locale'),
__('Menu Text', 'plugin-name-locale'),
'read',
'plugin-name',
array( $this, 'display_plugin_admin_page' )
);
}
/**