Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint the various modules #734

Merged
merged 13 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
},
"scripts": {
"cs": [
"@php ./vendor/bin/phpcs -p -s -v -n . --standard=\"WordPress-VIP-Go\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*\""
"@php ./vendor/bin/phpcs -p -s -v -n . --standard=\"phpcs.xml.dist\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*,/common/*\""
],
"cbf": [
"@php ./vendor/bin/phpcbf -p -s -v -n . --standard=\"WordPress-VIP-Go\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*\""
"@php ./vendor/bin/phpcbf -p -s -v -n . --standard=\"phpcs.xml.dist\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*,/common/*\""
],
"integration": "wp-env run tests-cli --env-cwd=wp-content/plugins/Edit-Flow ./vendor/bin/phpunit",
"integration-ms": "wp-env run tests-cli --env-cwd=wp-content/plugins/Edit-Flow /bin/bash -c 'WP_MULTISITE=1 ./vendor/bin/phpunit'"
Expand Down
2 changes: 1 addition & 1 deletion edit-flow.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*
* Since this is not the primary plugin file, it does not have the standard WordPress headers.
*/
require_once dirname( __FILE__ ) . '/edit_flow.php';
require_once __DIR__ . '/edit_flow.php';
19 changes: 10 additions & 9 deletions edit_flow.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ private function setup_actions() {
* Inititalizes the Edit Flows!
* Loads options for each registered module and then initializes it if it's active
*/
function action_init() {
public function action_init() {

load_plugin_textdomain( 'edit-flow', null, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
load_plugin_textdomain( 'edit-flow', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );

$this->load_modules();

Expand All @@ -218,7 +218,7 @@ function action_init() {
/**
* Initialize the plugin for the admin
*/
function action_admin_init() {
public function action_admin_init() {

// Upgrade if need be but don't run the upgrade if the plugin has never been used
$previous_version = get_option( $this->options_group . 'version' );
Expand Down Expand Up @@ -315,7 +315,7 @@ public function register_module( $name, $args = array() ) {
* Load all of the module options from the database
* If a given option isn't yet set, then set it to the module's default (upgrades, etc.)
*/
function load_module_options() {
public function load_module_options() {

foreach ( $this->modules as $mod_name => $mod_data ) {

Expand Down Expand Up @@ -343,7 +343,7 @@ function load_module_options() {
*
* @see http://dev.editflow.org/2011/11/17/edit-flow-v0-7-alpha2-notes/#comment-232
*/
function action_init_after() {
public function action_init_after() {
foreach ( $this->modules as $mod_name => $mod_data ) {

if ( isset( $this->modules->$mod_name->options->post_types ) ) {
Expand All @@ -360,7 +360,7 @@ function action_init_after() {
* @param string $key The property to use for searching a module (ex: 'name')
* @param string|int|array $value The value to compare (using ==)
*/
function get_module_by( $key, $value ) {
public function get_module_by( $key, $value ) {
$module = false;
foreach ( $this->modules as $mod_name => $mod_data ) {

Expand All @@ -380,13 +380,13 @@ function get_module_by( $key, $value ) {
/**
* Update the $edit_flow object with new value and save to the database
*/
function update_module_option( $mod_name, $key, $value ) {
public function update_module_option( $mod_name, $key, $value ) {
$this->modules->$mod_name->options->$key = $value;
$this->$mod_name->module = $this->modules->$mod_name;
return update_option( $this->options_group . $mod_name . '_options', $this->modules->$mod_name->options );
}

function update_all_module_options( $mod_name, $new_options ) {
public function update_all_module_options( $mod_name, $new_options ) {
if ( is_array( $new_options ) ) {
$new_options = (object) $new_options;
}
Expand All @@ -398,7 +398,7 @@ function update_all_module_options( $mod_name, $new_options ) {
/**
* Registers commonly used scripts + styles for easy enqueueing
*/
function register_scripts_and_styles() {
public function register_scripts_and_styles() {
wp_enqueue_style( 'ef-admin-css', EDIT_FLOW_URL . 'common/css/edit-flow-admin.css', false, EDIT_FLOW_VERSION, 'all' );

wp_register_script( 'jquery-listfilterizer', EDIT_FLOW_URL . 'common/js/jquery.listfilterizer.js', array( 'jquery' ), EDIT_FLOW_VERSION, true );
Expand All @@ -418,6 +418,7 @@ function register_scripts_and_styles() {
}
}

// phpcs:disable WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
function EditFlow() {
return edit_flow::instance();
}
Expand Down
Loading
Loading