Skip to content

Commit 4b3dcdf

Browse files
authored
Merge pull request #38 from WordPress-Phoenix/v5
V5
2 parents 12e1625 + 001ed2e commit 4b3dcdf

54 files changed

Lines changed: 3449 additions & 3295 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/codesniffer.ruleset.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
- run:
1414
name: Install Testing Dependencies
1515
command: |
16-
composer require --dev --no-update "wp-coding-standards/wpcs:^0.14.1" ; \
17-
composer install --dev --no-autoloader ; \
18-
sudo ./vendor/bin/phpcs --config-set installed_paths $PWD/vendor/wp-coding-standards/wpcs ;
19-
- run: sudo ./vendor/bin/phpcs --config-set installed_paths $PWD/vendor/wp-coding-standards/wpcs
20-
- run: ./vendor/bin/phpcs -p -s -v -n --standard=.circleci/codesniffer.ruleset.xml .
16+
composer install --prefer-source --no-interaction
17+
- run:
18+
name: Running Tests
19+
command: |
20+
composer lint:check
2121
notify:
2222
docker:
2323
- image: circleci/node:latest

.circleci/phpcs.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="wpphx">
3+
<description>OneCMS phpcs ruleset, based on WordPress Core and VIP standards.</description>
4+
5+
<!-- Exclude specific Composer-related directories from linting. -->
6+
<exclude-pattern>*/vendor/*</exclude-pattern>
7+
<exclude-pattern>*/lib/index.php</exclude-pattern>
8+
<exclude-pattern>*/lib/autoload.php</exclude-pattern>
9+
<exclude-pattern>*/lib/bin/*</exclude-pattern>
10+
<exclude-pattern>*/lib/composer/*</exclude-pattern>
11+
12+
<!-- Exclude static assets from linting. -->
13+
<exclude-pattern>*/assets/*</exclude-pattern>
14+
<exclude-pattern>*\.(css|js|xml)</exclude-pattern>
15+
<exclude-pattern>*/node_modules/*</exclude-pattern>
16+
17+
<!-- Don't fail in CI if there are warnings. -->
18+
<config name="ignore_warnings_on_exit" value="1" />
19+
20+
<!-- Only worry about WordPress 5.0+. -->
21+
<config name="minimum_supported_wp_version" value="5.0" />
22+
23+
<rule ref="WordPress">
24+
<exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found" />
25+
</rule>
26+
27+
<rule ref="WordPress-Core"></rule>
28+
29+
<rule ref="WordPress-VIP">
30+
<exclude name="WordPress.VIP.SuperGlobalInputUsage" />
31+
<exclude name="WordPress.VIP.RestrictedFunctions.switch_to_blog" />
32+
<exclude name="WordPress.VIP.RestrictedFunctions.get_page_by_title" />
33+
<exclude name="WordPress.VIP.RestrictedFunctions.get_page_by_title_get_page_by_title" />
34+
</rule>
35+
36+
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
37+
<exclude-pattern>/lib/*</exclude-pattern>
38+
<exclude-pattern>/src/*</exclude-pattern>
39+
</rule>
40+
</ruleset>

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 4
5+
indent_style = tab
6+
7+
[*.{json,yml}]
8+
indent_size = 2
9+
indent_style = space

README.md

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,66 @@
22

33
WordPress options builder class is a library that helps you setup theme or plugin options that store data in the database with just a few lines of code.
44

5-
### Updated in 4.1
6-
* Fully escaped & sanitized
7-
* More data storage APIs
8-
* Cleaned up styles
9-
* Improved Media field
10-
* Cruft cleanup
11-
* Inline docblocks
12-
* ... and much more!
5+
### Updated in 5.0
6+
7+
* Updated WordPress Coding Standards
8+
* Improved Composer configuration
9+
* Added support for the [.editorconfig standard](https://editorconfig.org)
10+
* Rewrote encryption on the Password field type to use OpenSSL instead of mcrypt
11+
* Removed the Markdown field type
12+
* Refactored library code
1313

1414
Builds protected by CircleCI: [![CircleCI](https://circleci.com/gh/WordPress-Phoenix/wordpress-options-builder-class.svg?style=svg)](https://circleci.com/gh/WordPress-Phoenix/wordpress-options-builder-class)
1515

16-
## Table of Contents:
17-
- [Installation](#installation)
18-
- [Usage](#usage)
16+
## Table of Contents
17+
18+
* [Installation](#installation)
19+
* [Upgrading to version 5.x](#upgrading-to-version-5x)
20+
* [Usage](#usage)
21+
22+
## Installation
23+
24+
### Composer style (recommended)
1925

26+
1. Include in your plugin by creating or adding the following to your composer.json file in the root of the plugin
27+
```json
28+
{
29+
"require": {
30+
"WordPress-Phoenix/wordpress-options-builder-class": "^5.0.0"
31+
}
32+
}
33+
```
34+
2. Confirm that composer is installed in your development enviroment using `which composer`.
35+
3. Open CLI into your plugins root directory and run `composer install`.
36+
4. Confirm that it created the vendor folder in your plugin.
37+
5. In your plugins main file, near the code where you include other files place the following:
38+
```php
39+
if ( file_exists( dirname( __FILE__ ) . 'vendor/autoload.php' ) ) {
40+
include_once dirname( __FILE__ ) . 'vendor/autoload.php';
41+
}
42+
```
2043

21-
# Installation
44+
### Manual Installation
2245

23-
## Composer style (recommended)
46+
1. Download the most updated copy of this repository from `https://api.github.com/repos/WordPress-Phoenix/wordpress-options-builder-class/zipball`
47+
2. Extract the zip file, and copy the PHP file into your plugin project.
48+
3. Include the `src/class-wordpress-options-panels.php` file in your plugin.
2449

25-
1. Include in your plugin by creating or adding the following to your composer.json file in the root of the plugin
26-
```json
27-
{
28-
"require": {
29-
"WordPress-Phoenix/wordpress-options-builder-class": "3.*"
30-
}
31-
}
32-
```
33-
2. Confirm that composer is installed in your development enviroment using `which composer`.
34-
3. Open CLI into your plugins root directory and run `composer install`.
35-
4. Confirm that it created the vendor folder in your plugin.
36-
5. In your plugins main file, near the code where you include other files place the following:
37-
```php
38-
if( file_exists( dirname( __FILE__ ) . 'vendor/autoload.php' ) ) {
39-
include_once dirname( __FILE__ ) . 'vendor/autoload.php';
40-
}
41-
```
50+
## Upgrading to version 5.x
4251

43-
## Manual Installation
44-
1. Download the most updated copy of this repository from `https://api.github.com/repos/WordPress-Phoenix/wordpress-options-builder-class/zipball`
45-
2. Extract the zip file, and copy the PHP file into your plugin project.
46-
3. Use SSI (Server Side Includes) to include the file into your plugin.
52+
Version 5.0 is a major rewrite of the WordPress Phoenix Options Panel and there are a few required update steps.
4753

48-
# Usage
54+
* If not using an autoloader, include `src/class-wordpress-options-panels.php` (instead of `wpop-init.php`)
55+
* Reference the `\WPOP\V_5_0\*` namespace instead of `\WPOP\V_4_1\*`
56+
* If you aren't using an autoloader, manually load the class files into memory:
57+
```php
58+
\WPOP\V_5_0\WordPress_Options_Panels::load_files();
59+
```
60+
* The Markdown field type has been removed; consider switching to `include_partial` and rendering the markdown through a PHP class of your choosing (WordPress Phoenix Options Panel version 4.x used [erusev/parsedown](https://packagist.org/packages/erusev/parsedown))
61+
* Update your array of `$args` to `new \WPOP\V_5_0\Page( $args, $fields );` to include an `installed_dir_uri` key and value, representing the public URL path to your installation of this library (required to load CSS and JS assets used to style the options panels)
4962

50-
* [Get started](https://github.com/WordPress-Phoenix/wordpress-options-builder-class/wiki) at the Wiki describing Panel, Section and Part schemas
51-
* [See a full example](https://github.com/WordPress-Phoenix/wpop-example-panel/blob/master/app/admin/class-options-panel.php) in the WPOP Example Plugin
52-
* [Generate a working copy](https://github.com/WordPress-Phoenix/wordpress-development-toolkit/releases) using the WordPress Development Toolkit and the [Abstract Plugin Base](https://github.com/WordPress-Phoenix/abstract-plugin-base).
63+
## Usage
5364

65+
* [Get started](https://github.com/WordPress-Phoenix/wordpress-options-builder-class/wiki) at the Wiki describing Panel, Section and Part schemas
66+
* [See a full example](https://github.com/WordPress-Phoenix/wpop-example-panel/blob/master/app/admin/class-options-panel.php) in the WPOP Example Plugin
67+
* [Generate a working copy](https://github.com/WordPress-Phoenix/wordpress-development-toolkit/releases) using the WordPress Development Toolkit and the [Abstract Plugin Base](https://github.com/WordPress-Phoenix/abstract-plugin-base).

composer.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@
1717
"role": "Developer"
1818
}
1919
],
20-
"require": {
21-
"composer/installers": "~1.0",
22-
"erusev/parsedown": "^1.7"
20+
"config": {
21+
"sort-packages": true
22+
},
23+
"require-dev": {
24+
"automattic/vipwpcs": "^0.4.0",
25+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
26+
"wp-coding-standards/wpcs": "^1.2.0"
27+
},
28+
"scripts": {
29+
"lint:check": "phpcs --standard=./.circleci/phpcs.xml .",
30+
"lint:fix": "phpcbf --standard=./.circleci/phpcs.xml ."
2331
},
2432
"autoload": {
2533
"classmap": [
26-
"/"
34+
"src"
2735
]
28-
},
29-
"require-dev": {
30-
"wp-coding-standards/wpcs": "^0.14.1"
3136
}
3237
}

0 commit comments

Comments
 (0)