Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
  • v0.10
  • 0.10.0
  • 0.10.1
  • 0.10.2
  • 0.10.3
  • 0.10.4
  • 0.10.5
  • 0.10.6
  • 0.9.0
  • 0.9.1
11 results

Target

Select target project
  • wpdesk/wp-init
1 result
Select Git revision
  • main
  • v0.10
  • 0.10.0
  • 0.10.1
  • 0.10.2
  • 0.10.3
  • 0.10.4
  • 0.10.5
  • 0.10.6
  • 0.9.0
  • 0.9.1
11 results
Show changes
Commits on Source (3)
# wp-init changelog # wp-init changelog
## [0.10.3] - 2024-11-13
### Changed
- Move i18n filter to `init` hook for WordPress 6.7 compatibility.
## [0.10.2] - 2024-10-08 ## [0.10.2] - 2024-10-08
### Fixed ### Fixed
- Typo in configuration parameter name. - Typo in configuration parameter name.
......
...@@ -23,6 +23,11 @@ class ArrayDefinitions implements BindingDefinitions { ...@@ -23,6 +23,11 @@ class ArrayDefinitions implements BindingDefinitions {
yield from $this->normalize( $this->bindings ); yield from $this->normalize( $this->bindings );
} }
/**
* @param iterable<string,array> $bindings
*
* @return iterable<Definition>
*/
private function normalize( iterable $bindings ): iterable { private function normalize( iterable $bindings ): iterable {
foreach ( $bindings as $key => $value ) { foreach ( $bindings as $key => $value ) {
if ( is_array( $value ) ) { if ( is_array( $value ) ) {
......
...@@ -14,11 +14,7 @@ class I18n implements Hookable { ...@@ -14,11 +14,7 @@ class I18n implements Hookable {
} }
public function hooks(): void { public function hooks(): void {
if ( did_action( 'plugins_loaded' ) ) { add_action( 'init', $this );
$this->__invoke();
} else {
add_action( 'plugins_loaded', $this );
}
} }
public function __invoke(): void { public function __invoke(): void {
......
...@@ -22,7 +22,9 @@ final class Init { ...@@ -22,7 +22,9 @@ final class Init {
private $config; private $config;
/** /**
* @param string|array|Configuration $config * @param string|array<string,mixed>|Configuration $config
*
* @return self
*/ */
public static function setup( $config ) { public static function setup( $config ) {
$result = require __DIR__ . '/platform_check.php'; $result = require __DIR__ . '/platform_check.php';
...@@ -35,7 +37,7 @@ final class Init { ...@@ -35,7 +37,7 @@ final class Init {
} }
/** /**
* @param string|array|Configuration $config * @param string|array<string, mixed>|Configuration $config
*/ */
public function __construct( $config ) { public function __construct( $config ) {
if ( $config instanceof Configuration ) { if ( $config instanceof Configuration ) {
...@@ -52,8 +54,10 @@ final class Init { ...@@ -52,8 +54,10 @@ final class Init {
/** /**
* @param string|null $filename Filename of the booted plugin. May be null, if called from plugin's main file. * @param string|null $filename Filename of the booted plugin. May be null, if called from plugin's main file.
*
* @return void
*/ */
public function boot( ?string $filename = null ) { public function boot( $filename = null ) {
if ( self::$bootable === false ) { if ( self::$bootable === false ) {
return; return;
} }
......