pressmodo/wp-requirements

该软件包已被废弃,不再维护。未建议替代软件包。

用于确定WordPress插件和主题需求的辅助库。

1.0.3 2021-01-05 16:24 UTC

This package is auto-updated.

Last update: 2021-06-12 10:14:08 UTC


README

⚠️ 已弃用:请使用 https://github.com/alessandrotesoro/wp-diagnostics 作为替代。⚠️

WP Requirements

WordPress插件和主题的简单即插即用库,用于检查核心、插件、主题和PHP需求。

安装

composer require pressmodo/wp-requirements

基本用法

在插件主文件中

<?php
/*
Plugin Name: My Test Plugin
Version: 1.0.0
*/

// Composer autoload.
require_once __DIR__ . '/vendor/autoload.php' ;

$requirements = new \Pressmodo\Requirements\Requirements( 'My Test Plugin', array(
	'php'                => '7.0',
	'php_extensions'     => array( 'soap' ),
	'wp'                 => '5.3',
	'plugins'            => array(
		array( 'file' => 'akismet/akismet.php', 'name' => 'Akismet', 'version' => '3.0' ),
		array( 'file' => 'hello-dolly/hello.php', 'name' => 'Hello Dolly', 'version' => '1.5' )
	),
	'theme'              => array(
		'slug' => 'twentysixteen',
		'name' => 'Twenty Sixteen'
	),
) );

/**
 * Run all the checks and check if requirements has been satisfied.
 * If not - display the admin notice and exit from the file.
 */
if ( ! $requirements->satisfied() ) {
	$requirements->print_notice();
	return;
}

// ... plugin runtime.