be3eb9b8e7
Cross-posting Joomla content to social media, email marketing, and chat platforms. Plugin-based service architecture with custom mokojoomcross plugin group. 14 sub-extensions: - com_mokojoomcross (admin component: dashboard, posts, services, logs) - plg_system_mokojoomcross (triggers cross-posting on article publish) - plg_content_mokojoomcross (admin article status badges) - plg_webservices_mokojoomcross (REST API) - 9 service plugins: facebook, twitter, linkedin, mastodon, bluesky, mailchimp, telegram, discord, slack Includes Perfect Publisher Pro migration tool, message templates with placeholders, post queue with retry logic, and default/custom bot modes for services supporting universal bots. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2.5 KiB
2.5 KiB
Adding Custom Services
MokoJoomCross uses a plugin-based architecture. Any developer can create a new service plugin.
Plugin Structure
Create a Joomla plugin in the mokojoomcross group:
plg_mokojoomcross_myservice/
├── myservice.xml # Plugin manifest (group="mokojoomcross")
├── myservice.php # Legacy stub (empty)
├── src/
│ └── Extension/
│ └── MyserviceService.php # Implements MokoJoomCrossServiceInterface
├── services/
│ └── provider.php # DI container registration
└── language/
└── en-GB/
├── plg_mokojoomcross_myservice.ini
└── plg_mokojoomcross_myservice.sys.ini
Implement the Interface
Your Extension class must implement MokoJoomCrossServiceInterface:
namespace Joomla\Plugin\MokoJoomCross\Myservice\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Component\MokoJoomCross\Administrator\Service\MokoJoomCrossServiceInterface;
use Joomla\Event\SubscriberInterface;
class MyserviceService extends CMSPlugin implements SubscriberInterface, MokoJoomCrossServiceInterface
{
public static function getSubscribedEvents(): array
{
return ['onMokoJoomCrossGetServices' => 'onMokoJoomCrossGetServices'];
}
public function onMokoJoomCrossGetServices(&$services): void
{
$services[] = $this;
}
public function getServiceType(): string { return 'myservice'; }
public function getServiceName(): string { return 'My Service'; }
public function getMaxLength(): int { return 500; }
public function supportsMedia(): bool { return true; }
public function publish(string $message, array $media, array $credentials, array $params): array
{
// Your API integration here
return ['success' => true, 'platform_post_id' => '...', 'response' => [...]];
}
public function validateCredentials(array $credentials): array
{
return ['valid' => true, 'message' => 'OK', 'account_name' => '...'];
}
}
Required Methods
| Method | Returns | Purpose |
|---|---|---|
getServiceType() |
string | Unique identifier (lowercase, no spaces) |
getServiceName() |
string | Display name in admin UI |
publish() |
array | Send content to the platform |
validateCredentials() |
array | Test if credentials work |
getMaxLength() |
int | Character limit (0 = no limit) |
supportsMedia() |
bool | Whether images can be attached |