# Tools for Easy Digital Downloads Extensions
## Installation and set up
The extension in question needs to have a `composer.json` file, specifically with the following:
```json
"require": {
"easydigitaldownloads/edd-addon-tools": "*"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/awesomemotive/edd-addon-tools"
}
]
```
Once set up, run `composer install --no-dev`. This should create a new `vendors/` folder with `easydigitaldownloads/edd-addon-tools/` inside.
## Using the extension loader
The `ExtensionLoader` class can be used to conditionally load an extension if all the requirements are met. Here's an example:
```php
require_once dirname( __FILE__ ) . '/vendor/autoload.php';
\EDD\ExtensionUtils\v1\ExtensionLoader::loadOrQuit( __FILE__, 'EDD_Content_Restriction_load', array(
'php' => '5.5',
'easy-digital-downloads' => '2.9',
) );
```
- The `vendor/autoload.php` file needs to be included.
- Call `\EDD\ExtensionUtils\v1\ExtensionLoader::loadOrQuit()`. This function takes three parameters:
1. The path to the main plugin file (`__FILE__` assuming this is included in the main plugin file).
2. The function/closure/callback you want to execute if all requirements are met. In this example that's a function called `EDD_Content_Restriction_load()`.
3. An array of requirements that must be met in order to load the plugin.
If the requirements are all met, the callback function is triggered on the `plugins_loaded` hook.
If the requirements are not met, then the callback is not triggered, and instead a warning is printed in the plugin's row in the admin table.
### Custom requirements
You can also set up custom/arbitrary requirements. Here's an example for where an extension could arbitrarily require a version of any plugin (in this case, MailPoet):
```php
\EDD\ExtensionUtils\v1\ExtensionLoader::loadOrQuit( __FILE__, 'edd_mailpoet_load', array(
'php' => '5.5',
'easy-digital-downloads' => '2.9',
'mailpoet' => array(
'minimum' => '2.0',
'name' => 'MailPoet',
'exists' => static function () {
return defined( 'MAILPOET_VERSION' ) || class_exists( 'WYSIJA_object' );
},
'current' => static function () {
if ( defined( 'MAILPOET_VERSION' ) ) {
return MAILPOET_VERSION;
} elseif ( class_exists( 'WYSIJA_object' ) ) {
return WYSIJA_object::$version;
} else {
return false;
}
},
),
) );
```
Note the use of closures. This ensures the constants are only evaluated on `plugins_loaded` instead of immediately. This is to ensure the dependencies are loaded before we check them.
没有合适的资源?快使用搜索试试~ 我知道了~
【WordPress插件】2022年最新版完整功能demo+插件v2.2.2.zip
共187个文件
php:162个
js:12个
css:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 90 浏览量
2022-03-29
12:11:20
上传
评论
收藏 213KB ZIP 举报
温馨提示
"【WordPress插件】2022年最新版完整功能demo+插件v2.2.2 Easy Digital Downloads Reviews Addon 轻松数字下载评论addon" ---------- 泰森云每天更新发布最新WordPress主题、HTML主题、WordPress插件、shopify主题、opencart主题、PHP项目源码、安卓项目源码、ios项目源码,更有超10000个资源可供选择,如有需要请站内联系。
资源推荐
资源详情
资源评论
收起资源包目录
【WordPress插件】2022年最新版完整功能demo+插件v2.2.2.zip (187个子文件)
edd-reviews.css 5KB
edd-reviews.min.css 4KB
edd-reviews-admin.css 4KB
edd-reviews-admin.min.css 3KB
phpstan.neon.dist 213B
blocks.js 7KB
edd-reviews-admin.js 4KB
admin.js 2KB
ReviewSelectControl.js 2KB
edd-reviews.js 2KB
ProductSelectControl.js 2KB
reviews.js 2KB
SelectReview.js 2KB
ReviewPreview.js 2KB
StarRating.js 551B
index.js 457B
index.js 33B
installed.json 6KB
LICENSE 1KB
LICENSE 1KB
README.md 3KB
edd-reviews-fr_FR.mo 3KB
edd-reviews.php 115KB
class-edd-reviews-fes-integration.php 36KB
class-edd-reviews-list-table.php 30KB
class-edd-reviews-vendor-feedback-list-table.php 25KB
ClassLoader.php 16KB
InstalledVersions.php 15KB
Settings.php 14KB
class-edd-reviews-request-review.php 12KB
class-edd-reviews-upgrades.php 11KB
Installer.php 10KB
class-edd-reviews-email-template-tags.php 9KB
class-edd-reviews-privacy.php 8KB
class-edd-reviews-reports-list-table.php 8KB
ApiV1.php 7KB
RequirementsChecker.php 7KB
Voting.php 7KB
class-per-product-reviews-widget.php 6KB
class-reviews-widget.php 6KB
class-edd-reviews-reports.php 6KB
class-walker-edd-review.php 5KB
DeprecatedMethodRouter.php 5KB
class-featured-review-widget.php 5KB
shortcode-vendor-feedback.php 5KB
ExtensionLoader.php 5KB
reviews.php 4KB
MicroweberInstaller.php 4KB
class-edd-reviews-json-ld.php 4KB
BitrixInstaller.php 4KB
class-edd-reviews-shortcode-review.php 4KB
AssetLoader.php 4KB
BaseInstaller.php 4KB
Reviews.php 3KB
MoodleInstaller.php 3KB
class-edd-reviews-download-list-table.php 3KB
PxcmsInstaller.php 2KB
installed.php 2KB
reviews-reply.php 2KB
autoload_real.php 2KB
CakePHPInstaller.php 2KB
reviews-fes-vendor-feedback.php 2KB
class-edd-reviews-highest-average-rating-list-table.php 2KB
class-edd-reviews-lowest-average-rating-list-table.php 2KB
class-edd-reviews-most-reviewed-list-table.php 2KB
Products.php 2KB
ShopwareInstaller.php 2KB
class-edd-reviews-vendor-feedback.php 2KB
uninstall.php 2KB
install.php 1KB
voting-box.php 1KB
autoload_static.php 1KB
WinterInstaller.php 1KB
OxidInstaller.php 1KB
class-edd-reviews-shortcode-average-rating.php 1KB
VgmcpInstaller.php 1KB
AsgardInstaller.php 1KB
MediaWikiInstaller.php 1KB
OctoberInstaller.php 1KB
blocks.php 1KB
DokuWikiInstaller.php 1KB
TYPO3FlowInstaller.php 1KB
SyDESInstaller.php 1KB
MauticInstaller.php 1KB
SilverStripeInstaller.php 1KB
TastyIgniterInstaller.php 875B
DrupalInstaller.php 867B
WHMCSInstaller.php 838B
MajimaInstaller.php 834B
Endpoint.php 815B
CraftInstaller.php 806B
MayaInstaller.php 791B
TaoInstaller.php 787B
ExpressionEngineInstaller.php 732B
LanManagementSystemInstaller.php 726B
OntoWikiInstaller.php 724B
PlentymarketsInstaller.php 713B
HuradInstaller.php 702B
GravInstaller.php 700B
PiwikInstaller.php 697B
共 187 条
- 1
- 2
资源评论
Lee达森
- 粉丝: 969
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功