Skip to content

Commit

Permalink
Drop it: Rename the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Apr 20, 2018
1 parent e2be2e0 commit 26a5aad
Show file tree
Hide file tree
Showing 21 changed files with 1,505 additions and 792 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": ["@wordpress/default"],
"plugins": [
["@wordpress/babel-plugin-makepot", { "output": "languages/splash.pot" }]
["@wordpress/babel-plugin-makepot", { "output": "languages/dropit.pot" }]
]
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
scripts/*/build
node_modules
splash.zip
dropit.zip
.DS_Store
svn
languages
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Splash
# Drop it

Splash.
Drop it.

### Features

* Splash.
* Drop it.
10 changes: 5 additions & 5 deletions bin/build-plugin-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ npm install
status "Generating build..."
npm run build
status "Generating PHP file for wordpress.org to parse translations..."
npx pot-to-php ./languages/splash.pot ./languages/splash-translations.php splash
npx pot-to-php ./languages/dropit.pot ./languages/dropit-translations.php dropit

# Remove any existing zip file
rm -f splash.zip
rm -f dropit.zip

# Generate the plugin zip file
status "Creating archive..."
zip -r splash.zip \
splash.php \
zip -r dropit.zip \
dropit.php \
lib/*.php \
scripts/{sidebar,i18n}/build/*.{js,css} \
languages/splash-translations.php \
languages/dropit-translations.php \
readme.txt

status "Done."
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "youknowriad/splash",
"name": "youknowriad/dropit",
"type": "wordpress-plugin"
}
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
environment:
WORDPRESS_DB_PASSWORD: example
volumes:
- ../:/var/www/html/wp-content/plugins/splash
- ../:/var/www/html/wp-content/plugins/dropit

mysql:
image: mysql:5.7
Expand Down
10 changes: 5 additions & 5 deletions splash.php → dropit.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
/**
* Plugin Name: Splash
* Plugin URI: https://github.com/youknowriad/splash
* Description: Splash
* Plugin Name: Drop it
* Plugin URI: https://github.com/youknowriad/dropit
* Description: Drop it
* Version: 1.0.0
* Text Domain: splash
* Text Domain: dropit
* Domain Path: /languages
* Author: Riad Benguella
*
* @package splash
* @package dropit
*/

// Some common utilities
Expand Down
8 changes: 4 additions & 4 deletions lib/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
/**
* Retrieves the root plugin path.
*
* @return string Root path to the splash plugin.
* @return string Root path to the drop it plugin.
*
* @since 1.0.0
*/
function splash_dir_path() {
function dropit_dir_path() {
return plugin_dir_path( dirname(__FILE__ ) );
}

/**
* Retrieves a URL to a file in the splash plugin.
* Retrieves a URL to a file in the drop it plugin.
*
* @param string $path Relative path of the desired file.
*
* @return string Fully qualified URL pointing to the desired file.
*
* @since 1.0.0
*/
function splash_url( $path ) {
function dropit_url( $path ) {
return plugins_url( $path, dirname( __FILE__ ) );
}
26 changes: 13 additions & 13 deletions lib/i18n-script.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @return array
*/
function splash_get_jed_locale_data( $domain ) {
function dropit_get_jed_locale_data( $domain ) {
$translations = get_translations_for_domain( $domain );

$locale = array(
Expand All @@ -35,31 +35,31 @@ function splash_get_jed_locale_data( $domain ) {
*
* @since 1.0.0
*/
function splash_i18n_register() {
$locale_data = splash_get_jed_locale_data( 'splash' );
$content = 'wp.i18n.setLocaleData( ' . json_encode( $locale_data ) . ', "splash" );';
function dropit_i18n_register() {
$locale_data = dropit_get_jed_locale_data( 'dropit' );
$content = 'wp.i18n.setLocaleData( ' . json_encode( $locale_data ) . ', "dropit" );';

wp_register_script(
'splash-i18n',
splash_url( 'scripts/i18n/build/index.js' ),
'dropit-i18n',
dropit_url( 'scripts/i18n/build/index.js' ),
array( 'wp-i18n' ),
filemtime( splash_dir_path() . 'scripts/i18n/build/index.js' )
filemtime( dropit_dir_path() . 'scripts/i18n/build/index.js' )
);
wp_add_inline_script( 'splash-i18n', $content );
wp_add_inline_script( 'dropit-i18n', $content );
}
add_action( 'init', 'splash_i18n_register' );
add_action( 'init', 'dropit_i18n_register' );


/**
* Load plugin text domain for translations.
*
* @since 1.0.0
*/
function splash_load_plugin_textdomain() {
function dropit_load_plugin_textdomain() {
load_plugin_textdomain(
'splash',
'dropit',
false,
plugin_basename( splash_dir_path() ) . '/languages/'
plugin_basename( dropit_dir_path() ) . '/languages/'
);
}
add_action( 'plugins_loaded', 'splash_load_plugin_textdomain' );
add_action( 'plugins_loaded', 'dropit_load_plugin_textdomain' );
26 changes: 13 additions & 13 deletions lib/sidebar-script.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
*
* @since 1.0.0
*/
function splash_sidebar_script_register() {
function dropit_sidebar_script_register() {
wp_register_script(
'splash-sidebar',
splash_url( 'scripts/sidebar/build/index.js' ),
array( 'wp-plugins', 'wp-element', 'wp-edit-post', 'wp-i18n', 'wp-api-request', 'wp-data', 'wp-components', 'wp-blocks', 'wp-editor', 'splash-i18n' ),
filemtime( splash_dir_path() . 'scripts/sidebar/build/index.js' ),
'dropit-sidebar',
dropit_url( 'scripts/sidebar/build/index.js' ),
array( 'wp-plugins', 'wp-element', 'wp-edit-post', 'wp-i18n', 'wp-api-request', 'wp-data', 'wp-components', 'wp-blocks', 'wp-editor', 'dropit-i18n' ),
filemtime( dropit_dir_path() . 'scripts/sidebar/build/index.js' ),
true
);
wp_register_style(
'splash-sidebar',
splash_url( 'scripts/sidebar/build/style.css' ),
'dropit-sidebar',
dropit_url( 'scripts/sidebar/build/style.css' ),
array(),
filemtime( splash_dir_path() . 'scripts/sidebar/build/style.css' )
filemtime( dropit_dir_path() . 'scripts/sidebar/build/style.css' )
);
}
add_action( 'init', 'splash_sidebar_script_register' );
add_action( 'init', 'dropit_sidebar_script_register' );

function splash_sidebar_script_enqueue() {
wp_enqueue_script( 'splash-sidebar' );
wp_enqueue_style( 'splash-sidebar' );
function dropit_sidebar_script_enqueue() {
wp_enqueue_script( 'dropit-sidebar' );
wp_enqueue_style( 'dropit-sidebar' );
}
add_action( 'enqueue_block_editor_assets', 'splash_sidebar_script_enqueue' );
add_action( 'enqueue_block_editor_assets', 'dropit_sidebar_script_enqueue' );
Loading

0 comments on commit 26a5aad

Please sign in to comment.