Architecture

Architecture

Package Structure

pkg_mokoog
  com_mokoog              -- Admin component (dashboard, tag CRUD, batch, CSV, ACL)
  plg_system_mokoog       -- System plugin (frontend meta tag injection, sitemap, AI)
  plg_content_mokoog      -- Content plugin (editor form fields, live preview)
  plg_webservices_mokoog  -- WebServices plugin (REST API routes)

Targets Joomla 6+ and PHP 8.2+. All extensions use the modern namespaced DI architecture: services/provider.php providers, SubscriberInterface event subscribers, and namespaced MVC. No deprecated Factory::getDbo/getUser/getSession/getLanguage, Joomla\CMS\Filesystem, or jexit() calls remain (forward-compatible with Joomla 7).

Data Flow

Frontend (onBeforeCompileHead)

  1. System plugin detects the current page (option, view, id)
  2. Loads custom OG data from #__mokoog_tags (language-aware)
  3. Falls back to category/menu OG data if available
  4. Auto-generates missing fields from article/product content
  5. Resolves the image URL, auto-resizes if enabled
  6. Emits OG, Twitter, LinkedIn, Discord, Telegram, Fediverse, Pinterest meta tags
  7. Builds JSON-LD schema(s) (Article/Product/WebPage + FAQ/HowTo/Event/Recipe/LocalBusiness/Video/custom)
  8. Fires onMokoOGAfterRender for third-party extensions

Editor (content plugin)

  1. Content plugin adds the OG fields tab to article/menu/category editor forms
  2. On save, stores custom OG data to #__mokoog_tags keyed by language; JSON fields are validated as objects/arrays
  3. Live preview updates the Facebook/Twitter/LinkedIn/Discord/Mastodon/Slack cards in real time

Admin component

  1. Dashboard (default view) — DashboardModel computes coverage stats; View/Dashboard renders a donut + breakdown + missing-articles list
  2. Tags — list view with publish/unpublish/delete (TagsController) and a single-record create/edit screen (TagControllerView/Tagtmpl/tag/edit.php)
  3. Batch / Import-ExportBatchController, ImportExportController (CSRF + ACL gated)

API

  1. WebServices plugin registers routes on onBeforeApiRoute
  2. JSON:API controller provides full CRUD plus a content-lookup endpoint
  3. A field whitelist (JsonapiView) prevents information leakage

Key Classes

Class Location Purpose
MokoOG plg_system_mokoog Meta tag injection, sitemap trigger, AI AJAX endpoint
MokoOGContent plg_content_mokoog Editor form injection, OG data save/load
MokoOGWebServices plg_webservices_mokoog API route registration
DisplayController com_mokoog Default view dispatch (→ dashboard)
DashboardModel com_mokoog Coverage metrics queries
TagController / TagsController com_mokoog Single-record edit / list operations
BatchController com_mokoog Batch OG generation
ImportExportController com_mokoog CSV import/export (JSON/URL validated)
TagTable com_mokoog DB table with field validation
ImageHelper plg_system_mokoog Image resize, center-crop, per-platform crops, prune
JsonLdBuilder plg_system_mokoog All JSON-LD schema builders + toScriptTag()
SitemapBuilder plg_system_mokoog Access-filtered XML sitemap, atomic write

Database

Single table: #__mokoog_tags

Performance & Safety


Printed from wiki · Architecture