Skip to content

Optimize shortcode detection before rendering#1010

Merged
CySSoO merged 1 commit intomasterfrom
cyssoo/optimize-actionoutputhtmlbefore-module
Mar 23, 2026
Merged

Optimize shortcode detection before rendering#1010
CySSoO merged 1 commit intomasterfrom
cyssoo/optimize-actionoutputhtmlbefore-module

Conversation

@CySSoO
Copy link
Contributor

@CySSoO CySSoO commented Mar 23, 2026

Motivation

  • The shortcode pipeline was being invoked for pages that contained [ characters in HTML/JS, causing unnecessary CPU time in hookActionOutputHTMLBefore.
  • The goal is to skip the heavy shortcode renderer when no real shortcode or Smarty/hook token is present.

Description

  • Tighten EverblockTools::hasShortcodeToken() by returning early for empty content and when the string contains neither [ nor { to avoid needless work.
  • Remove the broad [ needle and instead keep Smarty/hook tokens ({hook h=, {$, {if, {foreach, {include}) detection while adding a regex check for shortcode shapes like [tag] or [tag ...].
  • Change is implemented in src/Service/EverblockTools.php and preserves detection for Smarty/hook markers while reducing false positives from plain HTML/JS.

Testing

  • Ran PHP lint on the modified file with php -l src/Service/EverblockTools.php, which reported no syntax errors.

Codex Task

@CySSoO CySSoO merged commit 4c97aee into master Mar 23, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant