Skip to content

Commit 0fac50d

Browse files
authored
Rename
1 parent 0ab86ce commit 0fac50d

13 files changed

Lines changed: 131 additions & 871 deletions

.github/workflows/gemini-code-assistant.yml

Lines changed: 0 additions & 405 deletions
This file was deleted.

.github/workflows/gemini-issue-assistant.yml

Lines changed: 0 additions & 345 deletions
This file was deleted.

.github/workflows/wp-compatibility-test.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ jobs:
255255
<rule ref="WordPress.WP.I18n">
256256
<properties>
257257
<property name="text_domain" type="array">
258-
<element value="wc-free-gift-coupons-bulk-coupons-generator"/>
258+
<element value="free-gift-coupons-bulk-coupons-generator"/>
259259
</property>
260260
</properties>
261261
</rule>
@@ -798,12 +798,12 @@ jobs:
798798
class Test_Free_Gift_Bulk_Coupon_Generator extends WP_UnitTestCase {
799799
public function test_plugin_loaded() {
800800
// Test the helper function exists and returns true
801-
$this->assertTrue(function_exists('wc_free_gift_bulk_coupons_is_loaded'), 'Plugin helper function should exist');
802-
$this->assertTrue(wc_free_gift_bulk_coupons_is_loaded(), 'Plugin class should be loaded');
801+
$this->assertTrue(function_exists('free_gift_coupons_bulk_coupons_is_loaded'), 'Plugin helper function should exist');
802+
$this->assertTrue(free_gift_coupons_bulk_coupons_is_loaded(), 'Plugin class should be loaded');
803803
}
804804
805805
public function test_plugin_class_exists() {
806-
$this->assertTrue(class_exists('WooCommerceFreeGiftBulkCoupons'), 'Main plugin class should exist');
806+
$this->assertTrue(class_exists('FreeGiftCouponsBulkGenerator'), 'Main plugin class should exist');
807807
}
808808
809809
public function test_wordpress_version_compatibility() {
@@ -817,25 +817,25 @@ jobs:
817817
}
818818
819819
public function test_plugin_constants() {
820-
$this->assertTrue(defined('SCG_PLUGIN_VERSION'), 'Plugin version constant should be defined');
821-
$this->assertTrue(defined('SCG_PLUGIN_URL'), 'Plugin URL constant should be defined');
822-
$this->assertTrue(defined('SCG_PLUGIN_PATH'), 'Plugin path constant should be defined');
820+
$this->assertTrue(defined('FGCBG_PLUGIN_VERSION'), 'Plugin version constant should be defined');
821+
$this->assertTrue(defined('FGCBG_PLUGIN_URL'), 'Plugin URL constant should be defined');
822+
$this->assertTrue(defined('FGCBG_PLUGIN_PATH'), 'Plugin path constant should be defined');
823823
824824
// Extract version from plugin header dynamically to test against latest commit
825825
$plugin_file = dirname( dirname( __FILE__ ) ) . '/free-gift-bulk-coupon-generator.php';
826826
$plugin_data = get_file_data( $plugin_file, array( 'Version' => 'Version' ) );
827827
$expected_version = $plugin_data['Version'];
828828
829829
$this->assertNotEmpty($expected_version, 'Plugin header should contain version');
830-
$this->assertEquals($expected_version, SCG_PLUGIN_VERSION, 'Plugin version constant should match header version in latest commit');
830+
$this->assertEquals($expected_version, FGCBG_PLUGIN_VERSION, 'Plugin version constant should match header version in latest commit');
831831
}
832832
833833
public function test_plugin_instance() {
834-
$instance = WooCommerceFreeGiftBulkCoupons::get_instance();
835-
$this->assertInstanceOf('WooCommerceFreeGiftBulkCoupons', $instance, 'Plugin should return valid instance');
834+
$instance = FreeGiftCouponsBulkGenerator::get_instance();
835+
$this->assertInstanceOf('FreeGiftCouponsBulkGenerator', $instance, 'Plugin should return valid instance');
836836
837837
// Test singleton pattern
838-
$instance2 = WooCommerceFreeGiftBulkCoupons::get_instance();
838+
$instance2 = FreeGiftCouponsBulkGenerator::get_instance();
839839
$this->assertSame($instance, $instance2, 'Plugin should use singleton pattern');
840840
}
841841
}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- **Plugin Rename**: Renamed plugin from "WC Free Gift Coupons Bulk Coupon Generator" to "Free Gift Coupons Bulk Coupon Generator" to remove WC prefix while maintaining clarity as a companion to the Free Gift Coupons for WooCommerce plugin.
12+
- Updated text domain from `wc-free-gift-coupons-bulk-coupons-generator` to `free-gift-coupons-bulk-coupons-generator`
13+
- Renamed main class from `WooCommerceFreeGiftBulkCoupons` to `FreeGiftCouponsBulkGenerator`
14+
- Updated all plugin constants: `SCG_*``FGCBG_*` (Free Gift Coupons Bulk Generator)
15+
- Updated all function names and hooks to use `fgcbg_` prefix instead of `scg_`
16+
- Updated all coupon metadata keys from `_scg_*` to `_fgcbg_*`
17+
- Updated helper functions and initialization callbacks
18+
- Updated PHPCS and composer configuration
19+
20+
**Migration Notes**: External code depending on the old hooks, filters, constants, or function names will need updating. This is considered a major version change due to the breaking API changes.
21+
1022
### Fixed
1123
- **CSRF in admin_init**: Restored nonce verification in `admin_init()` before processing form data to prevent CSRF. The v1.5.1 removal was incorrect — without it, `$_POST` is accessed before any security check.
1224
- **XSS in Success Notice**: Wrapped `sprintf()` output in `esc_html()` (using `__()` instead of `esc_html__()` for the format string) to properly escape the final rendered output.

