Issues (565)

system/AdminPageFramework_FieldType_system.php (1 issue)

1
<?php
2
/**
3
 * Admin Page Framework
4
 *
5
 * http://admin-page-framework.michaeluno.jp/
6
 * Copyright (c) 2013-2022, Michael Uno; Licensed MIT
7
 *
8
 */
9
10
/**
11
 * The System field type displays site information in a text area field.
12
 *
13
 * Used to create a page that helps to report issues with their server information.
14
 *
15
 * <h2>Field Definition Arguments</h2>
16
 * <h3>Field Type Specific Arguments</h3>
17
 * <ul>
18
 *     <li>**data** - (optional, array) an associative array that holds the data to display. The following items are embedded by default. To remove an item, pass an empty value with the key.
19
 *          <ul>
20
 *              <li>`Current Time` - the current time</li>
21
 *              <li>`Admin Page Framework` - information of used Admin Page Framework</li>
22
 *              <li>`WordPress` - information of installed WordPress</li>
23
 *              <li>`PHP` - information of installed PHP</li>
24
 *              <li>`Server` - information of the server</li>
25
 *              <li>`PHP Error Log` - PHP error log</li>
26
 *              <li>`MySQL` - MySQL</li>
27
 *              <li>`MySQL Error Log` - MySQL error log</li>
28
 *              <li>`Browser` - Browser</li>
29
 *          </ul>
30
 *     </li>
31
 *     <li>**print_type** - [3.3.6+] (optional, integer) Indicates how the data array should be displayed. 1: readable array representation. 2. the output of the print_r() function. Default: `1`.</li>
32
 * </ul>
33
 *
34
 * <h3>Common Field Definition Arguments</h3>
35
 * For common field definition arguments, see {@link AdminPageFramework_Factory_Controller::addSettingField()}.
36
 *
37
 * <h2>Example</h2>
38
 * <code>
39
 *  array(
40
 *      'field_id'      => 'system_information',
41
 *      'type'          => 'system',
42
 *      'title'         => __( 'System Information', 'admin-page-framework-loader' ),
43
 *      'data'          => array(
44
 *          'Custom Data'           => __( 'Here you can insert your own custom data with the data argument.', 'admin-page-framework-loader' ),
45
 *
46
 *          // To remove items, set empty values
47
 *          'Current Time'          => '',
48
 *          'Admin Page Framework'  => '',
49
 *      ),
50
 *      'save'          => false,
51
 *  ),
52
 * </code>
53
 *
54
 *
55
 * @image       http://admin-page-framework.michaeluno.jp/image/common/form/field_type/system.png
56
 * @package     AdminPageFramework/Common/Form/FieldType
57
 * @since       3.3.0
58
 */
