felixarntz/wp-global-options 问题修复 & 功能扩展

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

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

felixarntz/wp-global-options

Composer 安装命令:

composer require felixarntz/wp-global-options

包简介

Implements a global option storage in WordPress.

README 文档

README

Build Status Latest Stable Version License

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-options command 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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2018-01-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固