PhpSecInfo Class Reference

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

Detailed Description

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.

See also:
phpsecinfo()
Author:
Ed Finkler <coj@funkatron.com>

v0.1.1

v0.1

Definition at line 78 of file PhpSecInfo.lib.php.


Member Function Documentation

_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

Parameters:
integer $code
Returns:
string

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.

See also:
PHPSecInfo::_outputRenderStatsTable()
Parameters:
integer $code
Returns:
string

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

See also:
PHPSecInfo::_outputRenderTable()

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)

See also:
PHPSecInfo::_outputRenderTable()
PHPSecInfo::_outputGetResultTypeFromCode()

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

Parameters:
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

Since:
0.1.1
Returns:
string

Definition at line 479 of file PhpSecInfo.lib.php.

getResultsAsArray (  ) 

returns an associative array of test data. Four keys are set:

  • test_results (array)
  • tests_not_run (array)
  • result_counts (array)
  • num_tests_run (integer)

note that this must be called after tests are loaded and run

Since:
0.1.1
Returns:
array

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

Since:
0.1.1

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 (  ) 

Constructor

Returns:
PhpSecInfo

Definition at line 145 of file PhpSecInfo.lib.php.

renderOutput (  ) 

This is the main output method. The look and feel mimics phpinfo()

We need to use PhpSecInfo_Test::getBooleanIniValue() below

See also:
PhpSecInfo_Test::getBooleanIniValue()

Definition at line 232 of file PhpSecInfo.lib.php.


Field Documentation

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.


The documentation for this class was generated from the following file:
Generated on Tue Jun 8 12:28:39 2010 for Claroline API by  doxygen 1.6.3