custom-twitter-feeds
Last commit date
admin
3 weeks ago
assets
3 weeks ago
css
3 weeks ago
img
3 weeks ago
inc
3 weeks ago
js
3 weeks ago
languages
3 weeks ago
templates
3 weeks ago
vendor
3 weeks ago
views
3 weeks ago
README.md
3 weeks ago
README.txt
1 week ago
changelog.txt
3 weeks ago
custom-twitter-feed.php
3 weeks ago
uninstall.php
3 weeks ago
README.md
144 lines
| 1 | # Custom Twitter Feeds - Developer Documentation |
| 2 | |
| 3 | This is a WordPress plugin for displaying customizable Twitter/X feeds. This document provides technical information about the project structure and build process. |
| 4 | |
| 5 | ## Project Structure |
| 6 | |
| 7 | ``` |
| 8 | custom-twitter-feeds/ |
| 9 | ├── admin/ # Admin interface |
| 10 | │ ├── Traits/ # Admin traits and mixins |
| 11 | │ ├── assets/ # Admin assets |
| 12 | │ │ ├── css/ # Admin stylesheets |
| 13 | │ │ ├── img/ # Admin images |
| 14 | │ │ │ └── about/ # About page images |
| 15 | │ │ └── js/ # Admin JavaScript |
| 16 | │ ├── builder/ # Feed builder interface |
| 17 | │ │ ├── assets/ # Builder assets |
| 18 | │ │ │ ├── css/ # Builder stylesheets |
| 19 | │ │ │ ├── img/ # Builder images |
| 20 | │ │ │ └── js/ # Builder JavaScript |
| 21 | │ │ └── templates/ # Builder templates |
| 22 | │ │ ├── preview/ # Preview templates |
| 23 | │ │ ├── screens/ # Screen templates |
| 24 | │ │ └── sections/ # Section templates |
| 25 | │ │ ├── create-feed/ # Feed creation sections |
| 26 | │ │ ├── customizer/ # Customizer sections |
| 27 | │ │ ├── feeds/ # Feed management sections |
| 28 | │ │ └── popup/ # Popup templates |
| 29 | │ └── views/ # Admin page views |
| 30 | │ ├── about/ # About page |
| 31 | │ ├── sections/ # Shared sections |
| 32 | │ ├── settings/ # Settings pages |
| 33 | │ │ └── tab/ # Settings tabs |
| 34 | │ └── support/ # Support page |
| 35 | ├── build/ # Build configuration |
| 36 | │ ├── composer/ # Composer build config |
| 37 | │ └── custom-twitter-feeds/ # Plugin build config |
| 38 | ├── css/ # Frontend stylesheets |
| 39 | ├── img/ # Frontend images |
| 40 | ├── inc/ # Core functionality |
| 41 | │ ├── Admin/ # Admin classes |
| 42 | │ │ └── Traits/ # Admin traits |
| 43 | │ ├── Builder/ # Feed builder classes |
| 44 | │ │ ├── Controls/ # UI controls |
| 45 | │ │ └── Tabs/ # Builder tabs |
| 46 | │ ├── Integrations/ # Third-party integrations |
| 47 | │ │ └── Analytics/ # Analytics integration |
| 48 | │ ├── SmashTwitter/ # Twitter API service |
| 49 | │ │ └── Services/ # Service classes |
| 50 | │ ├── V2/ # Twitter API v2 adapters |
| 51 | │ └── blocks/ # Gutenberg blocks |
| 52 | ├── js/ # Frontend JavaScript |
| 53 | ├── languages/ # Translation files |
| 54 | ├── templates/ # Frontend templates |
| 55 | ├── views/ # Frontend views |
| 56 | ├── custom-twitter-feed.php # Main plugin file |
| 57 | ├── composer.json # Composer configuration |
| 58 | ├── Makefile # Build commands |
| 59 | ├── scoper.inc.php # PHP Scoper configuration |
| 60 | ├── phpcs.xml # Code standards config |
| 61 | ├── phpstan.neon # Static analysis config |
| 62 | ├── README.txt # Plugin documentation |
| 63 | └── uninstall.php # Uninstall procedures |
| 64 | ``` |
| 65 | |
| 66 | ## Build Process |
| 67 | |
| 68 | The project uses a sophisticated build system managed by Smash Bundler. |
| 69 | |
| 70 | ### Prerequisites |
| 71 | |
| 72 | 1. **PHP Scoper** - Must be installed globally: |
| 73 | ```bash |
| 74 | composer global require humbug/php-scoper |
| 75 | ``` |
| 76 | |
| 77 | 2. **Composer** - For dependency management |
| 78 | |
| 79 | 3. **Smash Bundler** - Available as dev dependency in composer.json |
| 80 | |
| 81 | 4. **WP-CLI** - For translation file generation (optional) |
| 82 | |
| 83 | ### Production Build |
| 84 | |
| 85 | To create a production-ready zip file: |
| 86 | |
| 87 | ```bash |
| 88 | make package |
| 89 | ``` |
| 90 | |
| 91 | This command uses the Smash Bundler with configuration from `build/custom-twitter-feeds/config.php` to: |
| 92 | - Install and scope PHP dependencies to prevent conflicts |
| 93 | - Copy all necessary plugin files |
| 94 | - Generate a versioned zip file (e.g., `custom-twitter-feeds-2.3.2.zip`) |
| 95 | |
| 96 | ### Other Build Commands |
| 97 | |
| 98 | Available via Makefile: |
| 99 | |
| 100 | 1. **Development Setup:** |
| 101 | ```bash |
| 102 | composer install |
| 103 | ``` |
| 104 | |
| 105 | 3. **Translation Files:** |
| 106 | ```bash |
| 107 | make translations |
| 108 | ``` |
| 109 | Generates and updates .pot, .po, and .mo files. |
| 110 | |
| 111 | ### Code Quality Tools |
| 112 | |
| 113 | - `composer phpcs` - Run PHP CodeSniffer for code standards |
| 114 | - `composer phpcbf` - Auto-fix code standard violations |
| 115 | - PHPStan for static analysis |
| 116 | |
| 117 | ### Dependency Management |
| 118 | |
| 119 | The build process uses PHP Scoper to isolate dependencies under the `Smashballoon\TwitterFeed\Vendor` namespace, preventing conflicts with other WordPress plugins that may use the same libraries. |
| 120 | |
| 121 | ## Core Components |
| 122 | |
| 123 | ### Main Plugin File |
| 124 | - `custom-twitter-feed.php` - Contains plugin initialization, constants definition, and basic setup |
| 125 | |
| 126 | ### Admin Interface |
| 127 | - Located in `admin/` directory |
| 128 | - Includes settings pages, feed builder, and management interfaces |
| 129 | - Assets are organized by functionality (CSS, JS, images) |
| 130 | |
| 131 | ### Core Functionality |
| 132 | - Located in `inc/` directory |
| 133 | - Contains all PHP classes and business logic |
| 134 | - Organized by feature area (Admin, Builder, Integrations, etc.) |
| 135 | |
| 136 | ### Frontend |
| 137 | - `css/` and `js/` - Frontend assets |
| 138 | - `templates/` - Display templates for feeds |
| 139 | - `views/` - Additional view files |
| 140 | |
| 141 | ### Build System |
| 142 | - `build/` - Contains build configuration files |
| 143 | - `Makefile` - Defines build commands |
| 144 | - `scoper.inc.php` - PHP Scoper configuration for dependency isolation |