Skip to content

Commit 90ceef9

Browse files
committed
Merge branch 'develop'
2 parents 5b6b805 + 0bdd65a commit 90ceef9

86 files changed

Lines changed: 3092 additions & 2757 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<p align="center">
2+
<a href="https://github.com/Pollora/framework">
3+
<img src="resources/images/pollora-logo.svg" width="400" alt="Pollora">
4+
</a>
5+
</p>
6+
7+
<p align="center">
8+
<a href="https://packagist.org/packages/pollora/framework"><img src="https://img.shields.io/packagist/v/pollora/framework" alt="Latest Stable Version"></a>
9+
<a href="https://packagist.org/packages/pollora/framework"><img src="https://img.shields.io/packagist/dt/pollora/framework" alt="Total Downloads"></a>
10+
<a href="https://codecov.io/gh/Pollora/framework"><img src="https://codecov.io/gh/Pollora/framework/branch/main/graph/badge.svg" alt="Coverage"></a>
11+
<a href="https://packagist.org/packages/pollora/framework"><img src="https://img.shields.io/packagist/l/pollora/framework" alt="License"></a>
12+
</p>
13+
14+
## About Pollora Framework
15+
16+
Pollora is a framework that bridges **Laravel** and **WordPress**, combining Laravel's architecture patterns with WordPress's content management capabilities. It allows developers to use Laravel's service providers, dependency injection, Blade templates, and Eloquent ORM while maintaining full WordPress functionality.
17+
18+
### Key Features
19+
20+
- **WordPress routing** via `Route::wp()` with template hierarchy support
21+
- **PHP attributes** for hooks (`#[Action]`, `#[Filter]`), post types (`#[PostType]`), taxonomies (`#[Taxonomy]`), scheduling (`#[Schedule]`), and REST routes (`#[WpRestRoute]`)
22+
- **Auto-discovery system** that scans and registers components automatically
23+
- **Blade templates** with [Sage Directives](https://log1x.github.io/sage-directives-docs/) for WordPress data
24+
- **Theme system** with dynamic PSR-4 autoloading, parent/child theme support, and Vite asset management
25+
- **WordPress authentication** guard and password hashing integration
26+
- **Event dispatching** for WordPress core, WooCommerce, Gravity Forms, and Yoast SEO
27+
- **Module system** via [nwidart/laravel-modules](https://github.com/nwidart/laravel-modules)
28+
29+
## Documentation
30+
31+
Full documentation is available at [github.com/Pollora/documentation](https://github.com/Pollora/documentation).
32+
33+
## Installation
34+
35+
Pollora is installed via the [skeleton project](https://github.com/Pollora/pollora):
36+
37+
```bash
38+
composer create-project pollora/pollora my-project
39+
```
40+
41+
See the [skeleton README](https://github.com/Pollora/pollora) for detailed setup instructions.
42+
43+
## Requirements
44+
45+
- PHP ^8.3
46+
- Laravel 13.x
47+
- WordPress 6.9+
48+
49+
## Testing
50+
51+
```bash
52+
composer test # Run all checks (Rector, Pint, PHPStan, Pest)
53+
composer test:unit # Run Pest tests with 100% coverage requirement
54+
composer test:types # Run PHPStan static analysis
55+
composer test:lint # Check code style with Pint
56+
composer test:refacto # Check refactoring rules with Rector
57+
```
58+
59+
## Contributing
60+
61+
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
62+
63+
## Security
64+
65+
If you discover a security vulnerability, please report it via [GitHub Security Advisories](https://github.com/Pollora/framework/security/advisories/new). See [SECURITY.md](SECURITY.md) for details.
66+
67+
## Changelog
68+
69+
All notable changes are documented in [CHANGELOG.md](CHANGELOG.md).
70+
71+
## License
72+
73+
Pollora is open-sourced software licensed under the [GPL-2.0-or-later](LICENSE).

‎rector.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
return RectorConfig::configure()
1111
->withPaths([
1212
__DIR__.'/src',
13-
// __DIR__.'/tests',
13+
__DIR__.'/tests',
1414
])
1515
->withSkip([
1616
AddOverrideAttributeToOverriddenMethodsRector::class,
17+
__DIR__.'/tests/Unit/helpers.php',
1718
])
1819
->withPreparedSets(
1920
deadCode: true,

‎resources/images/pollora-logo.svg‎

Lines changed: 322 additions & 0 deletions
Loading

‎src/Providers/PolloraServiceProvider.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use Pollora\Theme\Infrastructure\Providers\ThemeServiceProvider;
3939
use Pollora\ThirdParty\WooCommerce\Infrastructure\Providers\WooCommerceServiceProvider;
4040
use Pollora\ThirdParty\WpRocket\WpRocketServiceProvider;
41+
use Pollora\VersionCheck\Infrastructure\Providers\VersionCheckServiceProvider;
4142
use Pollora\View\Infrastructure\Providers\TemplateHierarchyServiceProvider;
4243
use Pollora\View\ViewServiceProvider;
4344
use Pollora\WordPress\Config\ConstantServiceProvider;
@@ -130,6 +131,9 @@ public function register(): void
130131
// Hashing service provider
131132
$this->app->register(HashServiceProvider::class);
132133
$this->app->register(WordPressServiceProvider::class);
134+
135+
// Version check notifications
136+
$this->app->register(VersionCheckServiceProvider::class);
133137
}
134138

135139
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pollora\VersionCheck\Domain\Contracts;
6+
7+
use Pollora\VersionCheck\Infrastructure\Services\PackagistVersionChecker;
8+
9+
/**
10+
* Contract for checking Pollora framework version information.
11+
*
12+
* Implementations are responsible for determining the currently installed
13+
* version and fetching the latest available version from a remote source.
14+
*
15+
* @see PackagistVersionChecker
16+
*/
17+
interface VersionCheckerInterface
18+
{
19+
/**
20+
* Get the latest stable version available from the remote source.
21+
*
22+
* @return string|null The latest version string (e.g. "13.3.0"), or null if unavailable
23+
*/
24+
public function getLatestVersion(): ?string;
25+
26+
/**
27+
* Get the currently installed version of the Pollora framework.
28+
*
29+
* @return string|null The current version string (e.g. "13.3.0"), or null if undetermined
30+
*/
31+
public function getCurrentVersion(): ?string;
32+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pollora\VersionCheck\Domain\Services;
6+
7+
use Pollora\VersionCheck\Domain\Contracts\VersionCheckerInterface;
8+
9+
/**
10+
* Compares the installed Pollora version against the latest available version.
11+
*
12+
* This domain service encapsulates the version comparison logic and acts as
13+
* the primary entry point for UI components (admin notice, Site Health) to
14+
* determine whether an update is available.
15+
*
16+
* @see VersionCheckerInterface
17+
*/
18+
class VersionComparator
19+
{
20+
public function __construct(
21+
private readonly VersionCheckerInterface $checker
22+
) {}
23+
24+
/**
25+
* Determine whether a newer version of Pollora is available.
26+
*
27+
* Returns false if either version cannot be determined, ensuring
28+
* no false-positive update notifications are shown.
29+
*/
30+
public function isUpdateAvailable(): bool
31+
{
32+
$current = $this->checker->getCurrentVersion();
33+
$latest = $this->checker->getLatestVersion();
34+
35+
if ($current === null || $latest === null) {
36+
return false;
37+
}
38+
39+
return version_compare($latest, $current, '>');
40+
}
41+
42+
/**
43+
* Get the currently installed version.
44+
*
45+
* Delegates to the underlying VersionCheckerInterface implementation.
46+
*
47+
* @return string|null The current version string, or null if undetermined
48+
*/
49+
public function getCurrentVersion(): ?string
50+
{
51+
return $this->checker->getCurrentVersion();
52+
}
53+
54+
/**
55+
* Get the latest available version.
56+
*
57+
* Delegates to the underlying VersionCheckerInterface implementation.
58+
*
59+
* @return string|null The latest version string, or null if unavailable
60+
*/
61+
public function getLatestVersion(): ?string
62+
{
63+
return $this->checker->getLatestVersion();
64+
}
65+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pollora\VersionCheck\Infrastructure\Providers;
6+
7+
use Illuminate\Support\ServiceProvider;
8+
use Pollora\Hook\Domain\Contracts\Action;
9+
use Pollora\Hook\Domain\Contracts\Filter;
10+
use Pollora\VersionCheck\Domain\Contracts\VersionCheckerInterface;
11+
use Pollora\VersionCheck\Domain\Services\VersionComparator;
12+
use Pollora\VersionCheck\Infrastructure\Services\PackagistVersionChecker;
13+
use Pollora\VersionCheck\UI\Http\AdminNotice;
14+
use Pollora\VersionCheck\UI\Http\SiteHealthCheck;
15+
16+
/**
17+
* Service provider for the Pollora version check module.
18+
*
19+
* Registers version checking services in the container and hooks the
20+
* admin notice and Site Health integration into WordPress when running
21+
* in the admin context.
22+
*
23+
* Hooks registered:
24+
* - `admin_notices`: Displays a dismissable update banner
25+
* - `wp_ajax_pollora_dismiss_update_notice`: Handles notice dismissal via AJAX
26+
* - `debug_information`: Adds Pollora version info to Site Health debug data
27+
* - `site_status_tests`: Adds a version status test to Site Health
28+
*/
29+
class VersionCheckServiceProvider extends ServiceProvider
30+
{
31+
/**
32+
* Register version check services in the container.
33+
*
34+
* Binds the VersionCheckerInterface to the Packagist implementation
35+
* and registers the VersionComparator as a singleton.
36+
*/
37+
public function register(): void
38+
{
39+
$this->app->singleton(VersionCheckerInterface::class, PackagistVersionChecker::class);
40+
$this->app->singleton(VersionComparator::class);
41+
}
42+
43+
/**
44+
* Boot version check hooks into WordPress admin.
45+
*
46+
* Only registers hooks when running in the WordPress admin context
47+
* to avoid unnecessary overhead on frontend requests.
48+
*
49+
* @param Action $action WordPress action hook service
50+
* @param Filter $filter WordPress filter hook service
51+
*/
52+
public function boot(Action $action, Filter $filter): void
53+
{
54+
if (! function_exists('is_admin') || ! is_admin()) {
55+
return;
56+
}
57+
58+
$action->add('admin_notices', [$this->app->make(AdminNotice::class), 'render']);
59+
$action->add('wp_ajax_pollora_dismiss_update_notice', [$this->app->make(AdminNotice::class), 'dismiss']);
60+
61+
$filter->add('debug_information', [$this->app->make(SiteHealthCheck::class), 'addDebugInfo']);
62+
$filter->add('site_status_tests', [$this->app->make(SiteHealthCheck::class), 'addTests']);
63+
}
64+
}

0 commit comments

Comments
 (0)