Class AdminPageFramework_Requirement
Performs checks for given requirements whether the site can satisfy them.
Usage
Set requirements to the first parameter and perform thecheck()
method to get the number of warnings.
Example
$_oRequirementCheck = new AdminPageFramework_Requirement( array( 'php' => array( 'version' => '5.2.4', 'error' => 'The plugin requires the PHP version %1$s or higher.', ), 'wordpress' => array( 'version' => '3.4', 'error' => 'The plugin requires the WordPress version %1$s or higher.', ), 'mysql' => array( 'version' => '5.0', 'error' => 'The plugin requires the MySQL version %1$s or higher.', ), ), 'My Plugin Name' ); if ( $_oRequirementCheck->check() ) { $_oRequirementCheck->deactivatePlugin( $this->sFilePath, // the plugin main file path __( 'Deactivating the plugin', 'admin-page-framework-loader' ), // additional message true // is in the activation hook. This will exit the script. ); }
Package: AdminPageFramework\Utility
Since: 3.4.6
Located at utility/requirement/AdminPageFramework_Requirement.php
Since: 3.4.6
Located at utility/requirement/AdminPageFramework_Requirement.php
Methods summary
public
|
#
__construct( array $aRequirements = array(), string $sScriptName = '' )
Sets up properties. To disable checking on particular item, set an empty value to the element or simply omit it. $aRequirement = array( 'mysql' => '', // <-- mysql will be skipped. 'php' ... // 'wordpress' will be omitted ) Parameters
Since
3.4.6
|
public
integer
|
#
check( )
Performs checks. If it is not empty, it means there is a missing requirement. Returnsinteger The number of warnings. Since
3.4.6
|
public
|
#
deactivatePlugin( string $sPluginFilePath, string $sMessage = '', boolean $bIsOnActivation = false )
Deactivates the plugin. Parameters
Since
3.4.6
|
Magic methods summary
Properties summary
public
array
|
$aWarnings |
#
Stores warning messages of insufficient items. Since
3.4.6
|