Skip to content

Commit

Permalink
Made compatible with newest version of Woocommerce, Re-build UI/UX, A…
Browse files Browse the repository at this point in the history
…dded more filters/actions to allow modifications
  • Loading branch information
emgk committed Nov 8, 2020
1 parent f5783fc commit d3fb3c4
Show file tree
Hide file tree
Showing 20 changed files with 856 additions and 1,409 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ Customers come and go on your online store when they found that the product they

Get the plugin from the [WordPress.org](https://wordpress.org/plugins/woo-in-stock-notifier/)

[Click Here](http://blog.govindkumar.me/introducing-woo-in-stock-notifier-plugin/) to know more about the plugin.

## Contribution
Please raise issue or sent Pull Request if you find any bugs in plugin.
30 changes: 9 additions & 21 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const webpack = require( 'webpack' );
const webpackStream = require( 'webpack-stream' );

const
sourceFiles = 'src/admin/',
sourceJsFiles = sourceFiles + '**/*.js',
sourceFiles = 'src/',
sourceJsFiles = sourceFiles + '**/**/*.js',
outputDir = 'build';

function watchFiles() {
Expand All @@ -28,13 +28,13 @@ function watchAllFiles() {
gulp.task( 'plugin-pot', function() {
return gulp.src( '**/*.php' )
.pipe( wpPot( {
domain: 'the-hub-client',
domain: 'in-stock-notifier',
} ) )
.pipe( gulp.dest( 'i18n/languages/the-hub-client.pot' ) );
.pipe( gulp.dest( 'i18n/languages/in-stock-notifier.pot' ) );
} );

gulp.task( 'plugin-zip-cleanup', function( done ) {
del.sync( [ 'build/the-hub-client' ] );
del.sync( [ 'zip/woo-in-stock-notifier' ] );
done();
} );

Expand All @@ -47,25 +47,13 @@ gulp.task( 'plugin-zip-copy', function() {
'!.gitattributes',
'!.gitignore',
'!.gitmodules',
'!composer.json',
'!composer.lock',
'!package.json',
'!package-lock.json',
'!webpack.config.js',
'!webpack.config.admin.js',
'!gulpfile.js',
'!.stylelintrc',
'!.eslintrc.js.js',
'!Gulpfile.js',
'!README.md',
'!.vscode/*',
'!.vscode',
'!tests/**',
'!tests',
'!build/**',
'!build',
'!bitbucket-pipelines.yml',
'!phpcs.ruleset.xml',
'!zip/**',
];

return gulp.src( glob )
Expand All @@ -79,17 +67,17 @@ gulp.task( 'plugin-zip', gulp.series( 'plugin-zip-cleanup', 'plugin-zip-copy', f
.pipe( gulp.dest( 'zip/' ) );
}, 'plugin-zip-cleanup' ) );

gulp.task( 'set-production-env', function( done ) {
gulp.task( 'production-env', function( done ) {
process.env.NODE_ENV = 'production';
done();
} );

gulp.task( 'watch', series( watchFiles, gulp.parallel( watchAllFiles ) ) );
gulp.task( 'build', gulp.series( [ 'set-production-env' ], gulp.parallel( watchFiles ) ) );
gulp.task( 'build', gulp.series( [ 'production-env' ], gulp.parallel( watchFiles ) ) );
gulp.task( 'default', gulp.series( [ 'build' ] ) );

gulp.task( 'release', gulp.series(
[ 'set-production-env' ],
[ 'production-env' ],
[ 'build' ],
[ 'plugin-pot' ],
[ 'plugin-zip' ],
Expand Down
4 changes: 2 additions & 2 deletions inc/classes/class-wsn-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ public function trigger( $users, $product_id ) {
);

// build header
$header = $this->get_headers() . 'BCC: ' . implode( ',', $users ) . "\r\n";
$header = $this->get_headers() . "\r\n";

// send email
$response = $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $header, $this->get_attachments() );
$response = $this->send( implode( ',', $users ), $this->get_subject(), $this->get_content(), $header, $this->get_attachments() );

// Return true in wsn_email_send_response.
if ( $response ) {
Expand Down
110 changes: 55 additions & 55 deletions inc/classes/class-wsn-initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class WSN_Initialize {
public function __construct() {

// Add plugin setting menu in back end .
add_action( 'admin_menu', array( __CLASS__, 'instockalert_option_args' ) );
add_action( 'admin_menu', array( __CLASS__, 'in_stock_submenu' ) );

// Add the waitlist user clumn in manage product page.
add_filter( 'manage_edit-product_columns', array( $this, 'instockalert_add_column' ) );
Expand Down Expand Up @@ -309,10 +309,10 @@ public function wsn_enqueue_assets() {
wp_enqueue_script( 'jquery' );

// Add the plugin style file.
wp_enqueue_style( 'wsn_style', WSN_ASSEST_PATH . '/css/wsn-style.css' );
wp_enqueue_style( 'wsn_styles', WSN_ASSEST_PATH . 'css/front.min.css' );

// Add plugin js script.
wp_enqueue_script( 'wsn_scripts', WSN_ASSEST_PATH . '/js/wsn-script.js' );
wp_enqueue_script( 'wsn_scripts', WSN_ASSEST_PATH . 'js/front.min.js' );
}

/**
Expand All @@ -337,18 +337,18 @@ public function wsn_register_settings() {
/**
* Add the waitlist setting sub menu inside the woo commerce
*/
public static function instockalert_option_args() {
public static function in_stock_submenu() {

// Add sub menu in woo commerce menu.
add_submenu_page(
'woocommerce',
'In-Stock Notifier',
'In-Stock Notifier',
__( 'In-Stock Notifier', 'in-stock-notifier' ),
__( 'In-Stock Notifier', 'in-stock-notifier' ),
'manage_options',
'in-stock-notifier-option',
array( __CLASS__, 'wsn_waitlist_option_page' ),
'dashicons-list-view',
59 );
59
);
}

/**
Expand All @@ -358,62 +358,62 @@ public static function instockalert_option_args() {
*/
public static function wsn_waitlist_option_page() {
?>
<div class="wrap">
<div class="wrap">

<h2><?php echo esc_attr__( 'In-Stock Notifier', 'in-stock-notifier' ); ?></h2>
<hr/>
<form method="post" action="options.php">
<h2><?php echo esc_attr__( 'In-Stock Notifier', 'in-stock-notifier' ); ?></h2>
<hr/>
<form method="post" action="options.php">

<?php settings_fields( 'wsn_setting_fields' ); ?>

<?php do_settings_sections( 'wsn_setting' ); ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php echo esc_attr__( 'Enable Waitlist', 'in-stock-notifier' ); ?></th>
<td><input type="checkbox" name="is_enabled"
value="1" <?php checked( 1, get_option( 'is_enabled', true ), true ); ?> /></td>
</tr>

<tr valign="top">
<th scope="row"><?php echo esc_attr__( 'Join Button label', 'in-stock-notifier' ); ?></th>
<td><input type="text" name="join_btn_label"
value="<?php echo get_option( 'join_btn_label' ) ? esc_attr( get_option( 'join_btn_label' ) ) : esc_attr__( 'Join Waitlist', 'in-stock-notifier' ); ?>"/>
</td>
</tr>

<tr valign="top">
<th scope="row"><?php echo esc_attr__( 'Leave Button label', 'in-stock-notifier' ); ?></th>
<td><input type="text" name="leave_btn_label"
value="<?php echo get_option( 'leave_btn_label' ) ? esc_attr( get_option( 'leave_btn_label' ) ) : esc_attr__( 'Leave Waitlist', 'in-stock-notifier' ); ?>"/>
</td>
</tr>

<tr valign="top">
<th scope="row"><?php echo esc_attr__( 'Additional Options', 'in-stock-notifier' ); ?></th>
<td><input type="checkbox" name="remove_after_email"
value="1" <?php checked( 1, get_option( 'remove_after_email' ), true ); ?> /> <?php echo esc_attr__( 'Remove user after email sent.', 'in-stock-notifier' ); ?>
</td>
</tr>

<tr valign="top">
<th scope="row"></th>
<td><input type="checkbox" name="unregistered_can_join"
value="1" <?php checked( 1, get_option( 'unregistered_can_join', true ), true ); ?> />
<table class="form-table">
<tr valign="top">
<th scope="row"><?php echo esc_attr__( 'Enable Waitlist', 'in-stock-notifier' ); ?></th>
<td><input type="checkbox" name="is_enabled"
value="1" <?php checked( 1, get_option( 'is_enabled', true ), true ); ?> /></td>
</tr>

<tr valign="top">
<th scope="row"><?php echo esc_attr__( 'Join Button label', 'in-stock-notifier' ); ?></th>
<td><input type="text" name="join_btn_label"
value="<?php echo get_option( 'join_btn_label' ) ? esc_attr( get_option( 'join_btn_label' ) ) : esc_attr__( 'Join Waitlist', 'in-stock-notifier' ); ?>"/>
</td>
</tr>

<tr valign="top">
<th scope="row"><?php echo esc_attr__( 'Leave Button label', 'in-stock-notifier' ); ?></th>
<td><input type="text" name="leave_btn_label"
value="<?php echo get_option( 'leave_btn_label' ) ? esc_attr( get_option( 'leave_btn_label' ) ) : esc_attr__( 'Leave Waitlist', 'in-stock-notifier' ); ?>"/>
</td>
</tr>

<tr valign="top">
<th scope="row"><?php echo esc_attr__( 'Additional Options', 'in-stock-notifier' ); ?></th>
<td><input type="checkbox" name="remove_after_email"
value="1" <?php checked( 1, get_option( 'remove_after_email' ), true ); ?> /> <?php echo esc_attr__( 'Remove user after email sent.', 'in-stock-notifier' ); ?>
</td>
</tr>

<tr valign="top">
<th scope="row"></th>
<td><input type="checkbox" name="unregistered_can_join"
value="1" <?php checked( 1, get_option( 'unregistered_can_join', true ), true ); ?> />
<?php echo esc_attr__( 'Allow guest to join.', 'in-stock-notifier' ); ?>
</td>
</tr>
</td>
</tr>

<tr valign="top">
<th scope="row"></th>
<td><input title="Archived user " type="checkbox" name="archive"
value="1" <?php checked( 1, get_option( 'archive', true ), true ); ?> /> <?php echo esc_attr__( 'Archive user after email sent.', 'in-stock-notifier' ); ?>
</td>
</tr>
<tr valign="top">
<th scope="row"></th>
<td><input title="Archived user " type="checkbox" name="archive"
value="1" <?php checked( 1, get_option( 'archive', true ), true ); ?> /> <?php echo esc_attr__( 'Archive user after email sent.', 'in-stock-notifier' ); ?>
</td>
</tr>

</table>
</table>
<?php submit_button(); ?>
</form>
</div>
</form>
</div>
<?php
}
}
Expand Down
Loading

0 comments on commit d3fb3c4

Please sign in to comment.