siteguard-admin-filter.php
11 years ago
siteguard-base.php
11 years ago
siteguard-captcha.php
11 years ago
siteguard-config.php
11 years ago
siteguard-disable-pingback.php
11 years ago
siteguard-htaccess.php
11 years ago
siteguard-login-alert.php
11 years ago
siteguard-login-history.php
11 years ago
siteguard-login-lock.php
11 years ago
siteguard-rename-login.php
11 years ago
siteguard-updates-notify.php
11 years ago
siteguard-waf-exclude-rule.php
11 years ago
siteguard-base.php
73 lines
| 1 | <?php |
| 2 | |
| 3 | function siteguard_error_log( $message ) { |
| 4 | $logfile = SITEGUARD_PATH . 'error.log'; |
| 5 | $f = @fopen( $logfile, 'a+' ); |
| 6 | if ( false != $f ) { |
| 7 | fwrite( $f, date_i18n( 'Y/m/d H:i:s:' ) . $message . "\n" ); |
| 8 | fclose( $f ); |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | function siteguard_error_dump( $title, $obj ) { |
| 13 | ob_start(); |
| 14 | var_dump( $obj ); |
| 15 | $msg = ob_get_contents( ); |
| 16 | ob_end_clean( ); |
| 17 | siteguard_error_log( "$title: $msg" ); |
| 18 | } |
| 19 | |
| 20 | function check_multisite( ) { |
| 21 | if ( ! is_multisite() ) { |
| 22 | return true; |
| 23 | } |
| 24 | $message = esc_html__( 'It does not support the multisite function of WordPress.', 'siteguard' ); |
| 25 | $error = new WP_Error( 'siteguard', $message ); |
| 26 | return $error; |
| 27 | } |
| 28 | |
| 29 | class SiteGuard_Base { |
| 30 | function __construct() { |
| 31 | } |
| 32 | function is_switch_value( $value ) { |
| 33 | if ( '0' == $value || '1' == $value ) { |
| 34 | return true; |
| 35 | } |
| 36 | return false; |
| 37 | } |
| 38 | function check_module( $name, $default = false ) { |
| 39 | return true; |
| 40 | # It does not work WP-CLI |
| 41 | #if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) { |
| 42 | # return ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== false); |
| 43 | #} else { |
| 44 | # return $default; |
| 45 | #} |
| 46 | |
| 47 | # It does not work in FastCGI well. |
| 48 | #$module = 'mod_' . $name; |
| 49 | #return apache_mod_loaded( $module, $default ); |
| 50 | #if ( function_exists('phpinfo') ) { |
| 51 | # ob_start( ); |
| 52 | # phpinfo(8); |
| 53 | # $phpinfo = ob_get_clean( ); |
| 54 | # if ( false !== strpos( $phpinfo, $module ) ) { |
| 55 | # return true; |
| 56 | # } |
| 57 | #} |
| 58 | #return $default; |
| 59 | } |
| 60 | function is_active_plugin( $plugin ) { |
| 61 | if ( function_exists( 'is_plugin_active' ) ) { |
| 62 | return is_plugin_active( $plugin ); |
| 63 | } else { |
| 64 | return in_array( |
| 65 | $plugin, |
| 66 | get_option( 'active_plugins' ) |
| 67 | ); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | ?> |
| 73 |