search schema warning fix - #747
Conversation
📝 WalkthroughWalkthroughCalendar events now use HTTPS Schema.org Event URLs and include metadata generated by ChangesEvent schema metadata
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CalendarView
participant Calendar
participant Event_Schema
CalendarView->>Calendar: request event schema metadata
Calendar->>Event_Schema: create schema generator for Event
Event_Schema-->>Calendar: return metadata
Calendar-->>CalendarView: return metadata
CalendarView->>CalendarView: render metadata in event markup
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PHPStan (2.2.7)PHP Warning: require(/vendor/composer/../guzzlehttp/promises/src/functions_include.php): Failed to open stream: No such file or directory in /vendor/composer/autoload_real.php on line 39 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@includes/calendars/views/default-calendar-grid.php`:
- Around line 532-534: Remove or gate the Event schema markup generated by the
event loops in includes/calendars/views/default-calendar-grid.php lines 532-534
and includes/calendars/views/default-calendar-list.php lines 683-687 so it is
emitted only when the view represents a unique event-detail page, not
multi-event calendar pages. Publish the metadata on dedicated event-detail URLs
when available; both listed sites require the same change.
In `@includes/events/event-builder.php`:
- Around line 1314-1325: Remove the site icon and custom logo fallback logic
from the event image builder, including the get_site_icon_url and custom_logo
handling. When no event-specific image exists, return no image value so the
event schema omits image rather than emitting site branding.
- Around line 1409-1437: Update get_schema_offers_meta to emit no Offer markup
unless the event model provides verified ticket price, availability,
ticket-purchase URL, and sales-start data. Remove the current unconditional
defaults and event-start fallback; return an empty string until those ticket
fields are present, then populate the Offer properties from the verified values.
- Around line 1378-1396: Update the performer metadata method around the
organizer and site-name fallback logic to return no performer markup unless
actual performer data is provided by the event source. Remove the
organizer-derived Person output and the site-name-derived Organization fallback,
leaving unrelated event metadata behavior unchanged.
- Around line 1174-1177: Update all event structured-data startDate and endDate
emitters in includes/events/event-builder.php, including lines 1174-1177 and
854-858, to use date-only toDateString() values when $event->whole_day is true;
retain toIso8601String() for timed events and ensure both existing whole-day
startDate emitters follow the same behavior.
- Around line 1345-1347: Update the organizer metadata generation near the
organizer email branch so the email meta tag is emitted only when the calendar
owner’s explicit public organizer-email setting is enabled. Otherwise omit the
tag entirely, preserving the existing organizer data handling.
- Around line 1207-1223: Update get_schema_attendance_mode() to evaluate both
the physical location and virtual event URL before returning. Return
https://schema.org/MixedEventAttendanceMode when both conditions are present,
while preserving the existing online-only and offline fallback behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5f901ef8-cabb-4095-a6ed-8bdf5d9e7276
📒 Files selected for processing (4)
includes/abstracts/calendar.phpincludes/calendars/views/default-calendar-grid.phpincludes/calendars/views/default-calendar-list.phpincludes/events/event-builder.php
| private function get_schema_attendance_mode() | ||
| { | ||
| $location = !empty($this->event->start_location['address']) | ||
| ? $this->event->start_location['address'] | ||
| : ''; | ||
|
|
||
| if (!empty($location)) { | ||
| return 'https://schema.org/OfflineEventAttendanceMode'; | ||
| } | ||
|
|
||
| $link = !empty($this->event->link) ? $this->event->link : ''; | ||
| if ($this->is_virtual_event_url($link)) { | ||
| return 'https://schema.org/OnlineEventAttendanceMode'; | ||
| } | ||
|
|
||
| return 'https://schema.org/OfflineEventAttendanceMode'; | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Return mixed attendance mode for hybrid events.
The physical-location branch returns OfflineEventAttendanceMode before the virtual-link check. An event with both values is therefore marked offline instead of mixed.
Check both conditions before returning a mode. Schema.org defines MixedEventAttendanceMode for events with online and offline attendance. (schema.org)
Proposed fix
- if (!empty($location)) {
- return 'https://schema.org/OfflineEventAttendanceMode';
- }
-
$link = !empty($this->event->link) ? $this->event->link : '';
- if ($this->is_virtual_event_url($link)) {
+ $has_location = !empty($location);
+ $has_virtual_location = $this->is_virtual_event_url($link);
+
+ if ($has_location && $has_virtual_location) {
+ return 'https://schema.org/MixedEventAttendanceMode';
+ }
+ if ($has_virtual_location) {
return 'https://schema.org/OnlineEventAttendanceMode';
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private function get_schema_attendance_mode() | |
| { | |
| $location = !empty($this->event->start_location['address']) | |
| ? $this->event->start_location['address'] | |
| : ''; | |
| if (!empty($location)) { | |
| return 'https://schema.org/OfflineEventAttendanceMode'; | |
| } | |
| $link = !empty($this->event->link) ? $this->event->link : ''; | |
| if ($this->is_virtual_event_url($link)) { | |
| return 'https://schema.org/OnlineEventAttendanceMode'; | |
| } | |
| return 'https://schema.org/OfflineEventAttendanceMode'; | |
| } | |
| private function get_schema_attendance_mode() | |
| { | |
| $location = !empty($this->event->start_location['address']) | |
| ? $this->event->start_location['address'] | |
| : ''; | |
| $link = !empty($this->event->link) ? $this->event->link : ''; | |
| $has_location = !empty($location); | |
| $has_virtual_location = $this->is_virtual_event_url($link); | |
| if ($has_location && $has_virtual_location) { | |
| return 'https://schema.org/MixedEventAttendanceMode'; | |
| } | |
| if ($has_virtual_location) { | |
| return 'https://schema.org/OnlineEventAttendanceMode'; | |
| } | |
| return 'https://schema.org/OfflineEventAttendanceMode'; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@includes/events/event-builder.php` around lines 1207 - 1223, Update
get_schema_attendance_mode() to evaluate both the physical location and virtual
event URL before returning. Return https://schema.org/MixedEventAttendanceMode
when both conditions are present, while preserving the existing online-only and
offline fallback behavior.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@includes/events/event-schema.php`:
- Line 1: Run the repository’s configured Prettier formatter on the
event-schema.php file and commit the resulting formatting-only changes,
preserving its behavior.
- Around line 193-205: Remove the site-icon and custom-logo fallbacks from the
event image resolution so events without a source-provided image return no
image. Update the offer handling around get_verified_event_offer() to discard
incomplete or invalid source offers rather than defaulting missing ticket data
to price 0; emit a zero-price offer only when the source explicitly marks the
event as free.
- Around line 91-102: Update the event attendance mode logic to evaluate both
the physical address and recognized virtual URL before returning. In the flow
using $location and $link, return https://schema.org/MixedEventAttendanceMode
when both are present, while preserving OnlineEventAttendanceMode for
virtual-only events and OfflineEventAttendanceMode for physical-only or
otherwise offline events.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 73f1391b-82cc-4cb8-80c1-7eab3c4b681c
📒 Files selected for processing (3)
includes/abstracts/calendar.phpincludes/events/event-builder.phpincludes/events/event-schema.php
💤 Files with no reviewable changes (1)
- includes/events/event-builder.php
🚧 Files skipped from review as they are similar to previous changes (1)
- includes/abstracts/calendar.php
| @@ -0,0 +1,487 @@ | |||
| <?php | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Apply the repository formatter.
The build Prettier check fails for this file. Run Prettier and commit the formatted output.
🧰 Tools
🪛 GitHub Actions: build / 1_lint.txt
[error] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues.
🪛 GitHub Actions: build / lint
[error] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@includes/events/event-schema.php` at line 1, Run the repository’s configured
Prettier formatter on the event-schema.php file and commit the resulting
formatting-only changes, preserving its behavior.
Source: Pipeline failures
| $location = !empty($this->event->start_location['address']) ? $this->event->start_location['address'] : ''; | ||
|
|
||
| if (!empty($location)) { | ||
| return 'https://schema.org/OfflineEventAttendanceMode'; | ||
| } | ||
|
|
||
| $link = !empty($this->event->link) ? $this->event->link : ''; | ||
| if ($this->is_virtual_event_url($link)) { | ||
| return 'https://schema.org/OnlineEventAttendanceMode'; | ||
| } | ||
|
|
||
| return 'https://schema.org/OfflineEventAttendanceMode'; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Files matching event-schema.php:"
fd -a 'event-schema\.php$' . || true
echo
echo "Relevant file excerpts:"
file="$(fd 'event-schema\.php$' . | head -n 1)"
if [ -n "${file:-}" ]; then
wc -l "$file"
sed -n '70,115p' "$file" | cat -n
echo
echo "Definitions/usages around hybrid logic:"
rg -n "get_schema_attendance_mode|is_virtual_event_url|OfflineEventAttendanceMode|MixedEventAttendanceMode|OnlineEventAttendanceMode|start_location|link" -C 3 "$file"
fi
echo
echo "Schema docs references in repo:"
rg -n "MixedEventAttendanceMode|OfflineEventAttendanceMode|OnlineEventAttendanceMode" .Repository: Xtendify/Simple-Calendar
Length of output: 3507
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Files matching event-schema.php:"
git ls-files | grep 'event-schema\.php$' || true
echo
echo "Relevant file excerpts:"
file="$(git ls-files | grep 'event-schema\.php$' | head -n 1)"
if [ -n "${file:-}" ]; then
wc -l "$file"
sed -n '70,115p' "$file" | cat -n
echo
echo "Definitions/usages around hybrid logic:"
rg -n "get_schema_attendance_mode|is_virtual_event_url|OfflineEventAttendanceMode|MixedEventAttendanceMode|OnlineEventAttendanceMode|start_location|link" -C 3 "$file"
fi
echo
echo "Schema attendance mode references in repo:"
rg -n "MixedEventAttendanceMode|OfflineEventAttendanceMode|OnlineEventAttendanceMode" . || trueRepository: Xtendify/Simple-Calendar
Length of output: 3497
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="includes/events/event-schema.php"
if [ ! -f "$file" ]; then
echo "Error: includes/events/event-schema.php not found"
exit 0
fi
python3 - <<'PY'
from pathlib import Path
text = Path("includes/events/event-schema.php").read_text()
# Extract the block that starts with the location variable in get_schema_attendance_mode
start_marker = "\t\t$location = !empty($this->event->start_location['address']) ? $this->event->start_location['address'] : '';"
idx = text.find(start_marker)
if idx == -1:
print("start_marker_not_found")
else:
end_idx = text.find("\t}", idx)
block = text[idx:end_idx+3] if end_idx != -1 else text[idx:end_idx+60]
lines = block.splitlines()
for i,line in enumerate(lines, 1):
print(f"{i}: {line.rstrip()}")
print()
# Simulate the block's return choices for representative inputs.
# Use Python booleans without evaluating PHP helpers: is_virtual is True only for link that matches
# one of the named virtual URL patterns in is_virtual_event_url().
def simulate(location_address, link, is_virtual):
if location_address:
return 'OfflineEventAttendanceMode'
if is_virtual:
return 'OnlineEventAttendanceMode'
return 'OfflineEventAttendanceMode'
cases = [
("123 Main St", "https://zoom.us/j/123456", True),
("", "https://zoom.us/j/123456", True),
("", "", False),
("123 Main St", "", False),
]
print("current branch simulation:")
for location, link, virtual in cases:
print(location, link, "is_virtual:", virtual, "=>", simulate(location, link, virtual))
PYRepository: Xtendify/Simple-Calendar
Length of output: 673
Return MixedEventAttendanceMode for hybrid events.
If the event has both a physical address and a recognized virtual meeting URL, set eventAttendanceMode to https://schema.org/MixedEventAttendanceMode. The current logic returns OfflineEventAttendanceMode before checking link, so hybrid events are marked offline-only.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@includes/events/event-schema.php` around lines 91 - 102, Update the event
attendance mode logic to evaluate both the physical address and recognized
virtual URL before returning. In the flow using $location and $link, return
https://schema.org/MixedEventAttendanceMode when both are present, while
preserving OnlineEventAttendanceMode for virtual-only events and
OfflineEventAttendanceMode for physical-only or otherwise offline events.
| $site_icon = get_site_icon_url(512); | ||
| if (!empty($site_icon)) { | ||
| return esc_url_raw($site_icon); | ||
| } | ||
|
|
||
| $custom_logo_id = get_theme_mod('custom_logo'); | ||
| if ($custom_logo_id) { | ||
| $logo_url = wp_get_attachment_image_url($custom_logo_id, 'full'); | ||
| if (!empty($logo_url)) { | ||
| return esc_url_raw($logo_url); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Do not invent event images or free offers.
Lines 193-205 use the site icon or logo when the event has no image. Those assets do not describe the event. Lines 356-362 convert incomplete ticket data into a free offer. For example, a paid offer without validFrom is discarded by get_verified_event_offer() and then emitted with price 0.
Return no image or offer when the event source does not provide valid data. Emit a zero-price offer only when the source explicitly declares the event free.
Also applies to: 354-413
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@includes/events/event-schema.php` around lines 193 - 205, Remove the
site-icon and custom-logo fallbacks from the event image resolution so events
without a source-provided image return no image. Update the offer handling
around get_verified_event_offer() to discard incomplete or invalid source offers
rather than defaulting missing ticket data to price 0; emit a zero-price offer
only when the source explicitly marks the event as free.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@includes/events/event-schema.php`:
- Line 136: Update the virtual-host comparison in the host detection logic to
correctly match subdomains such as tenant.zoom.us against the configured virtual
host zoom.us, avoiding the current incorrect positive substring offset. Preserve
the exact-host match and ensure only the virtual host itself or a dot-delimited
suffix match is accepted.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e0b096c7-68c9-455a-a01e-20965ba8fab0
📒 Files selected for processing (5)
includes/abstracts/calendar.phpincludes/calendars/views/default-calendar-grid.phpincludes/calendars/views/default-calendar-list.phpincludes/events/event-builder.phpincludes/events/event-schema.php
🚧 Files skipped from review as they are similar to previous changes (3)
- includes/calendars/views/default-calendar-list.php
- includes/abstracts/calendar.php
- includes/events/event-builder.php
| ]; | ||
|
|
||
| foreach ($virtual_hosts as $virtual_host) { | ||
| if ($host === $virtual_host || substr($host, -(1 - strlen($virtual_host))) === '.' . $virtual_host) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fix virtual-host suffix detection.
Line 136 computes a positive offset. A URL such as https://tenant.zoom.us/... does not match zoom.us. The event is then marked offline instead of online or mixed.
Proposed fix
- if ($host === $virtual_host || substr($host, -(1 - strlen($virtual_host))) === '.' . $virtual_host) {
+ if ($host === $virtual_host || substr($host, -strlen('.' . $virtual_host)) === '.' . $virtual_host) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if ($host === $virtual_host || substr($host, -(1 - strlen($virtual_host))) === '.' . $virtual_host) { | |
| if ($host === $virtual_host || substr($host, -strlen('.' . $virtual_host)) === '.' . $virtual_host) { |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@includes/events/event-schema.php` at line 136, Update the virtual-host
comparison in the host detection logic to correctly match subdomains such as
tenant.zoom.us against the configured virtual host zoom.us, avoiding the current
incorrect positive substring offset. Preserve the exact-host match and ensure
only the virtual host itself or a dot-delimited suffix match is accepted.
Description: Fix The Event Schema Markup in Simple Calendar appears to be missing some fields:
Missing field “eventAttendanceMode”
Missing field “endDate”
Missing field “offers”
Missing field “image”
Missing field “eventStatus”
Missing field “performer”
Missing field “organizer”
Clickup: https://app.clickup.com/t/1867958/86cypavtm
Summary by CodeRabbit
New Features
Improvements