baxtian / wp_requirements
0.3.9
2024-02-14 12:27 UTC
Requires
- php: >=7.0
README
用于定义主题或插件的必要条件的对象。
使用方法
<?php
use Baxtian\WP_Requirements as WP_Requirements;
// Do we miss a requirement
if (WP_Requirements::requirements(
'Theme or Plugin Name',
[
[
'name' => 'Timber',
'slug' => 'timber-library/timber.php',
'zip'=> 'https://downloads.wordpress.org/plugin/timber-library.latest-stable.zip',
'check' => ['self::has_timber', ''], // To detect if your theme has timber.
],
[
'name' => 'SCSS-Library',
'slug' => 'scss-library/scss-library.php',
'zip'=> 'https://downloads.wordpress.org/plugin/scss-library.latest-stable.zip',
'check' => ['class_exists', 'ScssLibrary\ScssLibrary'], // You can use here also 'function_exists'.
],
[
'name' => 'Font Awesome',
'slug' => 'font-awesome/font-awesome.php',
'zip'=> 'https://downloads.wordpress.org/plugin/font-awesome.latest-stable.zip',
'check' => ['class_exists', 'FortAwesome\FontAwesome_Loader'],
],
]
)) {
// Code to be displayed if there are missing requirements
...
// Finish your theme execution? It's up to you.
return;
}
维护者
Juan Sebastián Echeverry baxtian.echeverry@gmail.com
变更日志
0.3.9
使用timber目录而不是composer.json文件作为'has_timber'要求的合规检测器。
0.3.8
如果主题和旧timber插件同时激活,则发出警告。
0.3.6
- 如果用作检查函数,则将self::替换为Baxtian\WP_Requirement::。
0.3.5
- 关于禁用旧Timber插件的提示信息。
0.3.3
- 检测主题是否具有Timber 2的动作。
0.3
- 如果在此类多个提供者中使用,允许Composer默认设置要使用的文件。
0.2
- 允许使用PHP8.0
0.1
- 首次稳定发布