1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-12-23 04:13:53 +02:00

Merge pull request #16 from pippinsplugins/master

Moved Plugin Textdomain and Added Class to Global Scope
This commit is contained in:
Tom McFarlin 2012-11-08 16:59:32 -08:00
commit f522cbd0e2

View file

@ -38,8 +38,8 @@ class PluginName {
*/ */
function __construct() { function __construct() {
// TODO: replace "plugin-name-locale" with a unique value for your plugin // load plugin text domain
load_plugin_textdomain( 'plugin-name-locale', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' ); add_action( 'init', array( $this, 'textdomain' ) );
// Register admin styles and scripts // Register admin styles and scripts
add_action( 'admin_print_styles', array( $this, 'register_admin_styles' ) ); add_action( 'admin_print_styles', array( $this, 'register_admin_styles' ) );
@ -86,6 +86,14 @@ class PluginName {
// TODO define deactivation functionality here // TODO define deactivation functionality here
} // end deactivate } // end deactivate
/**
* Loads the plugin text domain for translation
*/
public function textdomain() {
// TODO: replace "plugin-name-locale" with a unique value for your plugin
load_plugin_textdomain( 'plugin-name-locale', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
}
/** /**
* Registers and enqueues admin-specific styles. * Registers and enqueues admin-specific styles.
*/ */
@ -157,4 +165,4 @@ class PluginName {
} // end class } // end class
// TODO: update the instantiation call of your plugin to the name given at the class definition // TODO: update the instantiation call of your plugin to the name given at the class definition
new PluginName(); $plugin_name = new PluginName();