soberwp/bundle

此包已被 弃用 且不再维护。没有推荐替代包。

WordPress 插件,通过 JSON、YAML 或 PHP 文件启用插件激活。

安装量: 3,686

依赖: 1

建议者: 0

安全性: 0

星标: 25

关注者: 5

分支: 3

开放问题: 0

类型:wordpress-muplugin

1.0.2-p 2018-08-21 08:33 UTC

This package is auto-updated.

Last update: 2021-06-24 13:02:33 UTC


README

WordPress 插件,通过 JSON、YAML 或 PHP 文件启用插件激活。

安装

Composer

推荐方法:

Roots BedrockWP-CLI

$ composer require soberwp/bundle
$ wp plugin activate bundle

Roots Sage

$ composer require soberwp/bundle:1.0.2-p

手动

  • 下载 zip 文件
  • 解压到您的网站插件文件夹
  • 通过 WordPress 激活

要求

设置

默认使用 bundle.jsonbundle.yamlbundle.php

您可以使用以下过滤器在主题的 functions.php 文件中为每个使用自定义文件:

add_filter('sober/bundle/file', function () {
    return get_stylesheet_directory() . '/plugin-dependencies.yaml';
});

用法

主题通常需要插件才能运行 —— bundle 利用流行的 tgmpa 类来执行插件激活提示和操作。

示例

bundle.json

[
  {
    "name": "Disable Comments",
    "slug": "disable-comments",
    "required": false,
    "force_activation": true
  },
  {
    "name": "Models",
    "slug": "models",
    "source": "https://github.com/soberwp/models/archive/master.zip",
    "external_url": "https://github.com/models/intervention",
    "required": true,
    "force_activation": true,
    "force_deactivation": false
  }
]

bundle.yaml

---
- name: Disable Comments
  slug: disable-comments
  required: false
  force_activation: true
- name: Models
  slug: models
  source: https://github.com/soberwp/models/archive/master.zip
  external_url: https://github.com/models/intervention
  required: true
  force_activation: true
  force_deactivation: false

bundle.php

<?php
return [
    [
        'name' => 'Disable Comments',
        'slug' => 'disable-comments',
        'required' => false,
        'force_activation' => true
    ],
    [
        'name' => 'Models',
        'slug' => 'models',
        'source' => 'https://github.com/soberwp/models/archive/master.zip',
        'external_url' => 'https://github.com/models/intervention',
        'required' => true,
        'force_activation' => true,
        'force_deactivation' => false
    ]
];

您可以阅读 tgmpa 文档 了解插件激活选项。

更新

Composer

  • 将 composer.json 版本更改为 ^1.0.2**
  • 在更新之前检查 CHANGELOG.md 了解任何破坏性更改。
$ composer update

WordPress

包含对 github-updater 的支持,以通过 WordPress 后端跟踪更新。

其他