API / Minn\Content / ContentScan

ContentScan final class

Minn\Content\ContentScan · public/minn/src/Minn/Content/ContentScan.php · 196 lines

What a site's stored content asks of the engine: shortcodes, block names, extra tables, extra post types. Preflight lights the findings; the scan itself is pure string and list work so a suite can pin it without a database.

Used by 1

Constants and properties

constCORE_TABLES = array ( 0 => 'commentmeta', 1 => 'comments', 2 => 'links', 3 => 'options', 4 => 'postmeta', 5 => 'posts', 6 => 'term_relationships', 7 => 'term_taxonomy', 8 => 'termmeta', 9 => 'terms', 10 => 'usermeta', 11 => 'users', )

Tables the engine already speaks. Anything else is plugin data.

constCORE_TYPES = array ( 0 => 'post', 1 => 'page', 2 => 'attachment', 3 => 'revision', 4 => 'nav_menu_item', 5 => 'custom_css', 6 => 'customize_changeset', 7 => 'oembed_cache', 8 => 'user_request', 9 => 'wp_block', 10 => 'wp_template', 11 => 'wp_template_part', 12 => 'wp_global_styles', 13 => 'wp_navigation', 14 => 'wp_font_family', 15 => 'wp_font_face', )

Built-in types the engine stores. Public ones are in data/types.json; the rest are silent core types that still occupy the posts table.

constCONTENT_TYPES = array ( 0 => 'post', 1 => 'page', 2 => 'wp_block', 3 => 'wp_template', 4 => 'wp_template_part', 5 => 'wp_navigation', )

post_content that a visitor (or a theme template) can actually see.

Public

staticshortcodes(string $content): array#

Opening shortcode tags in $content. Escaped [[tag]] is skipped; closers [/tag] never match because a tag name starts with a letter.

@return array<string, int> tag => occurrences
staticblocks(string $content): array#

Block names in $content, namespace included. A delimiter without a namespace is core/, matching the parser.

@return array<string, int> name => occurrences
staticextraTables(array $tables, string $prefix): array#

The tables under the prefix that are not the reference's own.

$tableslist<string>names from SHOW TABLES
@return list<string> bare names after stripping the prefix
statictableFamilies(array $bare): array#

Group extra tables by the first underscore segment. Wordfence's tables are wfHits and wfls_* with no shared underscore prefix, so those two stems collapse to one family.

$barelist<string>
@return list<string>
staticextraTypes(array $types): array#

The post types in use that the reference does not register itself.

$typeslist<string>
@return list<string>
staticthirdParty(array $named): array#

The block names that are not core/*, with their counts.

$namedarray<string, int>
@return array<string, int>
staticlisted(array $names, int $cap = 40): string#

Names sorted and comma-separated, cut with a count past the cap.

$nameslist<string>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatewalk(array $blocks, array $found): void#
$blockslist<\Minn\Blocks\Block>@param array<string, int> $found