定制 acrossai-co/addons-page 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

acrossai-co/addons-page

最新稳定版本:0.0.17

Composer 安装命令:

composer require acrossai-co/addons-page

包简介

Reusable WordPress Add-ons page with free and paid add-ons support via Freemius.

README 文档

README

A reusable Composer package that adds a fully working Add-ons page inside WP Admin for any WordPress plugin.

Requirements

  • PHP 7.4+
  • WordPress 6.0+
  • automattic/jetpack-autoloader: ^5.0 in your plugin's composer.json

Installation

composer require acrossai-co/addons-page

Load the autoloader in your plugin (jetpack-autoloader generates vendor/autoload_packages.php):

require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload_packages.php';

Integration

Register a free product in your Freemius dashboard (WordPress Plugin, Analytics only, free plan ON) and grab its Product ID and Public Key.

Then call the constructor anywhere after your plugin's admin menu is registered (e.g. inside a plugins_loaded callback or define_admin_hooks()):

new \AcrossAI_Addon\AddonsPage(
    'your-plugin-menu-slug', // parent menu slug registered with add_menu_page()
    __FILE__,                // your plugin's main file
    [
        'fs_product_id' => '12345',       // your Freemius product ID
        'fs_public_key' => 'pk_abc123',   // your Freemius public key
        'fs_slug'       => 'your-plugin', // optional — defaults to menu slug
    ]
);

Each plugin gets its own Freemius product so activations and analytics are tracked separately per plugin in your dashboard.

The package handles:

  • Registering the Add-ons submenu under your parent menu slug
  • Rendering the add-ons grid (free + paid)
  • Installing free add-ons silently (WordPress.org API or GitHub ZIP)
  • Paid add-on checkout via Freemius JS popup
  • Opt-in / "Login & Connect" flow
  • Shared opt-in: if the user opted in via another plugin using this package, the banner is already hidden

Upgrading jetpack-autoloader from v3

If your plugin currently has "automattic/jetpack-autoloader": "^3.0", bump it to ^5.0:

"automattic/jetpack-autoloader": "^5.0"

Then run:

composer update automattic/jetpack-autoloader

Your existing vendor/autoload_packages.php bootstrap call continues to work unchanged.

See docs/upgrade-notes.md for the full migration guide.

readme.txt sections (for wordpress.org submissions)

Copy the blocks from docs/readme-template.txt into your plugin's readme.txt. These sections are required by wordpress.org:

  • == Installation ==
  • == External Services ==
  • == Privacy Policy ==

Known limitations

  • Multisite: not tested or supported in v1. Works on per-site dashboards but network-activated behaviour is undefined.
  • Uninstall edge case: if you have two plugins using this package and one is uninstalled (not just deactivated) while the other is active, Freemius may clear shared opt-in state. Recovery: the user clicks "Login / Connect" on the remaining plugin's Add-ons page.
  • Non-plugin contexts: instantiating outside a WordPress plugin (theme, mu-plugin, CLI) throws \RuntimeException.

License

GPL-2.0-or-later — see LICENSE.txt.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固