PluginProbe ʕ •ᴥ•ʔ
LightStart – Maintenance Mode, Coming Soon and Landing Page Builder / 1.6.7
LightStart – Maintenance Mode, Coming Soon and Landing Page Builder v1.6.7
2.6.22 trunk 1.3 1.5.3 1.6.10 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.8.0 1.8.1 1.8.10 1.8.11 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2 2.2 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.6.0 2.6.1 2.6.10 2.6.11 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.18 2.6.19 2.6.2 2.6.20 2.6.21 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9
wp-maintenance-mode / wp-maintenance-mode.php
wp-maintenance-mode Last commit date
css 15 years ago js 15 years ago languages 15 years ago styles 15 years ago WP Maintenance Mode-da_DK.txt 15 years ago index.php 15 years ago license.txt 15 years ago readme.txt 15 years ago screenshot-1.png 15 years ago screenshot-10.png 15 years ago screenshot-11.png 15 years ago screenshot-12.png 15 years ago screenshot-13.png 15 years ago screenshot-2.png 15 years ago screenshot-3.png 15 years ago screenshot-4.png 15 years ago screenshot-5.png 15 years ago screenshot-6.png 15 years ago screenshot-7.png 15 years ago screenshot-8.png 15 years ago screenshot-9.png 15 years ago site.php 15 years ago uninstall.php 15 years ago wp-maintenance-mode.php 15 years ago
wp-maintenance-mode.php
998 lines
1 <?php
2 /**
3 * Plugin Name: WP Maintenance Mode
4 * Plugin URI: http://bueltge.de/wp-wartungsmodus-plugin/101/
5 * Text Domain: wp-maintenance-mode
6 * Domain Path: /languages
7 * Description: The plugin adds a splash page to your blog that lets visitors know your blog is down for maintenance. Logged in users get full access to the blog including the front-end, depends of the settings.
8 * Author: Frank B&uuml;ltge
9 * Author URI: http://bueltge.de/
10 * Donate URI: http://bueltge.de/wunschliste/
11 * Version: 1.6.7
12 * Last change: 05.01.2011
13 * Licence: GPL
14 */
15
16 /**
17 License:
18 ==============================================================================
19 Copyright 2009-2010 Frank Bueltge (email : frank@bueltge.de)
20
21 This program is free software; you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation; either version 2 of the License, or
24 (at your option) any later version.
25
26 This program is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 GNU General Public License for more details.
30
31 You should have received a copy of the GNU General Public License
32 along with this program; if not, write to the Free Software
33 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34
35 Requirements:
36 ==============================================================================
37 This plugin requires WordPress >= 2.6 and tested with PHP Interpreter >= 5.3.1
38 */
39
40 //avoid direct calls to this file, because now WP core and framework has been used
41 if ( !function_exists('add_action') ) {
42 header('Status: 403 Forbidden');
43 header('HTTP/1.1 403 Forbidden');
44 exit();
45 }
46
47 if ( !class_exists('WPMaintenanceMode') ) {
48
49 if ( !defined('WP_CONTENT_URL') )
50 define('WP_CONTENT_URL', site_url() . '/wp-content');
51 if ( !defined('WP_PLUGIN_URL') )
52 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' );
53
54 define( 'FB_WM_BASENAME', plugin_basename(__FILE__) );
55 define( 'FB_WM_BASEDIR', dirname( plugin_basename(__FILE__) ) );
56 define( 'FB_WM_BASE', rtrim (dirname (__FILE__), '/') );
57 define( 'FB_WM_TEXTDOMAIN', 'wp-maintenance-mode' );
58
59 class WPMaintenanceMode {
60
61 function WPMaintenanceMode() {
62 global $wp_version;
63
64 register_activation_hook( __FILE__, array(&$this, 'add_config') );
65 add_action( 'load-plugins.php', array(&$this, 'add_scripts') );
66 add_action( 'admin_init', array(&$this, 'admin_init') );
67 if ( version_compare( $wp_version, '2.7alpha', '>' ) ) {
68 add_action( 'after_plugin_row_' . FB_WM_BASENAME, array(&$this, 'add_config_form'), 10, 3);
69 add_filter( 'plugin_action_links_' . FB_WM_BASENAME, array(&$this, 'add_settings_link' ), 10, 2);
70 } else {
71 add_action( 'after_plugin_row', array(&$this, 'add_config_form'), 10, 3);
72 add_filter( 'plugin_action_links', array(&$this, 'add_settings_link' ), 10, 2 );
73 }
74 add_action( 'wp_ajax_wm_config-update', array(&$this, 'save_config' ) );
75 add_action( 'wp_ajax_wm_config-active', array(&$this, 'save_active' ) );
76 add_action( 'init', array(&$this, 'on_init'), 1 );
77 }
78
79
80 function esc_attr($text) {
81 if ( function_exists('esc_attr') )
82 $text = esc_attr($text);
83 else
84 $text = attribute_escape($text);
85
86 return $text;
87 }
88
89
90 // function for WP < 2.8
91 function get_plugins_url($path = '', $plugin = '') {
92
93 if ( function_exists('plugin_url') )
94 return plugins_url($path, $plugin);
95
96 if ( function_exists('is_ssl') )
97 $scheme = ( is_ssl() ? 'https' : 'http' );
98 else
99 $scheme = 'http';
100 if ( function_exists('plugins_url') )
101 $url = plugins_url();
102 else
103 $url = WP_PLUGIN_URL;
104 if ( 0 === strpos($url, 'http') ) {
105 if ( function_exists('is_ssl') && is_ssl() )
106 $url = str_replace( 'http://', "{$scheme}://", $url );
107 }
108
109 if ( !empty($plugin) && is_string($plugin) )
110 {
111 $folder = dirname(plugin_basename($plugin));
112 if ('.' != $folder)
113 $url .= '/' . ltrim($folder, '/');
114 }
115
116 if ( !empty($path) && is_string($path) && ( FALSE === strpos($path, '..') ) )
117 $url .= '/' . ltrim($path, '/');
118
119 return apply_filters('plugins_url', $url, $path, $plugin);
120 }
121
122
123 function on_init() {
124
125 load_plugin_textdomain( FB_WM_TEXTDOMAIN, FALSE, FB_WM_BASEDIR . '/languages' );
126
127 $valuemsqld = (int) get_option( FB_WM_TEXTDOMAIN . '-msqld' );
128
129 if ( 1 === $valuemsqld )
130 $this->on_active();
131 }
132
133
134 function add_scripts() {
135 global $current_user;
136
137 $locale = get_locale();
138
139 wp_enqueue_script( 'jquery-ui-datetimepicker', $this->get_plugins_url( 'js/ui.datetimepicker.js', __FILE__ ), array('jquery-ui-core') , 0.1, TRUE );
140 //wp_register_script( 'jquery-ui-datetimepicker-de', $this->get_plugins_url( 'js/de_DE.datetimepicker.js', __FILE__ ), array( 'jquery-ui-core', 'jquery-ui-datetimepicker' ) , 0.1, TRUE );
141 //if ( 'de_DE' === $locale )
142 // wp_enqueue_script( 'jquery-ui-core', 'jquery-ui-datetimepicker', 'jquery-ui-datetimepicker-de' );
143 add_action( 'admin_footer', array(&$this, 'add_script2admin_footer') );
144
145 wp_enqueue_style( 'jquery-ui-datepicker', $this->get_plugins_url( 'css/overcast/jquery-ui-1.7.2.custom.css', __FILE__ ) );
146
147 add_thickbox();
148 }
149
150
151 function admin_init() {
152
153 wp_enqueue_style( 'wp-maintenance-mode-options', $this->get_plugins_url( 'css/style.css', __FILE__ ) );
154 }
155
156
157 function add_settings_link( $links, $file ) {
158 array_unshift(
159 $links,
160 sprintf( '<a id="wm-pluginconflink" href="javascript:void(0)" title="Configure this plugin">%s</a>', __('Settings') )
161 );
162
163 return $links;
164 }
165
166
167 function add_script2admin_footer() {
168 ?>
169 <script type="text/javascript">
170 jQuery(document).ready( function($){
171
172 $('#wm-pluginconflink').click(function(s){$('#wm_config_row').slideToggle('fast'); });
173 $('#wm_config_active').click(function(){ wm_config_active(); });
174 $('#wm_config_submit').click(function(){ wm_config_update(); });
175 $("#wm_config-date").datetimepicker({ dateFormat: 'dd-mm-yy', timeFormat: ' hh:ii:ss' });
176
177 function wm_config_active(){
178
179 active_Val = $('#wm_config-active').val();
180 url = '<?php echo get_bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php';
181 $.post( url , {
182 "action" : "wm_config-active",
183 "wm_config-active" : active_Val
184 },
185 function(data) {
186 $('#wm_message_active, #wm_message_active2').show('fast').animate({opacity: 1.0}, 3000).hide('slow');
187 }
188 );
189 }
190
191 function wm_config_update(){
192
193 time_Val = $('#wm_config-time').val();
194 link_Val = $('#wm_config-link').val();
195 unit_Val = $('#wm_config-unit').val();
196 theme_Val = $('#wm_config-theme').val();
197 styleurl_Val = $('#wm_config-styleurl').val();
198 title_Val = $('#wm_config-title').val();
199 header_Val = $('#wm_config-header').val();
200 heading_Val = $('#wm_config-heading').val();
201 text_Val = $('#wm_config-text').val();
202 exclude_Val = $('#wm_config-exclude').val();
203 role_Val = $('#wm_config-role').val();
204 radio_Val = $('#wm_config-radio').val();
205 date_Val = $('#wm_config-date').val();
206 cd_day_Val = $('#wm_config-cd-day').val();
207 cd_month_Val = $('#wm_config-cd-month').val();
208 cd_year_Val = $('#wm_config-cd-year').val();
209 url = '<?php echo get_bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php';
210 $.post( url , {
211 "action" : "wm_config-update",
212 "wm_config-time" : time_Val,
213 "wm_config-unit" : unit_Val,
214 "wm_config-link" : link_Val,
215 "wm_config-theme" : theme_Val,
216 "wm_config-styleurl" : styleurl_Val,
217 "wm_config-title" : title_Val,
218 "wm_config-header" : header_Val,
219 "wm_config-heading" : heading_Val,
220 "wm_config-text" : text_Val,
221 "wm_config-exclude" : exclude_Val,
222 "wm_config-role" : role_Val,
223 "wm_config-radio" : radio_Val,
224 "wm_config-date" : date_Val,
225 "wm_config-cd-day" : cd_day_Val,
226 "wm_config-cd-month" : cd_month_Val,
227 "wm_config-cd-year" : cd_year_Val
228 },
229 function(data) {
230 $('#wm_message_update, #wm_message_update2').show('fast').animate({opacity: 1.0}, 3000).hide('slow');
231 }
232 );
233 return false;
234 }
235 });
236 </script>
237 <?php
238 }
239
240 /**
241 *
242 * @return
243 * @param $wm_pluginfile Object
244 * @param $wm_plugindata Object (array)
245 * @param $wm_context Object (all, active, inactive)
246 */
247 function add_config_form($wm_pluginfile, $wm_plugindata, $wm_context) {
248 global $wp_roles;
249
250 //if ( 0 < count($_POST['checked']) )
251 // return;
252
253 $value = get_option( FB_WM_TEXTDOMAIN );
254 ?>
255 <tr id="wm_config_tr" >
256 <td colspan="3">
257
258 <div id="wm_config_row" class="<?php echo ( isset($_GET['show']) && 'wmconfig' == $_GET['show'] ) ? '' : 'config_hidden' ;?>">
259 <div class="updated fade" id="wm_message_update" style="background-color: #FFFBCC;">
260 <p><?php echo sprintf( __( 'Plugin %s settings <strong>updated</strong>.', FB_WM_TEXTDOMAIN ), $wm_plugindata['Name'] ); ?></p>
261 </div>
262 <div class="error fade" id="wm_message_active" >
263 <p><?php echo sprintf( __( 'Plugin %s active status <strong>updated</strong>.', FB_WM_TEXTDOMAIN ), $wm_plugindata['Name'] ); ?></p>
264 </div>
265
266 <h4><?php _e( 'Plugin Activate', FB_WM_TEXTDOMAIN ); ?></h4>
267 <input type="hidden" name="wm_action" value="wm_config-active" />
268 <p>
269 <select name="wm_config-active" id="wm_config-active">
270 <option value="0"<?php if ( isset($value['active']) && 0 === $value['active'] ) { echo ' selected="selected"'; } ?>><?php _e('False', FB_WM_TEXTDOMAIN ); ?> </option>
271 <option value="1"<?php if ( isset($value['active']) && 1 === $value['active'] ) { echo ' selected="selected"'; } ?>><?php _e('True', FB_WM_TEXTDOMAIN ); ?> </option>
272 </select>
273 <input id="wm_config_active" type="button" value="<?php _e( 'Update', FB_WM_TEXTDOMAIN ); ?>" class="button-primary" />
274 </p>
275 <div class="plugin-update-tr">
276 <p id="wm_message_active2" class="update-message"><?php echo sprintf( __( 'Plugin %s active status <strong>updated</strong>.', FB_WM_TEXTDOMAIN ), $wm_plugindata['Name'] ); ?></p>
277 </div>
278
279 <h4><?php _e( 'Plugin Settings', FB_WM_TEXTDOMAIN ); ?></h4>
280 <input type="hidden" name="wm_action" value="wm_config-update" />
281
282 <table class="form-table">
283 <tr valign="top">
284 <th scope="row">
285 <label for="wm_config-radio"><?php _e( 'Countdown:', FB_WM_TEXTDOMAIN ); ?></label>
286 </th>
287 <td>
288 <select name="wm_config-radio" id="wm_config-radio">
289 <option value="0"<?php if ( isset($value['radio']) && 0 === $value['radio'] ) { echo ' selected="selected"'; } ?>><?php _e('False', FB_WM_TEXTDOMAIN ); ?> </option>
290 <option value="1"<?php if ( isset($value['radio']) && 1 === $value['radio'] ) { echo ' selected="selected"'; } ?>><?php _e('True', FB_WM_TEXTDOMAIN ); ?> </option>
291 </select>
292 </td>
293 </tr>
294 <tr valign="top">
295 <th scope="row">
296 <label for="wm_config-date" title="<?php _e( 'Click for datepicker', FB_WM_TEXTDOMAIN ); ?>"><?php _e( 'Date:', FB_WM_TEXTDOMAIN ); ?></label>
297 </th>
298 <td>
299 <input size="30" title="<?php _e( 'Click for datepicker', FB_WM_TEXTDOMAIN ); ?>" type="text" id="wm_config-date" name="wm_config-date" value="<?php if ( isset($value['date']) ) echo $value['date']; ?>" /><br />
300 <small><?php _e( 'Activate countdown for using this. Use value and unit or use the countdown and set the date.', FB_WM_TEXTDOMAIN ); ?></small>
301 </td>
302 </tr>
303 <tr valign="top">
304 <th scope="row" class="alternate">
305 <label for="wm_config-time"><?php _e( 'Value:', FB_WM_TEXTDOMAIN ); ?></label>
306 </th>
307 <td class="alternate">
308 <input size="5" type="text" id="wm_config-time" name="wm_config-time" value="<?php if( isset($value['time']) ) echo $value['time']; ?>" />
309 </td>
310 </tr>
311 <tr valign="top">
312 <th scope="row" class="alternate">
313 <label for="wm_config-unit"><?php _e( 'Unit:', FB_WM_TEXTDOMAIN ); ?></label>
314 </th>
315 <td class="alternate">
316 <select name="wm_config-unit" id="wm_config-unit">
317 <option value="0"<?php if ( isset($value['unit']) && 0 === $value['unit'] ) { echo ' selected="selected"'; } ?>><?php _e('second', FB_WM_TEXTDOMAIN ); ?> </option>
318 <option value="1"<?php if ( isset($value['unit']) && 1 === $value['unit'] ) { echo ' selected="selected"'; } ?>><?php _e('minute', FB_WM_TEXTDOMAIN ); ?> </option>
319 <option value="2"<?php if ( isset($value['unit']) && 2 === $value['unit'] ) { echo ' selected="selected"'; } ?>><?php _e('hour', FB_WM_TEXTDOMAIN ); ?> </option>
320 <option value="3"<?php if ( isset($value['unit']) && 3 === $value['unit'] ) { echo ' selected="selected"'; } ?>><?php _e('day', FB_WM_TEXTDOMAIN ); ?> </option>
321 <option value="4"<?php if ( isset($value['unit']) && 4 === $value['unit'] ) { echo ' selected="selected"'; } ?>><?php _e('week', FB_WM_TEXTDOMAIN ); ?> </option>
322 <option value="5"<?php if ( isset($value['unit']) && 5 === $value['unit'] ) { echo ' selected="selected"'; } ?>><?php _e('month', FB_WM_TEXTDOMAIN ); ?> </option>
323 <option value="6"<?php if ( isset($value['unit']) && 6 === $value['unit'] ) { echo ' selected="selected"'; } ?>><?php _e('year', FB_WM_TEXTDOMAIN ); ?> </option>
324 </select>
325 </td>
326 </tr>
327 <tr valign="top">
328 <th scope="row">
329 <label for="wm_config-link"><?php _e( 'Link:', FB_WM_TEXTDOMAIN ); ?></label>
330 </th>
331 <td>
332 <select name="wm_config-link" id="wm_config-link">
333 <option value="0"<?php if ( isset($value['link']) && 0 === $value['link'] ) { echo ' selected="selected"'; } ?>><?php _e('False', FB_WM_TEXTDOMAIN ); ?> </option>
334 <option value="1"<?php if ( isset($value['link']) && 1 === $value['link'] ) { echo ' selected="selected"'; } ?>><?php _e('True', FB_WM_TEXTDOMAIN ); ?> </option>
335 </select>
336 <br />
337 <small><?php _e( 'Please leave a link to the plugin- and design-author on your maintenance mode site.', FB_WM_TEXTDOMAIN ); ?></small>
338 </td>
339 </tr>
340 <tr valign="top">
341 <th scope="row" class="alternate">
342 <label for="wm_config-theme"><?php _e( 'Theme:', FB_WM_TEXTDOMAIN ); ?></label>
343 </th>
344 <td class="alternate">
345 <select name="wm_config-theme" id="wm_config-theme">
346 <option value="0"<?php if ( isset($value['theme']) && 0 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Own Style', FB_WM_TEXTDOMAIN ); ?> </option>
347 <option value="1"<?php if ( isset($value['theme']) && 1 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Simple Text', FB_WM_TEXTDOMAIN ); ?> </option>
348 <option value="2"<?php if ( isset($value['theme']) && 2 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('The Truck', FB_WM_TEXTDOMAIN ); ?> </option>
349 <option value="3"<?php if ( isset($value['theme']) && 3 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('The Sun', FB_WM_TEXTDOMAIN ); ?> </option>
350 <option value="4"<?php if ( isset($value['theme']) && 4 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('The FF Error', FB_WM_TEXTDOMAIN ); ?> </option>
351 <option value="5"<?php if ( isset($value['theme']) && 5 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Monster', FB_WM_TEXTDOMAIN ); ?> </option>
352 <option value="6"<?php if ( isset($value['theme']) && 6 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Chastely', FB_WM_TEXTDOMAIN ); ?> </option>
353 <option value="7"<?php if ( isset($value['theme']) && 7 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Only Typo', FB_WM_TEXTDOMAIN ); ?> </option>
354 <option value="8"<?php if ( isset($value['theme']) && 8 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Paint', FB_WM_TEXTDOMAIN ); ?> </option>
355 <option value="9"<?php if ( isset($value['theme']) && 9 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Animate (Flash)', FB_WM_TEXTDOMAIN ); ?> </option>
356 <option value="10"<?php if ( isset($value['theme']) && 10 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Damask', FB_WM_TEXTDOMAIN ); ?> </option>
357 <option value="11"<?php if ( isset($value['theme']) && 11 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Lego', FB_WM_TEXTDOMAIN ); ?> </option>
358 <option value="12"<?php if ( isset($value['theme']) && 12 === $value['theme'] ) { echo ' selected="selected"'; } ?>><?php _e('Chemistry', FB_WM_TEXTDOMAIN ); ?> </option>
359 </select>
360 </td>
361 </tr>
362 <tr valign="top">
363 <th scope="row" class="alternate">
364 <label for="wm_config-styleurl"><?php _e( 'Own Style URL (incl. http://):', FB_WM_TEXTDOMAIN ); ?></label>
365 </th>
366 <td class="alternate">
367 <input size="30" type="text" id="wm_config-styleurl" name="wm_config-styleurl" value="<?php if ( isset($value['styleurl']) ) echo $value['styleurl']; ?>" /> <small><?php _e( 'URL to the css-file', FB_WM_TEXTDOMAIN ); ?></small>
368 <br />
369 <small><?php _e( '<strong>Coution:</strong> Please don&acute;t copy the stylesheet in your plugin folder, it will be deleted on the next automatical update of the plugin!', FB_WM_TEXTDOMAIN ); ?></small>
370 </td>
371 </tr>
372 <tr valign="top">
373 <th scope="row" class="alternate">
374 <label for="wm_config-preview"><?php _e( 'Preview', FB_WM_TEXTDOMAIN ); ?></label>
375 </th>
376 <td class="alternate" style="padding:5px 0 0 0;">
377 <a onclick="return false;" href="<?php echo WP_PLUGIN_URL . '/' . FB_WM_BASEDIR; ?>/index.php?TB_iframe=true" class="thickbox button"><?php _e( 'Preview', FB_WM_TEXTDOMAIN ); ?></a>
378 </td>
379 </tr>
380 <tr valign="top">
381 <th scope="row">
382 <label for="wm_config-title"><?php _e( 'Title:', FB_WM_TEXTDOMAIN ); ?></label>
383 </th>
384 <td>
385 <input size="30" type="text" id="wm_config-title" name="wm_config-title" value="<?php if ( isset($value['title']) ) echo $value['title']; ?>" /> <small><?php _e( 'Leave empty for default.', FB_WM_TEXTDOMAIN ); ?></small>
386 </td>
387 </tr>
388 <tr valign="top">
389 <th scope="row" class="alternate">
390 <label for="wm_config-header"><?php _e( 'Header:', FB_WM_TEXTDOMAIN ); ?></label>
391 </th>
392 <td class="alternate">
393 <input size="30" type="text" id="wm_config-header" name="wm_config-header" value="<?php if ( isset($value['header']) ) echo $value['header']; ?>" /> <small><?php _e( 'Leave empty for default.', FB_WM_TEXTDOMAIN ); ?></small>
394 </td>
395 </tr>
396 <tr valign="top">
397 <th scope="row">
398 <label for="wm_config-heading"><?php _e( 'Heading:', FB_WM_TEXTDOMAIN ); ?></label>
399 </th>
400 <td>
401 <input size="30" type="text" id="wm_config-heading" name="wm_config-heading" value="<?php if ( isset($value['heading']) ) echo $value['heading']; ?>" /> <small><?php _e( 'Leave empty for default.', FB_WM_TEXTDOMAIN ); ?></small>
402 </td>
403 </tr>
404 <tr valign="top">
405 <th scope="row" class="alternate">
406 <label for="wm_config-text"><?php _e( 'Text:', FB_WM_TEXTDOMAIN ); ?></label>
407 </th>
408 <td class="alternate">
409 <textarea class="code" style="width: 95%;" cols="40" rows="4" name="wm_config-text" id="wm_config-text"><?php if ( isset($value['text']) ) echo esc_attr($value['text']); ?></textarea>
410 <br />
411 <small><?php _e( 'Use the first <em>%1$s</em> for the time value or countdown and second <em>%2$s</em> for the unit of the time or countdown-value; HTML and Shortcodes are possible', FB_WM_TEXTDOMAIN ); ?></small>
412 </td>
413 </tr>
414 <tr valign="top">
415 <th scope="row">
416 <label for="wm_config-exclude"><?php _e( 'Excludes:', FB_WM_TEXTDOMAIN ); ?></label>
417 </th>
418 <td>
419 <?php
420 if ( isset($value['exclude']) ) {
421 if ( 1 < count($value['exclude']) ) {
422 $value_exclude = join( ', ', $value['exclude'] );
423 } else {
424 $value_exclude = $value['exclude'];
425 }
426 } else {
427 $value_exclude = NULL;
428 }
429 ?>
430 <input size="30" type="text" id="wm_config-exclude" name="wm_config-exclude" value="<?php echo $value_exclude; ?>" />
431 <br />
432 <small><?php _e( 'Exclude feed, pages, posts or archives from the maintenance mode. Add the Slug of page or post as a comma-separated list.<br />Example:', FB_WM_TEXTDOMAIN ); ?> <code>wp-cron, feed, wp-admin, about, my-first-page, how-is-this-possible, category/test</code></small>
433 </td>
434 </tr>
435 <tr valign="top">
436 <th scope="row" class="alternate">
437 <label for="wm_config-role"><?php _e( 'Role:', FB_WM_TEXTDOMAIN ); ?></label>
438 </th>
439 <td class="alternate">
440 <select name="wm_config-role" id="wm_config-role">
441 <?php
442 // fallback
443 if ( !isset($value['role'][0]) )
444 $value['role'][0] = NULL;
445
446 foreach ( $wp_roles->roles as $role => $name ) {
447 if ( function_exists('translate_user_role') )
448 $role_name = translate_user_role( $name['name'] );
449 elseif ( function_exists('before_last_bar') )
450 $role_name = before_last_bar( $name['name'], 'User role' );
451 else
452 $role_name = strrpos( $name['name'], '|' );
453
454 if ($value['role'][0] !== $role)
455 $selected = '';
456 else
457 $selected = ' selected="selected"';
458 echo '<option value="' . $role . '"' . $selected . '>' . $role_name . ' (' . $role . ')' . ' </option>';
459 }
460 ?>
461 </select>
462 <small><?php _e( 'Allowed userrole to see the frontend of this blog.', FB_WM_TEXTDOMAIN ); ?>
463 <?php if ( is_multisite() ) { _e( 'Super Admin has always access.', FB_WM_TEXTDOMAIN ); } ?></small>
464 </td>
465 </tr>
466 </table>
467 <br />
468 <div class="plugin-update-tr">
469 <p id="wm_message_update2" class="update-message"><?php echo sprintf( __( 'Plugin %s settings <strong>updated</strong>.', FB_WM_TEXTDOMAIN ), $wm_plugindata['Name'] ); ?></p>
470 </div>
471 <p id="submitbutton">
472 <input id="wm_config_submit" type="button" value="<?php _e( 'Save', FB_WM_TEXTDOMAIN ); ?>" class="button-secondary" />
473 </p>
474 </div>
475
476 </td>
477 </tr>
478 <?php
479 }
480
481
482 function add_config() {
483
484 $this->data = array(
485 'active' => 0,
486 'radio' => 0,
487 'time' => 60,
488 'link' => 1,
489 'theme' => 1,
490 'role' => 'administrator',
491 'unit' => 1,
492 'title' => 'Maintenance mode',
493 'text' => '<p>Sorry for the inconvenience.<br />Our website is currently undergoing scheduled maintenance.<br /><strong>Please try back in %1$s %2$s</strong><br />Thank you for your understanding.</p>',
494 'exclude' => 'wp-cron, feed, wp-admin'
495 );
496 add_option( FB_WM_TEXTDOMAIN, $this->data );
497 add_option( FB_WM_TEXTDOMAIN . '-msqld', $this->data['active'] );
498
499 $old_check = get_option( 'wartungsmodus' );
500 if ($old_check)
501 delete_option( 'wartungsmodus' );
502 }
503
504
505 function save_active() {
506
507 $this->data = array();
508 $this->data = get_option( FB_WM_TEXTDOMAIN );
509 $this->datamsqld = get_option( FB_WM_TEXTDOMAIN . '-msqld' );
510
511 if ( isset($_POST['wm_config-active']) )
512 $this->data['active'] = (int) $_POST['wm_config-active'];
513
514 update_option( FB_WM_TEXTDOMAIN, $this->data );
515 update_option( FB_WM_TEXTDOMAIN . '-msqld', $this->data['active'] );
516
517 die( __( 'Updated', FB_WM_TEXTDOMAIN ) );
518 }
519
520
521 function save_config() {
522
523 $this->data = array();
524 $this->data = get_option( FB_WM_TEXTDOMAIN );
525
526 if ( isset($_POST['wm_config-time']) )
527 $this->data['time'] = (int) $_POST['wm_config-time'];
528 if ( isset($_POST['wm_config-unit']) )
529 $this->data['unit'] = (int) $_POST['wm_config-unit'];
530 if ( isset($_POST['wm_config-link']) )
531 $this->data['link'] = (int) $_POST['wm_config-link'];
532 if ( isset($_POST['wm_config-theme']) )
533 $this->data['theme'] = (int) $_POST['wm_config-theme'];
534 if ( isset($_POST['wm_config-styleurl']) ) {
535 if ( function_exists('esc_url') ) {
536 $this->data['styleurl'] = esc_url( $_POST['wm_config-styleurl'] );
537 } else {
538 $this->data['styleurl'] = clean_url( $_POST['wm_config-styleurl'] );
539 }
540 }
541 if ( isset($_POST['wm_config-title']) )
542 $this->data['title'] = stripslashes_deep( $_POST['wm_config-title'] );
543 if ( isset($_POST['wm_config-header']) )
544 $this->data['header'] = stripslashes_deep( $_POST['wm_config-header'] );
545 if ( isset($_POST['wm_config-heading']) )
546 $this->data['heading'] = stripslashes_deep( $_POST['wm_config-heading'] );
547 if ( isset($_POST['wm_config-text']) )
548 $this->data['text'] = stripslashes_deep( $_POST['wm_config-text'] );
549 if ( isset($_POST['wm_config-exclude']) )
550 $this->data['exclude'] = preg_split("/[\s,]+/", $this->esc_attr( $_POST['wm_config-exclude'] ) );
551 if ( isset($_POST['wm_config-role']) )
552 $this->data['role'] = preg_split("/[\s,]+/", $this->esc_attr( $_POST['wm_config-role'] ) );
553 if ( isset($_POST['wm_config-radio']) )
554 $this->data['radio'] = (int) $_POST['wm_config-radio'];
555 if ( isset($_POST['wm_config-date']) )
556 $this->data['date'] = $this->esc_attr( $_POST['wm_config-date'] );
557
558 update_option( FB_WM_TEXTDOMAIN, $this->data );
559
560 die( __( 'Updated', FB_WM_TEXTDOMAIN ) );
561 }
562
563
564 function del_config() {
565
566 delete_option( FB_WM_TEXTDOMAIN );
567 delete_option( FB_WM_TEXTDOMAIN . '-msqld' );
568 }
569
570
571 function check_version() {
572 global $wp_version;
573
574 if ( version_compare($wp_version, '2.1-dev', '<') ) {
575 require (ABSPATH . WPINC . '/pluggable-functions.php'); // < WP 2.1
576 } else {
577 require (ABSPATH . WPINC . '/pluggable.php'); // >= WP 2.1
578 }
579 }
580
581
582 function check_exclude() {
583 $value = get_option( FB_WM_TEXTDOMAIN );
584
585 if ( !isset($value['exclude']) )
586 return FALSE;
587
588 foreach ( (array) $value['exclude'] as $exclude ) {
589 if ( $exclude && strstr($_SERVER['REQUEST_URI'], $exclude) )
590 return TRUE;
591 }
592
593 return FALSE;
594 }
595
596
597 function check_role() {
598 $value = get_option( FB_WM_TEXTDOMAIN );
599
600 if ( is_super_admin() )
601 return TRUE;
602
603 if ( !isset( $value['role'][0] ) || ( '' != $value['role'][0] ) )
604 $role = 'manage_options';
605
606 $defaultroles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
607
608 if ( isset($value['role'][0]) ) {
609 if ( 'administrator' == $value['role'][0] )
610 $role = 'manage_options';
611
612 elseif ( 'editor' == $value['role'][0] )
613 $role = 'manage_categories';
614
615 elseif ( 'author' == $value['role'][0] )
616 $role = 'publish_posts';
617
618 elseif ( 'contributor' == $value['role'][0] )
619 $role = 'edit_posts';
620
621 elseif ( 'subscriber' == $value['role'][0] )
622 $role = 'read';
623
624 elseif ( !in_array( $value['role'][0], $defaultroles ) )
625 $role = 'manage_options';
626 } else {
627 $role = 'manage_options';
628 }
629
630 if ( current_user_can( $role ) )
631 return TRUE;
632
633 return FALSE;
634 }
635
636
637 function case_unit($unitvalue) {
638
639 $value['unit'] = $unitvalue;
640 $unitvalues = array();
641
642 switch( $value['unit'] ) {
643 case 0:
644 $unitvalues['unit'] = __( 'seconds', FB_WM_TEXTDOMAIN );
645 $unitvalues['multiplier'] = 1;
646 break;
647 case 1:
648 $unitvalues['unit'] = __( 'minutes', FB_WM_TEXTDOMAIN );
649 $unitvalues['multiplier'] = 60;
650 break;
651 case 2:
652 $unitvalues['unit'] = __( 'hours', FB_WM_TEXTDOMAIN );
653 $unitvalues['multiplier'] = 3600;
654 break;
655 case 3:
656 $unitvalues['unit'] = __( 'days', FB_WM_TEXTDOMAIN );
657 $unitvalues['multiplier'] = 86400;
658 break;
659 case 4:
660 $unitvalues['unit'] = __( 'weeks', FB_WM_TEXTDOMAIN );
661 $unitvalues['multiplier'] = 604800;
662 break;
663 case 5:
664 $unitvalues['unit'] = __( 'months', FB_WM_TEXTDOMAIN );
665 $unitvalues['multiplier'] = 2592000; // 30 days
666 break;
667 case 6:
668 $unitvalues['unit'] = __( 'years', FB_WM_TEXTDOMAIN );
669 $unitvalues['multiplier'] = 31556952;
670 break;
671 }
672
673 return $unitvalues;
674 }
675
676
677 function check_datetime() {
678
679 $datetime = NULL;
680 $time = NULL;
681 $date = NULL;
682 $value = get_option( FB_WM_TEXTDOMAIN );
683
684 if ( isset($value['radio']) && 1 === $value['radio'] ) {
685 $datetime = explode( ' ', $value['date'] );
686 $date = explode( '-', $datetime[0] );
687 if ( isset($datetime[1]) )
688 $time = explode( ':', $datetime[1] );
689 else $time = 0;
690 if (count($date) < 3) {
691 $date = 0; //ausschalten wegen datum is nicht
692 } else {
693 $date[1] = $date[1] - 1;
694 if (count($time) < 3)
695 $time = 0;
696 if ( isset($time) && 0 !== $time ) {
697 // 'Years', 'Months', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds'
698 $date = $date[2].', '.$date[1].', '.$date[0].', '.$time[0].', '.$time[1].', '.$time[2];
699 } else {
700 $date = $date[2].', '.$date[1].', '.$date[0];
701 }
702 }
703 }
704
705 return array( $datetime, $time, $date );
706 }
707
708
709 function on_active() {
710 global $current_user;
711
712 $value = get_option( FB_WM_TEXTDOMAIN );
713
714 $message = __( 'Caution: Maintenance mode is <strong>active</strong>!', FB_WM_TEXTDOMAIN );
715 add_filter( 'login_message', create_function( '', "return '<div id=\"login_error\">$message</div>';" ) );
716 $admin_notices = '<div id="message" class="error fade" style="background-color: #FFEBE8 !important;"><p>' . $message . ' <a href="plugins.php#wm-pluginconflink">' . __( 'Deactivate or change Settings', FB_WM_TEXTDOMAIN ) . '</a></p></div>';
717 add_action( 'admin_notices', create_function( '', "echo '$admin_notices';" ) );
718 $in_admin_header = '<a id="mm_in_admin_header" href="plugins.php#wm-pluginconflink" title="' . __( 'Deactivate or change Settings', FB_WM_TEXTDOMAIN ) . '">' . $message . '</a>';
719 add_action( 'in_admin_header', create_function( '', "echo '$in_admin_header';" ) );
720 /**
721 // actual a ticket in trac #14126
722 // @link http://core.trac.wordpress.org/ticket/14126
723 $in_admin_header = '<a class="privacy-on-link" href="plugins.php#wm-pluginconflink" title="' . __( 'Deactivate or change Settings', FB_WM_TEXTDOMAIN ) . '">' . $message . '</a>';
724 add_action( 'in_admin_site_heading', create_function( '', "echo '$in_admin_header';" ) );
725 */
726
727 add_action( 'wm_head', array(&$this, 'add_theme') );
728 add_action( 'wm_content', array(&$this, 'add_flash') );
729 add_action( 'wm_content', array( &$this, 'add_content' ) );
730 if ( isset($value['link']) && 1 === $value['link'] )
731 add_action( 'wm_footer', array(&$this, 'add_link') );
732
733 $locale = get_locale();
734
735 if ( isset($value['unit']) )
736 $unitvalues = $this->case_unit($value['unit']);
737
738 // set backtime for header status
739 if ( isset($value['time']) )
740 $backtime = $value['time'] * $unitvalues['multiplier'];
741 else
742 $backtime = NULL;
743
744 if ( ( !$this->check_role() )
745 && !strstr($_SERVER['PHP_SELF'], 'wp-login.php' )
746 && !strstr($_SERVER['PHP_SELF'], 'async-upload.php')
747 && !strstr($_SERVER['PHP_SELF'], '/plugins/')
748 && !$this->check_exclude()
749 ) {
750 $rolestatus = 'norights';
751 nocache_headers();
752 header("HTTP/1.0 503 Service Unavailable");
753 header("Retry-After: $backtime");
754 include('site.php');
755 exit();
756 }
757
758 //$this->check_version();
759 if ( !strstr($_SERVER['PHP_SELF'], 'feed/')
760 && !strstr($_SERVER['PHP_SELF'], 'wp-admin/')
761 && !strstr($_SERVER['PHP_SELF'], 'wp-login.php')
762 && !strstr($_SERVER['PHP_SELF'], 'async-upload.php')
763 && !( strstr($_SERVER['PHP_SELF'], 'upgrade.php') && $this->check_role() )
764 && !strstr($_SERVER['PHP_SELF'], 'trackback/')
765 && !strstr($_SERVER['PHP_SELF'], '/plugins/')
766 && !$this->check_exclude()
767 && !$this->check_role()
768 ) {
769 include('site.php');
770 exit();
771 } else if ( strstr($_SERVER['PHP_SELF'], 'feed/') || strstr($_SERVER['PHP_SELF'], 'trackback/') ) {
772 nocache_headers();
773 header("HTTP/1.0 503 Service Unavailable");
774 header("Retry-After: $backtime");
775 exit();
776 }
777
778 }
779
780
781 function add_link() {
782
783 $value = get_option( FB_WM_TEXTDOMAIN );
784 ?>
785 <div id="footer">
786 <p><a href="http://bueltge.de/"><?php _e( 'Plugin by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://bueltge.de/favicon.ico" alt="bueltge.de" width="16" height="16" /></a>
787 <?php if ( 2 === $value['theme'] ) { ?>
788 &nbsp;<a href="http://davidhellmann.com/"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://davidhellmann.com/favicon.ico" alt="davidhellmann.com" width="16" height="16" /></a>
789 <?php } elseif ( 3 === $value['theme'] ) { ?>
790 &nbsp;<a href="http://www.mynicki.net"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://www.mynicki.net/favicon.ico" alt="mynicki.net" width="16" height="16" /></a>
791 <?php } elseif ( 4 === $value['theme'] ) { ?>
792 &nbsp;<a href="http://www.lokalnetz.com"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://www.lokalnetz.com/images/favicon.ico" alt="lokalnetz.com" width="16" height="16" /></a>
793 <?php } elseif ( 5 === $value['theme'] ) { ?>
794 &nbsp;<a href="http://www.backseatsurfer.de"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://www.backseatsurfer.de/favicon.ico" alt="backseatsurfer.de" width="16" height="16" /></a>
795 <?php } elseif ( 6 === $value['theme'] ) { ?>
796 &nbsp;<a href="http://fv-web.de/"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://fv-web.de/favicon.ico" alt="fv-web.de" width="16" height="16" /></a>
797 <?php } elseif ( 7 === $value['theme'] ) { ?>
798 &nbsp;<a href="http://krautsuppe.de/"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://krautsuppe.de/favicon.ico" alt="krautsuppe.de" width="16" height="16" /></a>
799 <?php } elseif ( 8 === $value['theme'] ) { ?>
800 &nbsp;<a href="http://www.bugeyes.de/"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://www.bugeyes.de/favicon.ico" alt="www.bugeyes.de" width="16" height="16" /></a>
801 <?php } elseif ( 9 === $value['theme'] ) { ?>
802 &nbsp;<a href="http://www.cayou-media.de/"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://www.cayou-media.de/favicon.ico" alt="www.cayou-media.de" width="16" height="16" /></a>
803 <?php } elseif ( 10 === $value['theme'] ) { ?>
804 &nbsp;<a href="http://fabianletscher.de/"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://fabianletscher.de/favicon.ico" alt="fabianletscher.de" width="16" height="16" /></a>
805 <?php } elseif ( 11 === $value['theme'] ) { ?>
806 &nbsp;<a href="http://www.blogdrauf.de/"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://www.blogdrauf.de/favicon.ico" alt="www.blogdrauf.de" width="16" height="16" /></a>
807 <?php } elseif ( 12 === $value['theme'] ) { ?>
808 &nbsp;<a href="http://www.elmastudio.de/"><?php _e( 'Design by:', FB_WM_TEXTDOMAIN ); ?> <img src="http://www.elmastudio.de/favicon.ico" alt="www.elmastudio.de" width="16" height="16" /></a>
809 <?php } ?>
810 </p>
811 </div>
812 <?php
813 }
814
815
816 function add_theme() {
817
818 $locale = get_locale();
819 $value = get_option( FB_WM_TEXTDOMAIN );
820
821 $theme = '';
822 $link = '';
823 $style = '';
824 // default theme
825 if ( !isset($value['theme']) )
826 $value['theme'] = 1;
827
828 switch( $value['theme'] ) {
829 case 0:
830 if ( $value['styleurl'] )
831 $style = '<link rel="stylesheet" href="' . $value['styleurl'] . '" type="text/css" media="all" />' ."\n";
832 break;
833 case 1:
834 $theme = 'txt.css';
835 break;
836 case 2:
837 $theme = 'dh.css';
838 $style .= ' <style type="text/css">' . "\n" . '<!--';
839 $style .= ' #content h1 { text-indent: -99999px; background: url(\'' . $this->get_plugins_url( '/styles/images/headline-' . $locale . '.jpg', __FILE__) . '\') no-repeat; }' . "\n";
840 $style .= ' -->' . "\n";
841 $style .= ' </style>';
842 break;
843 case 3:
844 $theme = 'nicki.css';
845 break;
846 case 4:
847 $theme = 'ln.css';
848 break;
849 case 5:
850 $theme = 'monster.css';
851 break;
852 case 6:
853 $theme = 'fv.css';
854 break;
855 case 7:
856 $theme = 'ks.css';
857 break;
858 case 8:
859 $theme = 'be.css';
860 break;
861 case 9:
862 $theme = 'cm.css';
863 break;
864 case 10:
865 $theme = 'fl.css';
866 break;
867 case 11:
868 $theme = 'af.css';
869 $style .= ' <style type="text/css">' . "\n" . '<!--';
870 $style .= ' #content h1 { text-indent: -99999px; background: url(\'' . $this->get_plugins_url( 'styles/images/headline-af-' . $locale . '.jpg\') no-repeat; }', __FILE__ ) . "\n";
871 $style .= ' -->' . "\n";
872 $style .= ' </style>';
873 break;
874 case 12:
875 $theme = 'es.css';
876 break;
877 }
878 $link = '<link rel="stylesheet" href="' . $this->get_plugins_url( 'styles/', __FILE__ ) . $theme . '" type="text/css" media="all" />' ."\n";
879 echo $link . $style;
880 }
881
882
883 function add_flash() {
884
885 $locale = get_locale();
886 $value = get_option( FB_WM_TEXTDOMAIN );
887
888 $flash = '';
889 $object = '';
890 // default theme
891 if ( !isset($value['theme']) )
892 $value['theme'] = 1;
893
894 switch( $value['theme'] ) {
895 case 9:
896 $flash = FB_WM_BASE . '/styles/wartung-' . $locale . '.swf';
897 if ( file_exists($flash) ) {
898 $flash = $flash;
899 } else {
900 $flash = $this->get_plugins_url( 'styles/', __FILE__ ) . 'wartung.swf';
901 }
902
903 $object = '
904 <object type="application/x-shockwave-flash" data="' . $flash . '" width="800" height="600" id="galerie" style="outline:none;">
905 <param name="wmode" value="transparent" />
906 <param name="movie" value="' . $flash . '" />
907 </object>';
908 break;
909 }
910 echo $object;
911 }
912
913
914 function add_content() {
915
916 $locale = get_locale();
917 $value = get_option( FB_WM_TEXTDOMAIN );
918 $echo = NULL;
919 // default for unit
920 if ( !isset($value['unit']) )
921 $value['unit'] = NULL;
922
923 $unitvalues = $this->case_unit($value['unit']);
924 $td = $this->check_datetime();
925
926 if ( isset($value['radio']) && 1 === $value['radio'] && 0 !== $td[2] ) {
927 $echodate = $td[0][0];
928 if ('de_DE' == $locale)
929 $echodate = str_replace('-', '.', $td[0][0]);
930 if ( 0 !== $td[1] )
931 $echodate .= ' ' . $td[0][1];
932 $echo = sprintf( stripslashes_deep( $value['text']), '<br /><span id="countdown"></span>', $echodate );
933 } elseif ( isset($value['text']) && isset($value['time']) ) {
934 $echo = sprintf( stripslashes_deep( $value['text'] ), $value['time'], $unitvalues['unit'] );
935 }
936
937 echo do_shortcode($echo);
938 }
939
940
941 function check_file($url) {
942
943 $url = parse_url($url);
944 $fp = fsockopen($url['host'], 80, $errno, $errstr, 30);
945
946 if (!$fp) {
947 echo $errstr . ' (' . $errno . ')<br />'. "\n";
948 } else {
949 $httpRequest = 'HEAD ' . $url['path'] . ' HTTP/1.1' . "\r\n"
950 . 'Host: ' . $url['host'] ."\r\n"
951 . 'Connection: close'. "\r\n\r\n";
952
953 fputs($fp, $httpRequest);
954 $zeileeins = fgets($fp, 1024);
955 fclose($fp);
956
957 if ( eregi('200 OK', $zeileeins) ) {
958 return TRUE;
959 } else {
960 return FALSE;
961 }
962 }
963 }
964
965
966 function url_exists($url) {
967 if ( (strpos($url, "http")) === FALSE ) $url = "http://" . $url;
968 if ( is_array(@get_headers($url)) )
969 return TRUE;
970 else
971 return FALSE;
972 }
973
974 } // end class
975
976 /**
977 * Template tag to use in site-template
978 */
979 function wm_head() {
980
981 do_action('wm_head');
982 }
983
984 function wm_content() {
985
986 do_action('wm_content');
987 }
988
989 function wm_footer() {
990
991 do_action('wm_footer');
992 }
993
994 $GLOBALS['WPMaintenanceMode'] = new WPMaintenanceMode();
995 }
996
997 ?>
998