GEMINI.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# WC Free Gift Coupons Bulk Coupon Generator - WordPress Plugin
1+
# Free Gift Coupons Bulk Coupon Generator - WordPress Plugin
22

33
## Project Overview
44

55
This is a WordPress plugin that generates bulk free gift coupon codes for WooCommerce stores. It integrates with the "Free Gift Coupons for WooCommerce" plugin to create coupons with the proper data structure for free gift functionality. Designed for store administrators who need to generate large quantities of gift coupons efficiently.
66

77
## Plugin Details
88

9-
- **Name:** WC Free Gift Coupons Bulk Coupon Generator
9+
- **Name:** Free Gift Coupons Bulk Coupon Generator
1010
- **Version:** 1.5.1
1111
- **WordPress Compatibility:** 6.5+
1212
- **PHP Compatibility:** 7.4+
1313
- **WooCommerce Compatibility:** 5.0+
1414
- **License:** GPL-3.0-or-later
15-
- **Text Domain:** wc-free-gift-coupons-bulk-coupons-generator
15+
- **Text Domain:** free-gift-coupons-bulk-coupons-generator
1616
- **Dependencies:** WooCommerce, Free Gift Coupons for WooCommerce
1717

1818
## Architecture & Design Patterns
@@ -22,7 +22,7 @@ This is a WordPress plugin that generates bulk free gift coupon codes for WooCom
2222
The plugin follows a singleton pattern with proper WordPress initialization:
2323

