| 开发者 | tporret |
|---|---|
| 更新时间 | 2026年7月20日 09:56 |
| 捐献地址: | 去捐款 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.0.0 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
src/ directory, compiled assets are in build/, and the maintained public source repository is available at https://github.com/tporret/enterprise-api-importer.
This readme is written for WordPress administrators and site owners evaluating or using the plugin from the Plugins screen.
Use tporret API Data Importer to run clean, repeatable import workflows without sacrificing flexibility:
Tporapdi_Validator — single validation seam for all import job fieldsTporapdi_Import_Runner — owns the 5-stage import lifecycle (Extract → Filter → Stage → Transform → Load)Tporapdi_Template_Engine — unified Twig rendering seam for all template fields and dry-run previewsTporapdi_Security_Guard — centralised SSRF, CIDR, and Twig security checks shared across save and run pathsTporapdi_Job_Repository, Tporapdi_Queue_Repository, Tporapdi_Log_Repository — domain repositories hiding all SQL and cache managementTporapdi_Media_Ingestor — isolated image sideload, HTML rewrite, featured image, gallery, and attachment-meta mapping logic with idempotent deduplicationTporapdi_Cleanup_Service — chunked garbage collection for staging queue and log tablesTporapdi_Lock_Policy — single edit-lock policy seam used by all admin UI affordancesTPORAPDI_Defaults_Resolver::normalize() — single normalization seam for post status defaults shared by REST save and import runtimeNo. It uses native WP-Cron scheduling, but supports CLI triggers.
Yes. Nested objects and arrays can be parsed and transformed through Twig templating.
Yes. Set Payload Format to iCal (.ics) and the importer will expand recurring events into normalized records.
Yes. Set Payload Format to CSV/TSV or XML/RSS. CSV supports delimiter auto-detection (or manual override), and XML/RSS uses a configurable repeating node element (for example, item or entry).
Use pagination where possible. JSON imports are non-streaming and protected by filterable payload and record limits. For very large feeds, CSV/XML streaming is the safer path.
Yes. It supports four modes per import job: none, bearer token, custom API-key header, and basic auth.
Yes. Use Post Title Template with Twig syntax. If left blank, the importer falls back to Imported Item {ID}.
Yes. Select any public post type from Target Post Type. If the selected post type becomes unavailable, imports safely fall back to post.
Imported items are saved as the public tporapdi_item post type. You can list them with a normal archive template such as archive-tporapdi_item.php, or with a WP_Query that sets post_type to tporapdi_item. The plugin does not include a dedicated front-end block for imported-item listings. Example archive template: ```php > No imported items found. ``` Example WP_Query loop: ```php $imported_items = new WP_Query( array( 'post_type' => 'tporapdi_item', 'post_status' => 'publish', 'posts_per_page' => 10, ) ); if ( $imported_items->have_posts() ) { while ( $imported_items->have_posts() ) { $imported_items->the_post(); echo ' ' . esc_html( get_the_title() ) . ''; } wp_reset_postdata(); } ```
Each subsite keeps its own import jobs, schedules, settings, and dashboard. A separate Network Admin dashboard can summarize active subsites when the plugin is also active on the primary site. Activate the plugin per site; Network Activate is intentionally blocked.
Yes. Configure Media Mappings in the Mapping/Templating tab to sideload featured images, gallery attachments, or attachment IDs stored in custom fields. The legacy Featured Image Source Path still works as a fallback when no media mappings are configured.
Yes. For hierarchical target post types, enable Parent Mapping in the Mapping/Templating tab. Parent lookup can use an imported external ID, an existing WordPress post ID, or a post slug. Missing parents can be deferred for later reconciliation, imported as root items, or skipped.
Template configuration requires the tporapdi_manage_templates capability or manage_options role. Multisite super admins always have access. Imported item editing can now be controlled per import job with the "Lock editing of imported posts" setting.
The following Twig tags are disallowed to prevent file inclusion and code injection: include, source, import, from, embed, extends, use, macro.
Yes, but not recommended for production. Go to Settings → Allow Internal Endpoints to permit RFC1918 and loopback addresses. For whitelisting specific hosts/CIDR blocks, use Settings → Allowed Endpoint Hosts and Settings → Allowed Endpoint CIDR Blocks.
The SSRF Hardening check starts in a warning state until you configure Allowed Endpoint Hosts or Allowed Endpoint CIDR Blocks. That warning is there to remind you that outbound API access is still open until you add an allowlist.
Start with Allowed Endpoint Hosts and list only trusted API domains. Leave Allow Internal Endpoints and Retain Raw API Records disabled unless you intentionally need them. Add CIDR blocks only when you need additional IP-range restrictions.
No, not by default. Raw record retention is debug-only and disabled by default. Enabling it stores _tporapdi_raw_record; disabling it purges stored raw records.
All template configuration changes are logged to the wp_custom_import_logs database table with before/after hashes, actor information, and precise timestamps. Review logs via tporret API Data Importer → Manage Imports → Import edit screen.
_tporapdi_raw_record meta.uid, instance_uid, start/end dates, all-day flag).data_format column on existing installs.sabre/vobject as a runtime dependency for iCal parsing.Tporapdi_Validator module: single entry point for all import job field validation (auth, recurrence, templates, post defaults, meta mappings) replacing scattered inline checks in rest.php.Tporapdi_Import_Runner module: owns the full 5-stage import lifecycle (Extract, Filter, Stage, Transform, Load) with state transitions and failure semantics in one place.Tporapdi_Template_Engine module: single render() seam used by both live import runs and dry-run previews, guaranteeing identical Twig security and output behaviour across all template fields.Tporapdi_Security_Guard module: centralises SSRF, CIDR, and Twig security validation — same rules enforced at save time and run time.Tporapdi_Job_Repository, Tporapdi_Queue_Repository, Tporapdi_Log_Repository): all SQL and cache management moved out of db.php, which is now a thin backwards-compatible shim layer.Tporapdi_Media_Ingestor module: image sideload, deduplication, and HTML content rewriting isolated from lifecycle cleanup.Tporapdi_Cleanup_Service module: chunked garbage collection for staging queue and log tables, independent of media handling.TPORAPDI_Reporting_Aggregator::register(); reporting.php uses glob-based auto-discovery so new reporters require no edits to existing files.Tporapdi_Lock_Policy module: single is_locked(int $post_id) seam for all import-managed post edit-locking; all content.php hook callbacks route through this one policy.TPORAPDI_Defaults_Resolver: new normalize(string $post_type, array $raw_input) static method is the single seam for post status/comment status/ping status normalization — used identically by the REST save path and the import runtime.wp_insert_post() and sync updates discussion settings during wp_update_post()./wp-json/eapi/v1/dashboard (metrics) and /wp-json/eapi/v1/dashboard/history (time-series data).tporapdi_manage_templates capability for template configuration access (separate from manage_options).tporapdi_manage_templates OR manage_options OR is_super_admin().map_meta_cap).