magicoli/wp-package-updater-lib 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

magicoli/wp-package-updater-lib

最新稳定版本:v1.1.1

Composer 安装命令:

composer require magicoli/wp-package-updater-lib

包简介

Composer package for wp-package-updater library.

README 文档

README

This is a set of all needed libraries to include in a plugin, to get automatic updates from Anexandre Froger's WP Plugin Update Server.

Requirements:

  • WP Plugin Update Server must be installed and configured
  • Your plugin must appear in WP Plugin Update Server packages list
  • Composer must be configured (if not run composer init --type=wordpress-plugin from your plugin root folder)

Install from command-line:

# Install package with composer
composer require magicoli/wp-package-updater-lib
# Add library to lib/wp-package-updater-lib
php vendor/magicoli/wp-package-updater-lib/install.php
# You should run install.php again each time the package is updated

To keep library up to date with composer update, insert this in composer.json:

"scripts": {
  "post-update-cmd": [
    "php vendor/magicoli/wp-package-updater-lib/install.php"
  ]
}

Include the following in your main plugin file:

// Adjust with your plugin uddate server URL
$wppul_server = 'https://magiiic.com';
$wppul_licence_required = false; // optional, set to true if licence is set in WPPUS

// Use autoload to load library
require_once( __DIR__ . '/lib/package-updater.php' );

The $wppul_server variable will be unset by the library afterwards to prevent conflicts with any other plugin so it is not safe to use it for other purposes.

Original README

Description

Used to enable updates for plugins and themes distributed via WP Plugin Update Server.

Requirements

The library must sit in a lib folder at the root of the plugin or theme directory.

Before deploying the plugin or theme, make sure to change the following value:

  • https://your-update-server.com => The URL of the server where WP Plugin Update Server is installed.
  • $prefix_updater => Change this variable's name with your plugin or theme prefix

Code to include in main plugin file

Simple update

require_once plugin_dir_path( __FILE__ ) . 'lib/wp-package-updater/class-wp-package-updater.php';

$prefix_updater = new WP_Package_Updater(
  'https://your-update-server.com',
  wp_normalize_path( __FILE__ ),
  wp_normalize_path( plugin_dir_path( __FILE__ ) ),
);

Update with license check

require_once plugin_dir_path( __FILE__ ) . 'lib/wp-package-updater/class-wp-package-updater.php';

$prefix_updater = new WP_Package_Updater(
  'https://your-update-server.com',
  wp_normalize_path( __FILE__ ),
  wp_normalize_path( plugin_dir_path( __FILE__ ) ),
  true
);

Code to include in functions.php

Simple update

require_once get_stylesheet_directory() . '/lib/wp-package-updater/class-wp-package-updater.php';

$prefix_updater = new WP_Package_Updater(
  'https://your-update-server.com',
  wp_normalize_path( __FILE__ ),
  get_stylesheet_directory(),
);

Update with license check

require_once get_stylesheet_directory() . '/lib/wp-package-updater/class-wp-package-updater.php';

$prefix_updater = new WP_Package_Updater(
  'https://your-update-server.com',
  wp_normalize_path( __FILE__ ),
  get_stylesheet_directory(),
  true
);

统计信息

  • 总下载量: 139
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2023-06-07