Changeset 2209421
- Timestamp:
- 12/10/2019 04:24:42 PM (6 years ago)
- Location:
- wpsimpletools-maintenance-mode/trunk
- Files:
-
- 2 added
- 2 deleted
- 3 edited
-
languages/wpsimpletools-maintenance-it_IT.mo (added)
-
languages/wpsimpletools-maintenance-it_IT.po (added)
-
languages/wpst_m-it_IT.mo (deleted)
-
languages/wpst_m-it_IT.po (deleted)
-
maintenance.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
wpsimpletools-maintenance.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpsimpletools-maintenance-mode/trunk/maintenance.php
r1910318 r2209421 31 31 <body> 32 32 <article> 33 <h1><?php _e('We\'ll be back soon!', 'wps t_m');?></h1>33 <h1><?php _e('We\'ll be back soon!', 'wpsimpletools-maintenance');?></h1> 34 34 <div> 35 35 <p> 36 <?php _e('Sorry for the inconvenience but we\'re performing some maintenance at the moment.', 'wps t_m');?><br />37 <?php _e('We\'ll be back online shortly!', 'wps t_m');?>36 <?php _e('Sorry for the inconvenience but we\'re performing some maintenance at the moment.', 'wpsimpletools-maintenance');?><br /> 37 <?php _e('We\'ll be back online shortly!', 'wpsimpletools-maintenance');?> 38 38 </p> 39 39 <p>— <?php bloginfo('name') ?></p> -
wpsimpletools-maintenance-mode/trunk/readme.txt
r2197434 r2209421 6 6 Requires PHP: 5.0.0 7 7 Tested up to: 5.3 8 Stable tag: 1. 0.58 Stable tag: 1.1.0 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 37 37 1.0.5 WP 5.3 supported 38 38 39 = 1.1.0 = 40 New settings page 41 39 42 == Frequently Asked Questions == 40 43 No FAQ yet... pls ask :) … … 53 56 = 1.0.5 = 54 57 1.0.5 WP 5.3 supported 58 = 1.1.0 = 59 New settings page 55 60 56 61 == Screenshots == -
wpsimpletools-maintenance-mode/trunk/wpsimpletools-maintenance.php
r2197434 r2209421 6 6 * Author: WpSimpleTools 7 7 * Author URI: https://profiles.wordpress.org/wpsimpletools/#content-plugins 8 * Version: 1. 0.48 * Version: 1.1.0 9 9 * Plugin Slug: wpsimpletools-maintenance 10 * Text Domain: wps t_m10 * Text Domain: wpsimpletools-maintenance 11 11 */ 12 12 if (! defined('ABSPATH')) { … … 17 17 function wpst_m_init() { 18 18 19 load_plugin_textdomain('wps t_m', false, basename(dirname(__FILE__)) . '/languages/');19 load_plugin_textdomain('wpsimpletools-maintenance', false, basename(dirname(__FILE__)) . '/languages/'); 20 20 } 21 21 add_action('plugins_loaded', 'wpst_m_init'); … … 26 26 $enabled = esc_attr(get_option('enabled')); 27 27 $redirect_url = esc_attr(get_option('url')); 28 $maintenancePage = esc_attr(get_option('maintenancePage')); 28 29 29 30 ?> 31 32 33 <script type="text/javascript"> 34 35 jQuery(function($) { 36 37 $('select#enabled').on('change', function() { 38 manageForm() 39 }); 40 41 $('select#maintenancePage').on('change', function() { 42 manageForm() 43 }); 44 45 function manageForm(){ 46 47 var enabled = $('select#enabled').val(); 48 console.log('enabled: ' + enabled); 49 50 var maintenancePage = $('select#maintenancePage').val(); 51 console.log('maintenancePage: ' + maintenancePage); 52 53 if(enabled > 0){ 54 $('select#maintenancePage').prop('disabled', false); 55 if(maintenancePage == 'CUSTOM') 56 $('input#url').prop('disabled', false); 57 else 58 $('input#url').prop('disabled', true); 59 }else{ 60 $('select#maintenancePage').prop('disabled', true); 61 $('input#url').prop('disabled', true); 62 } 63 64 } 65 66 // onload 67 manageForm(); 68 69 }); 70 71 </script> 30 72 31 73 <div class="wrap"> … … 37 79 <table class="form-table"> 38 80 <tr valign="top"> 39 <th scope="row"><?php _e('Enabled', 'wps t_m');?></th>40 <td><select name="enabled" >81 <th scope="row"><?php _e('Enabled', 'wpsimpletools-maintenance');?></th> 82 <td><select name="enabled" id="enabled"> 41 83 <option <?php if(!$enabled) { echo 'selected="selected" '; } ?> value="0">No</option> 42 84 <option <?php if($enabled) { echo 'selected="selected" '; } ?> value="1" style="color: red;">Yes</option> … … 44 86 </tr> 45 87 <tr valign="top"> 46 <th scope="row"><?php _e('URL', 'wpst_m');?></th> 47 <td><input type="text" name="url" value="<?php echo $redirect_url ?>" /> 48 <p class="description" id="tagline-description"><?php _e('If empty, default maintenance page will be shown', 'wpst_m');?></p></td> 88 <th scope="row"><?php _e('Maintenance mode page', 'wpsimpletools-maintenance');?></th> 89 <td><select name="maintenancePage" id="maintenancePage"> 90 <option <?php if($maintenancePage == 'DEFAULT') { echo 'selected="selected" '; } ?> value="DEFAULT">Default page</option> 91 <option <?php if($maintenancePage == 'CUSTOM') { echo 'selected="selected" '; } ?> value="CUSTOM">Custom URL</option> 92 </select></td> 93 </tr> 94 <tr valign="top"> 95 <th scope="row"><?php _e('URL', 'wpsimpletools-maintenance');?></th> 96 <td><input type="text" name="url" id="url" value="<?php echo $redirect_url ?>" size="40" /></td> 49 97 </tr> 50 98 </table> … … 58 106 59 107 if (function_exists('add_options_page')) 60 add_options_page(__('Maintenance mode', 'wps t_m'), __('Maintenance mode', 'wpst_m'), 'manage_options', 'opts.php', 'wpst_m_options_page_body');108 add_options_page(__('Maintenance mode', 'wpsimpletools-maintenance'), __('Maintenance mode', 'wpsimpletools-maintenance'), 'manage_options', 'opts.php', 'wpst_m_options_page_body'); 61 109 } 62 110 … … 64 112 65 113 register_setting('wpsimpletools-manteinance', 'enabled'); 114 register_setting('wpsimpletools-manteinance', 'maintenancePage'); 66 115 register_setting('wpsimpletools-manteinance', 'url'); 67 116 } … … 71 120 $enabled = esc_attr(get_option('enabled')); 72 121 $redirect_url = esc_attr(get_option('url')); 122 $maintenancePage = esc_attr(get_option('maintenancePage')); 73 123 74 124 $url_parts = explode('/', $_SERVER['REQUEST_URI']); 75 125 76 if ($enabled) 126 echo $_SERVER['REQUEST_URI']; 127 128 if ($enabled){ 129 77 130 if (in_array('wp-admin', $url_parts)) { 131 78 132 // admin - no redirect 133 134 }else if (current_user_can('manage_options')) { 135 136 // user is logged - no redirect 137 79 138 } else if (in_array('wpsimpletools-maintenance', $url_parts)) { 139 80 140 // maintenance page - no redirect 81 } else { 82 if (current_user_can('manage_options')) { 83 // user is logged - no redirect 84 } else { 85 86 if (empty($redirect_url) || $redirect_url == '') { 87 // no redirect url -> default maintenance page 88 include 'maintenance.php'; 89 exit(); 90 } else { 91 // redirect 92 header('Location: ' . esc_attr(get_option('url'))); 93 die(); 94 } 95 } 141 142 }else if($maintenancePage == 'CUSTOM'){ 143 144 // redirect 145 header('Location: ' . $redirect_url); 146 die(); 147 148 }else{ 149 150 // default page 151 include 'maintenance.php'; 152 exit(); 96 153 } 154 155 } 97 156 } 98 157 … … 102 161 if ($enabled) { 103 162 $class = 'notice notice-error'; 104 $message = __('Maintenance mode is active!', 'wps t_m');163 $message = __('Maintenance mode is active!', 'wpsimpletools-maintenance'); 105 164 printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class), esc_html($message)); 106 165 } … … 113 172 114 173 function wpst_m_deactivation() { 115 116 // Welp, I've been deactivated - are there some things I should clean up? 174 delete_option('enabled'); 175 delete_option('maintenancePage'); 176 delete_option('url'); 117 177 } 118 178
Note: See TracChangeset
for help on using the changeset viewer.