No description
- PHP 67.6%
- JavaScript 16.1%
- CSS 11.1%
- HTML 3.3%
- Shell 1.6%
- Other 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github | ||
| assets | ||
| build | ||
| builders | ||
| compat/woocommerce-subscriptions | ||
| docs | ||
| languages | ||
| md-files | ||
| member-docs | ||
| src | ||
| subscriptions-example | ||
| subscriptions-useful | ||
| test | ||
| .gitignore | ||
| .gitmodules | ||
| CHANIMATION.md | ||
| CODE_RULES.md | ||
| composer.json | ||
| composer.lock | ||
| p_enqueue_media();\\ | ||
| README.md | ||
| SndActivation.php | ||
| SndCore.php | ||
| SndDeactivation.php | ||
| SndMigrate.php | ||
SndCore — Audio Commerce Engine for WordPress/WooCommerce
High‑performance audio streaming and commerce toolkit powering large catalogs and multi‑GB files on WooCommerce. Secure REST streaming, demo generation, product automation, and member features, implemented with modern WordPress plugin practices.
Highlights
- WooCommerce‑native products and albums with player integration
- Secure REST streaming with signed URLs, nonce checks, and HTTP Range support
- FFmpeg‑powered demo creation (duration %, start offset, fade), with caching
- Large‑file delivery and packaging (multi‑format zip builder) with safe tmp handling
- Frontend and wp‑admin album creation flows
- Membership features: likes, comments, chat, vault
- Subscription integration example for recurring products
- Content restriction by membership tier/role
- Player engines and skins, assets enqueued only when needed
- Performance: batched config reads, streaming direct from disk, transient caches
- Engineering discipline: PSR‑12, PSR‑4 autoload, SRP, centralized hooks, typed PHP
- Chunked Uploads for large albums
- Tested with 50 gig album. Playback and Package Generation for 438 tracks seamlessly.
- Extensive Admin Interface
What this codebase does well
- Single‑Responsibility and dependency boundaries: Core/Bootstrap wires services; feature code pulls dependencies from Bootstrap, never via ad‑hoc new.
- Hooks isolation: only Core/Hooks registers actions/filters; constructors remain side‑effect free.
- Config/state model: snd* keys with inheritance (product override → global → default), bulk getters to reduce DB roundtrips.
- Security posture: nonces for internal REST, capability checks, input sanitization, prepared statements, escaped output.
- Streaming correctness: HTTP Range, partial content, local stream or remote redirect through Storage/FileManager.
- UI separation: PHP that outputs HTML lives under UI/*; domain logic does not echo.
- Scale: assets enqueued on demand, demo outputs cached, long‑running work delegated to FFmpeg paths, and download packaging uses tmp + lock discipline.
Architecture at a glance
- Core: Bootstrap, Config, Hooks
- Audio: Audio, Player, PlayerManager, PlayerRegistry, Streamer, PlaybackController, DemoCreator, DownloadProcessor
- Storage: FileManager, Cloud (providers), optional Google Drive client
- REST: StreamController (audio), PlaylistController, CustomPricePaymentController
- WooCommerce: WooCommerceIntegration, ProductProcessor, AlbumUploadModal, AlbumUploadProcessor, FormatDownloader, BatchProductAssigner, PurchasersDisplay
- UI: Renderer, ProductRenderer, DownloadRenderer, AdminRenderer, DbRenderer, widgets/templates
- Members: Vault, MemberDashboard, Comments, Chat, ContentRestriction, UsersPageIntegration
- Subs: SubscriptionFormHandler/Manager/Products and Woo integration (example module)
- Db: Installer, Monitor, Clean
- Utils: Analytics, Cache, Debug, Update, Utils
See /src for the full tree.
How streaming and demos work
- Request arrives via REST route (sndcore‑player/v1/stream/{product_id}/{file_id}) with nonce.
- Permission check: purchase, login requirements, and content restrictions enforced.
- Config resolution: global + product overrides fetched via Config (bulk where possible).
- Demo path (when applicable): DemoCreator builds/caches a truncated file (duration %, start, fade) via FFmpeg.
- Delivery: Storage/FileManager streams local files with Range; remote sources redirect. Headers and partial content handled correctly.
Settings and state
- Keys prefixed snd.
- Global settings stored in the snd_global_settings option.
- Product‑level overrides use post meta with the same keys.
- Use Config::getStates([...]) for batched reads; write via Config::updateState() then persist.
Requirements
- WordPress 6.5+
- WooCommerce 8+
- PHP 8.3+
- FFmpeg available when demo generation is enabled
- Permalinks + REST API enabled
Development guardrails
- PSR‑12, strict_types, typed properties/returns
- Centralize hooks in Core/Hooks; avoid work in constructors
- Do not echo HTML from non‑UI classes; route rendering via UI/*
- Do not instantiate services directly; request them from Bootstrap
- Do not read/write settings directly; go through Core/Config
- Enqueue assets conditionally; keep front end lean
Repository structure (top‑level)
- SndCore.php — plugin entry point
- composer.json — PSR‑4 autoload: "SndCore\": "src/"
- src/Core — Bootstrap, Config, Hooks (initialization + hook registration)
- src/Audio — player, streaming, demo and download helpers
- src/Storage — FileManager, cloud clients
- src/REST — REST endpoints
- src/WooCommerce — integration and product/album tooling
- src/UI — renderers and admin views
- src/Members, src/Subs — members and subscriptions modules
- docs/ and md‑files/ — internal design docs and manuals
Internal docs
- docs/BOOTSTRAP‑INITIALIZATION.md
- docs/CONFIG‑MANAGEMENT.md
- docs/HOOKS‑REGISTRATION.md
- CODE_RULES.md
- md‑files/REST_API.md
- md‑files/HowDemosWork.md
Notes
- Subscriptions code is provided as an example module; enable and adapt per project needs.
- Large file support depends on your PHP/web server limits; SndCore streams efficiently but honors host caps.