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('PhpSecInfo/PhpSecInfo.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('PhpSecInfo/PhpSecInfo.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.
Located in /PhpSecInfo/PhpSecInfo.php (line 77)
The language code used. Defaults to PHPSECINFO_LANG_DEFAULT, which is 'en'
The number of tests that have been run
An array of integers recording the number of test results in each category. Categories can include some or all of the PHPSECINFO_TEST_* constants. Constants are the keys, # of results are the values.
An array of tests that were not run
- $result['result'] = PHPSECINFO_TEST_RESULT_NOTRUN;
- $result['message'] = "a string explaining why the test was not run";
An array of tests to run
An array of results. Each result is an associative array:
- $result['result'] = PHPSECINFO_TEST_RESULT_NOTICE;
- $result['message'] = "a string describing the test results and what they mean";
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
returns an associative array of test data. Four keys are set:
Loads and runs all the tests
As loading, then running, is a pretty common process, this saves a extra method call
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
This is the main output method. The look and feel mimics phpinfo()
This runs the tests in the tests_to_run array and
places returned data in the following arrays/scalars:
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
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.
This outputs a table containing a summary or test that were not executed, and the reasons why they were skipped
This outputs a table containing a summary of the test results (counts and % in each result type)
This is a helper method that makes it easy to output tables of test results for a given test group
Documentation generated on Fri, 06 Apr 2007 13:32:17 -0400 by phpDocumentor 1.3.0RC3