1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-04-25 16:15:23 +03:00

Merge pull request #2 from tommcfarlin/master

Update 16.05.2013
This commit is contained in:
Ulrich Pogson 2013-05-15 15:02:01 -07:00
commit a59d520420
15 changed files with 30 additions and 25 deletions

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -71,17 +71,18 @@ class PluginName {
// Add the options page and menu item.
// add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
// Enqueue admin styles and scripts.
// Load admin style sheet and JavaScript.
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
// Enqueue public style and scripts.
// Load public-facing style sheet and JavaScript.
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
// Define custom functionality. See http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
// Define custom functionality. Read more about actions and filters: http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
add_action( 'TODO', array( $this, 'action_method_name' ) );
add_filter( 'TODO', array( $this, 'filter_method_name' ) );
}
/**
@ -92,6 +93,7 @@ class PluginName {
* @return object A single instance of this class.
*/
public static function get_instance() {
// If the single instance hasn't been set, set it now.
if ( null == self::$instance ) {
self::$instance = new self;
@ -128,6 +130,7 @@ class PluginName {
* @since 1.0.0
*/
public function load_plugin_textdomain() {
$domain = $this->plugin_slug;
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
@ -136,7 +139,7 @@ class PluginName {
}
/**
* Enqueue admin-specific style sheets.
* Register and enqueue admin-specific style sheet.
*
* @since 1.0.0
*
@ -156,7 +159,7 @@ class PluginName {
}
/**
* Enqueue admin-specific JavaScript.
* Register and enqueue admin-specific JavaScript.
*
* @since 1.0.0
*
@ -176,7 +179,7 @@ class PluginName {
}
/**
* Enqueue public-facing style sheets.
* Register and enqueue public-facing style sheet.
*
* @since 1.0.0
*/
@ -185,7 +188,7 @@ class PluginName {
}
/**
* Enqueues public-facing script files.
* Register and enqueues public-facing JavaScript files.
*
* @since 1.0.0
*/
@ -199,6 +202,7 @@ class PluginName {
* @since 1.0.0
*/
public function add_plugin_admin_menu() {
/*
* TODO:
*
@ -213,6 +217,7 @@ class PluginName {
$this->plugin_slug,
array( $this, 'display_plugin_admin_page' )
);
}
/**
@ -249,4 +254,5 @@ class PluginName {
public function filter_method_name() {
// TODO: Define your filter hook callback here
}
}

View file

@ -3,7 +3,7 @@
msgid ""
msgstr ""
"Project-Id-Version: TODO 1.0.0\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/plugin-boilerplate\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/plugin-name\n"
"POT-Creation-Date: 2013-05-10 11:23:19+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -18,18 +18,18 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-SearchPath-0: .\n"
#: plugin-boilerplate.php:273
#: plugin-name.php:273
msgid "Page Title"
msgstr ""
#: plugin-boilerplate.php:274
#: plugin-name.php:274
msgid "Menu Text"
msgstr ""
#: plugin-boilerplate.php:275
#: plugin-name.php:275
msgid "read"
msgstr ""
#: plugin-boilerplate.php:276
#: plugin-name.php:276
msgid "plugin-name"
msgstr ""

View file

@ -12,30 +12,29 @@
*
* @wordpress-plugin
* Plugin Name: TODO
* Plugin URI: TODO
* Plugin URI: TODO
* Description: TODO
* Version: 1.0.0
* Author: TODO
* Author URI: TODO
* Author Email: TODO
* Version: 1.0.0
* Author: TODO
* Author URI: TODO
* Text Domain: plugin-name-locale
* License: GPL-2.0+
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /lang/
* Domain Path: /lang
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
if ( ! defined( 'WPINC' ) ) {
die;
}
// TODO: replace `class-plugin-boilerplate.php` with the name of the actual plugin's class file
require_once( plugin_dir_path( __FILE__ ) . 'class-plugin-boilerplate.php' );
// TODO: replace `class-plugin-name.php` with the name of the actual plugin's class file
require_once( plugin_dir_path( __FILE__ ) . 'class-plugin-name.php' );
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-boilerplate.php`
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-name.php`
register_activation_hook( __FILE__, array( 'PluginName', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'PluginName', 'deactivate' ) );
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-boilerplate.php`
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-name.php`
PluginName::get_instance();

View file

Before

Width:  |  Height:  |  Size: 450 KiB

After

Width:  |  Height:  |  Size: 450 KiB