Skip to content

Commit

Permalink
init 4.0.0 (#42)
Browse files Browse the repository at this point in the history
* init 4.0.0

* update plugin
  • Loading branch information
kjroelke authored Jun 18, 2024
1 parent ea6cc14 commit 0a64379
Show file tree
Hide file tree
Showing 31 changed files with 945 additions and 1,871 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
- name: Lint PHP
id: phpcbf
continue-on-error: true
run: vendor/bin/phpcbf inc/ templates/ template-parts/ choctaw-events-plugin.php
run: composer phpcbf

- name: Run PHPCS checks
id: phpcs
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml template-parts/ templates/ inc/ choctaw-events-plugin.php
run: composer phpcs

- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/vendor
/.DS_Store
/dist
phpcs-report.xml
38 changes: 30 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,57 @@ A WordPress Plugin for Event Displays.
1. Download the `choctaw-events-plugin.zip` from the [latest release](https://github.com/choctaw-nation/cno-plugin-events/releases)
2. Install to WordPress

### Peer Dependencies

This plugin assumes `Bootstrap ^5.3.3` is installed, and specifically makes use of the following modules:

- Breadrcrumb
- Grid
- Utilities
- Forms
- Spinners

---

# Changelog

## v4.0.0

- Added ACF stubs to composer
- Bumped packages
- Cleaned up the `single` and `event-preview` templates according to new class properties & methods
- Removed WPGraphQL references from php files and deleted the React-powered Search (for now).
- Updated `events` class API
- `categories` property is now `WP_Term[]|null`
- Renamed: `get_the_category` is now `get_the_categories`
- Removed: `the_category`
- Fixed the paths to enqueue the front-end JS for the plugin

## v3.2.6

- Fixed a type error
- Fixed a type error

## v3.2.5

- Fixed a bug that was incorrectly assigning properties
- Fixed a bug that was incorrectly assigning properties

## v3.2.3

- Now properly handles the new `Requires Plugin` header to require ACF Pro
- Now properly handles the new `Requires Plugin` header to require ACF Pro

## v3.2.2

- Init Plugin with WordPress hooks
- Fixed a bug where assigning a custom slug wouldn't override every setting across the plugin.
- Init Plugin with WordPress hooks
- Fixed a bug where assigning a custom slug wouldn't override every setting across the plugin.

## v3.2.1

- Fixed a return type bug with `get_the_times` method
- Fixed a return type bug with `get_the_times` method

## v3.2.0

- Added new `Choctaw_Event` methods for getting venue details without calling the nested `Venue` class (e.g. `$event->venue->the_name()` has been replaced by `$event->the_venue_name()`)
- Added return types to comments.
- Added new `Choctaw_Event` methods for getting venue details without calling the nested `Venue` class (e.g. `$event->venue->the_name()` has been replaced by `$event->the_venue_name()`)
- Added return types to comments.

## v3.1.3

Expand Down
5 changes: 3 additions & 2 deletions choctaw-events-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Choctaw Events Plugin
* Plugin URI: https://github.com/choctaw-nation/cno-plugin-events
* Description: Choctaw Events Plugin creates the Events and displays them in a nice way.
* Version: 3.2.6
* Version: 3.2.7
* Author: Choctaw Nation of Oklahoma
* Author URI: https://www.choctawnation.com
* Text Domain: cno
Expand All @@ -12,6 +12,7 @@
* Requires PHP: 8.1
* Requires at least: 6.0
* Requires Plugins: advanced-custom-fields-pro
* Tested up to: 6.5.4
*
* @package ChoctawNation
* @subpackage Events
Expand All @@ -27,4 +28,4 @@
$plugin_loader = new Plugin_Loader();

register_activation_hook( __FILE__, array( $plugin_loader, 'activate' ) );
register_deactivation_hook( __FILE__, array( $plugin_loader, 'deactivate' ) );
register_deactivation_hook( __FILE__, array( $plugin_loader, 'deactivate' ) );
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
}
},
"scripts": {
"phpcs": "phpcs inc/ templates/ template-parts/ choctaw-events-plugin.php",
"phpcs": "phpcs --report-full --report-checkstyle=./phpcs-report.xml inc/ templates/ template-parts/ choctaw-events-plugin.php",
"phpcbf": "phpcbf inc/ templates/ template-parts/ choctaw-events-plugin.php"
},
"require-dev": {
"wp-coding-standards/wpcs": "*"
"wp-coding-standards/wpcs": "*",
"php-stubs/acf-pro-stubs": "^6.2"
}
}
116 changes: 104 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 10 additions & 28 deletions inc/acf/classes/class-choctaw-event.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/**
* The Choctaw Event ACF Object
*
* @since 1.0
* @package ChoctawNation
* @subpackage Events
*/
Expand Down Expand Up @@ -100,14 +99,14 @@ class Choctaw_Event {
*
* @var bool $has_category
*/
public bool $has_category = false;
public bool $has_categories = false;

/**
* The Event's Categories
*
* @var array $categories
* @var ?\WP_Term[] $categories the event's categories as WP_Term objects, or null
*/
public array $categories;
public ?array $categories;

/**
* The Venue
Expand Down Expand Up @@ -242,17 +241,11 @@ private function set_the_venue(): void {
private function set_the_terms(): void {
$categories = get_the_terms( $this->event_id, 'choctaw-events-category' );
if ( false === $categories ) {
$this->categories = array();
$this->categories = null;
} else {
foreach ( $categories as $category ) {
$array = array(
'name' => $category->name,
'slug' => $category->slug,
);
$this->categories[] = $array;
}
if ( count( $this->categories ) > 0 ) {
$this->has_category = true;
$this->categories = $categories;
if ( count( $this->categories ) ) {
$this->has_categories = true;
}
}
}
Expand Down Expand Up @@ -337,11 +330,11 @@ public function get_the_website(): ?string {
}

/**
* Gets the category (as an array)
* Gets the categories
*
* @return array
* @return ?\WP_Term[]
*/
public function get_the_category(): array {
public function get_the_categories(): ?array {
return $this->categories;
}

Expand Down Expand Up @@ -489,17 +482,6 @@ public function the_website(): void {
}
}

/**
* Echoes each category in the object's `categories` prop as an anchor
*
* @return void
*/
public function the_category(): void {
foreach ( $this->categories as $category ) {
echo "<a href='/{$category['slug']}'>{$category['name']}</a>";
}
}

/**
* Echoes Start and End Dates. If Dates are the same, only start is returned.
*
Expand Down
3 changes: 1 addition & 2 deletions inc/acf/classes/class-event-venue.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/**
* The Choctaw Event Venue (Taxonomy) ACF Object
*
* @since 1.0
* @package ChoctawNation
* @subpackage Events
*/
Expand Down Expand Up @@ -220,4 +219,4 @@ public function the_website(): void {
echo "<a href='{$url}' target='_blank' rel='noopener noreferrer' id='venue-website'>{$url}</a>";
}
}
}
}
Loading

0 comments on commit 0a64379

Please sign in to comment.