@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Give Session |
|
| 4 | - * |
|
| 5 | - * This is a wrapper class for WP_Session / PHP $_SESSION and handles the storage of Give sessions |
|
| 6 | - * |
|
| 7 | - * @package Give |
|
| 8 | - * @subpackage Classes/Session |
|
| 9 | - * @copyright Copyright (c) 2016, WordImpress |
|
| 10 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | - * @since 1.0 |
|
| 12 | - */ |
|
| 3 | + * Give Session |
|
| 4 | + * |
|
| 5 | + * This is a wrapper class for WP_Session / PHP $_SESSION and handles the storage of Give sessions |
|
| 6 | + * |
|
| 7 | + * @package Give |
|
| 8 | + * @subpackage Classes/Session |
|
| 9 | + * @copyright Copyright (c) 2016, WordImpress |
|
| 10 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | + * @since 1.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -70,53 +70,53 @@ discard block |
||
| 70 | 70 | public function __construct() { |
| 71 | 71 | |
| 72 | 72 | $this->use_php_sessions = $this->use_php_sessions(); |
| 73 | - $this->exp_option = give_get_option( 'session_lifetime' ); |
|
| 73 | + $this->exp_option = give_get_option('session_lifetime'); |
|
| 74 | 74 | |
| 75 | 75 | //PHP Sessions |
| 76 | - if ( $this->use_php_sessions ) { |
|
| 76 | + if ($this->use_php_sessions) { |
|
| 77 | 77 | |
| 78 | - if ( is_multisite() ) { |
|
| 78 | + if (is_multisite()) { |
|
| 79 | 79 | |
| 80 | - $this->prefix = '_' . get_current_blog_id(); |
|
| 80 | + $this->prefix = '_'.get_current_blog_id(); |
|
| 81 | 81 | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - add_action( 'init', array( $this, 'maybe_start_session' ), - 2 ); |
|
| 84 | + add_action('init', array($this, 'maybe_start_session'), - 2); |
|
| 85 | 85 | |
| 86 | 86 | } else { |
| 87 | 87 | |
| 88 | - if ( ! $this->should_start_session() ) { |
|
| 88 | + if ( ! $this->should_start_session()) { |
|
| 89 | 89 | return; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | // Use WP_Session |
| 93 | - if ( ! defined( 'WP_SESSION_COOKIE' ) ) { |
|
| 94 | - define( 'WP_SESSION_COOKIE', 'give_wp_session' ); |
|
| 93 | + if ( ! defined('WP_SESSION_COOKIE')) { |
|
| 94 | + define('WP_SESSION_COOKIE', 'give_wp_session'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if ( ! class_exists( 'Recursive_ArrayAccess' ) ) { |
|
| 98 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
| 97 | + if ( ! class_exists('Recursive_ArrayAccess')) { |
|
| 98 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( ! class_exists( 'WP_Session' ) ) { |
|
| 102 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session.php'; |
|
| 103 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/wp-session.php'; |
|
| 101 | + if ( ! class_exists('WP_Session')) { |
|
| 102 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session.php'; |
|
| 103 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/wp-session.php'; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 ); |
|
| 107 | - add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 ); |
|
| 106 | + add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999); |
|
| 107 | + add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999); |
|
| 108 | 108 | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | //Init Session |
| 112 | - if ( empty( $this->session ) && ! $this->use_php_sessions ) { |
|
| 113 | - add_action( 'plugins_loaded', array( $this, 'init' ), - 1 ); |
|
| 112 | + if (empty($this->session) && ! $this->use_php_sessions) { |
|
| 113 | + add_action('plugins_loaded', array($this, 'init'), - 1); |
|
| 114 | 114 | } else { |
| 115 | - add_action( 'init', array( $this, 'init' ), - 1 ); |
|
| 115 | + add_action('init', array($this, 'init'), - 1); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | //Set cookie on Donation Completion page |
| 119 | - add_action( 'give_pre_process_purchase', array( $this, 'set_session_cookies' ) ); |
|
| 119 | + add_action('give_pre_process_purchase', array($this, 'set_session_cookies')); |
|
| 120 | 120 | |
| 121 | 121 | } |
| 122 | 122 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function init() { |
| 131 | 131 | |
| 132 | - if ( $this->use_php_sessions ) { |
|
| 133 | - $this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array(); |
|
| 132 | + if ($this->use_php_sessions) { |
|
| 133 | + $this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array(); |
|
| 134 | 134 | } else { |
| 135 | 135 | $this->session = WP_Session::get_instance(); |
| 136 | 136 | } |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @return string Session variable |
| 164 | 164 | */ |
| 165 | - public function get( $key ) { |
|
| 166 | - $key = sanitize_key( $key ); |
|
| 165 | + public function get($key) { |
|
| 166 | + $key = sanitize_key($key); |
|
| 167 | 167 | |
| 168 | - return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false; |
|
| 168 | + return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false; |
|
| 169 | 169 | |
| 170 | 170 | } |
| 171 | 171 | |
@@ -179,21 +179,21 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * @return mixed Session variable |
| 181 | 181 | */ |
| 182 | - public function set( $key, $value ) { |
|
| 182 | + public function set($key, $value) { |
|
| 183 | 183 | |
| 184 | - $key = sanitize_key( $key ); |
|
| 184 | + $key = sanitize_key($key); |
|
| 185 | 185 | |
| 186 | - if ( is_array( $value ) ) { |
|
| 187 | - $this->session[ $key ] = serialize( $value ); |
|
| 186 | + if (is_array($value)) { |
|
| 187 | + $this->session[$key] = serialize($value); |
|
| 188 | 188 | } else { |
| 189 | - $this->session[ $key ] = $value; |
|
| 189 | + $this->session[$key] = $value; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - if ( $this->use_php_sessions ) { |
|
| 193 | - $_SESSION[ 'give' . $this->prefix ] = $this->session; |
|
| 192 | + if ($this->use_php_sessions) { |
|
| 193 | + $_SESSION['give'.$this->prefix] = $this->session; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - return $this->session[ $key ]; |
|
| 196 | + return $this->session[$key]; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -206,10 +206,10 @@ discard block |
||
| 206 | 206 | * @since 1.4 |
| 207 | 207 | */ |
| 208 | 208 | public function set_session_cookies() { |
| 209 | - if( ! headers_sent() ) { |
|
| 210 | - $lifetime = current_time( 'timestamp' ) + $this->set_expiration_time(); |
|
| 211 | - @setcookie( session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
| 212 | - @setcookie( session_name() . '_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
| 209 | + if ( ! headers_sent()) { |
|
| 210 | + $lifetime = current_time('timestamp') + $this->set_expiration_time(); |
|
| 211 | + @setcookie(session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
| 212 | + @setcookie(session_name().'_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function set_expiration_variant_time() { |
| 227 | 227 | |
| 228 | - return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 ); |
|
| 228 | + return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function set_expiration_time() { |
| 242 | 242 | |
| 243 | - return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 ); |
|
| 243 | + return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -258,21 +258,21 @@ discard block |
||
| 258 | 258 | $ret = false; |
| 259 | 259 | |
| 260 | 260 | // If the database variable is already set, no need to run autodetection |
| 261 | - $give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' ); |
|
| 261 | + $give_use_php_sessions = (bool) get_option('give_use_php_sessions'); |
|
| 262 | 262 | |
| 263 | - if ( ! $give_use_php_sessions ) { |
|
| 263 | + if ( ! $give_use_php_sessions) { |
|
| 264 | 264 | |
| 265 | 265 | // Attempt to detect if the server supports PHP sessions |
| 266 | - if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 266 | + if (function_exists('session_start') && ! ini_get('safe_mode')) { |
|
| 267 | 267 | |
| 268 | - $this->set( 'give_use_php_sessions', 1 ); |
|
| 268 | + $this->set('give_use_php_sessions', 1); |
|
| 269 | 269 | |
| 270 | - if ( $this->get( 'give_use_php_sessions' ) ) { |
|
| 270 | + if ($this->get('give_use_php_sessions')) { |
|
| 271 | 271 | |
| 272 | 272 | $ret = true; |
| 273 | 273 | |
| 274 | 274 | // Set the database option |
| 275 | - update_option( 'give_use_php_sessions', true ); |
|
| 275 | + update_option('give_use_php_sessions', true); |
|
| 276 | 276 | |
| 277 | 277 | } |
| 278 | 278 | |
@@ -284,13 +284,13 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant |
| 287 | - if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) { |
|
| 287 | + if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) { |
|
| 288 | 288 | $ret = true; |
| 289 | - } else if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) { |
|
| 289 | + } else if (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) { |
|
| 290 | 290 | $ret = false; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - return (bool) apply_filters( 'give_use_php_sessions', $ret ); |
|
| 293 | + return (bool) apply_filters('give_use_php_sessions', $ret); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | $start_session = true; |
| 305 | 305 | |
| 306 | - if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { |
|
| 306 | + if ( ! empty($_SERVER['REQUEST_URI'])) { |
|
| 307 | 307 | |
| 308 | - $blacklist = apply_filters( 'give_session_start_uri_blacklist', array( |
|
| 308 | + $blacklist = apply_filters('give_session_start_uri_blacklist', array( |
|
| 309 | 309 | 'feed', |
| 310 | 310 | 'feed', |
| 311 | 311 | 'feed/rss', |
@@ -313,21 +313,21 @@ discard block |
||
| 313 | 313 | 'feed/rdf', |
| 314 | 314 | 'feed/atom', |
| 315 | 315 | 'comments/feed/' |
| 316 | - ) ); |
|
| 317 | - $uri = ltrim( $_SERVER['REQUEST_URI'], '/' ); |
|
| 318 | - $uri = untrailingslashit( $uri ); |
|
| 319 | - if ( in_array( $uri, $blacklist ) ) { |
|
| 316 | + )); |
|
| 317 | + $uri = ltrim($_SERVER['REQUEST_URI'], '/'); |
|
| 318 | + $uri = untrailingslashit($uri); |
|
| 319 | + if (in_array($uri, $blacklist)) { |
|
| 320 | 320 | $start_session = false; |
| 321 | 321 | } |
| 322 | - if ( false !== strpos( $uri, 'feed=' ) ) { |
|
| 322 | + if (false !== strpos($uri, 'feed=')) { |
|
| 323 | 323 | $start_session = false; |
| 324 | 324 | } |
| 325 | - if ( is_admin() ) { |
|
| 325 | + if (is_admin()) { |
|
| 326 | 326 | $start_session = false; |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - return apply_filters( 'give_start_session', $start_session ); |
|
| 330 | + return apply_filters('give_start_session', $start_session); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | public function maybe_start_session() { |
| 340 | 340 | |
| 341 | - if ( ! $this->should_start_session() ) { |
|
| 341 | + if ( ! $this->should_start_session()) { |
|
| 342 | 342 | return; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if ( ! session_id() && ! headers_sent() ) { |
|
| 345 | + if ( ! session_id() && ! headers_sent()) { |
|
| 346 | 346 | session_start(); |
| 347 | 347 | } |
| 348 | 348 | |
@@ -358,9 +358,9 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | $expiration = false; |
| 360 | 360 | |
| 361 | - if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) { |
|
| 361 | + if (session_id() && isset($_COOKIE[session_name().'_expiration'])) { |
|
| 362 | 362 | |
| 363 | - $expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) ); |
|
| 363 | + $expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration'])); |
|
| 364 | 364 | |
| 365 | 365 | } |
| 366 | 366 | |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | * |
| 50 | 50 | * @since: 1.4 |
| 51 | 51 | * |
| 52 | - * @return bool |
|
| 52 | + * @return boolean|null |
|
| 53 | 53 | */ |
| 54 | 54 | function give_allow_sessions_for_sysinfo() { |
| 55 | 55 | if ( is_admin() && ( isset( $_GET['page'] ) && isset( $_GET['tab'] ) ) && ( $_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings' ) ) { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function give_system_info_callback() { |
| 26 | 26 | |
| 27 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 27 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | ?> |
| 31 | 31 | <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo give_tools_sysinfo_get(); ?></textarea> |
| 32 | 32 | <p class="submit"> |
| 33 | 33 | <input type="hidden" name="give-action" value="download_sysinfo"/> |
| 34 | - <?php submit_button( 'Download System Info File', 'secondary', 'give-download-sysinfo', false ); ?> |
|
| 34 | + <?php submit_button('Download System Info File', 'secondary', 'give-download-sysinfo', false); ?> |
|
| 35 | 35 | </p> |
| 36 | 36 | <style> |
| 37 | 37 | .give_forms_page_give-settings .give-submit-wrap { |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | * @return bool |
| 53 | 53 | */ |
| 54 | 54 | function give_allow_sessions_for_sysinfo() { |
| 55 | - if ( is_admin() && ( isset( $_GET['page'] ) && isset( $_GET['tab'] ) ) && ( $_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings' ) ) { |
|
| 55 | + if (is_admin() && (isset($_GET['page']) && isset($_GET['tab'])) && ($_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings')) { |
|
| 56 | 56 | return true; |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -add_filter( 'give_start_session', 'give_allow_sessions_for_sysinfo' ); |
|
| 60 | +add_filter('give_start_session', 'give_allow_sessions_for_sysinfo'); |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -72,63 +72,63 @@ discard block |
||
| 72 | 72 | function give_tools_sysinfo_get() { |
| 73 | 73 | global $wpdb, $give_options; |
| 74 | 74 | |
| 75 | - if ( ! class_exists( 'Browser' ) ) { |
|
| 76 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php'; |
|
| 75 | + if ( ! class_exists('Browser')) { |
|
| 76 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php'; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $browser = new Browser(); |
| 80 | 80 | |
| 81 | 81 | // Get theme info |
| 82 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
| 83 | - $theme_data = wp_get_theme( get_stylesheet_directory() . '/style.css' ); |
|
| 84 | - $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; |
|
| 82 | + if (get_bloginfo('version') < '3.4') { |
|
| 83 | + $theme_data = wp_get_theme(get_stylesheet_directory().'/style.css'); |
|
| 84 | + $theme = $theme_data['Name'].' '.$theme_data['Version']; |
|
| 85 | 85 | } else { |
| 86 | 86 | $theme_data = wp_get_theme(); |
| 87 | - $theme = $theme_data->Name . ' ' . $theme_data->Version; |
|
| 87 | + $theme = $theme_data->Name.' '.$theme_data->Version; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // Try to identify the hosting provider |
| 91 | 91 | $host = give_get_host(); |
| 92 | 92 | |
| 93 | - $return = '### Begin System Info ###' . "\n\n"; |
|
| 93 | + $return = '### Begin System Info ###'."\n\n"; |
|
| 94 | 94 | |
| 95 | 95 | // Start with the basics... |
| 96 | - $return .= '-- Site Info' . "\n\n"; |
|
| 97 | - $return .= 'Site URL: ' . site_url() . "\n"; |
|
| 98 | - $return .= 'Home URL: ' . home_url() . "\n"; |
|
| 99 | - $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; |
|
| 96 | + $return .= '-- Site Info'."\n\n"; |
|
| 97 | + $return .= 'Site URL: '.site_url()."\n"; |
|
| 98 | + $return .= 'Home URL: '.home_url()."\n"; |
|
| 99 | + $return .= 'Multisite: '.(is_multisite() ? 'Yes' : 'No')."\n"; |
|
| 100 | 100 | |
| 101 | - $return = apply_filters( 'give_sysinfo_after_site_info', $return ); |
|
| 101 | + $return = apply_filters('give_sysinfo_after_site_info', $return); |
|
| 102 | 102 | |
| 103 | 103 | // Can we determine the site's host? |
| 104 | - if ( $host ) { |
|
| 105 | - $return .= "\n" . '-- Hosting Provider' . "\n\n"; |
|
| 106 | - $return .= 'Host: ' . $host . "\n"; |
|
| 104 | + if ($host) { |
|
| 105 | + $return .= "\n".'-- Hosting Provider'."\n\n"; |
|
| 106 | + $return .= 'Host: '.$host."\n"; |
|
| 107 | 107 | |
| 108 | - $return = apply_filters( 'give_sysinfo_after_host_info', $return ); |
|
| 108 | + $return = apply_filters('give_sysinfo_after_host_info', $return); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // The local users' browser information, handled by the Browser class |
| 112 | - $return .= "\n" . '-- User Browser' . "\n\n"; |
|
| 112 | + $return .= "\n".'-- User Browser'."\n\n"; |
|
| 113 | 113 | $return .= $browser; |
| 114 | 114 | |
| 115 | - $return = apply_filters( 'give_sysinfo_after_user_browser', $return ); |
|
| 115 | + $return = apply_filters('give_sysinfo_after_user_browser', $return); |
|
| 116 | 116 | |
| 117 | 117 | // WordPress configuration |
| 118 | - $return .= "\n" . '-- WordPress Configuration' . "\n\n"; |
|
| 119 | - $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; |
|
| 120 | - $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; |
|
| 121 | - $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; |
|
| 122 | - $return .= 'Active Theme: ' . $theme . "\n"; |
|
| 123 | - $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; |
|
| 118 | + $return .= "\n".'-- WordPress Configuration'."\n\n"; |
|
| 119 | + $return .= 'Version: '.get_bloginfo('version')."\n"; |
|
| 120 | + $return .= 'Language: '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n"; |
|
| 121 | + $return .= 'Permalink Structure: '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n"; |
|
| 122 | + $return .= 'Active Theme: '.$theme."\n"; |
|
| 123 | + $return .= 'Show On Front: '.get_option('show_on_front')."\n"; |
|
| 124 | 124 | |
| 125 | 125 | // Only show page specs if frontpage is set to 'page' |
| 126 | - if ( get_option( 'show_on_front' ) == 'page' ) { |
|
| 127 | - $front_page_id = get_option( 'page_on_front' ); |
|
| 128 | - $blog_page_id = get_option( 'page_for_posts' ); |
|
| 126 | + if (get_option('show_on_front') == 'page') { |
|
| 127 | + $front_page_id = get_option('page_on_front'); |
|
| 128 | + $blog_page_id = get_option('page_for_posts'); |
|
| 129 | 129 | |
| 130 | - $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; |
|
| 131 | - $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; |
|
| 130 | + $return .= 'Page On Front: '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n"; |
|
| 131 | + $return .= 'Page For Posts: '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n"; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // Make sure wp_remote_post() is working |
@@ -137,203 +137,203 @@ discard block |
||
| 137 | 137 | $params = array( |
| 138 | 138 | 'sslverify' => false, |
| 139 | 139 | 'timeout' => 60, |
| 140 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
| 140 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
| 141 | 141 | 'body' => $request |
| 142 | 142 | ); |
| 143 | 143 | |
| 144 | - $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); |
|
| 144 | + $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); |
|
| 145 | 145 | |
| 146 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
| 146 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
| 147 | 147 | $WP_REMOTE_POST = 'wp_remote_post() works'; |
| 148 | 148 | } else { |
| 149 | 149 | $WP_REMOTE_POST = 'wp_remote_post() does not work'; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; |
|
| 153 | - $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; |
|
| 154 | - $return .= 'Admin AJAX: ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; |
|
| 155 | - $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; |
|
| 156 | - $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; |
|
| 157 | - $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; |
|
| 152 | + $return .= 'Remote Post: '.$WP_REMOTE_POST."\n"; |
|
| 153 | + $return .= 'Table Prefix: '.'Length: '.strlen($wpdb->prefix).' Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n"; |
|
| 154 | + $return .= 'Admin AJAX: '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n"; |
|
| 155 | + $return .= 'WP_DEBUG: '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n"; |
|
| 156 | + $return .= 'Memory Limit: '.WP_MEMORY_LIMIT."\n"; |
|
| 157 | + $return .= 'Registered Post Stati: '.implode(', ', get_post_stati())."\n"; |
|
| 158 | 158 | |
| 159 | - $return = apply_filters( 'give_sysinfo_after_wordpress_config', $return ); |
|
| 159 | + $return = apply_filters('give_sysinfo_after_wordpress_config', $return); |
|
| 160 | 160 | |
| 161 | 161 | // GIVE configuration |
| 162 | - $return .= "\n" . '-- Give Configuration' . "\n\n"; |
|
| 163 | - $return .= 'Version: ' . GIVE_VERSION . "\n"; |
|
| 164 | - $return .= 'Upgraded From: ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n"; |
|
| 165 | - $return .= 'Test Mode: ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" ); |
|
| 166 | - $return .= 'Currency Code: ' . give_get_currency() . "\n"; |
|
| 167 | - $return .= 'Currency Position: ' . give_get_option( 'currency_position', 'before' ) . "\n"; |
|
| 168 | - $return .= 'Decimal Separator: ' . give_get_option( 'decimal_separator', '.' ) . "\n"; |
|
| 169 | - $return .= 'Thousands Separator: ' . give_get_option( 'thousands_separator', ',' ) . "\n"; |
|
| 162 | + $return .= "\n".'-- Give Configuration'."\n\n"; |
|
| 163 | + $return .= 'Version: '.GIVE_VERSION."\n"; |
|
| 164 | + $return .= 'Upgraded From: '.get_option('give_version_upgraded_from', 'None')."\n"; |
|
| 165 | + $return .= 'Test Mode: '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n"); |
|
| 166 | + $return .= 'Currency Code: '.give_get_currency()."\n"; |
|
| 167 | + $return .= 'Currency Position: '.give_get_option('currency_position', 'before')."\n"; |
|
| 168 | + $return .= 'Decimal Separator: '.give_get_option('decimal_separator', '.')."\n"; |
|
| 169 | + $return .= 'Thousands Separator: '.give_get_option('thousands_separator', ',')."\n"; |
|
| 170 | 170 | |
| 171 | - $return = apply_filters( 'give_sysinfo_after_give_config', $return ); |
|
| 171 | + $return = apply_filters('give_sysinfo_after_give_config', $return); |
|
| 172 | 172 | |
| 173 | 173 | // GIVE pages |
| 174 | - $return .= "\n" . '-- Give Page Configuration' . "\n\n"; |
|
| 175 | - $return .= 'Success Page: ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" ); |
|
| 176 | - $return .= 'Failure Page: ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" ); |
|
| 177 | - $return .= 'Give Forms Slug: ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" ); |
|
| 174 | + $return .= "\n".'-- Give Page Configuration'."\n\n"; |
|
| 175 | + $return .= 'Success Page: '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n"); |
|
| 176 | + $return .= 'Failure Page: '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n"); |
|
| 177 | + $return .= 'Give Forms Slug: '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n"); |
|
| 178 | 178 | |
| 179 | - $return = apply_filters( 'give_sysinfo_after_give_pages', $return ); |
|
| 179 | + $return = apply_filters('give_sysinfo_after_give_pages', $return); |
|
| 180 | 180 | |
| 181 | 181 | // GIVE gateways |
| 182 | - $return .= "\n" . '-- Give Gateway Configuration' . "\n\n"; |
|
| 182 | + $return .= "\n".'-- Give Gateway Configuration'."\n\n"; |
|
| 183 | 183 | |
| 184 | 184 | $active_gateways = give_get_enabled_payment_gateways(); |
| 185 | - if ( $active_gateways ) { |
|
| 186 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
| 187 | - if ( $default_gateway_is_active ) { |
|
| 188 | - $default_gateway = give_get_default_gateway( null ); |
|
| 189 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
| 185 | + if ($active_gateways) { |
|
| 186 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
| 187 | + if ($default_gateway_is_active) { |
|
| 188 | + $default_gateway = give_get_default_gateway(null); |
|
| 189 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
| 190 | 190 | } else { |
| 191 | 191 | $default_gateway = 'Test Payment'; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $gateways = array(); |
| 195 | - foreach ( $active_gateways as $gateway ) { |
|
| 195 | + foreach ($active_gateways as $gateway) { |
|
| 196 | 196 | $gateways[] = $gateway['admin_label']; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $return .= 'Enabled Gateways: ' . implode( ', ', $gateways ) . "\n"; |
|
| 200 | - $return .= 'Default Gateway: ' . $default_gateway . "\n"; |
|
| 199 | + $return .= 'Enabled Gateways: '.implode(', ', $gateways)."\n"; |
|
| 200 | + $return .= 'Default Gateway: '.$default_gateway."\n"; |
|
| 201 | 201 | } else { |
| 202 | - $return .= 'Enabled Gateways: None' . "\n"; |
|
| 202 | + $return .= 'Enabled Gateways: None'."\n"; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - $return = apply_filters( 'give_sysinfo_after_give_gateways', $return ); |
|
| 205 | + $return = apply_filters('give_sysinfo_after_give_gateways', $return); |
|
| 206 | 206 | |
| 207 | 207 | // GIVE Templates |
| 208 | - $dir = get_stylesheet_directory() . '/give_templates/*'; |
|
| 209 | - if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) { |
|
| 210 | - $return .= "\n" . '-- Give Template Overrides' . "\n\n"; |
|
| 208 | + $dir = get_stylesheet_directory().'/give_templates/*'; |
|
| 209 | + if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) { |
|
| 210 | + $return .= "\n".'-- Give Template Overrides'."\n\n"; |
|
| 211 | 211 | |
| 212 | - foreach ( glob( $dir ) as $file ) { |
|
| 213 | - $return .= 'Filename: ' . basename( $file ) . "\n"; |
|
| 212 | + foreach (glob($dir) as $file) { |
|
| 213 | + $return .= 'Filename: '.basename($file)."\n"; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - $return = apply_filters( 'give_sysinfo_after_give_templates', $return ); |
|
| 216 | + $return = apply_filters('give_sysinfo_after_give_templates', $return); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | // Must-use plugins |
| 220 | 220 | $muplugins = get_mu_plugins(); |
| 221 | - if ( count( $muplugins > 0 ) ) { |
|
| 222 | - $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; |
|
| 221 | + if (count($muplugins > 0)) { |
|
| 222 | + $return .= "\n".'-- Must-Use Plugins'."\n\n"; |
|
| 223 | 223 | |
| 224 | - foreach ( $muplugins as $plugin => $plugin_data ) { |
|
| 225 | - $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; |
|
| 224 | + foreach ($muplugins as $plugin => $plugin_data) { |
|
| 225 | + $return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n"; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - $return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return ); |
|
| 228 | + $return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // WordPress active plugins |
| 232 | - $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; |
|
| 232 | + $return .= "\n".'-- WordPress Active Plugins'."\n\n"; |
|
| 233 | 233 | |
| 234 | 234 | $plugins = get_plugins(); |
| 235 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
| 235 | + $active_plugins = get_option('active_plugins', array()); |
|
| 236 | 236 | |
| 237 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
| 238 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
| 237 | + foreach ($plugins as $plugin_path => $plugin) { |
|
| 238 | + if ( ! in_array($plugin_path, $active_plugins)) { |
|
| 239 | 239 | continue; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
| 242 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return ); |
|
| 245 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins', $return); |
|
| 246 | 246 | |
| 247 | 247 | // WordPress inactive plugins |
| 248 | - $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; |
|
| 248 | + $return .= "\n".'-- WordPress Inactive Plugins'."\n\n"; |
|
| 249 | 249 | |
| 250 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
| 251 | - if ( in_array( $plugin_path, $active_plugins ) ) { |
|
| 250 | + foreach ($plugins as $plugin_path => $plugin) { |
|
| 251 | + if (in_array($plugin_path, $active_plugins)) { |
|
| 252 | 252 | continue; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
| 255 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return ); |
|
| 258 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return); |
|
| 259 | 259 | |
| 260 | - if ( is_multisite() ) { |
|
| 260 | + if (is_multisite()) { |
|
| 261 | 261 | // WordPress Multisite active plugins |
| 262 | - $return .= "\n" . '-- Network Active Plugins' . "\n\n"; |
|
| 262 | + $return .= "\n".'-- Network Active Plugins'."\n\n"; |
|
| 263 | 263 | |
| 264 | 264 | $plugins = wp_get_active_network_plugins(); |
| 265 | - $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
|
| 265 | + $active_plugins = get_site_option('active_sitewide_plugins', array()); |
|
| 266 | 266 | |
| 267 | - foreach ( $plugins as $plugin_path ) { |
|
| 268 | - $plugin_base = plugin_basename( $plugin_path ); |
|
| 267 | + foreach ($plugins as $plugin_path) { |
|
| 268 | + $plugin_base = plugin_basename($plugin_path); |
|
| 269 | 269 | |
| 270 | - if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { |
|
| 270 | + if ( ! array_key_exists($plugin_base, $active_plugins)) { |
|
| 271 | 271 | continue; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $plugin = get_plugin_data( $plugin_path ); |
|
| 275 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
| 274 | + $plugin = get_plugin_data($plugin_path); |
|
| 275 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - $return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return ); |
|
| 278 | + $return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Server configuration (really just versioning) |
| 282 | - $return .= "\n" . '-- Webserver Configuration' . "\n\n"; |
|
| 283 | - $return .= 'PHP Version: ' . PHP_VERSION . "\n"; |
|
| 284 | - $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; |
|
| 285 | - $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; |
|
| 282 | + $return .= "\n".'-- Webserver Configuration'."\n\n"; |
|
| 283 | + $return .= 'PHP Version: '.PHP_VERSION."\n"; |
|
| 284 | + $return .= 'MySQL Version: '.$wpdb->db_version()."\n"; |
|
| 285 | + $return .= 'Webserver Info: '.$_SERVER['SERVER_SOFTWARE']."\n"; |
|
| 286 | 286 | |
| 287 | - $return = apply_filters( 'give_sysinfo_after_webserver_config', $return ); |
|
| 287 | + $return = apply_filters('give_sysinfo_after_webserver_config', $return); |
|
| 288 | 288 | |
| 289 | 289 | // PHP configs... now we're getting to the important stuff |
| 290 | - $return .= "\n" . '-- PHP Configuration' . "\n\n"; |
|
| 291 | - $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); |
|
| 292 | - $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; |
|
| 293 | - $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
| 294 | - $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; |
|
| 295 | - $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
| 296 | - $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; |
|
| 297 | - $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; |
|
| 298 | - $return .= 'URL-aware fopen: ' . ( ini_get( 'allow_url_fopen' ) ? 'On (' . ini_get( 'allow_url_fopen' ) . ')' : 'N/A' ) . "\n"; |
|
| 299 | - $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; |
|
| 300 | - |
|
| 301 | - $return = apply_filters( 'give_sysinfo_after_php_config', $return ); |
|
| 290 | + $return .= "\n".'-- PHP Configuration'."\n\n"; |
|
| 291 | + $return .= 'Safe Mode: '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n"); |
|
| 292 | + $return .= 'Memory Limit: '.ini_get('memory_limit')."\n"; |
|
| 293 | + $return .= 'Upload Max Size: '.ini_get('upload_max_filesize')."\n"; |
|
| 294 | + $return .= 'Post Max Size: '.ini_get('post_max_size')."\n"; |
|
| 295 | + $return .= 'Upload Max Filesize: '.ini_get('upload_max_filesize')."\n"; |
|
| 296 | + $return .= 'Time Limit: '.ini_get('max_execution_time')."\n"; |
|
| 297 | + $return .= 'Max Input Vars: '.ini_get('max_input_vars')."\n"; |
|
| 298 | + $return .= 'URL-aware fopen: '.(ini_get('allow_url_fopen') ? 'On ('.ini_get('allow_url_fopen').')' : 'N/A')."\n"; |
|
| 299 | + $return .= 'Display Errors: '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n"; |
|
| 300 | + |
|
| 301 | + $return = apply_filters('give_sysinfo_after_php_config', $return); |
|
| 302 | 302 | |
| 303 | 303 | // PHP extensions and such |
| 304 | - $return .= "\n" . '-- PHP Extensions' . "\n\n"; |
|
| 305 | - $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
| 304 | + $return .= "\n".'-- PHP Extensions'."\n\n"; |
|
| 305 | + $return .= 'cURL: '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n"; |
|
| 306 | 306 | |
| 307 | 307 | //cURL version |
| 308 | - if ( function_exists( 'curl_init' ) && function_exists( 'curl_version' ) ) { |
|
| 308 | + if (function_exists('curl_init') && function_exists('curl_version')) { |
|
| 309 | 309 | $curl_values = curl_version(); |
| 310 | - $return .= 'cURL Version: ' . $curl_values["version"] . "\n"; |
|
| 310 | + $return .= 'cURL Version: '.$curl_values["version"]."\n"; |
|
| 311 | 311 | } |
| 312 | - $return .= 'zlib: ' . ( function_exists( 'gzcompress' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
| 313 | - $return .= 'GD: ' . ( ( extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
| 314 | - $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
| 315 | - $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
| 316 | - $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
| 312 | + $return .= 'zlib: '.(function_exists('gzcompress') ? 'Supported' : 'Not Supported')."\n"; |
|
| 313 | + $return .= 'GD: '.((extension_loaded('gd') && function_exists('gd_info')) ? 'Supported' : 'Not Supported')."\n"; |
|
| 314 | + $return .= 'fsockopen: '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n"; |
|
| 315 | + $return .= 'SOAP Client: '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n"; |
|
| 316 | + $return .= 'Suhosin: '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n"; |
|
| 317 | 317 | |
| 318 | - $return = apply_filters( 'give_sysinfo_after_php_ext', $return ); |
|
| 318 | + $return = apply_filters('give_sysinfo_after_php_ext', $return); |
|
| 319 | 319 | |
| 320 | 320 | // Session stuff |
| 321 | - $return .= "\n" . '-- Session Configuration' . "\n\n"; |
|
| 322 | - $return .= 'Give Use Sessions: ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n"; |
|
| 323 | - $return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; |
|
| 321 | + $return .= "\n".'-- Session Configuration'."\n\n"; |
|
| 322 | + $return .= 'Give Use Sessions: '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n"; |
|
| 323 | + $return .= 'Session: '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n"; |
|
| 324 | 324 | |
| 325 | 325 | // The rest of this is only relevant is session is enabled |
| 326 | - if ( isset( $_SESSION ) ) { |
|
| 327 | - $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; |
|
| 328 | - $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; |
|
| 329 | - $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; |
|
| 330 | - $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
| 331 | - $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
| 326 | + if (isset($_SESSION)) { |
|
| 327 | + $return .= 'Session Name: '.esc_html(ini_get('session.name'))."\n"; |
|
| 328 | + $return .= 'Cookie Path: '.esc_html(ini_get('session.cookie_path'))."\n"; |
|
| 329 | + $return .= 'Save Path: '.esc_html(ini_get('session.save_path'))."\n"; |
|
| 330 | + $return .= 'Use Cookies: '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n"; |
|
| 331 | + $return .= 'Use Only Cookies: '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n"; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - $return = apply_filters( 'give_sysinfo_after_session_config', $return ); |
|
| 334 | + $return = apply_filters('give_sysinfo_after_session_config', $return); |
|
| 335 | 335 | |
| 336 | - $return .= "\n" . '### End System Info ###'; |
|
| 336 | + $return .= "\n".'### End System Info ###'; |
|
| 337 | 337 | |
| 338 | 338 | return $return; |
| 339 | 339 | } |
@@ -347,17 +347,17 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | function give_tools_sysinfo_download() { |
| 349 | 349 | |
| 350 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 350 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 351 | 351 | return; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | nocache_headers(); |
| 355 | 355 | |
| 356 | - header( 'Content-Type: text/plain' ); |
|
| 357 | - header( 'Content-Disposition: attachment; filename="give-system-info.txt"' ); |
|
| 356 | + header('Content-Type: text/plain'); |
|
| 357 | + header('Content-Disposition: attachment; filename="give-system-info.txt"'); |
|
| 358 | 358 | |
| 359 | - echo wp_strip_all_tags( $_POST['give-sysinfo'] ); |
|
| 359 | + echo wp_strip_all_tags($_POST['give-sysinfo']); |
|
| 360 | 360 | give_die(); |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | -add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' ); |
|
| 364 | 363 | \ No newline at end of file |
| 364 | +add_action('give_download_sysinfo', 'give_tools_sysinfo_download'); |
|
| 365 | 365 | \ No newline at end of file |