59
class AdminPageFramework_FieldType_system extends AdminPageFramework_FieldType {
60
61
    /**
62
     * Defines the field type slugs used for this field type.
63
     *
64
     * The slug is used for the type key in a field definition array.
65
     * <code>
66
     * $this->addSettingFields(
67
     *      array(
68
     *          'section_id'    => '...',
69
     *          'type'          => 'system',        // <--- THIS PART
70
     *          'field_id'      => '...',
71
     *          'title'         => '...',
72
     *      )
73
     *  );
74
     * </code>
75
     * @var         array
76
     */
77
    public $aFieldTypeSlugs = array( 'system', );
78
79
    /**
80
     * Defines the default key-values of this field type.
81
     *
82
     * The keys are used for the field definition array.
83
     * <code>
84
     *     $this->addSettingFields(
85
     *      array(
86
     *          'section_id'    => '...',
87
     *          'type'          => '...',
88
     *          'field_id'      => '...',
89
     *          'my_custom_key' => '...',    // <-- THIS PART
90
     *      )
91
     *  );
92
     * </code>
93
     * @var             array
94
     * @remark          `$_aDefaultKeys` holds shared default key-values defined in the base class.
95
     */
96
    protected $aDefaultKeys = array(
97
        'data'          =>  array(),        // [3.2.0+] Stores the data to be displayed
98
        'print_type'    =>  1,              // [3.4.6+] 1: readable representation of array. 2: print_r()
99
        'attributes'    =>    array(
100
            'rows'          => 60,
101
            'autofocus'     => null,
102
            'disabled'      => null,
103
            'formNew'       => null,
104
            'maxlength'     => null,
105
            'placeholder'   => null,
106
            'readonly'      => 'readonly',
107
            'required'      => null,
108
            'wrap'          => null,
109
            'style'         => null,
110
            // 'onclick'       => 'this.focus();this.select()', // @deprecated 3.8.24
111
        ),
112
    );
113
114
    /**
115
     * Returns the output of the field type.
116
     *
117
     * @internal
118
     * @param       array   $aField
119
     * @return      string
120
     */
121
    protected function getField( $aField ) {
122
123
        $_aInputAttributes             = $aField[ 'attributes' ];
124
        $_aInputAttributes[ 'class' ] .= ' system';
125
        unset( $_aInputAttributes[ 'value' ] );
126
        return
127
            $aField[ 'before_label' ]
128
            . "<div class='admin-page-framework-input-label-container'>"
129
                . "<label for='{$aField[ 'input_id' ]}'>"
130
                    . $aField[ 'before_input' ]
131
                    . ( $aField[ 'label' ] && ! $aField[ 'repeatable' ]
132
                        ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">"
133
                                . $aField[ 'label' ]
134
                            . "</span>"
135
                        : ""
136
                    )
137
                    . "<textarea " . $this->getAttributes( $_aInputAttributes ) . " >"
138
                        . esc_textarea( $this->___getSystemInformation( $aField[ 'value' ], $aField[ 'data' ], $aField[ 'print_type' ] ) )
139
                    . "</textarea>"
140
                    . $aField[ 'after_input' ]
141
                . "</label>"
142
            . "</div>"
143
            . $aField[ 'after_label' ];
144
145
    }
146
        /**
147
         * Returns the system information value for a textarea tag.
148
         *
149
         * @return      string       The human readable system information.
150
         * @param       array|string $asValue
151
         * @param       array|string $asCustomData
152
         * @param       integer      $iPrintType
153
         * @internal
154
         */
155
        private function ___getSystemInformation( $asValue=null, $asCustomData=null, $iPrintType=1 ) {
156
157
            if ( isset( $asValue ) ) {
158
                return $asValue;
159
            }
160
161
            $_aOutput   = array();
162
            foreach( $this->___getFormattedSystemInformation( $asCustomData ) as $_sSection => $_aInfo ) {
163
                $_aOutput[] = $this->_____getSystemInfoBySection( $_sSection, $_aInfo, $iPrintType );
164
            }
165
            return implode( PHP_EOL, $_aOutput );
166
167
        }
168
            /**
169
             * Returns the formatted system information array.
170
             * @since       3.5.3
171
             * @internal
172
             * @param       string|array $asCustomData
173
             * @return      array        The formatted system information array.
174
             */
175
            private function ___getFormattedSystemInformation( $asCustomData ) {
176
177
                $_aData = $this->getAsArray( $asCustomData );
178
                $_aData = $_aData + array(
179
                    'WordPress'             => $this->___getSiteInfoWithCache( ! isset( $_aData[ 'WordPress' ] ) ),
180
                    'PHP'                   => $this->_getPHPInfo( ! isset( $_aData[ 'PHP' ] ) ),
181
                    'PHP Error Log'         => $this->___getErrorLogByType( 'php', ! isset( $_aData[ 'PHP Error Log' ] ) ),
182
                    'MySQL'                 => isset( $_aData[ 'MySQL' ] )
183
                        ? null
184
                        : $this->getMySQLInfo(),    // defined in the utility class.
185
                    'MySQL Error Log'       => $this->___getErrorLogByType( 'mysql', ! isset( $_aData[ 'MySQL Error Log' ] ) ),
186
                    'Server'                => $this->___getWebServerInfo( ! isset( $_aData[ 'Server' ] ) ),
187
                    'Browser'               => $this->___getClientInfo( ! isset( $_aData[ 'Browser' ] ) ),
188
                    'Admin Page Framework'  => isset( $_aData[ 'Admin Page Framework' ] )
189
                        ? null
190
                        : AdminPageFramework_Registry::getInfo(),
191
                );
192
193
                // Dropping empty elements allows the user to remove a section by setting an empty section.
194
                return array_filter( $_aData );
195
196
            }
197
            /**
198
             * Returns the system information by section.
199
             * @since       3.5.3
200
             * @return      string      The system information by section.
201
             * @param       string      $sSectionName
202
             * @param       array       $aData
203
             * @param       integer     $iPrintType
204
             * @internal
205
             */
206
            private function _____getSystemInfoBySection( $sSectionName, $aData, $iPrintType ) {
207
                switch ( $iPrintType ) {
208
                    default:
209
                    case 1: // use the framework readable representation of arrays.
210
                        return $this->getReadableArrayContents( $sSectionName, $aData, 32 ) . PHP_EOL;
211
                    case 2: // use print_r()
212
                        return "[{$sSectionName}]" . PHP_EOL
213
                            . print_r( $aData, true ) . PHP_EOL;
214
                }
215
            }
216
            /**
217
             * Returns a client information
218
             *
219
             * @internal
220
             * @since       3.4.6
221
             * @since       3.5.3       Added the $bGenerateInfo parameter. This is to reduce conditional statement in the caller method.
222
             * @param       boolean     $bGenerateInfo
223
             * @return      string
224
             */
225
            private function ___getClientInfo( $bGenerateInfo=true ) {
226
227
                if ( ! $bGenerateInfo ) {
228
                    return '';
229
                }
230
231
                // Check the browscap value in the ini file first to prevent warnings from being populated
232
                $_aBrowser = @ini_get( 'browscap' )
233
                    ? get_browser( $_SERVER[ 'HTTP_USER_AGENT' ], true )
234
                    : array();
235
                unset( $_aBrowser[ 'browser_name_regex' ] );  // this element causes output to be blank
236
                return empty( $_aBrowser )
237
                    ? __( 'No browser information found.', 'admin-page-framework' )
238
                    : $_aBrowser;
239
240
            }
241
242
            /**
243
             * Returns a error log by type.
244
             *
245
             * @internal
246
             * @since       3.5.3
247
             * @return      string      The found error log.
248
             * @param       string      $sType          The error log type. Either 'php' or 'mysql' is accepted.
249
             * @param       boolean     $bGenerateInfo  Whether to generate a log. This is for the caller method to reduce a conditinal statement.
250
             */
251
            private function ___getErrorLogByType( $sType, $bGenerateInfo=true ) {
252
253
                if ( ! $bGenerateInfo ) {
254
                    return '';
255
                }
256
                switch ( $sType ) {
257
                    default:
258
                    case 'php':
259
                        $_sLog = $this->getPHPErrorLog( 200 );
260
                        break;
261
                    case 'mysql':
262
                        $_sLog = $this->getMySQLErrorLog( 200 );
263
                        break;
264
                }
265
                return empty( $_sLog )
266
                    ? $this->oMsg->get( 'no_log_found' )
267
                    : $_sLog;
268
269
            }
270
271
            /**
272
             * Caches the WordPress installed site information.
273
             */
274
            static private $_aSiteInfo;
275
            /**
276
             * Returns the Wordpress installed site.
277
             *
278
             * Uses a cache if stored in a previous call.
279
             *
280
             * @internal
281
             * @since       3.4.6
282
             * @since       3.5.3       Added the $bGenerateInfo paramter. This is to reduce conditional statment in the caller method.
283
             * @param       boolean     $bGenerateInfo
284
             * @return      array       The generated site information array.
285
             */
286
            private function ___getSiteInfoWithCache( $bGenerateInfo=true ) {
287
288
                if ( ! $bGenerateInfo || isset( self::$_aSiteInfo ) ) {
289
                    return self::$_aSiteInfo;
290
                }
291
                self::$_aSiteInfo = self::___getSiteInfo();
292
                return self::$_aSiteInfo;
293
294
            }
295
                /**
296
                 * Returns the WordPress site information.
297
                 *
298
                 * @internal
299
                 * @since       3.5.3
300
                 * @return      array       The WordPress site information.
301
                 */
302
                private function ___getSiteInfo() {
303
                    global $wpdb;
304
                    return array(
305
                        __( 'Version', 'admin-page-framework' )                     => $GLOBALS[ 'wp_version' ],
306
                        __( 'Language', 'admin-page-framework' )                    => $this->getSiteLanguage(),
307
                        __( 'Memory Limit', 'admin-page-framework' )                => $this->getReadableBytes( $this->getNumberOfReadableSize( WP_MEMORY_LIMIT ) ),
308
                        __( 'Multi-site', 'admin-page-framework' )                  => $this->getAOrB( is_multisite(), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ),
309
                        __( 'Permalink Structure', 'admin-page-framework' )         => get_option( 'permalink_structure' ),
310
                        __( 'Active Theme', 'admin-page-framework' )                => $this->___getActiveThemeName(),
311
                        __( 'Registered Post Statuses', 'admin-page-framework' )    => implode( ', ', get_post_stati() ),
312
                        'WP_DEBUG'                                                  => $this->getAOrB( $this->isDebugMode(), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ),
313
                        'WP_DEBUG_LOG'                                              => $this->getAOrB( $this->isDebugLogEnabled(), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ),
314
                        'WP_DEBUG_DISPLAY'                                          => $this->getAOrB( $this->isDebugDisplayEnabled(), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ),
315
                        __( 'Table Prefix', 'admin-page-framework' )                => $wpdb->prefix,
316
                        __( 'Table Prefix Length', 'admin-page-framework' )         => strlen( $wpdb->prefix ),
317
                        __( 'Table Prefix Status', 'admin-page-framework' )         => $this->getAOrB( strlen( $wpdb->prefix ) > 16, $this->oMsg->get( 'too_long' ), $this->oMsg->get( 'acceptable' ) ),
318
                        'wp_remote_post()'                                          => $this->___getWPRemotePostStatus(),
319
                        'wp_remote_get()'                                           => $this->___getWPRemoteGetStatus(),
320
                        __( 'Multibite String Extension', 'admin-page-framework' )  => $this->getAOrB( function_exists( 'mb_detect_encoding' ), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ),
321
                        __( 'WP_CONTENT_DIR Writeable', 'admin-page-framework' )    => $this->getAOrB( is_writable( WP_CONTENT_DIR ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ),
322
                        __( 'Active Plugins', 'admin-page-framework' )              => PHP_EOL . $this->___getActivePlugins(),
323
                        __( 'Network Active Plugins', 'admin-page-framework' )      => PHP_EOL . $this->___getNetworkActivePlugins(),
324
                        __( 'Constants', 'admin-page-framework' )                   => $this->___getDefinedConstants( 'user' ),
325
                    );
326
                }
327
                    /**
328
                     *
329
                     * @since       3.5.12
330
                     * @param       array|string|null $asCategories
331
                     * @param       array|string|null $asRemovingCategories
332
                     * @return      string|array
333
                     * @internal
334
                     */
335
                    private function ___getDefinedConstants( $asCategories=null, $asRemovingCategories=null ) {
336
                        $_asConstants = $this->getDefinedConstants( $asCategories, $asRemovingCategories );
337
                        if ( ! is_array( $_asConstants ) ) {
338
                            return $_asConstants;
339
                        }
340
                        if ( isset( $_asConstants[ 'user' ] ) ) {
341
                            $_asConstants[ 'user' ] = array(
342
                                'AUTH_KEY'              => '__masked__',
343
                                'SECURE_AUTH_KEY'       => '__masked__',
344
                                'LOGGED_IN_KEY'         => '__masked__',
345
                                'NONCE_KEY'             => '__masked__',
346
                                'AUTH_SALT'             => '__masked__',
347
                                'SECURE_AUTH_SALT'      => '__masked__',
348
                                'LOGGED_IN_SALT'        => '__masked__',
349
                                'NONCE_SALT'            => '__masked__',
350
                                'COOKIEHASH'            => '__masked__',
351
                                'USER_COOKIE'           => '__masked__',
352
                                'PASS_COOKIE'           => '__masked__',
353
                                'AUTH_COOKIE'           => '__masked__',
354
                                'SECURE_AUTH_COOKIE'    => '__masked__',
355
                                'LOGGED_IN_COOKIE'      => '__masked__',
356
                                'TEST_COOKIE'           => '__masked__',
357
                                'DB_USER'               => '__masked__',
358
                                'DB_PASSWORD'           => '__masked__',
359
                                'DB_HOST'               => '__masked__',
360
                            ) + $_asConstants[ 'user' ];
361
                        }
362
                        return $_asConstants;
363
                    }
364
365
                /**
366
                 * Returns the active theme name.
367
                 * @internal
368
                 * @return      string
369
                 */
370
                private function ___getActiveThemeName() {
371
372
                    // If the WordPress version is less than 3.4,
373
                    if ( version_compare( $GLOBALS[ 'wp_version' ], '3.4', '<' ) ) {
374
                        $_aThemeData = get_theme_data( get_stylesheet_directory() . '/style.css' );
0 ignored issues
show
Deprecated Code introduced by
The function get_theme_data() has been deprecated: 3.4.0 Use wp_get_theme() ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

374
                        $_aThemeData = /** @scrutinizer ignore-deprecated */ get_theme_data( get_stylesheet_directory() . '/style.css' );

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
375
                        return $_aThemeData[ 'Name' ] . ' ' . $_aThemeData[ 'Version' ];
376
                    }
377
378
                    $_oThemeData = wp_get_theme();
379
                    return $_oThemeData->Name . ' ' . $_oThemeData->Version;
380
381
                }
382
                /**
383
                 * Returns a list of active plugins.
384
                 *
385
                 * @return      string
386
                 * @internal
387
                 */
388
                private function ___getActivePlugins() {
389
390
                    $_aPluginList       = array();
391
                    $_aActivePlugins    = get_option( 'active_plugins', array() );
392
                    foreach ( get_plugins() as $_sPluginPath => $_aPlugin ) {
393
                        if ( ! in_array( $_sPluginPath, $_aActivePlugins ) ) {
394
                            continue;
395
                        }
396
                        $_aPluginList[] = '    ' . $_aPlugin[ 'Name' ] . ': ' . $_aPlugin[ 'Version' ];
397
                    }
398
                    return implode( PHP_EOL, $_aPluginList );
399
400
                }
401
                /**
402
                 * Returns a list of network-activated plugins.
403
                 * @return      string
404
                 * @internal
405
                 */
406
                private function ___getNetworkActivePlugins() {
407
408
                    if ( ! is_multisite() ) {
409
                        return '';
410
                    }
411
                    $_aPluginList       = array();
412
                    $_aActivePlugins    = get_site_option( 'active_sitewide_plugins', array() );
413
                    foreach ( wp_get_active_network_plugins() as $_sPluginPath ) {
414
                        if ( ! array_key_exists( plugin_basename( $_sPluginPath ), $_aActivePlugins ) ) {
415
                            continue;
416
                        }
417
                        $_aPlugin       = get_plugin_data( $_sPluginPath );
418
                        $_aPluginList[] = '    ' . $_aPlugin[ 'Name' ] . ' :' . $_aPlugin[ 'Version' ];
419
                    }
420
                    return implode( PHP_EOL, $_aPluginList );
421
422
                }
423
424
                /**
425
                 * Checks if the wp_remote_post() function is functioning.
426
                 *
427
                 * @return      string
428
                 * @internal
429
                 */
430
                private function ___getWPRemotePostStatus() {
431
                    $_vResponse = $this->getTransient( 'apf_rp_check' );
432
                    $_vResponse = false === $_vResponse
433
                        ? wp_remote_post(
434
                            // 'https://www.paypal.com/cgi-bin/webscr',
435
                            add_query_arg( $this->getHTTPQueryGET( array(), array() ), admin_url( $GLOBALS[ 'pagenow' ] ) ),
436
                            array(
437
                                'sslverify'     => false,
438
                                'timeout'       => 60,
439
                                'body'          => array( 'apf_remote_request_test' => '_testing', 'cmd' => '_notify-validate' ),
440
                            )
441
                        )
442
                        : $_vResponse;
443
                    $this->setTransient( 'apf_rp_check', $_vResponse, 60 );
444
                    return $this->getAOrB( $this->___isHttpRequestError( $_vResponse ), $this->oMsg->get( 'not_functional' ), $this->oMsg->get( 'functional' ) );
445
                }
446
                /**
447
                 * Checks if the wp_remote_post() function is functioning.
448
                 *
449
                 * @return      string
450
                 * @internal
451
                 */
452
                private function ___getWPRemoteGetStatus() {
453
454
                    $_aoResponse = $this->getTransient( 'apf_rg_check' );
455
                    $_aoResponse = false === $_aoResponse
456
                        ? wp_remote_get(
457
                            add_query_arg( $this->getHTTPQueryGET( array(), array() ) + array( 'apf_remote_request_test' => '_testing' ), admin_url( $GLOBALS[ 'pagenow' ] ) ),
458
                            array(
459
                                'sslverify'     => false,
460
                                'timeout'       => 60,
461
                            )
462
                        )
463
                        : $_aoResponse;
464
                    $this->setTransient( 'apf_rg_check', $_aoResponse, 60 );
465
                    return $this->getAOrB( $this->___isHttpRequestError( $_aoResponse ), $this->oMsg->get( 'not_functional' ), $this->oMsg->get( 'functional' ) );
466
467
                }
468
                    /**
469
                     * Checks the HTTP request response has an error.
470
                     * @since       3.5.3
471
                     * @param       mixed   $aoResponse        
472
                     * @return      boolean
473
                     * @internal
474
                     */
475
                    private function ___isHttpRequestError( $aoResponse ) {
476
                        
477
                        if ( is_wp_error( $aoResponse ) ) {
478
                            return true;
479
                        }
480
                        if ( $aoResponse[ 'response'][ 'code' ] < 200 ) {
481
                            return true;
482
                        }
483
                        if ( $aoResponse[ 'response' ][ 'code' ] >= 300 ) {
484
                            return true;
485
                        }
486
                        return false;
487
                        
488
                    }
489
490
            /**
491
             * Caches the php information.
492
             * @since       3.4.6
493
             * @internal
494
             */
495
            static private $_aPHPInfo;
496
497
            /**
498
             * Returns the PHP information.
499
             *
500
             * @internal
501
             * @since       3.4.6
502
             * @since       3.5.3       Added the $bGenerateInfo parameter. This is to reduce conditional statement in the caller method.
503
             * @param       boolean     $bGenerateInfo
504
             * @return      array
505
             */
506
            private function _getPHPInfo( $bGenerateInfo=true ) {
507
508
                if ( ! $bGenerateInfo || isset( self::$_aPHPInfo ) ) {
509
                    return self::$_aPHPInfo;
510
                }
511
512
                $_oErrorReporting   = new AdminPageFramework_ErrorReporting;
513
                self::$_aPHPInfo = array(
514
                    __( 'Version', 'admin-page-framework' )                 => phpversion(),
515
                    __( 'Safe Mode', 'admin-page-framework' )               => $this->getAOrB( @ini_get( 'safe_mode' ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ),
516
                    __( 'Memory Limit', 'admin-page-framework' )            => @ini_get( 'memory_limit' ),
517
                    __( 'Upload Max Size', 'admin-page-framework' )         => @ini_get( 'upload_max_filesize' ),
518
                    __( 'Post Max Size', 'admin-page-framework' )           => @ini_get( 'post_max_size' ),
519
                    __( 'Upload Max File Size', 'admin-page-framework' )    => @ini_get( 'upload_max_filesize' ),
520
                    __( 'Max Execution Time', 'admin-page-framework' )      => @ini_get( 'max_execution_time' ),
521
                    __( 'Max Input Vars', 'admin-page-framework' )          => @ini_get( 'max_input_vars' ),
522
                    __( 'Argument Separator', 'admin-page-framework' )      => @ini_get( 'arg_separator.output' ),
523
                    __( 'Allow URL File Open', 'admin-page-framework' )     => $this->getAOrB( @ini_get( 'allow_url_fopen' ),    $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ),
524
                    __( 'Display Errors', 'admin-page-framework' )          => $this->getAOrB( @ini_get( 'display_errors' ),     $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ),
525
                    __( 'Log Errors', 'admin-page-framework' )              => $this->getAOrB( @ini_get( 'log_errors' ),         $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ),
526
                    __( 'Error log location', 'admin-page-framework' )      => @ini_get( 'error_log' ),
527
                    __( 'Error Reporting Level', 'admin-page-framework' )   => $_oErrorReporting->getErrorLevel(),
528
                    __( 'FSOCKOPEN', 'admin-page-framework' )               => $this->getAOrB( function_exists( 'fsockopen' ),   $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ),
529
                    __( 'cURL', 'admin-page-framework' )                    => $this->getAOrB( function_exists( 'curl_init' ),   $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ),
530
                    __( 'SOAP', 'admin-page-framework' )                    => $this->getAOrB( class_exists( 'SoapClient' ),     $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ),
531
                    __( 'SUHOSIN', 'admin-page-framework' )                 => $this->getAOrB( extension_loaded( 'suhosin' ),    $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ),
532
                    'ini_set()'                                             => $this->getAOrB( function_exists( 'ini_set' ),     $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ),
533
                )
534
                + $this->getPHPInfo()
535
                + array(
536
                    __( 'Constants', 'admin-page-framework' )               => $this->___getDefinedConstants( null, 'user' )
537
                )
538
                ;
539
540
                return self::$_aPHPInfo;
541
542
            }
543
544
            /**
545
             * Returns the web server information.
546
             * @internal
547
             * @since       3.4.6
548
             * @since       3.5.3        Added the $bGenerateInfo paramter. This is to reduce conditional statment in the caller method.
549
             * @param       boolean      $bGenerateInfo
550
             * @return      array|string
551
             */
552
            private function ___getWebServerInfo( $bGenerateInfo=true ) {
553
                return $bGenerateInfo
554
                    ? array(
555
                        __( 'Web Server', 'admin-page-framework' )                  => $_SERVER['SERVER_SOFTWARE'],
556
                        'SSL'                                                       => $this->getAOrB( is_ssl(), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ),
557
                        __( 'Session', 'admin-page-framework' )                     => $this->getAOrB( isset( $_SESSION ), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ),
558
                        __( 'Session Name', 'admin-page-framework' )                => esc_html( @ini_get( 'session.name' ) ),
559
                        __( 'Session Cookie Path', 'admin-page-framework' )         => esc_html( @ini_get( 'session.cookie_path' ) ),
560
                        __( 'Session Save Path', 'admin-page-framework' )           => esc_html( @ini_get( 'session.save_path' ) ),
561
                        __( 'Session Use Cookies', 'admin-page-framework' )         => $this->getAOrB( @ini_get( 'session.use_cookies' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ),
562
                        __( 'Session Use Only Cookies', 'admin-page-framework' )    => $this->getAOrB( @ini_get( 'session.use_only_cookies' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ),
563
                    ) + $_SERVER
564
                    : '';
565
            }
566
567
}