PluginProbe
Auto Alt Text / trunk
Auto Alt Text vtrunk
3.0.3 2.8.2 1.3.1 1.3.2 2.0.0 2.1.0 2.1.1 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.7.0 2.8.0 2.8.1 All 28 releases
auto-alt-text / src / App / Setup.php

Setup.php in Auto Alt Text trunk, at src/App/Setup.php

50 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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