Changeset 3453782
- Timestamp:
- 02/04/2026 12:21:44 PM (8 weeks ago)
- Location:
- nightly
- Files:
-
- 49 added
- 18 deleted
- 9 edited
- 1 copied
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (added)
-
assets/icon-128x128.png (modified) (previous)
-
assets/icon-256x256.png (modified) (previous)
-
assets/icon.svg (modified) (1 diff)
-
assets/screenshot-1.png (added)
-
assets/screenshot-2.png (added)
-
assets/screenshot-3.png (added)
-
tags/1.0.2 (copied) (copied from nightly/trunk)
-
tags/1.0.2/assets (added)
-
tags/1.0.2/assets/css (added)
-
tags/1.0.2/assets/css/dark-mode.css (added)
-
tags/1.0.2/assets/js (added)
-
tags/1.0.2/assets/js/toggle-button.js (added)
-
tags/1.0.2/build/admin (deleted)
-
tags/1.0.2/build/block (deleted)
-
tags/1.0.2/build/frontend (deleted)
-
tags/1.0.2/build/index-rtl.css (added)
-
tags/1.0.2/build/index.asset.php (added)
-
tags/1.0.2/build/index.css (added)
-
tags/1.0.2/build/index.js (added)
-
tags/1.0.2/build/js (deleted)
-
tags/1.0.2/includes/admin.php (added)
-
tags/1.0.2/includes/assets.php (added)
-
tags/1.0.2/includes/boot.php (added)
-
tags/1.0.2/includes/class-admin.php (deleted)
-
tags/1.0.2/includes/class-api.php (deleted)
-
tags/1.0.2/includes/class-block.php (deleted)
-
tags/1.0.2/includes/class-nightly.php (deleted)
-
tags/1.0.2/includes/constants.php (added)
-
tags/1.0.2/includes/frontend.php (added)
-
tags/1.0.2/includes/meta-boxes.php (added)
-
tags/1.0.2/includes/notices.php (added)
-
tags/1.0.2/includes/options.php (added)
-
tags/1.0.2/includes/permissions.php (added)
-
tags/1.0.2/includes/rest.php (added)
-
tags/1.0.2/includes/sanitize.php (added)
-
tags/1.0.2/includes/uninstall.php (added)
-
tags/1.0.2/languages (deleted)
-
tags/1.0.2/nightly.php (modified) (1 diff)
-
tags/1.0.2/readme.txt (modified) (1 diff)
-
tags/1.0.2/tsconfig.json (added)
-
tags/1.0.2/uninstall.php (modified) (1 diff)
-
trunk/assets (added)
-
trunk/assets/css (added)
-
trunk/assets/css/dark-mode.css (added)
-
trunk/assets/js (added)
-
trunk/assets/js/toggle-button.js (added)
-
trunk/build/admin (deleted)
-
trunk/build/block (deleted)
-
trunk/build/frontend (deleted)
-
trunk/build/index-rtl.css (added)
-
trunk/build/index.asset.php (added)
-
trunk/build/index.css (added)
-
trunk/build/index.js (added)
-
trunk/build/js (deleted)
-
trunk/includes/admin.php (added)
-
trunk/includes/assets.php (added)
-
trunk/includes/boot.php (added)
-
trunk/includes/class-admin.php (deleted)
-
trunk/includes/class-api.php (deleted)
-
trunk/includes/class-block.php (deleted)
-
trunk/includes/class-nightly.php (deleted)
-
trunk/includes/constants.php (added)
-
trunk/includes/frontend.php (added)
-
trunk/includes/meta-boxes.php (added)
-
trunk/includes/notices.php (added)
-
trunk/includes/options.php (added)
-
trunk/includes/permissions.php (added)
-
trunk/includes/rest.php (added)
-
trunk/includes/sanitize.php (added)
-
trunk/includes/uninstall.php (added)
-
trunk/languages (deleted)
-
trunk/nightly.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/tsconfig.json (added)
-
trunk/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
nightly/assets/icon.svg
r3345433 r3453782 1 1 <svg width="96" height="96" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg"> 2 <rect width="96" height="96" rx="36" fill="url(#paint0_linear_43_2050)"/> 3 <path d="M45.1931 77.213C29.6629 77.213 17.0128 64.575 17.0128 49.0328C17.0128 33.4905 29.6508 20.8525 45.1931 20.8525C47.028 20.8525 48.8629 21.0348 50.6614 21.3872L54.2341 22.092L51.2812 24.2307C47.4412 27.0135 45.1566 31.4976 45.1566 36.2368C45.1566 44.415 51.8159 51.0743 59.9941 51.0743C64.0285 51.0743 67.7956 49.4824 70.6027 46.6024L73.1546 43.9776L73.3247 47.6353C73.349 48.0849 73.3612 48.5467 73.3612 49.0206C73.3612 64.575 60.7232 77.213 45.1931 77.213ZM45.1931 24.0363C31.4128 24.0363 20.1966 35.2525 20.1966 49.0328C20.1966 62.813 31.4128 74.0292 45.1931 74.0292C58.2564 74.0292 69.0108 63.9553 70.1045 51.1715C67.1516 53.1765 63.664 54.2581 60.0062 54.2581C50.066 54.2581 41.985 46.1771 41.985 36.2368C41.985 31.7041 43.7105 27.3659 46.7242 24.0727C46.2017 24.0484 45.6913 24.0363 45.1931 24.0363Z" fill="white"/> 4 <path d="M45.1931 68.889C34.2443 68.889 25.3369 59.9817 25.3369 49.0328C25.3369 40.806 30.3678 33.7336 37.5131 30.7199C37.0756 32.5062 36.8448 34.3655 36.8448 36.2369C36.8448 49.0085 47.2346 59.3984 60.0063 59.3984C60.7354 59.3984 61.4645 59.3619 62.1815 59.3012C58.6939 65.049 52.387 68.889 45.1931 68.889Z" fill="white"/> 5 <path d="M59.9939 54.2702C50.0537 54.2702 41.9727 46.1892 41.9727 36.249C41.9727 30.5011 44.7554 25.0449 49.4096 21.6667C52.4841 19.4186 56.1418 18.2277 59.9818 18.2277C69.922 18.2277 78.003 26.3087 78.003 36.249C78.003 40.9882 76.1803 45.4601 72.8628 48.8384C69.4603 52.3381 64.8911 54.2702 59.9939 54.2702ZM59.9939 21.4115C56.8344 21.4115 53.8208 22.3958 51.281 24.2429C47.441 27.0257 45.1443 31.5219 45.1443 36.249C45.1443 44.4272 51.8035 51.0865 59.9818 51.0865C64.0162 51.0865 67.7833 49.4946 70.5904 46.6146C73.3246 43.8318 74.8192 40.1497 74.8192 36.2368C74.8435 28.0708 68.1843 21.4115 59.9939 21.4115Z" fill="white"/> 2 <g clip-path="url(#clip0_1066_757)"> 3 <path d="M60 0C79.8822 0 96 16.1177 96 36V60C96 79.8822 79.8822 96 60 96H36C16.1177 96 0 79.8822 0 60V36C0 16.1177 16.1177 0 36 0H60ZM59.9814 18.2275C56.3785 18.2276 52.9361 19.2763 49.9854 21.2627C48.4043 20.9917 46.7988 20.8526 45.1934 20.8525C29.6511 20.8525 17.0127 33.4909 17.0127 49.0332C17.0129 64.5752 29.6633 77.2129 45.1934 77.2129C60.7233 77.2127 73.3613 64.5748 73.3613 49.0205C73.3613 48.7834 73.3567 48.5494 73.3506 48.3184C76.3573 45.0076 78.0029 40.7496 78.0029 36.249C78.0029 26.3088 69.9216 18.2275 59.9814 18.2275ZM45.1934 24.0361C45.6894 24.0361 46.1976 24.0472 46.7178 24.0713C43.7036 27.3652 41.9727 31.7162 41.9727 36.249C41.9727 46.1892 50.0539 54.2705 59.9941 54.2705C62.9505 54.2705 65.7866 53.5645 68.3193 52.2363C68.3731 52.2083 68.426 52.1789 68.4795 52.1504C68.5867 52.0927 68.6937 52.0345 68.7998 51.9746C69.2445 51.7254 69.6808 51.4596 70.1045 51.1719C69.0107 63.9554 58.2564 74.0291 45.1934 74.0293C31.4132 74.0293 20.1965 62.8132 20.1963 49.0332C20.1963 35.2529 31.4131 24.0361 45.1934 24.0361ZM37.5127 30.7197C30.3675 33.7335 25.3369 40.8065 25.3369 49.0332C25.3371 59.9819 34.2447 68.8887 45.1934 68.8887C52.387 68.8886 58.694 65.0493 62.1816 59.3018C61.4646 59.3625 60.735 59.3984 60.0059 59.3984C47.2345 59.3982 36.8449 49.0086 36.8447 36.2373C36.8447 34.3659 37.0752 32.506 37.5127 30.7197ZM59.9941 21.4111C68.1844 21.4113 74.8436 28.0714 74.8193 36.2373C74.8192 40.1498 73.3246 43.8316 70.5908 46.6143C70.5031 46.7043 70.4138 46.7934 70.3242 46.8809C67.5489 49.5849 63.8966 51.0742 59.9941 51.0742C51.8161 51.0742 45.1565 44.4153 45.1562 36.2373C45.1562 34.2323 45.5665 32.2729 46.3291 30.4688C47.3731 28.0145 49.0711 25.8449 51.2812 24.2432C53.821 22.3961 56.8347 21.4111 59.9941 21.4111Z" fill="#353535"/> 4 </g> 6 5 <defs> 7 <linearGradient id="paint0_linear_43_2050" x1="0" y1="0" x2="115.11" y2="58.2088" gradientUnits="userSpaceOnUse"> 8 <stop stop-color="#4B1F85"/> 9 <stop offset="1" stop-color="#1C1154"/> 10 </linearGradient> 6 <clipPath id="clip0_1066_757"> 7 <rect width="96" height="96" fill="white"/> 8 </clipPath> 11 9 </defs> 12 10 </svg> -
nightly/tags/1.0.2/nightly.php
r3345454 r3453782 2 2 3 3 /** 4 * Plugin Name: Nightly — Dark Mode Toggle5 * Plugin URI: https://plugpress.io/ 6 * Description: A lightweight WordPress plugin that provides a minimal dark mode toggle functionality for websites.7 * Version: 1.0. 18 * Author: PlugPress9 * Author URI: https://plugpress.io /4 * Plugin Name: Dark Mode for WordPress - Nightly 5 * Plugin URI: https://plugpress.io/nightly 6 * Description: The most powerful dark mode plugin for WordPress. Eye-friendly night mode with smart scheduling, 6 color themes, smooth transitions, and advanced customization. Perfect for reducing eye strain and enhancing user experience. 7 * Version: 1.0.2 8 * Author: Fahim Reza 9 * Author URI: https://plugpress.io 10 10 * License: GPL v2 or later 11 11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 12 12 * Text Domain: nightly 13 13 * Domain Path: /languages 14 * Requires at least: 5.0 15 * Tested up to: 6.8 14 * Requires at least: 6.0 16 15 * Requires PHP: 7.4 17 16 * 18 17 * @package Nightly 19 * @since 1.0.020 18 */ 21 19 22 // Prevent direct access 23 if (!defined('ABSPATH')) { 24 exit; 20 if (! defined('ABSPATH')) { 21 exit; 25 22 } 26 23 27 // Define plugin constants 28 define('NIGHTLY_VERSION', '1.0.1'); 29 define('NIGHTLY_PLUGIN_FILE', __FILE__); 30 define('NIGHTLY_PLUGIN_DIR', plugin_dir_path(__FILE__)); 31 define('NIGHTLY_PLUGIN_URL', plugin_dir_url(__FILE__)); 32 define('NIGHTLY_PLUGIN_BASENAME', plugin_basename(__FILE__)); 24 require_once __DIR__ . '/includes/boot.php'; 33 25 34 // Autoloader for plugin classes 35 spl_autoload_register(function ($class) { 36 // Check if the class belongs to our plugin namespace 37 if (strpos($class, 'Nightly\\') !== 0) { 38 return; 39 } 26 register_activation_hook(__FILE__, array('Nightly\\Notices', 'activate')); 40 27 41 // Remove namespace prefix and convert to file path 42 $class_name = str_replace('Nightly\\', '', $class); 43 $class_file = strtolower(str_replace('_', '-', $class_name)); 44 $file_path = NIGHTLY_PLUGIN_DIR . 'includes/class-' . $class_file . '.php'; 45 46 if (file_exists($file_path)) { 47 require_once $file_path; 48 } 49 }); 50 51 // Initialize the plugin 52 function nightly_init() 53 { 54 // Load text domain for translations 55 load_plugin_textdomain('nightly', false, dirname(NIGHTLY_PLUGIN_BASENAME) . '/languages'); 56 57 // Initialize main plugin class 58 if (class_exists('Nightly\\Nightly')) { 59 $nightly = new Nightly\Nightly(); 60 $nightly->init(); 61 } 62 } 63 64 // Hook into WordPress 65 add_action('plugins_loaded', 'nightly_init'); 66 67 // Activation hook 68 register_activation_hook(__FILE__, 'nightly_activate'); 69 function nightly_activate() 70 { 71 // Check WordPress version compatibility 72 if (version_compare(get_bloginfo('version'), '5.0', '<')) { 73 deactivate_plugins(plugin_basename(__FILE__)); 74 wp_die(__('Nightly requires WordPress 5.0 or higher.', 'nightly')); 75 } 76 77 // Check PHP version compatibility 78 if (version_compare(PHP_VERSION, '7.4', '<')) { 79 deactivate_plugins(plugin_basename(__FILE__)); 80 wp_die(__('Nightly requires PHP 7.4 or higher.', 'nightly')); 81 } 82 83 // Set default options only if they don't exist 84 $default_settings = array( 85 'auto_inject' => false, 86 'floating_position' => 'bottom-right', 87 'respect_system_preference' => true, 88 89 'intensity' => 0.8, 90 'contrast' => 1.0, 91 'brightness' => 0.9, 92 'sepia' => 0.1, 93 94 // Floating button design settings 95 'floating_button_style' => 'rounded', 96 'floating_button_size' => 'medium', 97 'floating_bg_color' => '#333333', 98 'floating_bg_color_hover' => '#555555', 99 'floating_bg_color_active' => '#79c0ff', 100 'floating_icon_color' => '#ffffff', 101 'floating_icon_color_hover' => '#ffffff', 102 'floating_border_color' => 'transparent', 103 'floating_border_width' => 0, 104 'floating_border_radius' => 50, 105 'floating_icon_size' => 24, 106 'floating_icon_type' => 'sun-moon', 107 'floating_custom_icon' => '🌙', 108 'floating_padding_top' => 12, 109 'floating_padding_bottom' => 12, 110 'floating_padding_left' => 16, 111 'floating_padding_right' => 16, 112 'floating_box_shadow' => '0 2px 4px rgba(0,0,0,0.1)', 113 'floating_box_shadow_hover' => '0 4px 8px rgba(0,0,0,0.15)', 114 'floating_width' => '3.5rem', 115 'floating_height' => '3.5rem', 116 ); 117 118 add_option('nightly_settings', $default_settings); 119 120 // Set activation timestamp for analytics 121 add_option('nightly_activated_at', current_time('mysql')); 122 123 // Set plugin version for future migrations 124 add_option('nightly_version', NIGHTLY_VERSION); 125 126 // Clear any cached data 127 if (function_exists('wp_cache_flush')) { 128 wp_cache_flush(); 129 } 130 131 // Flush rewrite rules 132 flush_rewrite_rules(); 133 } 134 135 // Deactivation hook 136 register_deactivation_hook(__FILE__, 'nightly_deactivate'); 137 function nightly_deactivate() 138 { 139 // Clear any cached data 140 if (function_exists('wp_cache_flush')) { 141 wp_cache_flush(); 142 } 143 144 // Flush rewrite rules 145 flush_rewrite_rules(); 146 147 // Note: We don't delete settings on deactivation 148 // Users might want to reactivate and keep their settings 149 } 28 Nightly\boot(); -
nightly/tags/1.0.2/readme.txt
r3380751 r3453782 1 === Nightly — Dark Mode Toggle === 2 Contributors: badhonrocks, plugpressco 3 Tags: dark mode, night mode, dark theme, light mode 4 Requires at least: 5.0 1 === Dark Mode for WordPress - Nightly === 2 Contributors: fahimreza 3 Tags: dark mode, night mode, dark theme, eye care, accessibility 4 Requires at least: 6.0 5 Tested up to: 6.7 5 6 Requires PHP: 7.4 6 Tested up to: 6.8 7 Stable tag: 1.0.1 7 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Add a professional dark mode toggle to your WordPress site. Works with any theme - FSE or classic. Lightweight, accessible, and user-friendly.11 Professional dark mode for WordPress with smart scheduling, multiple themes, and customization options. 12 12 13 13 == Description == 14 14 15 **Transform your WordPress site with a sleek dark mode toggle that your visitors will love.** 15 Nightly adds a professional dark mode to your WordPress site with one click. Give your visitors a comfortable viewing experience with automatic dark mode that reduces eye strain and saves battery life. 16 16 17 Nightly 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. 17 = Why Dark Mode? = 18 18 19 = Why Choose Nightly? = 19 Dark mode reduces eye strain during nighttime browsing and in low-light environments. Studies show 68% of users prefer dark mode for evening use. It also saves battery life on OLED screens and provides a modern, professional look. 20 20 21 * **Universal Compatibility** - Works with FSE themes, classic themes, and everything in between 22 * **Smart Theme Detection** - Automatically adapts the 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 21 = How It Works = 28 22 23 Nightly uses smart CSS filters to automatically invert your site's colors when dark mode is active. Your visitors can toggle between light and dark modes using a floating button, or you can set automatic scheduling based on time of day. 29 24 30 25 = Key Features = 31 26 32 * System preference detection (respects prefers-color-scheme) 33 * Customizable transition animations (0-1000ms) 34 * Multiple floating toggle positions (all four corners) 35 * localStorage persistence for user preferences 36 * Synchronized toggles (multiple toggles stay in sync) 37 * Mobile-responsive design 38 * RTL language support 27 **6 Color Themes** 28 Choose from Classic, Cool, Warm, High Contrast, Pure Black (OLED), or create your own custom colors. 39 29 40 = Easy to Use = 30 **Smart Auto-Scheduling** 31 Automatically enable dark mode during evening hours (e.g., 8 PM to 6 AM). 41 32 42 **Getting Started is Simple:** 33 **Customizable Toggle Button** 34 3 styles (Classic, Pill, Minimal) with 5 size options that float on your site. 43 35 44 1. **Install & Activate** - One-click installation from WordPress.org 45 2. **Choose Your Method** - Use the Gutenberg block or enable the floating toggle 46 3. **Customize Settings** - Configure position, animation speed, and preferences 47 4. **Done!** - Your visitors can now enjoy dark mode 36 **Smooth Transitions** 37 Adjustable fade animations when switching between light and dark modes. 48 38 49 **No coding required. No theme modifications needed. Just install and go.** 39 **Keyboard Shortcuts** 40 Let power users toggle dark mode with customizable keyboard shortcuts. 50 41 51 = 🛠️ Developer Friendly = 42 **Per-Page Control** 43 Disable dark mode on specific pages like landing pages or photo galleries. 52 44 53 * Clean, well-documented code following WordPress standards 54 * CSS custom properties for easy theme integration 55 * JavaScript events for advanced customization 56 * Hooks and filters for extensibility 57 * Modern build process with optimized assets 45 **Media Controls** 46 Individual brightness adjustments for images, videos, and backgrounds. 58 47 59 = 🌐 Accessibility & Performance = 60 61 * **WCAG 2.1 AA Compliant** - Full accessibility support 62 * **Keyboard Navigation** - Tab, Enter, and Space key support 63 * **Screen Reader Compatible** - Proper ARIA attributes and announcements 64 * **High Contrast Support** - Works with Windows high contrast mode 65 * **Lightweight** - Minimal impact on page load times 66 * **Conditional Loading** - Assets only load when needed 48 **Performance Optimized** 49 Lightweight and fast with no impact on page speed. 67 50 68 51 == Installation == 69 52 70 = Automatic Installation = 71 72 1. Log in to your WordPress admin dashboard 73 2. Navigate to Plugins → Add New 74 3. Search for "Nightly Dark Mode Toggle" 75 4. Click "Install Now" and then "Activate" 76 5. Go to Appearance → Nightly to configure settings 77 78 = Manual Installation = 79 80 1. Download the plugin zip file 81 2. Upload to your `/wp-content/plugins/` directory 82 3. Extract the files 83 4. Activate the plugin through the WordPress admin 84 5. Configure settings under Appearance → Nightly 85 86 = Quick Setup = 87 88 1. Go to Appearance → Nightly 89 2. Enable "Auto-inject floating toggle" 90 3. Customize position and animation settings 91 4. Save settings - your site now has dark mode! 92 93 **Using Gutenberg Blocks:** 94 1. Edit any page or post 95 2. Add a new block and search for "Nightly" 96 3. Insert the block where you want the toggle 97 4. Customize the button text and appearance 98 5. Publish - visitors can now toggle dark mode on that page 53 1. Go to **Plugins → Add New** in your WordPress admin 54 2. Search for "Nightly Dark Mode" 55 3. Click **Install** and then **Activate** 56 4. Navigate to **Settings → Nightly** to configure 57 5. Enable dark mode and customize your preferences 99 58 100 59 == Frequently Asked Questions == 101 60 102 = Does this work with mytheme? =61 = Does it work with my WordPress theme? = 103 62 104 Yes! 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.63 Yes! Nightly works with any WordPress theme using universal CSS filters. We've tested it with popular themes like Astra, GeneratePress, Kadence, and Divi. 105 64 106 = Will this slow down my website? =65 = Will it slow down my site? = 107 66 108 No. Nightly is performance-optimized and only loads assets when needed. The total footprint is minimal and won't impact your site speed.67 No. Nightly is performance-optimized with minimal CSS and JavaScript. It won't affect your page speed scores. 109 68 110 = Can I customize the appearance? =69 = Can visitors toggle dark mode on/off? = 111 70 112 Absolutely! You can customize colors, position, animation speed, and behavior. Advanced users can use CSS custom properties for deeper customization.71 Yes! A customizable toggle button appears on your site that visitors can click. Their preference is saved automatically. 113 72 114 = Is it accessible for users with disabilities? =73 = Does it work on mobile devices? = 115 74 116 Yes . Nightly is WCAG 2.1 AA compliant with full keyboard navigation, screen reader support, and high contrast compatibility.75 Yes! Nightly is fully responsive and works perfectly on desktops, tablets, and smartphones. 117 76 118 = Can I use both the block and floating toggle? =77 = Can I customize the colors? = 119 78 120 Yes! You can use the Gutenberg block on specific pages and the floating toggle for site-wide coverage. They work together seamlessly.79 Yes! Choose from 6 pre-built themes or create your own custom color palette with our color picker. 121 80 122 = Does it remember user preferences? =81 = Will dark mode break my images? = 123 82 124 Yes. User preferences are saved in localStorage and persist across sessions. The plugin also respects system dark mode preferences.83 No! Nightly intelligently re-inverts images, videos, and media so they display correctly in dark mode. 125 84 126 = Can I disable it on certain pages? =85 = Can I schedule dark mode for specific hours? = 127 86 128 Yes . The floating toggle can be disabled globally, and blocks can be added or removed from specific pages as needed.87 Yes! Enable auto-scheduling to automatically activate dark mode during evening hours (e.g., 8 PM to 6 AM). 129 88 130 = Is it translation ready? =89 = Is it accessible? = 131 90 132 Yes . Nightly is fully internationalized and ready for translation into any language.91 Yes! Nightly is WCAG 2.1 compliant with keyboard navigation, screen reader support, and a high-contrast mode. 133 92 134 = Does it work with caching plugins? =93 = Does it collect any data? = 135 94 136 Yes. Nightly is compatible with all major caching plugins and CDNs.95 No. Nightly is 100% GDPR compliant with no external API calls or data collection. All settings are stored locally. 137 96 138 = Can I customize the toggle button design? =97 = How do I disable dark mode on specific pages? = 139 98 140 Yes. The plugin provides CSS custom properties for easy styling, and developers can override styles as needed.99 Use the "Dark Mode Settings" meta box in the post/page editor to disable dark mode for specific content. 141 100 142 101 == Screenshots == 143 102 144 1. **Admin Dashboard** - Clean, intuitive settings interface for both FSE and classic themes 145 2. **Floating Toggle** - Professional floating toggle in action on a live website 146 3. **Gutenberg Block** - Easy-to-use block editor integration with customization options 147 4. **Dark Mode Active** - Beautiful dark mode transformation of a typical WordPress site 148 5. **Mobile Responsive** - Perfect appearance and functionality on all device sizes 149 6. **Accessibility Features** - Keyboard navigation and screen reader compatibility in action 103 1. Admin dashboard with all settings 104 2. Six beautiful color theme options 105 3. Toggle button customization 106 4. Live preview of dark mode 107 5. Auto-scheduling settings 108 6. Custom color palette creator 109 7. Per-page dark mode control 110 8. Frontend toggle button on live site 150 111 151 112 == Changelog == 152 113 153 = 1.0.0 = 114 = 1.0.2 - 2025-02-04 = 115 * Added 6 color scheme variants (Classic, Cool, Warm, High Contrast, Pure Black, Custom) 116 * Added auto-scheduling with custom time ranges 117 * Added per-page dark mode control with meta boxes 118 * Added customizable keyboard shortcuts 119 * Added smooth transitions with adjustable duration 120 * Added individual media brightness controls (images, videos, backgrounds) 121 * Improved live preview with real-time updates 122 * Fixed toggle button icon visibility issues 123 * Performance optimizations 124 * WCAG 2.1 accessibility improvements 125 126 = 1.0.1 - 2025-01-15 = 154 127 * Initial release 155 * Gutenberg block for flexible toggle placement156 * Floating toggle with 4 position options157 * FSE and classic theme support158 * Admin dashboard with theme-specific interfaces159 * System preference detection160 * Accessibility compliance (WCAG 2.1 AA)161 * Performance optimizations162 * RTL language support163 * Mobile responsive design164 * localStorage preference persistence165 * Smooth transition animations166 * Multiple toggle synchronization167 128 168 129 == Upgrade Notice == 169 130 170 = 1.0.0 = 171 Initial release of Nightly - the professional dark mode solution for WordPress. Install now to give your visitors the modern dark mode experience they expect. 172 173 == Support == 174 175 Need help? We're here for you! 176 177 * **Documentation**: Comprehensive guides and examples 178 * **Support Forum**: Community support and troubleshooting 179 * **Developer Resources**: Hooks, filters, and customization guides 180 181 Visit [plugpress.io](https://plugpress.io/) for additional resources and premium support options. 182 183 == Privacy == 184 185 Nightly respects user privacy: 186 187 * No data is sent to external servers 188 * User preferences are stored locally in the browser 189 * No tracking or analytics 190 * GDPR compliant 191 * No cookies used 192 193 Your users' privacy is protected while they enjoy the dark mode experience. 131 = 1.0.2 = 132 Major update! Adds 6 color schemes, auto-scheduling, per-page control, keyboard shortcuts, and media brightness controls. Highly recommended upgrade. -
nightly/tags/1.0.2/uninstall.php
r3345433 r3453782 1 1 <?php 2 2 /** 3 * Uninstall Nightly Plugin 4 * 5 * This file is executed when the plugin is uninstalled via the WordPress admin. 6 * It handles cleanup of all plugin data, options, and any other traces. 3 * Uninstall cleanup for Nightly. 7 4 * 8 5 * @package Nightly 9 * @since 1.0.010 6 */ 11 7 12 // Prevent direct access 13 if (!defined('WP_UNINSTALL_PLUGIN')) { 14 exit; 8 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 9 exit; 15 10 } 16 11 17 /** 18 * Clean up plugin data on uninstall 19 */ 20 function nightly_uninstall_cleanup() { 21 // Remove plugin options 22 delete_option('nightly_settings'); 23 24 // Remove any transients 25 delete_transient('nightly_cache'); 26 27 // Remove user meta (if we stored any user-specific preferences) 28 delete_metadata('user', 0, 'nightly_user_preference', '', true); 29 30 // Clean up any custom database tables (if we had any) 31 // Note: This plugin doesn't create custom tables, but this is where you'd clean them up 32 33 // Remove any uploaded files or directories (if any) 34 // This plugin doesn't create files, but this is where you'd clean them up 35 36 // Clear any cached data 37 wp_cache_flush(); 38 39 // Remove any scheduled cron jobs (if any) 40 wp_clear_scheduled_hook('nightly_cleanup_cron'); 41 } 12 require_once __DIR__ . '/includes/constants.php'; 13 require_once __DIR__ . '/includes/uninstall.php'; 42 14 43 /** 44 * Only run cleanup if this is a single site or if we're on the main site of a multisite 45 */ 46 if (!is_multisite()) { 47 // Single site cleanup 48 nightly_uninstall_cleanup(); 49 } else { 50 // Multisite cleanup - run for each site 51 global $wpdb; 52 53 $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); 54 $original_blog_id = get_current_blog_id(); 55 56 foreach ($blog_ids as $blog_id) { 57 switch_to_blog($blog_id); 58 nightly_uninstall_cleanup(); 59 } 60 61 switch_to_blog($original_blog_id); 62 63 // Clean up any network-wide options (if any) 64 delete_site_option('nightly_network_settings'); 65 } 15 Nightly\uninstall(); -
nightly/trunk/nightly.php
r3345454 r3453782 2 2 3 3 /** 4 * Plugin Name: Nightly — Dark Mode Toggle5 * Plugin URI: https://plugpress.io/ 6 * Description: A lightweight WordPress plugin that provides a minimal dark mode toggle functionality for websites.7 * Version: 1.0. 18 * Author: PlugPress9 * Author URI: https://plugpress.io /4 * Plugin Name: Dark Mode for WordPress - Nightly 5 * Plugin URI: https://plugpress.io/nightly 6 * Description: The most powerful dark mode plugin for WordPress. Eye-friendly night mode with smart scheduling, 6 color themes, smooth transitions, and advanced customization. Perfect for reducing eye strain and enhancing user experience. 7 * Version: 1.0.2 8 * Author: Fahim Reza 9 * Author URI: https://plugpress.io 10 10 * License: GPL v2 or later 11 11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 12 12 * Text Domain: nightly 13 13 * Domain Path: /languages 14 * Requires at least: 5.0 15 * Tested up to: 6.8 14 * Requires at least: 6.0 16 15 * Requires PHP: 7.4 17 16 * 18 17 * @package Nightly 19 * @since 1.0.020 18 */ 21 19 22 // Prevent direct access 23 if (!defined('ABSPATH')) { 24 exit; 20 if (! defined('ABSPATH')) { 21 exit; 25 22 } 26 23 27 // Define plugin constants 28 define('NIGHTLY_VERSION', '1.0.1'); 29 define('NIGHTLY_PLUGIN_FILE', __FILE__); 30 define('NIGHTLY_PLUGIN_DIR', plugin_dir_path(__FILE__)); 31 define('NIGHTLY_PLUGIN_URL', plugin_dir_url(__FILE__)); 32 define('NIGHTLY_PLUGIN_BASENAME', plugin_basename(__FILE__)); 24 require_once __DIR__ . '/includes/boot.php'; 33 25 34 // Autoloader for plugin classes 35 spl_autoload_register(function ($class) { 36 // Check if the class belongs to our plugin namespace 37 if (strpos($class, 'Nightly\\') !== 0) { 38 return; 39 } 26 register_activation_hook(__FILE__, array('Nightly\\Notices', 'activate')); 40 27 41 // Remove namespace prefix and convert to file path 42 $class_name = str_replace('Nightly\\', '', $class); 43 $class_file = strtolower(str_replace('_', '-', $class_name)); 44 $file_path = NIGHTLY_PLUGIN_DIR . 'includes/class-' . $class_file . '.php'; 45 46 if (file_exists($file_path)) { 47 require_once $file_path; 48 } 49 }); 50 51 // Initialize the plugin 52 function nightly_init() 53 { 54 // Load text domain for translations 55 load_plugin_textdomain('nightly', false, dirname(NIGHTLY_PLUGIN_BASENAME) . '/languages'); 56 57 // Initialize main plugin class 58 if (class_exists('Nightly\\Nightly')) { 59 $nightly = new Nightly\Nightly(); 60 $nightly->init(); 61 } 62 } 63 64 // Hook into WordPress 65 add_action('plugins_loaded', 'nightly_init'); 66 67 // Activation hook 68 register_activation_hook(__FILE__, 'nightly_activate'); 69 function nightly_activate() 70 { 71 // Check WordPress version compatibility 72 if (version_compare(get_bloginfo('version'), '5.0', '<')) { 73 deactivate_plugins(plugin_basename(__FILE__)); 74 wp_die(__('Nightly requires WordPress 5.0 or higher.', 'nightly')); 75 } 76 77 // Check PHP version compatibility 78 if (version_compare(PHP_VERSION, '7.4', '<')) { 79 deactivate_plugins(plugin_basename(__FILE__)); 80 wp_die(__('Nightly requires PHP 7.4 or higher.', 'nightly')); 81 } 82 83 // Set default options only if they don't exist 84 $default_settings = array( 85 'auto_inject' => false, 86 'floating_position' => 'bottom-right', 87 'respect_system_preference' => true, 88 89 'intensity' => 0.8, 90 'contrast' => 1.0, 91 'brightness' => 0.9, 92 'sepia' => 0.1, 93 94 // Floating button design settings 95 'floating_button_style' => 'rounded', 96 'floating_button_size' => 'medium', 97 'floating_bg_color' => '#333333', 98 'floating_bg_color_hover' => '#555555', 99 'floating_bg_color_active' => '#79c0ff', 100 'floating_icon_color' => '#ffffff', 101 'floating_icon_color_hover' => '#ffffff', 102 'floating_border_color' => 'transparent', 103 'floating_border_width' => 0, 104 'floating_border_radius' => 50, 105 'floating_icon_size' => 24, 106 'floating_icon_type' => 'sun-moon', 107 'floating_custom_icon' => '🌙', 108 'floating_padding_top' => 12, 109 'floating_padding_bottom' => 12, 110 'floating_padding_left' => 16, 111 'floating_padding_right' => 16, 112 'floating_box_shadow' => '0 2px 4px rgba(0,0,0,0.1)', 113 'floating_box_shadow_hover' => '0 4px 8px rgba(0,0,0,0.15)', 114 'floating_width' => '3.5rem', 115 'floating_height' => '3.5rem', 116 ); 117 118 add_option('nightly_settings', $default_settings); 119 120 // Set activation timestamp for analytics 121 add_option('nightly_activated_at', current_time('mysql')); 122 123 // Set plugin version for future migrations 124 add_option('nightly_version', NIGHTLY_VERSION); 125 126 // Clear any cached data 127 if (function_exists('wp_cache_flush')) { 128 wp_cache_flush(); 129 } 130 131 // Flush rewrite rules 132 flush_rewrite_rules(); 133 } 134 135 // Deactivation hook 136 register_deactivation_hook(__FILE__, 'nightly_deactivate'); 137 function nightly_deactivate() 138 { 139 // Clear any cached data 140 if (function_exists('wp_cache_flush')) { 141 wp_cache_flush(); 142 } 143 144 // Flush rewrite rules 145 flush_rewrite_rules(); 146 147 // Note: We don't delete settings on deactivation 148 // Users might want to reactivate and keep their settings 149 } 28 Nightly\boot(); -
nightly/trunk/readme.txt
r3380751 r3453782 1 === Nightly — Dark Mode Toggle === 2 Contributors: badhonrocks, plugpressco 3 Tags: dark mode, night mode, dark theme, light mode 4 Requires at least: 5.0 1 === Dark Mode for WordPress - Nightly === 2 Contributors: fahimreza 3 Tags: dark mode, night mode, dark theme, eye care, accessibility 4 Requires at least: 6.0 5 Tested up to: 6.7 5 6 Requires PHP: 7.4 6 Tested up to: 6.8 7 Stable tag: 1.0.1 7 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Add a professional dark mode toggle to your WordPress site. Works with any theme - FSE or classic. Lightweight, accessible, and user-friendly.11 Professional dark mode for WordPress with smart scheduling, multiple themes, and customization options. 12 12 13 13 == Description == 14 14 15 **Transform your WordPress site with a sleek dark mode toggle that your visitors will love.** 15 Nightly adds a professional dark mode to your WordPress site with one click. Give your visitors a comfortable viewing experience with automatic dark mode that reduces eye strain and saves battery life. 16 16 17 Nightly 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. 17 = Why Dark Mode? = 18 18 19 = Why Choose Nightly? = 19 Dark mode reduces eye strain during nighttime browsing and in low-light environments. Studies show 68% of users prefer dark mode for evening use. It also saves battery life on OLED screens and provides a modern, professional look. 20 20 21 * **Universal Compatibility** - Works with FSE themes, classic themes, and everything in between 22 * **Smart Theme Detection** - Automatically adapts the 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 21 = How It Works = 28 22 23 Nightly uses smart CSS filters to automatically invert your site's colors when dark mode is active. Your visitors can toggle between light and dark modes using a floating button, or you can set automatic scheduling based on time of day. 29 24 30 25 = Key Features = 31 26 32 * System preference detection (respects prefers-color-scheme) 33 * Customizable transition animations (0-1000ms) 34 * Multiple floating toggle positions (all four corners) 35 * localStorage persistence for user preferences 36 * Synchronized toggles (multiple toggles stay in sync) 37 * Mobile-responsive design 38 * RTL language support 27 **6 Color Themes** 28 Choose from Classic, Cool, Warm, High Contrast, Pure Black (OLED), or create your own custom colors. 39 29 40 = Easy to Use = 30 **Smart Auto-Scheduling** 31 Automatically enable dark mode during evening hours (e.g., 8 PM to 6 AM). 41 32 42 **Getting Started is Simple:** 33 **Customizable Toggle Button** 34 3 styles (Classic, Pill, Minimal) with 5 size options that float on your site. 43 35 44 1. **Install & Activate** - One-click installation from WordPress.org 45 2. **Choose Your Method** - Use the Gutenberg block or enable the floating toggle 46 3. **Customize Settings** - Configure position, animation speed, and preferences 47 4. **Done!** - Your visitors can now enjoy dark mode 36 **Smooth Transitions** 37 Adjustable fade animations when switching between light and dark modes. 48 38 49 **No coding required. No theme modifications needed. Just install and go.** 39 **Keyboard Shortcuts** 40 Let power users toggle dark mode with customizable keyboard shortcuts. 50 41 51 = 🛠️ Developer Friendly = 42 **Per-Page Control** 43 Disable dark mode on specific pages like landing pages or photo galleries. 52 44 53 * Clean, well-documented code following WordPress standards 54 * CSS custom properties for easy theme integration 55 * JavaScript events for advanced customization 56 * Hooks and filters for extensibility 57 * Modern build process with optimized assets 45 **Media Controls** 46 Individual brightness adjustments for images, videos, and backgrounds. 58 47 59 = 🌐 Accessibility & Performance = 60 61 * **WCAG 2.1 AA Compliant** - Full accessibility support 62 * **Keyboard Navigation** - Tab, Enter, and Space key support 63 * **Screen Reader Compatible** - Proper ARIA attributes and announcements 64 * **High Contrast Support** - Works with Windows high contrast mode 65 * **Lightweight** - Minimal impact on page load times 66 * **Conditional Loading** - Assets only load when needed 48 **Performance Optimized** 49 Lightweight and fast with no impact on page speed. 67 50 68 51 == Installation == 69 52 70 = Automatic Installation = 71 72 1. Log in to your WordPress admin dashboard 73 2. Navigate to Plugins → Add New 74 3. Search for "Nightly Dark Mode Toggle" 75 4. Click "Install Now" and then "Activate" 76 5. Go to Appearance → Nightly to configure settings 77 78 = Manual Installation = 79 80 1. Download the plugin zip file 81 2. Upload to your `/wp-content/plugins/` directory 82 3. Extract the files 83 4. Activate the plugin through the WordPress admin 84 5. Configure settings under Appearance → Nightly 85 86 = Quick Setup = 87 88 1. Go to Appearance → Nightly 89 2. Enable "Auto-inject floating toggle" 90 3. Customize position and animation settings 91 4. Save settings - your site now has dark mode! 92 93 **Using Gutenberg Blocks:** 94 1. Edit any page or post 95 2. Add a new block and search for "Nightly" 96 3. Insert the block where you want the toggle 97 4. Customize the button text and appearance 98 5. Publish - visitors can now toggle dark mode on that page 53 1. Go to **Plugins → Add New** in your WordPress admin 54 2. Search for "Nightly Dark Mode" 55 3. Click **Install** and then **Activate** 56 4. Navigate to **Settings → Nightly** to configure 57 5. Enable dark mode and customize your preferences 99 58 100 59 == Frequently Asked Questions == 101 60 102 = Does this work with mytheme? =61 = Does it work with my WordPress theme? = 103 62 104 Yes! 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.63 Yes! Nightly works with any WordPress theme using universal CSS filters. We've tested it with popular themes like Astra, GeneratePress, Kadence, and Divi. 105 64 106 = Will this slow down my website? =65 = Will it slow down my site? = 107 66 108 No. Nightly is performance-optimized and only loads assets when needed. The total footprint is minimal and won't impact your site speed.67 No. Nightly is performance-optimized with minimal CSS and JavaScript. It won't affect your page speed scores. 109 68 110 = Can I customize the appearance? =69 = Can visitors toggle dark mode on/off? = 111 70 112 Absolutely! You can customize colors, position, animation speed, and behavior. Advanced users can use CSS custom properties for deeper customization.71 Yes! A customizable toggle button appears on your site that visitors can click. Their preference is saved automatically. 113 72 114 = Is it accessible for users with disabilities? =73 = Does it work on mobile devices? = 115 74 116 Yes . Nightly is WCAG 2.1 AA compliant with full keyboard navigation, screen reader support, and high contrast compatibility.75 Yes! Nightly is fully responsive and works perfectly on desktops, tablets, and smartphones. 117 76 118 = Can I use both the block and floating toggle? =77 = Can I customize the colors? = 119 78 120 Yes! You can use the Gutenberg block on specific pages and the floating toggle for site-wide coverage. They work together seamlessly.79 Yes! Choose from 6 pre-built themes or create your own custom color palette with our color picker. 121 80 122 = Does it remember user preferences? =81 = Will dark mode break my images? = 123 82 124 Yes. User preferences are saved in localStorage and persist across sessions. The plugin also respects system dark mode preferences.83 No! Nightly intelligently re-inverts images, videos, and media so they display correctly in dark mode. 125 84 126 = Can I disable it on certain pages? =85 = Can I schedule dark mode for specific hours? = 127 86 128 Yes . The floating toggle can be disabled globally, and blocks can be added or removed from specific pages as needed.87 Yes! Enable auto-scheduling to automatically activate dark mode during evening hours (e.g., 8 PM to 6 AM). 129 88 130 = Is it translation ready? =89 = Is it accessible? = 131 90 132 Yes . Nightly is fully internationalized and ready for translation into any language.91 Yes! Nightly is WCAG 2.1 compliant with keyboard navigation, screen reader support, and a high-contrast mode. 133 92 134 = Does it work with caching plugins? =93 = Does it collect any data? = 135 94 136 Yes. Nightly is compatible with all major caching plugins and CDNs.95 No. Nightly is 100% GDPR compliant with no external API calls or data collection. All settings are stored locally. 137 96 138 = Can I customize the toggle button design? =97 = How do I disable dark mode on specific pages? = 139 98 140 Yes. The plugin provides CSS custom properties for easy styling, and developers can override styles as needed.99 Use the "Dark Mode Settings" meta box in the post/page editor to disable dark mode for specific content. 141 100 142 101 == Screenshots == 143 102 144 1. **Admin Dashboard** - Clean, intuitive settings interface for both FSE and classic themes 145 2. **Floating Toggle** - Professional floating toggle in action on a live website 146 3. **Gutenberg Block** - Easy-to-use block editor integration with customization options 147 4. **Dark Mode Active** - Beautiful dark mode transformation of a typical WordPress site 148 5. **Mobile Responsive** - Perfect appearance and functionality on all device sizes 149 6. **Accessibility Features** - Keyboard navigation and screen reader compatibility in action 103 1. Admin dashboard with all settings 104 2. Six beautiful color theme options 105 3. Toggle button customization 106 4. Live preview of dark mode 107 5. Auto-scheduling settings 108 6. Custom color palette creator 109 7. Per-page dark mode control 110 8. Frontend toggle button on live site 150 111 151 112 == Changelog == 152 113 153 = 1.0.0 = 114 = 1.0.2 - 2025-02-04 = 115 * Added 6 color scheme variants (Classic, Cool, Warm, High Contrast, Pure Black, Custom) 116 * Added auto-scheduling with custom time ranges 117 * Added per-page dark mode control with meta boxes 118 * Added customizable keyboard shortcuts 119 * Added smooth transitions with adjustable duration 120 * Added individual media brightness controls (images, videos, backgrounds) 121 * Improved live preview with real-time updates 122 * Fixed toggle button icon visibility issues 123 * Performance optimizations 124 * WCAG 2.1 accessibility improvements 125 126 = 1.0.1 - 2025-01-15 = 154 127 * Initial release 155 * Gutenberg block for flexible toggle placement156 * Floating toggle with 4 position options157 * FSE and classic theme support158 * Admin dashboard with theme-specific interfaces159 * System preference detection160 * Accessibility compliance (WCAG 2.1 AA)161 * Performance optimizations162 * RTL language support163 * Mobile responsive design164 * localStorage preference persistence165 * Smooth transition animations166 * Multiple toggle synchronization167 128 168 129 == Upgrade Notice == 169 130 170 = 1.0.0 = 171 Initial release of Nightly - the professional dark mode solution for WordPress. Install now to give your visitors the modern dark mode experience they expect. 172 173 == Support == 174 175 Need help? We're here for you! 176 177 * **Documentation**: Comprehensive guides and examples 178 * **Support Forum**: Community support and troubleshooting 179 * **Developer Resources**: Hooks, filters, and customization guides 180 181 Visit [plugpress.io](https://plugpress.io/) for additional resources and premium support options. 182 183 == Privacy == 184 185 Nightly respects user privacy: 186 187 * No data is sent to external servers 188 * User preferences are stored locally in the browser 189 * No tracking or analytics 190 * GDPR compliant 191 * No cookies used 192 193 Your users' privacy is protected while they enjoy the dark mode experience. 131 = 1.0.2 = 132 Major update! Adds 6 color schemes, auto-scheduling, per-page control, keyboard shortcuts, and media brightness controls. Highly recommended upgrade. -
nightly/trunk/uninstall.php
r3345433 r3453782 1 1 <?php 2 2 /** 3 * Uninstall Nightly Plugin 4 * 5 * This file is executed when the plugin is uninstalled via the WordPress admin. 6 * It handles cleanup of all plugin data, options, and any other traces. 3 * Uninstall cleanup for Nightly. 7 4 * 8 5 * @package Nightly 9 * @since 1.0.010 6 */ 11 7 12 // Prevent direct access 13 if (!defined('WP_UNINSTALL_PLUGIN')) { 14 exit; 8 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 9 exit; 15 10 } 16 11 17 /** 18 * Clean up plugin data on uninstall 19 */ 20 function nightly_uninstall_cleanup() { 21 // Remove plugin options 22 delete_option('nightly_settings'); 23 24 // Remove any transients 25 delete_transient('nightly_cache'); 26 27 // Remove user meta (if we stored any user-specific preferences) 28 delete_metadata('user', 0, 'nightly_user_preference', '', true); 29 30 // Clean up any custom database tables (if we had any) 31 // Note: This plugin doesn't create custom tables, but this is where you'd clean them up 32 33 // Remove any uploaded files or directories (if any) 34 // This plugin doesn't create files, but this is where you'd clean them up 35 36 // Clear any cached data 37 wp_cache_flush(); 38 39 // Remove any scheduled cron jobs (if any) 40 wp_clear_scheduled_hook('nightly_cleanup_cron'); 41 } 12 require_once __DIR__ . '/includes/constants.php'; 13 require_once __DIR__ . '/includes/uninstall.php'; 42 14 43 /** 44 * Only run cleanup if this is a single site or if we're on the main site of a multisite 45 */ 46 if (!is_multisite()) { 47 // Single site cleanup 48 nightly_uninstall_cleanup(); 49 } else { 50 // Multisite cleanup - run for each site 51 global $wpdb; 52 53 $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); 54 $original_blog_id = get_current_blog_id(); 55 56 foreach ($blog_ids as $blog_id) { 57 switch_to_blog($blog_id); 58 nightly_uninstall_cleanup(); 59 } 60 61 switch_to_blog($original_blog_id); 62 63 // Clean up any network-wide options (if any) 64 delete_site_option('nightly_network_settings'); 65 } 15 Nightly\uninstall();
Note: See TracChangeset
for help on using the changeset viewer.