summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2023-01-20 20:22:06 +0100
committerHarald Eilertsen <haraldei@anduin.net>2023-01-20 20:22:06 +0100
commit277fedffc624f55c6ecc8bd80ed8db370134e47e (patch)
treeac22560f978c3789a63c80284fbd314e11d0b396 /includes
parentf499d9e657fe79e4413eec9e20ae13d616fac6f5 (diff)
downloadgigologadmin-277fedffc624f55c6ecc8bd80ed8db370134e47e.tar.gz
gigologadmin-277fedffc624f55c6ecc8bd80ed8db370134e47e.tar.bz2
gigologadmin-277fedffc624f55c6ecc8bd80ed8db370134e47e.zip
Rename and reorganize more source files.
Diffstat (limited to 'includes')
-rw-r--r--includes/admin/views/class-giglogadmin-adminpage.php (renamed from includes/admin/views/giglog_admin_page.php)29
-rw-r--r--includes/admin/views/class-giglogadmin-importgigspage.php (renamed from includes/admin/views/giglog_import_gigs.php)15
-rw-r--r--includes/class-giglogadmin-plugin.php13
-rw-r--r--includes/giglogadmin-register-db-tables.php (renamed from includes/admin/register_db_tables.php)19
-rw-r--r--includes/view-helpers/class-giglogadmin-concertform.php (renamed from includes/admin/views/_edit_concert_form.php)22
-rw-r--r--includes/view-helpers/class-giglogadmin-concertstable.php (renamed from includes/admin/views/_concerts_table.php)16
-rw-r--r--includes/view-helpers/class-giglogadmin-venueform.php (renamed from includes/admin/views/_new_venue_form.php)18
-rw-r--r--includes/view-helpers/select-field-helper.php (renamed from includes/view-helpers/select_field.php)14
8 files changed, 92 insertions, 54 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/class-giglogadmin-adminpage.php
index acd0172..23a0a85 100644
--- a/includes/admin/views/giglog_admin_page.php
+++ b/includes/admin/views/class-giglogadmin-adminpage.php
@@ -1,15 +1,20 @@
<?php
-
-// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
-// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
+/**
+ * Class representing the main GiglogAdmin admin page.
+ *
+ * @package giglogadmin
+ *
+ * SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+ * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
if ( ! class_exists( 'GiglogAdmin_AdminPage' ) ) {
require_once __DIR__ . '/../../class-giglogadmin-venue.php';
- require_once __DIR__ . '/_concerts_table.php';
- require_once __DIR__ . '/_edit_concert_form.php';
- require_once __DIR__ . '/_new_venue_form.php';
+ require_once __DIR__ . '/../../view-helpers/class-giglogadmin-concertstable.php';
+ require_once __DIR__ . '/../../view-helpers/class-giglogadmin-concertform.php';
+ require_once __DIR__ . '/../../view-helpers/class-giglogadmin-venueform.php';
class GiglogAdmin_AdminPage {
@@ -51,8 +56,8 @@ if ( ! class_exists( 'GiglogAdmin_AdminPage' ) ) {
</div>
<?php
if ( current_user_can( 'administrator' ) ) {
- $edit_form = new GiglogAdmin_EditConcertForm();
- $venue_form = new GiglogAdmin_NewVenueForm();
+ $edit_form = new GiglogAdmin_ConcertForm();
+ $venue_form = new GiglogAdmin_VenueForm();
?>
<div>
<h3>Form to create/edit concerts and venues</h3>
@@ -78,12 +83,12 @@ if ( ! class_exists( 'GiglogAdmin_AdminPage' ) ) {
}
if ( isset( $_POST['newconcert'] ) || isset( $_POST['editconcert'] ) ) {
- GiglogAdmin_EditConcertForm::update();
+ GiglogAdmin_ConcertForm::update();
return;
}
if ( isset( $_POST['newvenue'] ) ) {
- GiglogAdmin_NewVenueForm::update();
+ GiglogAdmin_VenueForm::update();
return;
}
}
diff --git a/includes/admin/views/giglog_import_gigs.php b/includes/admin/views/class-giglogadmin-importgigspage.php
index 758981e..5dcf939 100644
--- a/includes/admin/views/giglog_import_gigs.php
+++ b/includes/admin/views/class-giglogadmin-importgigspage.php
@@ -1,9 +1,14 @@
<?php
-
-// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
-// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
+/**
+ * Class representing the page for importing gigs.
+ *
+ * @package giglogadmin
+ *
+ * SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+ * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
if ( ! class_exists( 'GiglogAdmin_ImportGigsPage' ) ) {
require_once __DIR__ . '/../../class-giglogadmin-concert.php';
diff --git a/includes/class-giglogadmin-plugin.php b/includes/class-giglogadmin-plugin.php
index a195ffa..6236f60 100644
--- a/includes/class-giglogadmin-plugin.php
+++ b/includes/class-giglogadmin-plugin.php
@@ -15,17 +15,18 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
{
static public function init(): void {
if ( !defined('GIGLOGADMIN_UNIT_TEST') ) {
- require_once __DIR__ . '/admin/register_db_tables.php';
+ require_once __DIR__ . '/giglogadmin-register-db-tables.php';
+ giglog_register_db_tables();
}
require_once __DIR__ . '/class-giglogadmin-venue.php';
require_once __DIR__ . '/class-giglogadmin-concert.php';
require_once __DIR__ . '/class-giglogadmin-icalexport.php';
- require_once __DIR__ . '/view-helpers/select_field.php';
+ require_once __DIR__ . '/view-helpers/select-field-helper.php';
if (is_admin()) {
- require_once __DIR__ . '/admin/views/giglog_admin_page.php';
- require_once __DIR__ . '/admin/views/giglog_import_gigs.php';
+ 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';
@@ -36,7 +37,7 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
add_filter( 'wp_nav_menu_args', array( 'GiglogAdmin_Plugin', 'nav_menu_args' ));
}
else {
- require_once __DIR__ . '/admin/views/_concerts_table.php';
+ require_once __DIR__ . '/view-helpers/class-giglogadmin-concertstable.php';
require_once __DIR__ . '/giglogadmin-shortcodes.php';
}
}
@@ -82,7 +83,7 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
array( 'GiglogAdmin_ImportGigsPage', 'submit_form' ) );
}
- wp_register_style( 'css_style', plugins_url( '/includes/css/main.css', __FILE__ ) );
+ wp_register_style( 'css_style', plugins_url( '/css/main.css', __FILE__ ) );
wp_enqueue_style('css_style');
}
diff --git a/includes/admin/register_db_tables.php b/includes/giglogadmin-register-db-tables.php
index 5f83e25..84df6e8 100644
--- a/includes/admin/register_db_tables.php
+++ b/includes/giglogadmin-register-db-tables.php
@@ -1,8 +1,14 @@
<?php
-// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
-// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
+/**
+ * Register custome database tables used by GiglogAdmin
+ *
+ * @package giglogadmin
+ *
+ * SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+ * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
if ( ! function_exists( 'giglog_register_db_tables' ) ) {
/**
@@ -44,12 +50,13 @@ if ( ! function_exists( 'giglog_register_db_tables' ) ) {
) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
foreach ( $tables as $tabledef ) {
+ // This use of the `query` nethod is safe
+ // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
$result = $wpdb->query( $tabledef );
+
if ( $result === false ) {
error_log( 'Registering table failed.' );
}
}
}
-
- giglog_register_db_tables();
}
diff --git a/includes/admin/views/_edit_concert_form.php b/includes/view-helpers/class-giglogadmin-concertform.php
index 1a2e5a6..5cc3a47 100644
--- a/includes/admin/views/_edit_concert_form.php
+++ b/includes/view-helpers/class-giglogadmin-concertform.php
@@ -1,13 +1,17 @@
<?php
-// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
-// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-require_once __DIR__ . '/../../view-helpers/select_field.php';
-
-if ( ! class_exists( 'GiglogAdmin_EditConcertForm' ) ) {
- class GiglogAdmin_EditConcertForm {
+/**
+ * Class for adding/editing concerts.
+ *
+ * @package giglogadmin
+ *
+ * SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+ * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+if ( ! class_exists( 'GiglogAdmin_ConcertForm' ) ) {
+ class GiglogAdmin_ConcertForm {
private function get_venue_selector( ?GiglogAdmin_Venue $invenue ): string {
return \EternalTerror\ViewHelpers\select_field(
diff --git a/includes/admin/views/_concerts_table.php b/includes/view-helpers/class-giglogadmin-concertstable.php
index 4f9b3c9..1288cbd 100644
--- a/includes/admin/views/_concerts_table.php
+++ b/includes/view-helpers/class-giglogadmin-concertstable.php
@@ -1,10 +1,14 @@
<?php
-// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
-// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-require_once __DIR__ . '/../../view-helpers/select_field.php';
+/**
+ * Class to render the concerts table.
+ *
+ * @package giglogadmin
+ *
+ * SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+ * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
if ( ! class_exists( 'GiglogAdmin_ConcertsTable' ) ) {
class GiglogAdmin_ConcertsTable {
diff --git a/includes/admin/views/_new_venue_form.php b/includes/view-helpers/class-giglogadmin-venueform.php
index 39eb1b2..f837d73 100644
--- a/includes/admin/views/_new_venue_form.php
+++ b/includes/view-helpers/class-giglogadmin-venueform.php
@@ -1,11 +1,17 @@
<?php
-// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
-// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
+/**
+ * Class to handle the form for adding venues.
+ *
+ * @package giglogadmin
+ *
+ * SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+ * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
-if ( ! class_exists( 'GiglogAdmin_NewVenueForm' ) ) {
- class GiglogAdmin_NewVenueForm {
+if ( ! class_exists( 'GiglogAdmin_VenueForm' ) ) {
+ class GiglogAdmin_VenueForm {
public function render() : string {
return '<div class="venueform">'
diff --git a/includes/view-helpers/select_field.php b/includes/view-helpers/select-field-helper.php
index aa156d0..c25244b 100644
--- a/includes/view-helpers/select_field.php
+++ b/includes/view-helpers/select-field-helper.php
@@ -1,8 +1,14 @@
<?php
-// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
-// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
+/**
+ * Select field implementation.
+ *
+ * @package giglogadmin
+ *
+ * SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+ * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
namespace EternalTerror\ViewHelpers;