felixarntz/wp-global-options
Composer 安装命令:
composer require felixarntz/wp-global-options
包简介
Implements a global option storage in WordPress.
README 文档
README
WP Global Options
Implements a global option storage in WordPress.
What it does
- introduces a database table
global_options - introduces a CRUD API for global options, including sanitization and validation
- introduces a CRUD API for global transients
- introduces an API for registering/unregistering global settings
- includes a
wp global-optionscommand for WP-CLI
How to install
The plugin can either be installed as a network-wide regular plugin or alternatively as a must-use plugin.
Recommendations
- While it is a best practice to prefix plugin functions and classes, this plugin is a proof-of-concept for WordPress core, and several functions may end up there eventually. This plugin only prefixes functions and classes that are specific to the plugin, internal helper functions for itself or hooks. Non-prefixed functions and classes are wrapped in a conditional so that, if WordPress core adapts them, their core variant will be loaded instead. Therefore, do not define any of the following functions or classes:
sanitize_global_option()get_global_option()update_global_option()add_global_option()delete_global_option()wp_load_global_alloptions()get_global_transient()set_global_transient()delete_global_transient()register_global_setting()unregister_global_setting()get_registered_global_settings()filter_default_global_option()
Usage
Managing Global Options
- Function:
get_global_option( string $option, mixed $default = false ): mixed - Function:
update_global_option( string $option, mixed $value, string|bool $autoload = null ): bool - Function:
add_global_option( string $option, mixed $value, string|bool $autoload = 'no' ): bool - Function:
delete_global_option( string $option ): bool
Managing Global Transients
- Function:
get_global_transient( string $transient ): mixed - Function:
set_global_transient( string $transient, mixed $value, int $expiration = 0 ): bool - Function:
delete_global_transient( string $transient ): bool
Managing Global Settings
- Function:
register_global_setting( string $option_group, string $option_name, array $args = array() ) - Function:
unregister_global_setting( string $option_group, string $option_name ) - Function:
get_registered_global_settings()
Hooks
- Filter:
sanitize_global_option_{$option} - Filter:
validate_global_option_{$option} - Filter:
pre_global_option_{$option} - Filter:
default_global_option_{$option} - Filter:
global_option_{$option} - Filter:
pre_update_global_option_{$option} - Filter:
pre_update_global_option - Filter:
pre_global_transient_{$transient} - Filter:
global_transient_{$transient} - Filter:
pre_set_global_transient_{$transient} - Filter:
expiration_of_global_transient_{$transient} - Action:
update_global_option - Action:
update_global_option_{$option} - Action:
updated_global_option - Action:
add_global_option - Action:
add_global_option_{$option} - Action:
added_global_option - Action:
pre_delete_global_option_{$option} - Action:
delete_global_option_{$option} - Action:
deleted_global_option - Action:
set_global_transient_{$transient} - Action:
setted_global_transient - Action:
delete_global_transient_{$transient} - Action:
deleted_global_transient
felixarntz/wp-global-options 适用场景与选型建议
felixarntz/wp-global-options 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 51 次下载、GitHub Stars 达 8, 最近一次更新时间为 2018 年 01 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「wordpress」 「global」 「multisite」 「multinetwork」 「global options」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 felixarntz/wp-global-options 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 felixarntz/wp-global-options 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 felixarntz/wp-global-options 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
A global CDN and reverse proxy cache warmer.
A global command line tool for Laravel's Artisan.
Create re-usable chunks of content for templates
Plugin to install Composer dependencies in a global directory.
Plugin for YOURLS. Default tools to use in some laemmi plugins
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2018-01-22