Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"autoload": {
"psr-4": {
"WP\\Skeleton\\": "src/"
"WP\\Skeleton\\": "src/",
"N3XT0R\\XPub\\Adapter\\": "src/Adapter/"
}
},
"scripts": {
Expand Down
13 changes: 2 additions & 11 deletions plugin-skeleton.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@

declare(strict_types=1);

use WP\Skeleton\Infrastructure\DI\ContainerProvider;
use WP\Skeleton\Shared\Plugin\PluginContext;
use N3XT0R\XPub\Adapter\WordpressPlugin;

defined('ABSPATH') or die('No script kiddies please!');

require_once __DIR__ . '/vendor/autoload.php';

ContainerProvider::setPluginContext(
new PluginContext(
__FILE__,
'wp-modern-plugin-skeleton',
'https://example.com'
)
);
WordpressPlugin::init(__FILE__);

$container = ContainerProvider::getContainer();
// $container can now be used to fetch services
18 changes: 18 additions & 0 deletions src/Adapter/WordpressCron.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace N3XT0R\XPub\Adapter;

final class WordpressCron
{
public function register(): void
{
// TODO: register cron events
}

public function handle(): void
{
// TODO: handle cron execution
}
}
29 changes: 29 additions & 0 deletions src/Adapter/WordpressPlugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace N3XT0R\XPub\Adapter;

use WP\Skeleton\Infrastructure\DI\ContainerProvider;
use WP\Skeleton\Shared\Plugin\PluginContext;

final class WordpressPlugin
{
private function __construct()
{
}

public static function init(string $pluginFile): void
{
ContainerProvider::setPluginContext(
new PluginContext(
$pluginFile,
'wp-modern-plugin-skeleton',
'https://example.com'
)
);

// Build the container. Services can now be fetched via ContainerProvider
ContainerProvider::getContainer();
}
}
Loading