Skip to content

Commit d246016

Browse files
committed
code style: adhere to WordPress Coding Standards
1 parent 37431f3 commit d246016

File tree

4 files changed

+517
-81
lines changed

4 files changed

+517
-81
lines changed

bootstrap.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
2-
32
/**
4-
* @wordpress-plugin
53
* Plugin Name: React Admin Page Example
64
* Plugin URI: https://github.com/wellmann/wp-react-admin-page-example
75
* Description: WordPress admin page developed with React and Gutenberg components.
@@ -12,20 +10,24 @@
1210
* Text Domain: wp-react-admin-page-example
1311
* Domain Path: /lang
1412
* GitHub Plugin URI: https://github.com/wellmann/wp-react-admin-page-example
13+
*
14+
* @package kwio/wp-react-admin-page-example
1515
*/
1616

17-
namespace KWIO\ReactAdminPage;
17+
namespace KWIO\React_Admin_Page;
1818

19-
if (!defined('ABSPATH')) {
20-
exit;
19+
if ( ! defined( 'ABSPATH' ) ) {
20+
exit;
2121
}
2222

23-
define(__NAMESPACE__ . '\\MAIN_FILE', __FILE__);
24-
define(__NAMESPACE__ . '\\BASENAME', plugin_basename(MAIN_FILE));
25-
define(__NAMESPACE__ . '\\DIR_PATH', plugin_dir_path(MAIN_FILE));
26-
define(__NAMESPACE__ . '\\DIR_URL', plugin_dir_url(MAIN_FILE));
27-
define(__NAMESPACE__ . '\\ADMIN_PAGE_SLUG', 'kwio-react-page');
23+
define( __NAMESPACE__ . '\\MAIN_FILE', __FILE__ );
24+
define( __NAMESPACE__ . '\\BASENAME', plugin_basename( MAIN_FILE ) );
25+
define( __NAMESPACE__ . '\\DIR_PATH', plugin_dir_path( MAIN_FILE ) );
26+
define( __NAMESPACE__ . '\\DIR_URL', plugin_dir_url( MAIN_FILE ) );
27+
define( __NAMESPACE__ . '\\ADMIN_PAGE_SLUG', 'kwio-react-page' );
28+
29+
if ( file_exists( DIR_PATH . 'vendor/autoload.php' ) ) {
30+
require_once DIR_PATH . 'vendor/autoload.php';
31+
}
2832

29-
if (file_exists(DIR_PATH . 'vendor/autoload.php')) {
30-
require_once DIR_PATH . 'vendor/autoload.php';
31-
}
33+
require_once DIR_PATH . 'src/hooks.php';

composer.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
"license": "GPL-3.0",
55
"autoload": {
66
"psr-4": {
7-
"Kwio\\ReactAdminPage\\": "src/"
8-
},
9-
"files": [
10-
"src/hooks.php"
11-
]
7+
"KWIO\\React_Admin_Page\\": "src/"
8+
}
129
},
1310
"authors": [
1411
{
@@ -18,7 +15,18 @@
1815
],
1916
"scripts": {
2017
"make-pot": "wp i18n make-pot . lang/wp-react-admin-page-example.pot",
21-
"make-json": "wp i18n make-json lang --no-purge"
18+
"make-json": "wp i18n make-json lang --no-purge",
19+
"cs:check": "phpcs -ps . --extensions=php --ignore=*/dist/*,*/node_modules/*,*/vendor/* --standard=WordPress",
20+
"cs:fix": "phpcbf -ps . --extensions=php --ignore=*/dist/*,*/node_modules/*,*/vendor/* --standard=WordPress"
21+
},
22+
"config": {
23+
"allow-plugins": {
24+
"dealerdirect/phpcodesniffer-composer-installer": true
25+
}
2226
},
23-
"require": {}
27+
"require-dev": {
28+
"wp-coding-standards/wpcs": "^3.0",
29+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
30+
"squizlabs/php_codesniffer": "^3.11"
31+
}
2432
}

0 commit comments

Comments
 (0)