From 92259517dbe21ac1bbf17cda9797ff7220d866e5 Mon Sep 17 00:00:00 2001 From: Tom McFarlin Date: Fri, 17 Aug 2012 14:06:06 -0400 Subject: [PATCH] Updating the JavaScript for better practices and refining one of the hooks for the plugin boilerplate --- js/admin.js | 6 +++--- js/display.js | 7 ++++--- plugin.php | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/js/admin.js b/js/admin.js index 296c707..5f62dc1 100644 --- a/js/admin.js +++ b/js/admin.js @@ -1,5 +1,5 @@ -(function($) { - $(function() { +(function ($) { + $(function () { // Place your administration-specific JavaScript here }); -})(jQuery); \ No newline at end of file +}(jQuery)); \ No newline at end of file diff --git a/js/display.js b/js/display.js index 5609ac4..23137ca 100644 --- a/js/display.js +++ b/js/display.js @@ -1,5 +1,6 @@ -(function($) { - $(function() { +(function ($) { + "use strict"; + $(function () { // Place your public-facing JavaScript here }); -})(jQuery); \ No newline at end of file +}(jQuery)); \ No newline at end of file diff --git a/plugin.php b/plugin.php index c8fc5d3..3f242c2 100644 --- a/plugin.php +++ b/plugin.php @@ -46,7 +46,7 @@ class PluginName { add_action( 'admin_enqueue_scripts', array( &$this, 'register_admin_scripts' ) ); // Register site styles and scripts - add_action( 'wp_print_styles', array( &$this, 'register_plugin_styles' ) ); + add_action( 'wp_enqueue_scripts', array( &$this, 'register_plugin_styles' ) ); add_action( 'wp_enqueue_scripts', array( &$this, 'register_plugin_scripts' ) ); register_activation_hook( __FILE__, array( &$this, 'activate' ) ); @@ -73,7 +73,7 @@ class PluginName { * * @params $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog */ - function activate( $network_wide ) { + public function activate( $network_wide ) { // TODO define activation functionality here } // end activate @@ -82,7 +82,7 @@ class PluginName { * * @params $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog */ - function deactivate( $network_wide ) { + public function deactivate( $network_wide ) { // TODO define deactivation functionality here } // end deactivate