From eb6f88aec695a2d5d659975d763c02c2aadd381f Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Fri, 20 Jan 2023 20:55:13 +0100 Subject: Fix all phpcs errors in main plugin source. --- includes/class-giglogadmin-plugin.php | 52 +++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/includes/class-giglogadmin-plugin.php b/includes/class-giglogadmin-plugin.php index 50f37bf..ff56d77 100644 --- a/includes/class-giglogadmin-plugin.php +++ b/includes/class-giglogadmin-plugin.php @@ -11,8 +11,19 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) { + /** + * The Main GiglogAdmin plugin class. + * + * Handles initialization and loads the rest of the plugin as needed. + */ class GiglogAdmin_Plugin { + /** + * Initialize the plugin. + * + * Loads the required modules, and registers classbacks for + * adding the admin pages and filters. + */ public static function init(): void { if ( ! defined( 'GIGLOGADMIN_UNIT_TEST' ) ) { require_once __DIR__ . '/giglogadmin-register-db-tables.php'; @@ -41,19 +52,13 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) { } } - static function activate(): void { - } - - static function deactivate(): void { - } - /** * Adds the 'Giglog' top level menu to the left side WordPress admin * menu. Other subpages will come later. * * @return void */ - static function add_admin_pages(): void { + private static function add_admin_pages(): void { if ( ! current_user_can( 'manage_options' ) ) { return; } @@ -64,8 +69,8 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) { 'giglog', // menu slug array( 'GiglogAdmin_AdminPage', 'render_html' ), // callable 'dashicons-tickets-alt', // Icon url - 11 - ); // Position, just below 'Media' + 11 // Position, just below 'Media' + ); add_action( 'load-' . $top, array( 'GiglogAdmin_AdminPage', 'update' ) ); @@ -75,8 +80,8 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) { 'Import gigs', // menu title 'upload_files', // required capability 'giglog_import', // menu slug - array( 'GiglogAdmin_ImportGigsPage', 'render_html' ) - ); // callable + array( 'GiglogAdmin_ImportGigsPage', 'render_html' ) // callable + ); if ( $import_hook !== false ) { add_action( @@ -85,11 +90,14 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) { ); } - wp_register_style( 'css_style', plugins_url( '/css/main.css', __FILE__ ) ); + wp_register_style( 'css_style', plugins_url( '/css/main.css', __FILE__ ), array(), '1' ); wp_enqueue_style( 'css_style' ); } - static function add_help_pages(): void { + /** + * Adds the "help" pages in the WordPress admin menu. + */ + private static function add_help_pages(): void { if ( ! current_user_can( 'manage_options' ) ) { return; } @@ -100,8 +108,8 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) { 'helpfiles', // menu slug array( 'Instructions_Page', 'render_instr_html' ), // callable 'dashicons-tickets-alt', // Icon url - 10 - ); // Position, just below 'Media' + 10 // Position, just below 'Media' + ); add_submenu_page( 'helpfiles', // parent slug @@ -109,8 +117,8 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) { 'Reviewer help files', // menu title 'upload_files', // required capability 'reviewer_help', // menu slug - array( 'Instructions_Reviewers', 'render_instr_rev_html' ) - ); // callable + array( 'Instructions_Reviewers', 'render_instr_rev_html' ) // callable + ); add_submenu_page( 'helpfiles', // parent slug @@ -118,17 +126,19 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) { 'Photogalleries help files', // menu title 'upload_files', // required capability 'photog_help', // menu slug - array( 'Instructions_Photogs', 'render_instr_photo_html' ) - ); // callable + array( 'Instructions_Photogs', 'render_instr_photo_html' ) // callable + ); } - /* + /** * Show menus based on whether user is logged in or not. * * Giglog admin pages should only be visible for logged in users/can eventually * be customized by role if needed + * + * @param array $args The menu array to filter. */ - static function nav_menu_args( array $args = array() ) : array { + private static function nav_menu_args( array $args = array() ) : array { if ( is_user_logged_in() ) { $args['menu'] = 'Loggedusers'; } else { -- cgit v1.2.3