Skip to content

Commit e9526b6

Browse files
committed
Added additional rename variables
1 parent 1b4f40a commit e9526b6

6 files changed

Lines changed: 20 additions & 13 deletions

File tree

app/EnqueueScripts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function enqueue_frontend_scripts() {
3838

3939
// Enqueue frontend JavaScript
4040
wp_enqueue_script( 'wordpress-base-plugin', Helpers::get_script_url( 'assets/js/wordpress-base-plugin.js' ), array( 'jquery', 'jquery-waituntilexists' ), Helpers::get_script_version( 'assets/js/wordpress-base-plugin.js' ), true );
41-
wp_localize_script( 'wordpress-base-plugin', 'wpbp_ajax_filter_params', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
41+
wp_localize_script( 'wordpress-base-plugin', $this->prefix( 'ajax_filter_params' ), array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
4242

4343
}
4444

@@ -56,7 +56,7 @@ public function enqueue_admin_scripts() {
5656

5757
// Enqueue WP Admin JavaScript
5858
wp_enqueue_script( 'wordpress-base-plugin-admin', Helpers::get_script_url( 'assets/js/wordpress-base-plugin-admin.js' ), array('jquery', 'jquery-waituntilexists'), Helpers::get_script_version( 'assets/js/wordpress-base-plugin-admin.js' ), true );
59-
wp_localize_script( 'wordpress-base-plugin-admin', 'wpbp_ajax_filter_params', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
59+
wp_localize_script( 'wordpress-base-plugin-admin', $this->prefix( 'ajax_filter_params' ), array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
6060

6161
}
6262

gulpfile.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ var jsTasks = [
6060
}
6161
];
6262

63-
/* Define strings to replace using 'gelp rename', defined in the config section of package.json */
63+
/* Define strings to replace using 'gulp rename', defined in the config section of package.json */
6464
var renameStrings = [
6565
[ 'dmhendricks\/wordpress-base-plugin', pkg.config.username + '/' + pkg.name ], // Git/Composer identifier
66-
[ 'wordpress-base-plugin', pkg.name ], // Plugin slug
67-
[ 'VendorName\\PluginName', pkg.config.php_namespace ], // PHP namespace for your plugin
68-
[ 'VendorName\\\\PluginName', pkg.config.php_namespace.replace(/\\/g, '\\\\') ], // Rename Composer namespace
69-
[ 'WPBP_NS', pkg.config.javascript_object ] // Unique JavaScript object for your plugin
66+
[ 'VendorName\\PluginName', pkg.config.php_namespace ], // PHP namespace for your plugin
67+
[ 'VendorName\\\\PluginName', pkg.config.php_namespace.replace( /\\/g, '\\\\' ) ], // Rename Composer namespace
68+
[ 'wordpress-base-plugin', pkg.name ], // Plugin slug
69+
[ 'wordpress_base_plugin', pkg.name.replace( '-', '_' ) ], // Plugin underscored slug
70+
[ 'WPBP_NS', pkg.config.prefix.toUpperCase() + '_NS' ], // Unique JavaScript object for your plugin
71+
[ 'wpbp', pkg.config.prefix ], // Replace remaining plugin prefixes
72+
[ 'WordPress Base Plugin', pkg.config.plugin_name ], // Replace plugin long name
73+
[ 'My Plugin', pkg.config.plugin_short_name ] // Replace plugin short name
74+
7075
];
7176

7277
/**

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"author": "Daniel M. Hendricks",
44
"license": "GPL-2.0",
55
"config": {
6+
"plugin_name": "WordPress Base Plugin",
7+
"plugin_short_name": "Base Plugin",
68
"username": "dmhendricks",
79
"php_namespace": "VendorName\\PluginName",
8-
"javascript_object": "WPBP_NS"
10+
"prefix": "wpbp"
911
},
1012
"scripts": {
1113
"translate": "wp-pot -s 'app/**/*.php' -o ./languages/$npm_package_name.pot -p $npm_package_config_slug",

plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"prefix": "myplugin",
2+
"prefix": "wpbp",
33
"short_name": "My Plugin",
44
"object_cache": {
5-
"group": "my_plugin_cache",
5+
"group": "wordpress_base_plugin_cache",
66
"expire_hours": 72
77
},
88
"dependencies": {

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: hendridm
33
Tags: wordpress,base,plugin,boilerplate,composer,carbonfields
44
Donate link: https://paypal.me/danielhendricks
55
Requires at least: 4.6
6-
Tested up to: 4.9.1
6+
Tested up to: 4.9.2
77
Stable tag: 0.4.0
88
License: GPL-2.0
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html

src/js/common/common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
success: function(result)
2121
{
22-
alert( result.success ? _myplugin_plugin_settings['admin_bar_add_clear_cache_success'] : 'Error: ' + result.message );
22+
alert( result.success ? _wpbp_plugin_settings['admin_bar_add_clear_cache_success'] : 'Error: ' + result.message );
2323
}
2424
});
2525

@@ -28,7 +28,7 @@
2828
}
2929

3030
// Bind event to clear theme cache Admin Bar link
31-
if( typeof _myplugin_plugin_settings !== 'undefined' && _myplugin_plugin_settings['show_clear_cache_link'] && _myplugin_plugin_settings['admin_bar_add_clear_cache'] ) {
31+
if( typeof _wpbp_plugin_settings !== 'undefined' && _wpbp_plugin_settings['show_clear_cache_link'] && _wpbp_plugin_settings['admin_bar_add_clear_cache'] ) {
3232
$( '#wpadminbar' ).waitUntilExists(function() {
3333
$('#wp-admin-bar-clear_object_cache').on( 'click', function( event ) {
3434
event.preventDefault();

0 commit comments

Comments
 (0)