定制 awesomemotive/wpforms-phpcs 二次开发

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

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

awesomemotive/wpforms-phpcs

最新稳定版本:1.7.0

Composer 安装命令:

composer require awesomemotive/wpforms-phpcs

包简介

WPForms Coding Standards

README 文档

README

Maintainers: The WPForms team

License: GPLv2 any later version.
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Description

WPForms coding standards are based on the WordPress Coding Standards and the PHPCompatibility Coding Standards and help create strict and high-quality code.

Installation

composer require awesomemotive/wpforms-phpcs --dev 

Configuration

Create the .phpcs.xml or phpcs.xml file at the root of your project:

<?xml version="1.0"?> <ruleset name="WPForms CS"> <description>The WPForms coding standard.</description> <exclude-pattern>\vendor/*</exclude-pattern> <exclude-pattern>\.github/*</exclude-pattern> <config name="testVersion" value="7.2-"/> <config name="multi_domains" value="true"/> <config name="minimum_supported_wp_version" value="5.5"/> <rule ref="WPForms"/> <rule ref="WPForms.PHP.ValidateDomain"> <properties> <property name="wpforms-lite" value="wpforms"/> <property name="wpforms" value="wpforms/pro/,wpforms/src/Pro/"/> </properties> </rule> </ruleset>

Sniffs detail

Validate Text Domain Sniff

The WPForms.PHP.ValidateDomain sniff validates that you are using the correct text domain for i18n functions such as __(), _e(), _n(), etc.

By default, this sniff works for one domain in the project. We get a directory name based on the vendor directory or the location of the phpcs.xml/.phpcs.xml file.

You can install our package to the plugins directory and enable the multi-domain mode. in this case, the text domain will be the next folder name in the path. Structure:

../wp-content/plugins/ # → Root ├── wpforms/ # → `wpforms` domain. └── wpforms-stripe/ # → `wpforms-stripe` domain. 

In your config you should enable the multi_domains property:

<?xml version="1.0"?> <ruleset name="WPForms CS"> <!-- ... --> <config name="multi_domains" value="true"/> <!-- ... --> </ruleset>

If you have different domains for directories inside your project (for example, for free and paid versions) and want to redefine the text domain for some paths:

../wp-content/plugins/ # → Root ├── wpforms/ # → `wpforms-lite` domain. │ ├── pro/ # → `wpforms` domain. │ └── src/ # → `wpforms-lite` domain. │ ├── Admin/ # → `wpforms-lite` domain. │ └── Pro/ # → `wpforms` domain. └── wpforms-stripe/ # → `wpforms-stripe` domain. 

In this case, you should add to the config file the property with name as a text domain and value as a path. If a domain has several paths, then list them via commas.

<?xml version="1.0"?> <ruleset name="WPForms CS"> <!-- ... --> <config name="multi_domains" value="true"/> <rule ref="WPForms.PHP.ValidateDomain"> <properties> <property name="wpforms-lite" value="wpforms"/> <property name="wpforms" value="wpforms/pro/,wpforms/src/Pro/"/> </properties> </rule> <!-- ... --> </ruleset>

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固