2424
```php
25-
class WooCommerceFreeGiftBulkCoupons {
25+
class FreeGiftCouponsBulkGenerator {
2626
private static $instance = null;
2727

2828
public static function get_instance() {
@@ -39,10 +39,10 @@ class WooCommerceFreeGiftBulkCoupons {
3939
The plugin uses proper WordPress initialization patterns with dependency checking:
4040

4141
```php
42-
function wc_free_gift_bulk_coupons_init() {
43-
WooCommerceFreeGiftBulkCoupons::get_instance();
42+
function free_gift_coupons_bulk_coupons_init() {
43+
FreeGiftCouponsBulkGenerator::get_instance();
4444
}
45-
add_action( 'plugins_loaded', 'wc_free_gift_bulk_coupons_init' );
45+
add_action( 'plugins_loaded', 'free_gift_coupons_bulk_coupons_init' );
4646
```
4747

4848
### File Structure
@@ -60,11 +60,12 @@ add_action( 'plugins_loaded', 'wc_free_gift_bulk_coupons_init' );
6060

6161
### Naming Conventions
6262

63-
- **Class:** `WooCommerceFreeGiftBulkCoupons` (PascalCase)
63+
- **Class:** `FreeGiftCouponsBulkGenerator` (PascalCase)
6464
- **Methods:** `snake_case` (WordPress standard)
6565
- **Variables:** `$snake_case`
66-
- **Constants:** `SCG_UPPER_SNAKE_CASE`
67-
- **Text Domain:** Always use `'wc-free-gift-coupons-bulk-coupons-generator'`
66+
- **Constants:** `FGCBG_UPPER_SNAKE_CASE`
67+
- **Hooks/Filters:** `fgcbg_*` prefix
68+
- **Text Domain:** Always use `'free-gift-coupons-bulk-coupons-generator'`
6869

6970
### Security Requirements
7071

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WC Free Gift Coupons Bulk Coupon Generator
1+
# Free Gift Coupons Bulk Coupon Generator
22

33
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/0d4ba2d43e6e4ee1b2171879388e8cbe)](https://app.codacy.com/gh/EngineScript/wc-free-gift-coupons-bulk-coupons-generator/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
44
[![License](https://img.shields.io/badge/License-GPL%20v3-green.svg?logo=gnu)](https://www.gnu.org/licenses/gpl-3.0.html)

assets/js/admin.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* WooCommerce Free Gift Bulk Coupons Generator Admin JavaScript
2+
* Free Gift Coupons Bulk Generator Admin JavaScript
33
* ES5-compatible code for maximum browser compatibility
44
*
55
* CODACY FALSE POSITIVES ADDRESSED:
@@ -17,7 +17,7 @@ if (typeof window !== 'undefined' && typeof window.jQuery !== 'undefined') {
1717
/**
1818
* Main admin object for handling the coupon generator interface
1919
*/
20-
var SCG_Admin = {
20+
var FGCBG_Admin = {
2121

2222
/**
2323
* Utility function to clean and validate alphanumeric input
@@ -76,7 +76,7 @@ if (typeof window !== 'undefined' && typeof window.jQuery !== 'undefined') {
7676
var $submitBtn = $form.find('.button-primary');
7777

7878
// Validate form before submission
79-
if (!SCG_Admin.validateForm()) {
79+
if (!FGCBG_Admin.validateForm()) {
8080
e.preventDefault();
8181
return false;
8282
}
@@ -110,7 +110,7 @@ if (typeof window !== 'undefined' && typeof window.jQuery !== 'undefined') {
110110
*/
111111
formatPrefix: function() {
112112
var value = $(this).val();
113-
var cleanValue = SCG_Admin.cleanAlphanumeric(value, 10);
113+
var cleanValue = FGCBG_Admin.cleanAlphanumeric(value, 10);
114114
$(this).val(cleanValue);
115115
},
116116

@@ -283,7 +283,7 @@ if (typeof window !== 'undefined' && typeof window.jQuery !== 'undefined') {
283283
var value = $this.val();
284284

285285
// CODACY ADDRESSED: Using centralized utility to eliminate duplication
286-
var cleanValue = SCG_Admin.cleanAlphanumeric(value, 10);
286+
var cleanValue = FGCBG_Admin.cleanAlphanumeric(value, 10);
287287
$this.val(cleanValue);
288288
});
289289
},
@@ -354,7 +354,7 @@ if (typeof window !== 'undefined' && typeof window.jQuery !== 'undefined') {
354354

355355
// Initialize admin functionality
356356
// CODACY FALSE POSITIVE: All browser API calls are properly guarded above
357-
SCG_Admin.init();
357+
FGCBG_Admin.init();
358358

359359
// Handle page unload during form submission
360360
// CODACY FALSE POSITIVE: Window API usage is safe within browser environment check

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "enginescript/wc-free-gift-coupons-bulk-coupon-generator",
3-
"description": "WC Free Gift Coupons Bulk Coupon Generator - Generate bulk free gift coupons for Free Gift Coupons for WooCommerce plugin",
2+
"name": "enginescript/free-gift-coupons-bulk-coupon-generator",
3+
"description": "Free Gift Coupons Bulk Coupon Generator - Generate bulk free gift coupons for Free Gift Coupons for WooCommerce plugin",
44
"type": "wordpress-plugin",
55
"license": "GPL-3.0-or-later",
66
"authors": [
@@ -20,7 +20,8 @@
2020
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
2121
"php-stubs/wordpress-stubs": "^6.8",
2222
"szepeviktor/phpstan-wordpress": "^1.3",
23-
"phpstan/phpstan": "^1.0"
23+
"phpstan/phpstan": "^1.0",
24+
"phpcompatibility/phpcompatibility-wp": "^2.1"
2425
},
2526
"scripts": {
2627
"phpcs": "phpcs --standard=phpcs.xml",

0 commit comments

Comments
 (0)