| 1 |
<?php |
| 2 |
|
| 3 |
namespace AATXT\App; |
| 4 |
|
| 5 |
use AATXT\App\Core\Container; |
| 6 |
use AATXT\App\Core\PluginBootstrap; |
| 7 |
use AATXT\App\Services\AltTextService; |
| 8 |
|
| 9 |
/** |
| 10 |
* Legacy Setup class maintained for backward compatibility. |
| 11 |
* |
| 12 |
* @deprecated 2.6.0 Use PluginBootstrap::init() and dependency injection for new code. |
| 13 |
* All methods in this class are deprecated and will be removed in v3.0.0. |
| 14 |
* Use AltTextService via dependency injection instead of Setup::altText(). |
| 15 |
*/ |
| 16 |
class Setup |
| 17 |
{ |
| 18 |
/** |
| 19 |
* Register plugin functionalities. |
| 20 |
* |
| 21 |
* @deprecated 2.6.0 Use PluginBootstrap::init() instead. |
| 22 |
* @return void |
| 23 |
*/ |
| 24 |
public static function register(): void |
| 25 |
{ |
| 26 |
_deprecated_function(__METHOD__, '2.6.0', 'PluginBootstrap::init()'); |
| 27 |
PluginBootstrap::init(AATXT_FILE_ABSPATH); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Generate alt text for an attachment. |
| 32 |
* |
| 33 |
* This method is kept for backward compatibility with external code |
| 34 |
* that may call Setup::altText() directly. |
| 35 |
* |
| 36 |
* @deprecated 2.6.0 Use AltTextService::generateForAttachment() via dependency injection instead. |
| 37 |
* @param int $postId The attachment post ID |
| 38 |
* @return string Generated alt text, or empty string if generation fails |
| 39 |
*/ |
| 40 |
public static function altText(int $postId): string |
| 41 |
{ |
| 42 |
_deprecated_function(__METHOD__, '2.6.0', 'AltTextService::generateForAttachment()'); |
| 43 |
|
| 44 |
$container = Container::make(); |
| 45 |
$altTextService = $container->get(AltTextService::class); |
| 46 |
|
| 47 |
return $altTextService->generateForAttachment($postId); |
| 48 |
} |
| 49 |
} |
| 50 |
|