| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Log file to know more about users website environment. |
| 5 |
* helps in debugging and providing support. |
| 6 |
* |
| 7 |
* @package LoginPress |
| 8 |
* @since 1.0.19 |
| 9 |
*/ |
| 10 |
|
| 11 |
class LoginPress_Log_Info { |
| 12 |
|
| 13 |
/** |
| 14 |
* Returns the plugin & system information. |
| 15 |
* @access public |
| 16 |
* @return string |
| 17 |
*/ |
| 18 |
public static function get_sysinfo() { |
| 19 |
|
| 20 |
global $wpdb; |
| 21 |
$loginpress_setting = get_option( 'loginpress_setting' ); |
| 22 |
$loginpress_config = get_option( 'loginpress_customization' ); |
| 23 |
$session_expiration = ( isset( $loginpress_setting['session_expiration'] ) && '0' != $loginpress_setting['session_expiration'] ) ? $loginpress_setting['session_expiration'] . ' Seconds' : 'Not Set'; |
| 24 |
$login_with_email = isset( $loginpress_setting['login_with_email'] ) ? $loginpress_setting['login_with_email'] : 'off'; |
| 25 |
$customization = isset( $loginpress_config ) ? print_r( $loginpress_config, true ) : 'No customization yet'; |
| 26 |
|
| 27 |
$html = '### Begin System Info ###' . "\n\n"; |
| 28 |
|
| 29 |
// Basic site info |
| 30 |
$html .= '-- WordPress Configuration --' . "\n\n"; |
| 31 |
$html .= 'Site URL: ' . site_url() . "\n"; |
| 32 |
$html .= 'Home URL: ' . home_url() . "\n"; |
| 33 |
$html .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; |
| 34 |
$html .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; |
| 35 |
$html .= 'Language: ' . get_locale() . "\n"; |
| 36 |
$html .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . "\n"; |
| 37 |
$html .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; |
| 38 |
$html .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; |
| 39 |
|
| 40 |
// Plugin Configuration |
| 41 |
$html .= "\n" . '-- LoginPress Configuration --' . "\n\n"; |
| 42 |
$html .= 'Plugin Version: ' . LOGINPRESS_VERSION . "\n"; |
| 43 |
$html .= 'Expiration: ' . $session_expiration . "\n"; |
| 44 |
$html .= 'Force Login with Email: ' . $login_with_email . "\n"; |
| 45 |
$html .= 'Total Customized Fields: ' . count( $loginpress_config ) . "\n"; |
| 46 |
$html .= 'Customization Detail: ' . $customization . "\n"; |
| 47 |
|
| 48 |
// Pro Plugin Configuration |
| 49 |
if ( class_exists( 'LoginPress_Pro' ) ) { |
| 50 |
|
| 51 |
$enable_repatcha = ( isset( $loginpress_setting['enable_repatcha'] ) ) ? $loginpress_setting['enable_repatcha'] : 'Off'; |
| 52 |
$loginpress_preset = get_option( 'customize_presets_settings', 'default1' ); |
| 53 |
|
| 54 |
$html .= "\n" . '-- LoginPress Pro Configuration --' . "\n\n"; |
| 55 |
$html .= 'Plugin Version: ' . LOGINPRESS_PRO_VERSION . "\n"; |
| 56 |
$html .= 'LoginPress Template: ' . $loginpress_preset . "\n"; |
| 57 |
$html .= 'Google Repatcha Status: ' . $enable_repatcha . "\n"; |
| 58 |
|
| 59 |
if ( 'on' == $enable_repatcha ) { |
| 60 |
$site_key = ( isset( $loginpress_setting['site_key'] ) ) ? $loginpress_setting['site_key'] : 'Not Set'; |
| 61 |
$secret_key = ( isset( $loginpress_setting['secret_key'] ) ) ? $loginpress_setting['secret_key'] : 'Not Set'; |
| 62 |
$captcha_theme = ( isset( $loginpress_setting['captcha_theme'] ) ) ? $loginpress_setting['captcha_theme'] : 'Light'; |
| 63 |
$captcha_language = ( isset( $loginpress_setting['captcha_language'] ) ) ? $loginpress_setting['captcha_language'] : 'English (US)'; |
| 64 |
$captcha_enable_on = ( isset( $loginpress_setting['captcha_enable'] ) ) ? $loginpress_setting['captcha_enable'] : 'Not Set'; |
| 65 |
|
| 66 |
$html .= 'Repatcha Site Key: ' . $site_key . "\n"; |
| 67 |
$html .= 'Repatcha Secret Key: ' . $secret_key . "\n"; |
| 68 |
$html .= 'Repatcha Theme Used: ' . $captcha_theme . "\n"; |
| 69 |
$html .= 'Repatcha Language Used: ' . $captcha_language . "\n"; |
| 70 |
if ( is_array( $captcha_enable_on ) ) { |
| 71 |
foreach ( $captcha_enable_on as $key ) { |
| 72 |
$html .= 'Repatcha Enable On: ' . ucfirst( str_replace( "_", " ", $key ) ) . "\n"; |
| 73 |
} |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
// Server Configuration |
| 78 |
$html .= "\n" . '-- Server Configuration --' . "\n\n"; |
| 79 |
$html .= 'Operating System: ' . php_uname( 's' ) . "\n"; |
| 80 |
$html .= 'PHP Version: ' . PHP_VERSION . "\n"; |
| 81 |
$html .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; |
| 82 |
|
| 83 |
$html .= 'Server Software: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; |
| 84 |
|
| 85 |
// PHP configs... now we're getting to the important stuff |
| 86 |
$html .= "\n" . '-- PHP Configuration --' . "\n\n"; |
| 87 |
$html .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); |
| 88 |
$html .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; |
| 89 |
$html .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; |
| 90 |
$html .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
| 91 |
$html .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; |
| 92 |
$html .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; |
| 93 |
$html .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; |
| 94 |
|
| 95 |
// WordPress active plugins |
| 96 |
$html .= "\n" . '-- WordPress Active Plugins --' . "\n\n"; |
| 97 |
$plugins = get_plugins(); |
| 98 |
$active_plugins = get_option( 'active_plugins', array() ); |
| 99 |
foreach( $plugins as $plugin_path => $plugin ) { |
| 100 |
if( !in_array( $plugin_path, $active_plugins ) ) |
| 101 |
continue; |
| 102 |
$html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
| 103 |
} |
| 104 |
|
| 105 |
// WordPress inactive plugins |
| 106 |
$html .= "\n" . '-- WordPress Inactive Plugins --' . "\n\n"; |
| 107 |
foreach( $plugins as $plugin_path => $plugin ) { |
| 108 |
if( in_array( $plugin_path, $active_plugins ) ) |
| 109 |
continue; |
| 110 |
$html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
| 111 |
} |
| 112 |
|
| 113 |
if( is_multisite() ) { |
| 114 |
// WordPress Multisite active plugins |
| 115 |
$html .= "\n" . '-- Network Active Plugins --' . "\n\n"; |
| 116 |
$plugins = wp_get_active_network_plugins(); |
| 117 |
$active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
| 118 |
foreach( $plugins as $plugin_path ) { |
| 119 |
$plugin_base = plugin_basename( $plugin_path ); |
| 120 |
if( !array_key_exists( $plugin_base, $active_plugins ) ) |
| 121 |
continue; |
| 122 |
$plugin = get_plugin_data( $plugin_path ); |
| 123 |
$html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
$html .= "\n" . '### End System Info ###'; |
| 128 |
return $html; |
| 129 |
} |
| 130 |
} // End of Class. |
| 131 |
|