# jesusyesares/wp-plugin-leaflet-map architecture

> Architecture diagram of the GitHub repository jesusyesares/wp-plugin-leaflet-map, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jesusyesares/wp-plugin-leaflet-map
- Repository: https://github.com/jesusyesares/wp-plugin-leaflet-map

## Overview

a. WordPress Integration Flow:
- WordPress Core → Plugin Initialization → Shortcode Registration → Frontend Rendering

b. Creation Flow:
- Shortcode → Shortcode Handler → Map Constructor → External Services

c. Admin Configuration Flow:
- WordPress Admin → Plugin Settings → Configuration Storage → Frontend Implementation

a. Configuration:
- Admin Settings → WordPress Options API → Map Instance

b. Geocoding:
- Address Input → Geocoder → Coordinates → Map Display

##### Component Relationships

- Parent-child relationships between shortcode classes
- Dependencies between JavaScript modules
- Integration points with WordPress core
- Connection to external services

##### Plugin's modular architecture
- Core plugin functionality
- Shortcode system
- Frontend rendering
- Admin interface

##### Clear separation between
- WordPress integration points
- Custom plugin functionality
- External service dependencies

##### Extensibility points
- Custom shortcode addition
- Customization options
- External service integration

##### Configuration flows
- How settings affect map display
- How shortcodes are processed
- How external services are integrated

Remember to maintain a balance between showing enough detail to understand the system while keeping it clear and readable. The focus should be on the architectural relationships and data flows rather than implementation details.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph WordPress
        WP[WordPress Core]
    end

    subgraph "Core Plugin Components"
        PI["Plugin Initialization"]:::core
        AI["Admin Interface"]:::core
        SM["Settings Manager"]:::core
        GS["Geocoding Service"]:::core
        PO["Plugin Options"]:::core
    end

    subgraph "Shortcode System"
        BSC["Base Shortcode Class"]:::shortcode
        SH["Shortcode Helper"]:::shortcode
        
        subgraph "Shortcode Handlers"
            MS["Map Shortcode"]:::shortcode
            MKS["Marker Shortcode"]:::shortcode
            GJS["GeoJSON Shortcode"]:::shortcode
        end
    end

    subgraph "Frontend Components"
        MC["Map Constructor"]:::frontend
        GJH["GeoJSON Handler"]:::frontend
        SIH["SVG Icon Handler"]:::frontend
    end

    subgraph "External Services"
        OSM["OpenStreetMap Tile Server"]:::external
        MQ["MapQuest API"]:::external
        NGS["Nominatim Geocoding Service"]:::external
    end

    %% Core Relationships
    WP --> PI
    PI --> AI
    PI --> SM
    PI --> GS
    AI --> SM
    
    %% Shortcode System Relationships
    BSC --> MS
    BSC --> MKS
    BSC --> GJS
    SH --> MS
    SH --> MKS
    SH --> GJS
    
    %% Frontend Integration
    MS --> MC
    MKS --> MC
    GJS --> GJH
    MC --> SIH
    
    %% External Service Integration
    MC --> OSM
    GS --> NGS
    GS --> MQ
    
    %% Click Events
    click PI "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/leaflet-map.php"
    click AI "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/class.admin.php"
    click SM "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/class.plugin-settings.php"
    click GS "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/class.geocoder.php"
    click BSC "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/shortcodes/class.shortcode.php"
    click SH "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/scripts/shortcode-helper.js"
    click MC "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/scripts/construct-leaflet-map.js"
    click GJH "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/scripts/leaflet-ajax-geojson.js"
    click SIH "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/scripts/leaflet-svg-icon.js"
    click PO "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/class.plugin-option.php"
    click MS "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/shortcodes/class.map-shortcode.php"
    click MKS "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/shortcodes/class.marker-shortcode.php"
    click GJS "https://github.com/jesusyesares/wp-plugin-leaflet-map/blob/master/shortcodes/class.geojson-shortcode.php"

    %% Styles
    classDef core fill:#b3d1ff,stroke:#333,stroke-width:2px
    classDef shortcode fill:#90EE90,stroke:#333,stroke-width:2px
    classDef frontend fill:#FFB366,stroke:#333,stroke-width:2px
    classDef external fill:#E6E6E6,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Shortcode System"]:::shortcode
        L3["Frontend Components"]:::frontend
        L4["External Services"]:::external
    end
```
