Skip to content

Commit

Permalink
fix: format error
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhooks committed Mar 31, 2023
1 parent 1ccd9d5 commit 7c6ae18
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 33 deletions.
33 changes: 16 additions & 17 deletions includes/class-activator.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<?php

namespace WP\Notifications;

/**
* Fired during plugin activation.
* WP_Notification plugin activation.
*
* This class defines all code necessary to run during the plugin's activation.
* Defines the plugin's activation procedure.
*
* @since 0.1.0
* @package WP_Notifications
* @subpackage WP_Notifications/includes
* @author WordPress Contributors
*/

namespace WP\Notifications;

/**
* It's a class that activates the plugin.
*/
class Activator {

/**
* The default options array.
*
* @var array $default_options
*/
private static $default_options = array();

/**
* It sets the default options for the plugin.
* Initialize the default options.
*/
public static function init_vars() {

Expand Down Expand Up @@ -86,7 +85,7 @@ public static function install_v1() {
log( 'notifications_channels table creation succeeded', 1 );
}

/* Create the subscriptions table */
/* Create the subscriptions table */
if ( ! in_array( $wpdb->prefix . 'notifications_subscriptions', $tables, true ) ) {
$subscriptions_sql = 'CREATE TABLE `' . $wpdb->prefix . "notifications_subscriptions` (
`user_id` BIGINT(20) NOT NULL,
Expand All @@ -101,7 +100,7 @@ public static function install_v1() {
log( 'notifications_subscriptions table creation succeeded', 1 );
}

/* Create the queue table */
/* Create the queue table */
if ( ! in_array( $wpdb->prefix . 'notifications_queue', $tables, true ) ) {
$queue_sql = 'CREATE TABLE `' . $wpdb->prefix . "notifications_queue` (
`message_id` BIGINT(20) NOT NULL,
Expand All @@ -119,7 +118,7 @@ public static function install_v1() {
}

/**
* Create or Update the WP_Notifications options
* Create or Update the WP_Notifications options.
*
* @param bool $reset_options - whatever to force the reset.
*/
Expand All @@ -131,19 +130,19 @@ public static function update_options( $reset_options = false ) {

if ( false !== $options && ! $reset_options ) {

/* update the plugin options but add the new options automatically */
/* Update the plugin options but add the new options automatically */
if ( isset( $options['wp_notifications_version'] ) ) {
unset( $options['wp_notifications_version'] );
}

/* merge previous options with the updated copy keeping the already selected option as default */
/* Merge previous options with the updated copy keeping the already selected option as default */
$new_options = array_merge( self::$default_options, $options );

log( 'WP Notifications plugin options updated', 1 );

update_option( 'wp_notifications_options', $new_options );
} else {
/* if the plugin options are missing Init the plugin with the default option + the default settings */
/* If the plugin options are missing Init the plugin with the default option + the default settings */
$new_options = array_merge( self::$default_options );

add_option( 'wp_notifications_options', $new_options );
Expand All @@ -155,7 +154,7 @@ public static function update_options( $reset_options = false ) {
}

/**
* Activate WP Notifications Plugin
* Activate the WP_Notifications plugin.
*/
public static function activate() {

Expand All @@ -168,7 +167,7 @@ public static function activate() {
update_option( 'wp_notifications_db_version', '1' );
}

/* If the options do not exist then create them*/
/* If the options do not exist then create them */
self::update_options();

set_transient( 'wp_notifications_activation', true );
Expand Down
24 changes: 11 additions & 13 deletions includes/class-uninstaller.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
<?php
/**
* Uninstall the plugin.
*
* @since 0.0.1
* @package WP_Notifications
* @subpackage WP_Notifications/includes
* @author WordPress Contributors
*/


namespace WP\Notifications;

use WP\Notifications\Activator;

/**
* Fired during plugin uninstall.
* WP_Notification plugin uninstall.
*
* Defines the plugin's uninstall procedure.
*
* This class defines all code necessary to run during the plugin's deactivation.
* @since 0.0.1
* @package WP_Notifications
* @subpackage WP_Notifications/includes
* @author WordPress Contributors
*/
class Uninstaller {
/**
* It uninstalls the plugin, then reinstall it
* Uninstall the plugin and reinstall.
*/
public static function full_reset() {
self::uninstall( true );
self::uninstall();

require_once WP_NOTIFICATION_CENTER_PLUGIN_DIR . '/includes/class-activator.php';

Expand All @@ -32,7 +30,7 @@ public static function full_reset() {
}

/**
* It deletes the plugin's database tables and options
* Delete the plugin's database tables and options
*/
public static function uninstall() {
global $wpdb;
Expand Down
3 changes: 1 addition & 2 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
namespace WP\Notifications;

/**
* If the string is not empty, and the log level is 0 or 1 and debug is on, or the log level is 2 and extended debug is
* on, then log the string
* If the string is not empty, and the log level is 0 or 1 and debug is on, then log the string
*
* @param string|array $log_data - The string/array to log.
* @param int $log_level 0 = log always, 1 = logging
Expand Down
2 changes: 1 addition & 1 deletion wp-feature-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ function wp_notifications_activate() {
Activator::activate();
}

register_activation_hook( __FILE__ , 'wp_notifications_activate' );
register_activation_hook( __FILE__, 'wp_notifications_activate' );

0 comments on commit 7c6ae18

Please sign in to comment.