mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 20:03:53 +02:00
This commit is contained in:
commit
29604c7ed3
1 changed files with 16 additions and 16 deletions
32
plugin.php
32
plugin.php
|
@ -40,7 +40,7 @@ class TODO {
|
||||||
// Define constants used throughout the plugin
|
// Define constants used throughout the plugin
|
||||||
$this->init_plugin_constants();
|
$this->init_plugin_constants();
|
||||||
|
|
||||||
load_plugin_textdomain(PLUGIN_LOCALE, false, dirname(plugin_basename(__FILE__)) . '/lang');
|
load_plugin_textdomain( PLUGIN_LOCALE, false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
|
@ -53,8 +53,8 @@ class TODO {
|
||||||
* For more information:
|
* For more information:
|
||||||
* http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
|
* http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
|
||||||
*/
|
*/
|
||||||
add_action('TODO', array($this, 'action_method_name'));
|
add_action( 'TODO', array( $this, 'action_method_name' ) );
|
||||||
add_filter('TODO', array($this, 'filter_method_name'));
|
add_filter( 'TODO', array( $this, 'filter_method_name' ) );
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@ class TODO {
|
||||||
*
|
*
|
||||||
* For example: wordpress-widget-boilerplate-locale.
|
* For example: wordpress-widget-boilerplate-locale.
|
||||||
*/
|
*/
|
||||||
if(!defined('PLUGIN_LOCALE')) {
|
if ( !defined( 'PLUGIN_LOCALE' ) ) {
|
||||||
define('PLUGIN_LOCALE', 'plugin-name-locale');
|
define( 'PLUGIN_LOCALE', 'plugin-name-locale' );
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
|
@ -106,8 +106,8 @@ class TODO {
|
||||||
*
|
*
|
||||||
* For example: WordPress Widget Boilerplate.
|
* For example: WordPress Widget Boilerplate.
|
||||||
*/
|
*/
|
||||||
if(!defined('PLUGIN_NAME')) {
|
if ( !defined( 'PLUGIN_NAME' ) ) {
|
||||||
define('PLUGIN_NAME', 'Plugin Name');
|
define( 'PLUGIN_NAME', 'Plugin Name' );
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
|
@ -120,8 +120,8 @@ class TODO {
|
||||||
*
|
*
|
||||||
* For example: wordpress-widget-boilerplate
|
* For example: wordpress-widget-boilerplate
|
||||||
*/
|
*/
|
||||||
if(!defined('PLUGIN_SLUG')) {
|
if ( !defined( 'PLUGIN_SLUG' ) ) {
|
||||||
define('PLUGIN_SLUG', 'plugin-name-slug');
|
define( 'PLUGIN_SLUG', 'plugin-name-slug' );
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
} // end init_plugin_constants
|
} // end init_plugin_constants
|
||||||
|
@ -133,16 +133,16 @@ class TODO {
|
||||||
* @file_path The path to the actual file
|
* @file_path The path to the actual file
|
||||||
* @is_script Optional argument for if the incoming file_path is a JavaScript source file.
|
* @is_script Optional argument for if the incoming file_path is a JavaScript source file.
|
||||||
*/
|
*/
|
||||||
private function load_file($name, $file_path, $is_script = false) {
|
private function load_file( $name, $file_path, $is_script = false ) {
|
||||||
$url = WP_PLUGIN_URL . $file_path;
|
$url = WP_PLUGIN_URL . $file_path;
|
||||||
$file = WP_PLUGIN_DIR . $file_path;
|
$file = WP_PLUGIN_DIR . $file_path;
|
||||||
if(file_exists($file)) {
|
if( file_exists( $file ) ) {
|
||||||
if($is_script) {
|
if( $is_script ) {
|
||||||
wp_register_script($name, $url);
|
wp_register_script( $name, $url );
|
||||||
wp_enqueue_script($name);
|
wp_enqueue_script( $name );
|
||||||
} else {
|
} else {
|
||||||
wp_register_style($name, $url);
|
wp_register_style( $name, $url );
|
||||||
wp_enqueue_style($name);
|
wp_enqueue_style( $name );
|
||||||
} // end if
|
} // end if
|
||||||
} // end if
|
} // end if
|
||||||
} // end _load_file
|
} // end _load_file
|
||||||
|
|
Loading…
Reference in a new issue