Skip to content

Commit 9791418

Browse files
refactor: change Black Friday label for Neve promotion (#508)
1 parent 33e3dc8 commit 9791418

3 files changed

Lines changed: 88 additions & 15 deletions

File tree

AGENTS.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Agent Workflow
2+
3+
## Project Overview
4+
5+
WP Maintenance Mode (LightStart) is a WordPress plugin by Themeisle that displays a maintenance mode, coming soon, or landing page to visitors. Text domain: `wp-maintenance-mode`. Option key: `wpmm_settings`. All constants prefixed with `WPMM_`.
6+
7+
## Commands
8+
9+
```bash
10+
# Install dependencies
11+
composer install
12+
npm install
13+
14+
# Lint (PHP_CodeSniffer with WordPress coding standards)
15+
composer run lint
16+
17+
# Auto-fix coding standards
18+
composer run format
19+
20+
# Run PHPUnit tests
21+
./vendor/bin/phpunit
22+
23+
# Run a single test file
24+
./vendor/bin/phpunit tests/generic-test.php
25+
26+
# Build assets (minify JS + CSS via Grunt)
27+
npm run build # or: npx grunt
28+
29+
# Watch for asset changes during development
30+
npx grunt watch
31+
```
32+
33+
## Architecture
34+
35+
### Entry Point & Bootstrap
36+
37+
`wp-maintenance-mode.php` — Main plugin file. Defines all `WPMM_*` constants (paths, URLs), requires function files, then loads the two core singleton classes via `plugins_loaded`.
38+
39+
### Core Classes (`includes/classes/`)
40+
41+
- **`WP_Maintenance_Mode`** — Frontend singleton. Handles maintenance mode display logic, page templates, redirect rules, multisite/network mode support, and shortcode registration. Loaded on every request.
42+
- **`WP_Maintenance_Mode_Admin`** — Admin singleton. Settings page, AJAX handlers (prefixed `wp_ajax_wpmm_*`), wizard flow, template management, subscriber export, and notices. Only loaded in `is_admin()` context.
43+
- **`WP_Maintenance_Mode_Shortcodes`** + `shortcodes/` — Shortcode registration (e.g., login form shortcode).
44+
45+
### Functions (`includes/functions/`)
46+
47+
- **`hooks.php`** — Plugin header filters and email content type hook.
48+
- **`helpers.php`** — Utility functions (e.g., `wpmm_get_option()`).
49+
50+
### Views (`views/`)
51+
52+
PHP template files for admin settings tabs (`settings.php`, `contact.php`, `google-analytics.php`), the frontend maintenance page (`maintenance.php`), wizard (`wizard.php`), network settings, notices, and sidebar.
53+
54+
### Assets
55+
56+
- `assets/js/` — Frontend (`scripts.js`) and admin (`scripts-admin.js`, `scripts-admin-global.js`) JavaScript, plus chatbot (`bot.js`, `bot.async.js`). Grunt minifies to `.min.js`.
57+
- `assets/css/` — Stylesheets minified via PostCSS/cssnano to `.min.css`.
58+
- `assets/templates/` — Block template JSON files organized by category: `coming-soon/`, `maintenance/`, `landing-page/`.
59+
60+
### Settings Structure
61+
62+
Plugin settings stored as serialized array in `wpmm_settings` option, with sections: `general` (status, network_mode), plus additional tabs managed by the admin class. Network/multisite settings stored in `wpmm_settings_network`.
63+
64+
## Coding Standards
65+
66+
- WordPress-Core standards enforced via PHPCS (`phpcs.xml`), with specific exclusions (no Yoda conditions required, loose comparison allowed, etc.)
67+
- i18n text domain: `wp-maintenance-mode`
68+
- PHP minimum: 7.0 (runtime set in PHPCS)
69+
- Assets use `.min.` suffix in production; controlled by `SCRIPT_DEBUG` constant

composer.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/classes/wp-maintenance-mode-admin.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,15 +1324,19 @@ public function add_inline_global_style() {
13241324
public function add_black_friday_data( $configs ) {
13251325
$config = $configs['default'];
13261326

1327-
// translators: %1$s - plugin namce, %2$s - HTML tag, %3$s - discount, %4$s - HTML tag, %5$s - company name.
1328-
$message_template = __( 'Brought to you by the team behind %1$s— our biggest sale of the year is here: %2$sup to %3$s OFF%4$s on premium products from %5$s! Limited-time only.', 'wp-maintenance-mode' );
1327+
if ( defined( 'NEVE_VERSION' ) ) {
1328+
return $configs;
1329+
}
13291330

1330-
$config['message'] = sprintf( $message_template, 'WP Maintenance Mode', '<strong>', '70%', '</strong>', '<strong>Themeisle</strong>' );
1331-
$config['sale_url'] = add_query_arg(
1331+
// translators: 1. Number of free licenses, 2. The price of the product.
1332+
$config['message'] = sprintf( __( 'You\'re using LightStart, and the team behind it is celebrating Black Friday by giving away %1$s licences of Neve Pro. A premium WordPress theme worth %2$s, packed with starter sites, a header builder, and WooCommerce layouts. Claim yours before they run out.', 'wp-maintenance-mode' ), 100, '$69' );
1333+
$config['cta_label'] = __( 'Get Neve Pro free', 'wp-maintenance-mode' );
1334+
$config['plugin_meta_message'] = __( 'Black Friday Sale - Get Neve Pro free', 'wp-maintenance-mode' );
1335+
$config['sale_url'] = add_query_arg(
13321336
array(
13331337
'utm_term' => 'free',
13341338
),
1335-
tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/all-bf', 'bfcm', 'wp-maintenance-mode' ) )
1339+
tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/neve-claim-bf', 'bfcm', 'lightstart' ) )
13361340
);
13371341

13381342
$configs[ WPMM_PRODUCT_SLUG ] = $config;

0 commit comments

Comments
 (0)