Skip to content

Extract CampTix Admin Setup and Tools into dedicated classes#1645

Open
dd32 wants to merge 7 commits intoproductionfrom
add/claude/camptix-admin-setup-extraction
Open

Extract CampTix Admin Setup and Tools into dedicated classes#1645
dd32 wants to merge 7 commits intoproductionfrom
add/claude/camptix-admin-setup-extraction

Conversation

@dd32
Copy link
Member

@dd32 dd32 commented Mar 10, 2026

Summary

  • Extracts the Tickets > Setup page methods from CampTix_Plugin into CampTix_Admin_Setup (inc/class-camptix-admin-setup.php)
  • Extracts the Tickets > Tools page UI methods (Summarize, Revenue, Export, Notify, Refund tabs) into CampTix_Admin_Tools (inc/class-camptix-admin-tools.php)
  • Data/utility methods (get_summary, generate_revenue_report_data, get_segment, etc.) remain in CampTix_Plugin
  • Settings getters (get_options, get_default_options, get_currencies) remain in CampTix_Plugin
  • Both new classes use composition: they hold a CampTix_Plugin reference and delegate to it
  • camptix.php reduced from ~8,867 to ~7,587 lines (-1,280 lines)

Test plan

  • All 63 existing CampTix integration tests pass locally
  • CI PHP tests pass on 8.1, 8.4, 8.5
  • CI lint checks pass

@dd32 dd32 changed the title Extract Admin Settings/Setup from CampTix_Plugin into dedicated class Extract CampTix Admin Setup and Tools into dedicated classes Mar 10, 2026
@dd32 dd32 requested a review from Copilot March 10, 2026 07:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors CampTix’s wp-admin UI by extracting the Tickets → Setup and Tickets → Tools screens out of the monolithic CampTix_Plugin class into dedicated admin classes, while keeping data/utility methods in the main plugin.

Changes:

  • Added CampTix_Admin_Setup to own Setup-page settings registration, validation, and UI.
  • Added CampTix_Admin_Tools to own Tools-page tab UIs (Summarize/Revenue/Export/Notify/Refund) and related request handlers.
  • Updated camptix.php to instantiate the new classes and route admin hooks/menu callbacks through them.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
public_html/wp-content/plugins/camptix/inc/class-camptix-admin-tools.php New class that renders the Tools admin page and handles export/notify/refund flows.
public_html/wp-content/plugins/camptix/inc/class-camptix-admin-setup.php New class that registers Setup settings/sections/fields, validates options, and renders Setup UI.
public_html/wp-content/plugins/camptix/camptix.php Wires the new admin classes into plugin init and admin menu/hook registration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

dd32 and others added 5 commits March 19, 2026 16:51
…etup

Move the Tickets > Setup page rendering, settings registration, field
renderers, options validation, and related admin UI methods into a
dedicated CampTix_Admin_Setup class at inc/class-camptix-admin-setup.php.

Settings getters (get_options, get_default_options, get_currencies,
get_beta_features) remain in CampTix_Plugin. A validate_options proxy
is kept on CampTix_Plugin for backwards compatibility.

This reduces camptix.php by ~420 lines and is the first step toward
splitting the monolithic class into focused admin modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The code in class-camptix-admin-setup.php was moved verbatim from
camptix.php which also uses phpcs:ignoreFile. Fixing 95 legacy lint
errors in moved code is a separate refactoring task.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move the Tickets > Tools page UI methods (Summarize, Revenue, Export,
Notify, Refund tabs) into a dedicated inc/class-camptix-admin-tools.php
file. Data/utility methods (get_summary, generate_revenue_report_data,
get_segment, etc.) remain in CampTix_Plugin.

camptix.php: 8,445 -> 7,587 lines (-858)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Dion Hulse <dd32@dd32.id.au>
After extracting field_* methods to CampTix_Admin_Setup, callers like
payment methods and addons still call them on the CampTix_Plugin instance.
Add a __call method that forwards these calls to admin_setup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dd32 dd32 force-pushed the add/claude/camptix-admin-setup-extraction branch from 62a4639 to 864870a Compare March 19, 2026 06:51
dd32 and others added 2 commits March 19, 2026 16:57
…ml_mail_enabled public

External addons (camptix-attendance, camptix-mailchimp, camptix-invoices,
camptix-admin-flags) call $camptix->add_settings_field_helper() which was
moved to CampTix_Admin_Setup. Add it to the __call proxy.

Also change html_mail_enabled() from protected to public since it is
called statically from both extracted classes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants