-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* @package Optimus | ||
* @link https://custom.simplemachines.org/mods/index.php?mod=2659 | ||
* @author Bugo https://dragomano.ru/mods/optimus | ||
* @copyright 2010-2024 Bugo | ||
* @license https://opensource.org/licenses/artistic-license-2.0 Artistic-2.0 | ||
* | ||
* @version 3.0 RC1 | ||
*/ | ||
|
||
namespace Bugo\Optimus\Handlers; | ||
|
||
use Bugo\Compat\IntegrationHook; | ||
use Bugo\Compat\Lang; | ||
use Bugo\Compat\Utils; | ||
use Bugo\Optimus\Utils\Copyright; | ||
|
||
if (! defined('SMF')) | ||
die('No direct access...'); | ||
|
||
final class CoreHandler | ||
{ | ||
public function __invoke(): void | ||
{ | ||
IntegrationHook::add( | ||
'integrate_load_theme', self::class . '::loadTheme#', false, __FILE__ | ||
); | ||
|
||
IntegrationHook::add( | ||
'integrate_credits', self::class . '::credits#', false, __FILE__ | ||
); | ||
} | ||
|
||
public function loadTheme(): void | ||
{ | ||
Lang::load('Optimus/Optimus'); | ||
} | ||
|
||
public function credits(): void | ||
{ | ||
Utils::$context['credits_modifications'][] = Copyright::getLink(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Bugo\Compat\Lang; | ||
use Bugo\Compat\Utils; | ||
use Bugo\Optimus\Handlers\CoreHandler; | ||
|
||
beforeEach(function () { | ||
$this->handler = new CoreHandler(); | ||
}); | ||
|
||
it('loads languages', function () { | ||
$this->handler->loadTheme(); | ||
|
||
expect(Lang::$txt['optimus_title']) | ||
->toEqual('Search Engine Optimization'); | ||
}); | ||
|
||
it('adds copyright', function () { | ||
$this->handler->credits(); | ||
|
||
expect(Utils::$context['credits_modifications']) | ||
->not->toBeEmpty(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,11 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Bugo\Compat\Lang; | ||
use Bugo\Compat\Utils; | ||
use Bugo\Optimus\Prime; | ||
|
||
beforeEach(function () { | ||
$this->prime = new Prime(); | ||
$this->prime = new Prime(); | ||
}); | ||
|
||
it('runs __invoke', function () { | ||
expect((new Prime())())->toBeNull(); | ||
}); | ||
|
||
it('loads languages', function () { | ||
$this->prime->loadTheme(); | ||
|
||
expect(Lang::$txt['optimus_title']) | ||
->toEqual('Search Engine Optimization'); | ||
}); | ||
|
||
it('adds copyright', function () { | ||
$this->prime->credits(); | ||
|
||
expect(Utils::$context['credits_modifications']) | ||
->not->toBeEmpty(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters