Skip to content

Commit

Permalink
Added additional rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dmhendricks committed Jan 22, 2018
1 parent 1b4f40a commit e9526b6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/EnqueueScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function enqueue_frontend_scripts() {

// Enqueue frontend JavaScript
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 );
wp_localize_script( 'wordpress-base-plugin', 'wpbp_ajax_filter_params', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
wp_localize_script( 'wordpress-base-plugin', $this->prefix( 'ajax_filter_params' ), array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );

}

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

// Enqueue WP Admin JavaScript
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 );
wp_localize_script( 'wordpress-base-plugin-admin', 'wpbp_ajax_filter_params', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
wp_localize_script( 'wordpress-base-plugin-admin', $this->prefix( 'ajax_filter_params' ), array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );

}

Expand Down
15 changes: 10 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,18 @@ var jsTasks = [
}
];

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

];

/**
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"author": "Daniel M. Hendricks",
"license": "GPL-2.0",
"config": {
"plugin_name": "WordPress Base Plugin",
"plugin_short_name": "Base Plugin",
"username": "dmhendricks",
"php_namespace": "VendorName\\PluginName",
"javascript_object": "WPBP_NS"
"prefix": "wpbp"
},
"scripts": {
"translate": "wp-pot -s 'app/**/*.php' -o ./languages/$npm_package_name.pot -p $npm_package_config_slug",
Expand Down
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"prefix": "myplugin",
"prefix": "wpbp",
"short_name": "My Plugin",
"object_cache": {
"group": "my_plugin_cache",
"group": "wordpress_base_plugin_cache",
"expire_hours": 72
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: hendridm
Tags: wordpress,base,plugin,boilerplate,composer,carbonfields
Donate link: https://paypal.me/danielhendricks
Requires at least: 4.6
Tested up to: 4.9.1
Tested up to: 4.9.2
Stable tag: 0.4.0
License: GPL-2.0
License URI: http:https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
4 changes: 2 additions & 2 deletions src/js/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
success: function(result)
{
alert( result.success ? _myplugin_plugin_settings['admin_bar_add_clear_cache_success'] : 'Error: ' + result.message );
alert( result.success ? _wpbp_plugin_settings['admin_bar_add_clear_cache_success'] : 'Error: ' + result.message );
}
});

Expand All @@ -28,7 +28,7 @@
}

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

0 comments on commit e9526b6

Please sign in to comment.