Public Member Functions | |
| PhpSecInfo () | |
| loadTests () | |
| renderOutput () | |
| _outputRenderTable ($group_name, $group_results) | |
| _outputRenderStatsTable () | |
| _outputRenderNotRunTable () | |
| _outputGetCssClassFromResult ($code) | |
| _outputGetResultTypeFromCode ($code) | |
| loadAndRun () | |
| getResultsAsArray () | |
| getOutput () | |
Data Fields | |
| $tests_to_run = array() | |
| $test_results = array() | |
| $tests_not_run = array() | |
| $language = PHPSECINFO_LANG_DEFAULT | |
| $result_counts = array() | |
| $num_tests_run = 0 | |
This is the main class for the phpsecinfo system. It's responsible for dynamically loading tests, running those tests, and generating the results output
Example: <?php require_once('lib/PhpSecInfo.lib.php'); ?> <?php phpsecinfo(); ?>
If you want to capture the output, or just grab the test results and display them in your own way, you'll need to do slightly more work.
Example: require_once('lib/PhpSecInfo.lib.php'); // instantiate the class $psi = new PhpSecInfo();
// load and run all tests $psi->loadAndRun();
// grab the results as a multidimensional array $results = $psi->getResultsAsArray(); echo "<pre>"; echo print_r($results, true); echo "</pre>";
// grab the standard results output as a string $html = $psi->getOutput();
// send it to the browser echo $html;
The procedural function "phpsecinfo" is defined below this class.
v0.1.1
v0.1
Definition at line 78 of file PhpSecInfo.lib.php.
| _outputGetCssClassFromResult | ( | $ | code | ) |
This is a helper function that returns a CSS class corresponding to the result code the test returned. This allows us to color-code results
| integer | $code |
Definition at line 359 of file PhpSecInfo.lib.php.
| _outputGetResultTypeFromCode | ( | $ | code | ) |
This is a helper function that returns a label string corresponding to the result code the test returned. This is mainly used for the Test Results Summary table.
| integer | $code |
Definition at line 400 of file PhpSecInfo.lib.php.
| _outputRenderNotRunTable | ( | ) |
This outputs a table containing a summary or test that were not executed, and the reasons why they were skipped
Definition at line 342 of file PhpSecInfo.lib.php.
| _outputRenderStatsTable | ( | ) |
This outputs a table containing a summary of the test results (counts and % in each result type)
Definition at line 319 of file PhpSecInfo.lib.php.
| _outputRenderTable | ( | $ | group_name, | |
| $ | group_results | |||
| ) |
This is a helper method that makes it easy to output tables of test results for a given test group
| string | $group_name | |
| array | $group_results |
Definition at line 278 of file PhpSecInfo.lib.php.
| getOutput | ( | ) |
returns the standard output as a string instead of echoing it to the browser
note that this must be called after tests are loaded and run
Definition at line 479 of file PhpSecInfo.lib.php.
| getResultsAsArray | ( | ) |
returns an associative array of test data. Four keys are set:
note that this must be called after tests are loaded and run
Definition at line 457 of file PhpSecInfo.lib.php.
| loadAndRun | ( | ) |
Loads and runs all the tests
As loading, then running, is a pretty common process, this saves a extra method call
Definition at line 439 of file PhpSecInfo.lib.php.
| loadTests | ( | ) |
recurses through the Test subdir and includes classes in each test group subdir, then builds an array of classnames for the tests that will be run
Definition at line 155 of file PhpSecInfo.lib.php.
| PhpSecInfo | ( | ) |
| renderOutput | ( | ) |
This is the main output method. The look and feel mimics phpinfo()
We need to use PhpSecInfo_Test::getBooleanIniValue() below
Definition at line 232 of file PhpSecInfo.lib.php.
Definition at line 120 of file PhpSecInfo.lib.php.
| $num_tests_run = 0 |
Definition at line 137 of file PhpSecInfo.lib.php.
| $result_counts = array() |
Definition at line 129 of file PhpSecInfo.lib.php.
| $test_results = array() |
Definition at line 97 of file PhpSecInfo.lib.php.
| $tests_not_run = array() |
Definition at line 110 of file PhpSecInfo.lib.php.
| $tests_to_run = array() |
Definition at line 86 of file PhpSecInfo.lib.php.
1.6.3