PHP code example of alessandrotesoro / wp-diagnostics
1. Go to this page and download the library: Download alessandrotesoro/wp-diagnostics library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alessandrotesoro / wp-diagnostics example snippets
composer
use Sematico\Diagnostics\Check\PHPVersion;
use Sematico\Diagnostics\Check\WPVersion;
use Sematico\Diagnostics\Runner;
defined( 'ABSPATH' ) || exit;
if ( file_exists( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) {
re met, you can boot your plugin.
if ( ! $rements->printNotice();
return;
}
$ __FILE__,
'My plugin'
);
$ __FILE__,
'My plugin',
[
new WPVersion( '5.7' ),
new PHPVersion( '7.2' ),
]
);
$
$ __FILE__,
'My plugin',
[
new WPVersion( '5.7' ),
new PHPVersion( '7.2' ),
],
true
);
$
$ 'title' => __( 'The “%1$s” plugin could not be activated.', 'my-plugin-textdomain' )
] );
$check1 = new Callback(
function() {
return true;
}
);
$check2 = new Callback(
function() {
return new WP_Error( 'example', 'Your error message goes here' );
}
);
$
// Single class check
$heck
$
$check1 = new ExtensionLoaded( 'mbstring' );
$rar' ] );
$
$check1 = new PHPVersion( '7.2' );
$' );
$
$check1 = new PluginActive( 'contact-form-7/wp-contact-form-7.php' );
$r/elementor.php' ] );
$
$check1 = new WPVersion( '5.7' );
$
namespace MyNameSpace\Example;
use Sematico\Diagnostics\Check\AbstractCheck;
use Sematico\Diagnostics\Check\CheckInterface;
use WP_Error;
class RegistrationActive extends AbstractCheck implements CheckInterface {
/**
* Perform the check.
*
* @return bool|\WP_Error
*/
public function check() {
if ( ! get_option( 'users_can_register' ) ) {
return new WP_Error( 'my-error', 'My error message here' );
}
return true;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.