Plugin Directory

Changeset 3345433


Ignore:
Timestamp:
08/16/2025 09:32:12 AM (7 months ago)
Author:
badhonrocks
Message:

Update to version 1.0.0 from GitHub

Location:
nightly
Files:
135 added
20 deleted
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • nightly/tags/1.0.0/nightly.php

    r2718493 r3345433  
    11<?php
     2
    23/**
    3  * Plugin Name: Nightly
    4  * Plugin URI: https://www.wppaw.com/wp-nightly
    5  * Description: Protect your visitor's eyes and enable dark mode on your website
    6  * Author: WPPAW
    7  * Author URI: https://www.wppaw.com
    8  * Version: 0.0.1-beta.3
    9  * License: GPL2+
    10  * License URI: https://www.gnu.org/licenses/gpl-2.0.txt
    11  * Text Domain: wp-nightly
     4 * Plugin Name: Nightly — Dark Mode Toggle
     5 * Plugin URI: https://plugpress.io/
     6 * Description: A lightweight WordPress plugin that provides a minimal dark mode toggle functionality for websites. Includes a custom Gutenberg block and React-based admin interface.
     7 * Version: 1.0.0
     8 * Author: PlugPress
     9 * Author URI: https://plugpress.io/
     10 * License: GPL v2 or later
     11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     12 * Text Domain: nightly
     13 * Domain Path: /languages
     14 * Requires at least: 5.0
     15 * Tested up to: 6.4
     16 * Requires PHP: 7.4
     17 * Network: false
    1218 *
     19 * Nightly is a modern dark mode toggle plugin that follows WordPress best practices.
     20 * It provides both a Gutenberg block for content editors and an automatic floating
     21 * toggle for classic themes. The plugin uses CSS custom properties for smooth theme
     22 * transitions and respects user system preferences.
    1323 *
    14  * WP Nightly is free software: you can redistribute it and/or modify
    15  * it under the terms of the GNU General Public License as published by
    16  * the Free Software Foundation, either version 2 of the License, or
    17  * any later version.
     24 * Key Features:
     25 * - Gutenberg block for flexible placement
     26 * - Automatic floating toggle for classic themes
     27 * - System preference detection
     28 * - Smooth CSS transitions
     29 * - Full accessibility support
     30 * - Performance optimized
     31 * - Clean, maintainable code
    1832 *
    19  *
    20  * WP Nightly is distributed in the hope that it will be useful,
    21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    23  * GNU General Public License for more details.
     33 * @package Nightly
     34 * @since 1.0.0
    2435 */
    2536
    26 // Exit if accessed directly.
    27 if ( !defined( 'ABSPATH' ) ) {
     37// Prevent direct access
     38if (!defined('ABSPATH')) {
    2839    exit;
    2940}
    3041
    31 if ( !defined( 'WP_NIGHTLY_VERSION' ) ) {
    32     define( 'WP_NIGHTLY_VERSION', '0.0.1-beta.3' );
    33 }
     42// Define plugin constants
     43define('NIGHTLY_VERSION', '1.0.0');
     44define('NIGHTLY_PLUGIN_FILE', __FILE__);
     45define('NIGHTLY_PLUGIN_DIR', plugin_dir_path(__FILE__));
     46define('NIGHTLY_PLUGIN_URL', plugin_dir_url(__FILE__));
     47define('NIGHTLY_PLUGIN_BASENAME', plugin_basename(__FILE__));
    3448
    35 if ( !defined( 'WP_NIGHTLY_PLUGIN_DIR' ) ) {
    36     define( 'WP_NIGHTLY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    37 }
    38 
    39 if ( !defined( 'WP_NIGHTLY_PLUGIN_URL' ) ) {
    40     define( 'WP_NIGHTLY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    41 }
    42 
    43 if ( !defined( 'WP_NIGHTLY_PLUGIN_FILE' ) ) {
    44     define( 'WP_NIGHTLY_PLUGIN_FILE', __FILE__ );
    45 }
    46 
    47 if ( !defined( 'WP_NIGHTLY_PLUGIN_ASSETS' ) ) {
    48     define( 'WP_NIGHTLY_PLUGIN_ASSETS', WP_NIGHTLY_PLUGIN_URL . 'assets' );
    49 }
    50 
    51 if ( !defined( 'WP_NIGHTLY_PLUGIN_DIST' ) ) {
    52     define( 'WP_NIGHTLY_PLUGIN_DIST', WP_NIGHTLY_PLUGIN_URL . 'dist' );
    53 }
    54 
    55 /**
    56  * WPNightly class.
    57  */
    58 if ( !class_exists( 'WPNightly' ) ):
    59     final class WPNightly {
    60 
    61         /**
    62          * @var Instance.
    63          */
    64         private static $instance;
    65 
    66         /**
    67          * The instance method for the static class.
    68          */
    69         public static function instance() {
    70             if ( !isset( self::$instance ) && !( self::$instance instanceof WPNightly ) ) {
    71                 self::$instance = new WPNightly;
    72                 self::$instance->includes();
    73             }
    74 
    75             return self::$instance;
    76         }
    77 
    78         /**
    79          * All files
    80          */
    81         private function includes() {
    82 
    83             require_once WP_NIGHTLY_PLUGIN_DIR . 'inc/settings.php';
    84             require_once WP_NIGHTLY_PLUGIN_DIR . 'inc/functions.php';
    85 
    86             if ( is_admin() ) {
    87                 require_once WP_NIGHTLY_PLUGIN_DIR . 'inc/dashboard.php';
    88             }
    89 
    90             require_once WP_NIGHTLY_PLUGIN_DIR . 'inc/frontend.php';
    91         }
    92 
    93         /**
    94          * Load text domain
    95          *
    96          * @return void
    97          */
    98         public function load_textdomain() {
    99 
    100             load_plugin_textdomain( 'wp-nightly', false, WP_NIGHTLY_PLUGIN_URL . '/languages/' );
    101         }
    102 
     49// Autoloader for plugin classes
     50spl_autoload_register(function ($class) {
     51    // Check if the class belongs to our plugin namespace
     52    if (strpos($class, 'Nightly\\') !== 0) {
     53        return;
    10354    }
    10455
    105 endif;
     56    // Remove namespace prefix and convert to file path
     57    $class_name = str_replace('Nightly\\', '', $class);
     58    $class_file = strtolower(str_replace('_', '-', $class_name));
     59    $file_path = NIGHTLY_PLUGIN_DIR . 'includes/class-' . $class_file . '.php';
    10660
    107 /**
    108  * Initialize the plugin.
    109  */
    110 if ( !function_exists( 'wpnightly' ) ) {
    111     function wpnightly() {
    112         return WPNightly::instance();
     61    if (file_exists($file_path)) {
     62        require_once $file_path;
     63    }
     64});
     65
     66// Initialize the plugin
     67function nightly_init()
     68{
     69    // Load text domain for translations
     70    load_plugin_textdomain('nightly', false, dirname(NIGHTLY_PLUGIN_BASENAME) . '/languages');
     71
     72    // Initialize main plugin class
     73    if (class_exists('Nightly\\Nightly')) {
     74        $nightly = new Nightly\Nightly();
     75        $nightly->init();
    11376    }
    11477}
    11578
    116 /**
    117  * The start of the app.
    118  *
    119  * @since   1.0.0
    120  */
    121 wpnightly();
     79// Hook into WordPress
     80add_action('plugins_loaded', 'nightly_init');
     81
     82// Activation hook
     83register_activation_hook(__FILE__, 'nightly_activate');
     84function nightly_activate()
     85{
     86    // Check WordPress version compatibility
     87    if (version_compare(get_bloginfo('version'), '5.0', '<')) {
     88        deactivate_plugins(plugin_basename(__FILE__));
     89        wp_die(__('Nightly requires WordPress 5.0 or higher.', 'nightly'));
     90    }
     91
     92    // Check PHP version compatibility
     93    if (version_compare(PHP_VERSION, '7.4', '<')) {
     94        deactivate_plugins(plugin_basename(__FILE__));
     95        wp_die(__('Nightly requires PHP 7.4 or higher.', 'nightly'));
     96    }
     97
     98    // Set default options only if they don't exist
     99    $default_settings = array(
     100        'auto_inject' => false,
     101        'floating_position' => 'bottom-right',
     102        'respect_system_preference' => true,
     103
     104        'intensity' => 0.8,
     105        'contrast' => 1.0,
     106        'brightness' => 0.9,
     107        'sepia' => 0.1,
     108
     109        // Floating button design settings
     110        'floating_button_style' => 'rounded',
     111        'floating_button_size' => 'medium',
     112        'floating_bg_color' => '#333333',
     113        'floating_bg_color_hover' => '#555555',
     114        'floating_bg_color_active' => '#79c0ff',
     115        'floating_icon_color' => '#ffffff',
     116        'floating_icon_color_hover' => '#ffffff',
     117        'floating_border_color' => 'transparent',
     118        'floating_border_width' => 0,
     119        'floating_border_radius' => 50,
     120        'floating_icon_size' => 24,
     121        'floating_icon_type' => 'sun-moon',
     122        'floating_custom_icon' => '🌙',
     123        'floating_padding_top' => 12,
     124        'floating_padding_bottom' => 12,
     125        'floating_padding_left' => 16,
     126        'floating_padding_right' => 16,
     127        'floating_box_shadow' => '0 2px 4px rgba(0,0,0,0.1)',
     128        'floating_box_shadow_hover' => '0 4px 8px rgba(0,0,0,0.15)',
     129        'floating_width' => '3.5rem',
     130        'floating_height' => '3.5rem',
     131    );
     132
     133    add_option('nightly_settings', $default_settings);
     134
     135    // Set activation timestamp for analytics
     136    add_option('nightly_activated_at', current_time('mysql'));
     137
     138    // Set plugin version for future migrations
     139    add_option('nightly_version', NIGHTLY_VERSION);
     140
     141    // Clear any cached data
     142    if (function_exists('wp_cache_flush')) {
     143        wp_cache_flush();
     144    }
     145
     146    // Flush rewrite rules
     147    flush_rewrite_rules();
     148}
     149
     150// Deactivation hook
     151register_deactivation_hook(__FILE__, 'nightly_deactivate');
     152function nightly_deactivate()
     153{
     154    // Clear any cached data
     155    if (function_exists('wp_cache_flush')) {
     156        wp_cache_flush();
     157    }
     158
     159    // Flush rewrite rules
     160    flush_rewrite_rules();
     161
     162    // Note: We don't delete settings on deactivation
     163    // Users might want to reactivate and keep their settings
     164}
  • nightly/tags/1.0.0/readme.txt

    r2718493 r3345433  
    1 === WP Nightly - Dark Mode for WordPress ===
    2 Contributors: badhonrocks
    3 Tags: dark mode, night mode, blocks, gutenberg blocks
    4 Requires at least: 4.7
    5 Requires PHP: 5.6
    6 Tested up to: 5.9
    7 Stable tag: 0.0.1-beta.3
     1=== Nightly — Dark Mode Toggle ===
     2Contributors: badhonrocks, plugpressco
     3Tags: dark mode, night mode, dark theme, light mode, toggle, accessibility, gutenberg, block, FSE, classic themes
     4Requires at least: 5.0
     5Requires PHP: 7.4
     6Tested up to: 6.4
     7Stable tag: 1.0.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Protect your visitor's eyes and enable dark mode on your website
     11Add a professional dark mode toggle to your WordPress site. Works with any theme - FSE or classic. Lightweight, accessible, and user-friendly.
    1212
    1313== Description ==
    14 <strong>WP Nightly</strong>
    15 
    16 WP Nightly is a plugin that turns the website dark at night. It also gives your website a new look and feel that may be appealing to many users.
    17 
    18 WP Nightly works across all browsers perfectly, so no worry which browser your customers are using.
    19 
    20 Features:
    21 - Toggle Switch
    22 - OS Aware
    23 - 3 Button Styles
    24 - 3 Color Palettes
     14
     15**Transform your WordPress site with a sleek dark mode toggle that your visitors will love.**
     16
     17Nightly is a lightweight, professional dark mode plugin that seamlessly integrates with any WordPress theme. Whether you're using modern FSE (Full Site Editing) themes or classic themes, Nightly provides the perfect dark mode solution for your website.
     18
     19= 🌙 Why Choose Nightly? =
     20
     21* **Universal Compatibility** - Works with FSE themes, classic themes, and everything in between
     22* **Smart Theme Detection** - Automatically adapts interface based on your theme type
     23* **Multiple Implementation Options** - Gutenberg block, floating toggle, or manual integration
     24* **Accessibility First** - WCAG 2.1 AA compliant with full keyboard navigation and screen reader support
     25* **Performance Optimized** - Lightweight code that won't slow down your site
     26* **User Preference Respect** - Automatically detects and honors system dark mode preferences
     27* **Smooth Transitions** - Customizable animation speeds for seamless theme switching
     28
     29= 🚀 Perfect for Any Website =
     30
     31* **Business Websites** - Professional appearance with improved user experience
     32* **Blogs & News Sites** - Reduce eye strain for readers, especially during evening hours
     33* **E-commerce Stores** - Modern shopping experience that customers expect
     34* **Portfolio Sites** - Showcase your work with elegant dark mode aesthetics
     35* **Documentation Sites** - Essential for developer-focused content
     36* **Any WordPress Site** - Universal solution that works everywhere
     37
     38= ⚡ Key Features =
     39
     40**For FSE (Block) Themes:**
     41* Dedicated admin dashboard for global floating toggle configuration
     42* Gutenberg block for page-specific toggle placement
     43* Clean, streamlined interface focused on what you need
     44
     45**For Classic Themes:**
     46* Full-featured admin dashboard with all configuration options
     47* Auto-injection of floating toggle for site-wide coverage
     48* Gutenberg block also available for flexible placement
     49
     50**Universal Features:**
     51* System preference detection (respects prefers-color-scheme)
     52* Customizable transition animations (0-1000ms)
     53* Multiple floating toggle positions (all four corners)
     54* localStorage persistence for user preferences
     55* Synchronized toggles (multiple toggles stay in sync)
     56* Mobile-responsive design
     57* RTL language support
     58
     59= 🎨 Easy to Use =
     60
     61**Getting Started is Simple:**
     62
     631. **Install & Activate** - One-click installation from WordPress.org
     642. **Choose Your Method** - Use the Gutenberg block or enable the floating toggle
     653. **Customize Settings** - Configure position, animation speed, and preferences
     664. **Done!** - Your visitors can now enjoy dark mode
     67
     68**No coding required. No theme modifications needed. Just install and go.**
     69
     70= 🛠️ Developer Friendly =
     71
     72* Clean, well-documented code following WordPress standards
     73* CSS custom properties for easy theme integration
     74* JavaScript events for advanced customization
     75* Hooks and filters for extensibility
     76* Modern build process with optimized assets
     77
     78= 🌐 Accessibility & Performance =
     79
     80* **WCAG 2.1 AA Compliant** - Full accessibility support
     81* **Keyboard Navigation** - Tab, Enter, and Space key support
     82* **Screen Reader Compatible** - Proper ARIA attributes and announcements
     83* **High Contrast Support** - Works with Windows high contrast mode
     84* **Lightweight** - Minimal impact on page load times
     85* **Conditional Loading** - Assets only load when needed
     86
     87= 🎯 Use Cases =
     88
     89* Add dark mode to any WordPress theme without coding
     90* Improve user experience for evening and night browsing
     91* Reduce eye strain for visitors reading long-form content
     92* Create a modern, professional appearance
     93* Meet accessibility requirements for your website
     94* Provide user choice and customization options
    2595
    2696== Installation ==
    2797
    28 Install the WP Nightly either via the WordPress plugin directory or by uploading the files to your server at wp-content/plugins.
     98= Automatic Installation =
     99
     1001. Log in to your WordPress admin dashboard
     1012. Navigate to Plugins → Add New
     1023. Search for "Nightly Dark Mode Toggle"
     1034. Click "Install Now" and then "Activate"
     1045. Go to Appearance → Nightly to configure settings
     105
     106= Manual Installation =
     107
     1081. Download the plugin zip file
     1092. Upload to your `/wp-content/plugins/` directory
     1103. Extract the files
     1114. Activate the plugin through the WordPress admin
     1125. Configure settings under Appearance → Nightly
     113
     114= Quick Setup =
     115
     116**For FSE Themes:**
     1171. Go to Appearance → Nightly
     1182. Enable "Enable floating toggle"
     1193. Choose your preferred corner position
     1204. Save settings - done!
     121
     122**For Classic Themes:**
     1231. Go to Appearance → Nightly
     1242. Enable "Auto-inject floating toggle"
     1253. Customize position and animation settings
     1264. Save settings - your site now has dark mode!
     127
     128**Using Gutenberg Blocks:**
     1291. Edit any page or post
     1302. Add a new block and search for "Nightly"
     1313. Insert the block where you want the toggle
     1324. Customize the button text and appearance
     1335. Publish - visitors can now toggle dark mode on that page
    29134
    30135== Frequently Asked Questions ==
    31136
    32 = Can I use the WP Nightly on client websites? =
    33 
    34 Yes! You can certainly use the WP Nightly  on yours as well as your client’s websites.
     137= Does this work with my theme? =
     138
     139Yes! Nightly is designed to work with any WordPress theme - FSE, classic, custom, or premium themes. It uses CSS custom properties that adapt to your existing design.
     140
     141= Will this slow down my website? =
     142
     143No. Nightly is performance-optimized and only loads assets when needed. The total footprint is minimal and won't impact your site speed.
     144
     145= Can I customize the appearance? =
     146
     147Absolutely! You can customize colors, position, animation speed, and behavior. Advanced users can use CSS custom properties for deeper customization.
     148
     149= Is it accessible for users with disabilities? =
     150
     151Yes. Nightly is WCAG 2.1 AA compliant with full keyboard navigation, screen reader support, and high contrast compatibility.
     152
     153= Can I use both the block and floating toggle? =
     154
     155Yes! You can use the Gutenberg block on specific pages and the floating toggle for site-wide coverage. They work together seamlessly.
     156
     157= Does it remember user preferences? =
     158
     159Yes. User preferences are saved in localStorage and persist across sessions. The plugin also respects system dark mode preferences.
     160
     161= Can I disable it on certain pages? =
     162
     163Yes. The floating toggle can be disabled globally, and blocks can be added or removed from specific pages as needed.
     164
     165= Is it translation ready? =
     166
     167Yes. Nightly is fully internationalized and ready for translation into any language.
     168
     169= Does it work with caching plugins? =
     170
     171Yes. Nightly is compatible with all major caching plugins and CDNs.
     172
     173= Can I customize the toggle button design? =
     174
     175Yes. The plugin provides CSS custom properties for easy styling, and developers can override styles as needed.
    35176
    36177== Screenshots ==
    37178
     1791. **Admin Dashboard** - Clean, intuitive settings interface for both FSE and classic themes
     1802. **Floating Toggle** - Professional floating toggle in action on a live website
     1813. **Gutenberg Block** - Easy-to-use block editor integration with customization options
     1824. **Dark Mode Active** - Beautiful dark mode transformation of a typical WordPress site
     1835. **Mobile Responsive** - Perfect appearance and functionality on all device sizes
     1846. **Accessibility Features** - Keyboard navigation and screen reader compatibility in action
     185
    38186== Changelog ==
    39187
    40 = 0.0.1 =
     188= 1.0.0 =
    41189* Initial release
     190* Gutenberg block for flexible toggle placement
     191* Floating toggle with 4 position options
     192* FSE and classic theme support
     193* Admin dashboard with theme-specific interfaces
     194* System preference detection
     195* Accessibility compliance (WCAG 2.1 AA)
     196* Performance optimizations
     197* RTL language support
     198* Mobile responsive design
     199* localStorage preference persistence
     200* Smooth transition animations
     201* Multiple toggle synchronization
     202
     203== Upgrade Notice ==
     204
     205= 1.0.0 =
     206Initial release of Nightly - the professional dark mode solution for WordPress. Install now to give your visitors the modern dark mode experience they expect.
     207
     208== Support ==
     209
     210Need help? We're here for you!
     211
     212* **Documentation**: Comprehensive guides and examples
     213* **Support Forum**: Community support and troubleshooting
     214* **Developer Resources**: Hooks, filters, and customization guides
     215
     216Visit [plugpress.io](https://plugpress.io/) for additional resources and premium support options.
     217
     218== Privacy ==
     219
     220Nightly respects user privacy:
     221
     222* No data is sent to external servers
     223* User preferences are stored locally in the browser
     224* No tracking or analytics
     225* GDPR compliant
     226* No cookies used
     227
     228Your users' privacy is protected while they enjoy the dark mode experience.
  • nightly/trunk/nightly.php

    r2718493 r3345433  
    11<?php
     2
    23/**
    3  * Plugin Name: Nightly
    4  * Plugin URI: https://www.wppaw.com/wp-nightly
    5  * Description: Protect your visitor's eyes and enable dark mode on your website
    6  * Author: WPPAW
    7  * Author URI: https://www.wppaw.com
    8  * Version: 0.0.1-beta.3
    9  * License: GPL2+
    10  * License URI: https://www.gnu.org/licenses/gpl-2.0.txt
    11  * Text Domain: wp-nightly
     4 * Plugin Name: Nightly — Dark Mode Toggle
     5 * Plugin URI: https://plugpress.io/
     6 * Description: A lightweight WordPress plugin that provides a minimal dark mode toggle functionality for websites. Includes a custom Gutenberg block and React-based admin interface.
     7 * Version: 1.0.0
     8 * Author: PlugPress
     9 * Author URI: https://plugpress.io/
     10 * License: GPL v2 or later
     11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     12 * Text Domain: nightly
     13 * Domain Path: /languages
     14 * Requires at least: 5.0
     15 * Tested up to: 6.4
     16 * Requires PHP: 7.4
     17 * Network: false
    1218 *
     19 * Nightly is a modern dark mode toggle plugin that follows WordPress best practices.
     20 * It provides both a Gutenberg block for content editors and an automatic floating
     21 * toggle for classic themes. The plugin uses CSS custom properties for smooth theme
     22 * transitions and respects user system preferences.
    1323 *
    14  * WP Nightly is free software: you can redistribute it and/or modify
    15  * it under the terms of the GNU General Public License as published by
    16  * the Free Software Foundation, either version 2 of the License, or
    17  * any later version.
     24 * Key Features:
     25 * - Gutenberg block for flexible placement
     26 * - Automatic floating toggle for classic themes
     27 * - System preference detection
     28 * - Smooth CSS transitions
     29 * - Full accessibility support
     30 * - Performance optimized
     31 * - Clean, maintainable code
    1832 *
    19  *
    20  * WP Nightly is distributed in the hope that it will be useful,
    21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    23  * GNU General Public License for more details.
     33 * @package Nightly
     34 * @since 1.0.0
    2435 */
    2536
    26 // Exit if accessed directly.
    27 if ( !defined( 'ABSPATH' ) ) {
     37// Prevent direct access
     38if (!defined('ABSPATH')) {
    2839    exit;
    2940}
    3041
    31 if ( !defined( 'WP_NIGHTLY_VERSION' ) ) {
    32     define( 'WP_NIGHTLY_VERSION', '0.0.1-beta.3' );
    33 }
     42// Define plugin constants
     43define('NIGHTLY_VERSION', '1.0.0');
     44define('NIGHTLY_PLUGIN_FILE', __FILE__);
     45define('NIGHTLY_PLUGIN_DIR', plugin_dir_path(__FILE__));
     46define('NIGHTLY_PLUGIN_URL', plugin_dir_url(__FILE__));
     47define('NIGHTLY_PLUGIN_BASENAME', plugin_basename(__FILE__));
    3448
    35 if ( !defined( 'WP_NIGHTLY_PLUGIN_DIR' ) ) {
    36     define( 'WP_NIGHTLY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    37 }
    38 
    39 if ( !defined( 'WP_NIGHTLY_PLUGIN_URL' ) ) {
    40     define( 'WP_NIGHTLY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    41 }
    42 
    43 if ( !defined( 'WP_NIGHTLY_PLUGIN_FILE' ) ) {
    44     define( 'WP_NIGHTLY_PLUGIN_FILE', __FILE__ );
    45 }
    46 
    47 if ( !defined( 'WP_NIGHTLY_PLUGIN_ASSETS' ) ) {
    48     define( 'WP_NIGHTLY_PLUGIN_ASSETS', WP_NIGHTLY_PLUGIN_URL . 'assets' );
    49 }
    50 
    51 if ( !defined( 'WP_NIGHTLY_PLUGIN_DIST' ) ) {
    52     define( 'WP_NIGHTLY_PLUGIN_DIST', WP_NIGHTLY_PLUGIN_URL . 'dist' );
    53 }
    54 
    55 /**
    56  * WPNightly class.
    57  */
    58 if ( !class_exists( 'WPNightly' ) ):
    59     final class WPNightly {
    60 
    61         /**
    62          * @var Instance.
    63          */
    64         private static $instance;
    65 
    66         /**
    67          * The instance method for the static class.
    68          */
    69         public static function instance() {
    70             if ( !isset( self::$instance ) && !( self::$instance instanceof WPNightly ) ) {
    71                 self::$instance = new WPNightly;
    72                 self::$instance->includes();
    73             }
    74 
    75             return self::$instance;
    76         }
    77 
    78         /**
    79          * All files
    80          */
    81         private function includes() {
    82 
    83             require_once WP_NIGHTLY_PLUGIN_DIR . 'inc/settings.php';
    84             require_once WP_NIGHTLY_PLUGIN_DIR . 'inc/functions.php';
    85 
    86             if ( is_admin() ) {
    87                 require_once WP_NIGHTLY_PLUGIN_DIR . 'inc/dashboard.php';
    88             }
    89 
    90             require_once WP_NIGHTLY_PLUGIN_DIR . 'inc/frontend.php';
    91         }
    92 
    93         /**
    94          * Load text domain
    95          *
    96          * @return void
    97          */
    98         public function load_textdomain() {
    99 
    100             load_plugin_textdomain( 'wp-nightly', false, WP_NIGHTLY_PLUGIN_URL . '/languages/' );
    101         }
    102 
     49// Autoloader for plugin classes
     50spl_autoload_register(function ($class) {
     51    // Check if the class belongs to our plugin namespace
     52    if (strpos($class, 'Nightly\\') !== 0) {
     53        return;
    10354    }
    10455
    105 endif;
     56    // Remove namespace prefix and convert to file path
     57    $class_name = str_replace('Nightly\\', '', $class);
     58    $class_file = strtolower(str_replace('_', '-', $class_name));
     59    $file_path = NIGHTLY_PLUGIN_DIR . 'includes/class-' . $class_file . '.php';
    10660
    107 /**
    108  * Initialize the plugin.
    109  */
    110 if ( !function_exists( 'wpnightly' ) ) {
    111     function wpnightly() {
    112         return WPNightly::instance();
     61    if (file_exists($file_path)) {
     62        require_once $file_path;
     63    }
     64});
     65
     66// Initialize the plugin
     67function nightly_init()
     68{
     69    // Load text domain for translations
     70    load_plugin_textdomain('nightly', false, dirname(NIGHTLY_PLUGIN_BASENAME) . '/languages');
     71
     72    // Initialize main plugin class
     73    if (class_exists('Nightly\\Nightly')) {
     74        $nightly = new Nightly\Nightly();
     75        $nightly->init();
    11376    }
    11477}
    11578
    116 /**
    117  * The start of the app.
    118  *
    119  * @since   1.0.0
    120  */
    121 wpnightly();
     79// Hook into WordPress
     80add_action('plugins_loaded', 'nightly_init');
     81
     82// Activation hook
     83register_activation_hook(__FILE__, 'nightly_activate');
     84function nightly_activate()
     85{
     86    // Check WordPress version compatibility
     87    if (version_compare(get_bloginfo('version'), '5.0', '<')) {
     88        deactivate_plugins(plugin_basename(__FILE__));
     89        wp_die(__('Nightly requires WordPress 5.0 or higher.', 'nightly'));
     90    }
     91
     92    // Check PHP version compatibility
     93    if (version_compare(PHP_VERSION, '7.4', '<')) {
     94        deactivate_plugins(plugin_basename(__FILE__));
     95        wp_die(__('Nightly requires PHP 7.4 or higher.', 'nightly'));
     96    }
     97
     98    // Set default options only if they don't exist
     99    $default_settings = array(
     100        'auto_inject' => false,
     101        'floating_position' => 'bottom-right',
     102        'respect_system_preference' => true,
     103
     104        'intensity' => 0.8,
     105        'contrast' => 1.0,
     106        'brightness' => 0.9,
     107        'sepia' => 0.1,
     108
     109        // Floating button design settings
     110        'floating_button_style' => 'rounded',
     111        'floating_button_size' => 'medium',
     112        'floating_bg_color' => '#333333',
     113        'floating_bg_color_hover' => '#555555',
     114        'floating_bg_color_active' => '#79c0ff',
     115        'floating_icon_color' => '#ffffff',
     116        'floating_icon_color_hover' => '#ffffff',
     117        'floating_border_color' => 'transparent',
     118        'floating_border_width' => 0,
     119        'floating_border_radius' => 50,
     120        'floating_icon_size' => 24,
     121        'floating_icon_type' => 'sun-moon',
     122        'floating_custom_icon' => '🌙',
     123        'floating_padding_top' => 12,
     124        'floating_padding_bottom' => 12,
     125        'floating_padding_left' => 16,
     126        'floating_padding_right' => 16,
     127        'floating_box_shadow' => '0 2px 4px rgba(0,0,0,0.1)',
     128        'floating_box_shadow_hover' => '0 4px 8px rgba(0,0,0,0.15)',
     129        'floating_width' => '3.5rem',
     130        'floating_height' => '3.5rem',
     131    );
     132
     133    add_option('nightly_settings', $default_settings);
     134
     135    // Set activation timestamp for analytics
     136    add_option('nightly_activated_at', current_time('mysql'));
     137
     138    // Set plugin version for future migrations
     139    add_option('nightly_version', NIGHTLY_VERSION);
     140
     141    // Clear any cached data
     142    if (function_exists('wp_cache_flush')) {
     143        wp_cache_flush();
     144    }
     145
     146    // Flush rewrite rules
     147    flush_rewrite_rules();
     148}
     149
     150// Deactivation hook
     151register_deactivation_hook(__FILE__, 'nightly_deactivate');
     152function nightly_deactivate()
     153{
     154    // Clear any cached data
     155    if (function_exists('wp_cache_flush')) {
     156        wp_cache_flush();
     157    }
     158
     159    // Flush rewrite rules
     160    flush_rewrite_rules();
     161
     162    // Note: We don't delete settings on deactivation
     163    // Users might want to reactivate and keep their settings
     164}
  • nightly/trunk/readme.txt

    r2718493 r3345433  
    1 === WP Nightly - Dark Mode for WordPress ===
    2 Contributors: badhonrocks
    3 Tags: dark mode, night mode, blocks, gutenberg blocks
    4 Requires at least: 4.7
    5 Requires PHP: 5.6
    6 Tested up to: 5.9
    7 Stable tag: 0.0.1-beta.3
     1=== Nightly — Dark Mode Toggle ===
     2Contributors: badhonrocks, plugpressco
     3Tags: dark mode, night mode, dark theme, light mode, toggle, accessibility, gutenberg, block, FSE, classic themes
     4Requires at least: 5.0
     5Requires PHP: 7.4
     6Tested up to: 6.4
     7Stable tag: 1.0.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Protect your visitor's eyes and enable dark mode on your website
     11Add a professional dark mode toggle to your WordPress site. Works with any theme - FSE or classic. Lightweight, accessible, and user-friendly.
    1212
    1313== Description ==
    14 <strong>WP Nightly</strong>
    15 
    16 WP Nightly is a plugin that turns the website dark at night. It also gives your website a new look and feel that may be appealing to many users.
    17 
    18 WP Nightly works across all browsers perfectly, so no worry which browser your customers are using.
    19 
    20 Features:
    21 - Toggle Switch
    22 - OS Aware
    23 - 3 Button Styles
    24 - 3 Color Palettes
     14
     15**Transform your WordPress site with a sleek dark mode toggle that your visitors will love.**
     16
     17Nightly is a lightweight, professional dark mode plugin that seamlessly integrates with any WordPress theme. Whether you're using modern FSE (Full Site Editing) themes or classic themes, Nightly provides the perfect dark mode solution for your website.
     18
     19= 🌙 Why Choose Nightly? =
     20
     21* **Universal Compatibility** - Works with FSE themes, classic themes, and everything in between
     22* **Smart Theme Detection** - Automatically adapts interface based on your theme type
     23* **Multiple Implementation Options** - Gutenberg block, floating toggle, or manual integration
     24* **Accessibility First** - WCAG 2.1 AA compliant with full keyboard navigation and screen reader support
     25* **Performance Optimized** - Lightweight code that won't slow down your site
     26* **User Preference Respect** - Automatically detects and honors system dark mode preferences
     27* **Smooth Transitions** - Customizable animation speeds for seamless theme switching
     28
     29= 🚀 Perfect for Any Website =
     30
     31* **Business Websites** - Professional appearance with improved user experience
     32* **Blogs & News Sites** - Reduce eye strain for readers, especially during evening hours
     33* **E-commerce Stores** - Modern shopping experience that customers expect
     34* **Portfolio Sites** - Showcase your work with elegant dark mode aesthetics
     35* **Documentation Sites** - Essential for developer-focused content
     36* **Any WordPress Site** - Universal solution that works everywhere
     37
     38= ⚡ Key Features =
     39
     40**For FSE (Block) Themes:**
     41* Dedicated admin dashboard for global floating toggle configuration
     42* Gutenberg block for page-specific toggle placement
     43* Clean, streamlined interface focused on what you need
     44
     45**For Classic Themes:**
     46* Full-featured admin dashboard with all configuration options
     47* Auto-injection of floating toggle for site-wide coverage
     48* Gutenberg block also available for flexible placement
     49
     50**Universal Features:**
     51* System preference detection (respects prefers-color-scheme)
     52* Customizable transition animations (0-1000ms)
     53* Multiple floating toggle positions (all four corners)
     54* localStorage persistence for user preferences
     55* Synchronized toggles (multiple toggles stay in sync)
     56* Mobile-responsive design
     57* RTL language support
     58
     59= 🎨 Easy to Use =
     60
     61**Getting Started is Simple:**
     62
     631. **Install & Activate** - One-click installation from WordPress.org
     642. **Choose Your Method** - Use the Gutenberg block or enable the floating toggle
     653. **Customize Settings** - Configure position, animation speed, and preferences
     664. **Done!** - Your visitors can now enjoy dark mode
     67
     68**No coding required. No theme modifications needed. Just install and go.**
     69
     70= 🛠️ Developer Friendly =
     71
     72* Clean, well-documented code following WordPress standards
     73* CSS custom properties for easy theme integration
     74* JavaScript events for advanced customization
     75* Hooks and filters for extensibility
     76* Modern build process with optimized assets
     77
     78= 🌐 Accessibility & Performance =
     79
     80* **WCAG 2.1 AA Compliant** - Full accessibility support
     81* **Keyboard Navigation** - Tab, Enter, and Space key support
     82* **Screen Reader Compatible** - Proper ARIA attributes and announcements
     83* **High Contrast Support** - Works with Windows high contrast mode
     84* **Lightweight** - Minimal impact on page load times
     85* **Conditional Loading** - Assets only load when needed
     86
     87= 🎯 Use Cases =
     88
     89* Add dark mode to any WordPress theme without coding
     90* Improve user experience for evening and night browsing
     91* Reduce eye strain for visitors reading long-form content
     92* Create a modern, professional appearance
     93* Meet accessibility requirements for your website
     94* Provide user choice and customization options
    2595
    2696== Installation ==
    2797
    28 Install the WP Nightly either via the WordPress plugin directory or by uploading the files to your server at wp-content/plugins.
     98= Automatic Installation =
     99
     1001. Log in to your WordPress admin dashboard
     1012. Navigate to Plugins → Add New
     1023. Search for "Nightly Dark Mode Toggle"
     1034. Click "Install Now" and then "Activate"
     1045. Go to Appearance → Nightly to configure settings
     105
     106= Manual Installation =
     107
     1081. Download the plugin zip file
     1092. Upload to your `/wp-content/plugins/` directory
     1103. Extract the files
     1114. Activate the plugin through the WordPress admin
     1125. Configure settings under Appearance → Nightly
     113
     114= Quick Setup =
     115
     116**For FSE Themes:**
     1171. Go to Appearance → Nightly
     1182. Enable "Enable floating toggle"
     1193. Choose your preferred corner position
     1204. Save settings - done!
     121
     122**For Classic Themes:**
     1231. Go to Appearance → Nightly
     1242. Enable "Auto-inject floating toggle"
     1253. Customize position and animation settings
     1264. Save settings - your site now has dark mode!
     127
     128**Using Gutenberg Blocks:**
     1291. Edit any page or post
     1302. Add a new block and search for "Nightly"
     1313. Insert the block where you want the toggle
     1324. Customize the button text and appearance
     1335. Publish - visitors can now toggle dark mode on that page
    29134
    30135== Frequently Asked Questions ==
    31136
    32 = Can I use the WP Nightly on client websites? =
    33 
    34 Yes! You can certainly use the WP Nightly  on yours as well as your client’s websites.
     137= Does this work with my theme? =
     138
     139Yes! Nightly is designed to work with any WordPress theme - FSE, classic, custom, or premium themes. It uses CSS custom properties that adapt to your existing design.
     140
     141= Will this slow down my website? =
     142
     143No. Nightly is performance-optimized and only loads assets when needed. The total footprint is minimal and won't impact your site speed.
     144
     145= Can I customize the appearance? =
     146
     147Absolutely! You can customize colors, position, animation speed, and behavior. Advanced users can use CSS custom properties for deeper customization.
     148
     149= Is it accessible for users with disabilities? =
     150
     151Yes. Nightly is WCAG 2.1 AA compliant with full keyboard navigation, screen reader support, and high contrast compatibility.
     152
     153= Can I use both the block and floating toggle? =
     154
     155Yes! You can use the Gutenberg block on specific pages and the floating toggle for site-wide coverage. They work together seamlessly.
     156
     157= Does it remember user preferences? =
     158
     159Yes. User preferences are saved in localStorage and persist across sessions. The plugin also respects system dark mode preferences.
     160
     161= Can I disable it on certain pages? =
     162
     163Yes. The floating toggle can be disabled globally, and blocks can be added or removed from specific pages as needed.
     164
     165= Is it translation ready? =
     166
     167Yes. Nightly is fully internationalized and ready for translation into any language.
     168
     169= Does it work with caching plugins? =
     170
     171Yes. Nightly is compatible with all major caching plugins and CDNs.
     172
     173= Can I customize the toggle button design? =
     174
     175Yes. The plugin provides CSS custom properties for easy styling, and developers can override styles as needed.
    35176
    36177== Screenshots ==
    37178
     1791. **Admin Dashboard** - Clean, intuitive settings interface for both FSE and classic themes
     1802. **Floating Toggle** - Professional floating toggle in action on a live website
     1813. **Gutenberg Block** - Easy-to-use block editor integration with customization options
     1824. **Dark Mode Active** - Beautiful dark mode transformation of a typical WordPress site
     1835. **Mobile Responsive** - Perfect appearance and functionality on all device sizes
     1846. **Accessibility Features** - Keyboard navigation and screen reader compatibility in action
     185
    38186== Changelog ==
    39187
    40 = 0.0.1 =
     188= 1.0.0 =
    41189* Initial release
     190* Gutenberg block for flexible toggle placement
     191* Floating toggle with 4 position options
     192* FSE and classic theme support
     193* Admin dashboard with theme-specific interfaces
     194* System preference detection
     195* Accessibility compliance (WCAG 2.1 AA)
     196* Performance optimizations
     197* RTL language support
     198* Mobile responsive design
     199* localStorage preference persistence
     200* Smooth transition animations
     201* Multiple toggle synchronization
     202
     203== Upgrade Notice ==
     204
     205= 1.0.0 =
     206Initial release of Nightly - the professional dark mode solution for WordPress. Install now to give your visitors the modern dark mode experience they expect.
     207
     208== Support ==
     209
     210Need help? We're here for you!
     211
     212* **Documentation**: Comprehensive guides and examples
     213* **Support Forum**: Community support and troubleshooting
     214* **Developer Resources**: Hooks, filters, and customization guides
     215
     216Visit [plugpress.io](https://plugpress.io/) for additional resources and premium support options.
     217
     218== Privacy ==
     219
     220Nightly respects user privacy:
     221
     222* No data is sent to external servers
     223* User preferences are stored locally in the browser
     224* No tracking or analytics
     225* GDPR compliant
     226* No cookies used
     227
     228Your users' privacy is protected while they enjoy the dark mode experience.
Note: See TracChangeset for help on using the changeset viewer.