PluginProbe ʕ •ᴥ•ʔ
Website Open/Closed Toggle / 0.1
Website Open/Closed Toggle v0.1
trunk 0.1 0.2 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 0.3.9 0.3.9.1 0.3.9.2
website-openclosed-toggle / woct / woct-output.php
website-openclosed-toggle / woct Last commit date
css 10 years ago woct-activate.php 10 years ago woct-admin-menu.php 10 years ago woct-admin-settings.php 10 years ago woct-deactivate.php 10 years ago woct-miscellaneous.php 10 years ago woct-option.php 10 years ago woct-output.php 10 years ago
woct-output.php
58 lines
1 <?php
2
3 function rs_woct_set_bypass_sustain( $bypass_get_key ) {
4 if( session_status() == PHP_SESSION_NONE ) { session_start(); }
5 if( ( is_array( $_GET ) ) && ( empty( $_GET ) == FALSE ) ) {
6 if( $_GET[$bypass_get_key] == '1' ) { $_SESSION[$bypass_get_key] = 1; }
7 elseif( $_GET[$bypass_get_key] == 'unset' ) { unset( $_SESSION[$bypass_get_key] ); }
8 }
9 }
10
11 function rs_woct_output() {
12 if( ( !is_admin() ) && ( strpos( $_SERVER['REQUEST_URI'], 'wp-login' ) == FALSE ) ) {
13 $path = rs_woct_get_current_path();
14 $option = rs_woct_get_option();
15 $website_open = $option['website_open'];
16 $closed_message = $option['closed_message'];
17 $closed_html = $option['closed_html'];
18 $closed_html = str_replace( '&quot;', '"', str_replace( '&gt;', '>', str_replace( '&lt;', '<', $closed_html ) ) );
19 $bypass_paths = $option['bypass_paths'];
20 $bypass_paths = explode( "\n", $bypass_paths );
21 $bypass_get_key = $option['bypass_get_key'];
22 rs_woct_set_bypass_sustain( $option['bypass_get_key'] );
23 if( $website_open != 'yes' ) {
24 $proceed = 0;
25 if( is_user_logged_in() == TRUE ) {
26 $proceed = 1;
27 } elseif( $_SESSION[$bypass_get_key] == 1 ) {
28 $proceed = 1;
29 } elseif( ( is_array( $bypass_paths ) ) && ( !empty( $bypass_paths ) ) ) {
30 foreach( $bypass_paths as $key => $value ) {
31 if( $proceed != 1 ) {
32 if( $value == $path['path'] ) {
33 $proceed = 1;
34 }
35 }
36 }
37 }
38 if( $proceed != 1 ) {
39 $closed = get_stylesheet_directory().'/closed.php';
40 if( file_exists( $closed ) == TRUE ) {
41 include( $closed );
42 exit();
43 } elseif( $closed_html != '' ) {
44 echo stripslashes( ltrim( rtrim( $closed_html ) ) );
45 exit();
46 } else {
47 if( $closed_message != '' ) { $message = stripslashes( $closed_message ); }
48 else { $message = 'Website not found.'; }
49 $args = array( 'response' => 404 );
50 $title = rtrim( $message, "." ).' | '.get_bloginfo( 'name', 'display' );
51 wp_die( $message, $title, $args );
52 }
53 }
54 } else {
55 return;
56 }
57 }
58 }