summaryrefslogtreecommitdiffstats
path: root/includes/class-giglogadmin-plugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/class-giglogadmin-plugin.php')
-rw-r--r--includes/class-giglogadmin-plugin.php95
1 files changed, 50 insertions, 45 deletions
diff --git a/includes/class-giglogadmin-plugin.php b/includes/class-giglogadmin-plugin.php
index 6236f60..50f37bf 100644
--- a/includes/class-giglogadmin-plugin.php
+++ b/includes/class-giglogadmin-plugin.php
@@ -11,10 +11,10 @@
if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
- class GiglogAdmin_Plugin
- {
- static public function init(): void {
- if ( !defined('GIGLOGADMIN_UNIT_TEST') ) {
+ class GiglogAdmin_Plugin {
+
+ public static function init(): void {
+ if ( ! defined( 'GIGLOGADMIN_UNIT_TEST' ) ) {
require_once __DIR__ . '/giglogadmin-register-db-tables.php';
giglog_register_db_tables();
}
@@ -24,19 +24,18 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
require_once __DIR__ . '/class-giglogadmin-icalexport.php';
require_once __DIR__ . '/view-helpers/select-field-helper.php';
- if (is_admin()) {
+ if ( is_admin() ) {
require_once __DIR__ . '/admin/views/class-giglogadmin-adminpage.php';
require_once __DIR__ . '/admin/views/class-giglogadmin-importgigspage.php';
require_once __DIR__ . '/admin/helpfiles/instrunctions.php';
require_once __DIR__ . '/admin/helpfiles/instr_reviewers.php';
require_once __DIR__ . '/admin/helpfiles/instr_photog.php';
- add_action( 'admin_menu', array( 'GiglogAdmin_Plugin', 'add_admin_pages' ));
- add_action( 'admin_menu', array( 'GiglogAdmin_Plugin', 'add_help_pages' ));
+ add_action( 'admin_menu', array( 'GiglogAdmin_Plugin', 'add_admin_pages' ) );
+ add_action( 'admin_menu', array( 'GiglogAdmin_Plugin', 'add_help_pages' ) );
- add_filter( 'wp_nav_menu_args', array( 'GiglogAdmin_Plugin', 'nav_menu_args' ));
- }
- else {
+ add_filter( 'wp_nav_menu_args', array( 'GiglogAdmin_Plugin', 'nav_menu_args' ) );
+ } else {
require_once __DIR__ . '/view-helpers/class-giglogadmin-concertstable.php';
require_once __DIR__ . '/giglogadmin-shortcodes.php';
}
@@ -59,32 +58,35 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
return;
}
$top = add_menu_page(
- "Giglog admin", // Page title
- "Giglog", // Menu title
- "upload_files", // Will show for users with this capability
- "giglog", // menu slug
+ 'Giglog admin', // Page title
+ 'Giglog', // Menu title
+ 'upload_files', // Will show for users with this capability
+ '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' ) );
$import_hook = add_submenu_page(
- "giglog", // parent slug
- "Import gigs", // page title
- "Import gigs", // menu title
- "upload_files", // required capability
- "giglog_import", // menu slug
- array( 'GiglogAdmin_ImportGigsPage', 'render_html' )); // callable
-
- if ($import_hook !== false) {
+ 'giglog', // parent slug
+ 'Import gigs', // page title
+ 'Import gigs', // menu title
+ 'upload_files', // required capability
+ 'giglog_import', // menu slug
+ array( 'GiglogAdmin_ImportGigsPage', 'render_html' )
+ ); // callable
+
+ if ( $import_hook !== false ) {
add_action(
'load-' . $import_hook,
- array( 'GiglogAdmin_ImportGigsPage', 'submit_form' ) );
+ array( 'GiglogAdmin_ImportGigsPage', 'submit_form' )
+ );
}
wp_register_style( 'css_style', plugins_url( '/css/main.css', __FILE__ ) );
- wp_enqueue_style('css_style');
+ wp_enqueue_style( 'css_style' );
}
static function add_help_pages(): void {
@@ -92,29 +94,32 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
return;
}
add_menu_page(
- "Help for ET users", // Page title
- "Help for ET users", // Menu title
- "upload_files", // Will show for users with this capability
- "helpfiles", // menu slug
+ 'Help for ET users', // Page title
+ 'Help for ET users', // Menu title
+ 'upload_files', // Will show for users with this capability
+ '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
- "Reviewer help files", // page title
- "Reviewer help files", // menu title
- "upload_files", // required capability
- "reviewer_help", // menu slug
- array( 'Instructions_Reviewers', 'render_instr_rev_html' )); // callable
+ 'helpfiles', // parent slug
+ 'Reviewer help files', // page title
+ 'Reviewer help files', // menu title
+ 'upload_files', // required capability
+ 'reviewer_help', // menu slug
+ array( 'Instructions_Reviewers', 'render_instr_rev_html' )
+ ); // callable
add_submenu_page(
- "helpfiles", // parent slug
- "Photogalleries help files", // page title
- "Photogalleries help files", // menu title
- "upload_files", // required capability
- "photog_help", // menu slug
- array( 'Instructions_Photogs', 'render_instr_photo_html' )); // callable
+ 'helpfiles', // parent slug
+ 'Photogalleries help files', // page title
+ 'Photogalleries help files', // menu title
+ 'upload_files', // required capability
+ 'photog_help', // menu slug
+ array( 'Instructions_Photogs', 'render_instr_photo_html' )
+ ); // callable
}
/*
@@ -123,7 +128,7 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
* Giglog admin pages should only be visible for logged in users/can eventually
* be customized by role if needed
*/
- static function nav_menu_args( array $args = [] ) : array {
+ static function nav_menu_args( array $args = array() ) : array {
if ( is_user_logged_in() ) {
$args['menu'] = 'Loggedusers';
} else {
@@ -135,8 +140,8 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
}
- register_activation_hook( __FILE__, array( 'GiglogAdmin_Plugin', 'activate' ));
- register_deactivation_hook( __FILE__, array( 'GiglogAdmin_Plugin', 'deactivate' ));
+ register_activation_hook( __FILE__, array( 'GiglogAdmin_Plugin', 'activate' ) );
+ register_deactivation_hook( __FILE__, array( 'GiglogAdmin_Plugin', 'deactivate' ) );
GiglogAdmin_Plugin::init();
}