-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathplugin.php
More file actions
54 lines (43 loc) · 1.17 KB
/
plugin.php
File metadata and controls
54 lines (43 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Plugin Name: AI Provider for Google
* Plugin URI: https://github.com/WordPress/ai-provider-for-google
* Description: AI Provider for Google for the WordPress AI Client.
* Requires at least: 6.9
* Requires PHP: 7.4
* Version: 1.0.3
* Author: WordPress AI Team
* Author URI: https://make.wordpress.org/ai/
* License: GPL-2.0-or-later
* License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
* Text Domain: ai-provider-for-google
*
* @package WordPress\GoogleAiProvider
*/
declare(strict_types=1);
namespace WordPress\GoogleAiProvider;
use WordPress\AiClient\AiClient;
use WordPress\GoogleAiProvider\Provider\GoogleProvider;
if (!defined('ABSPATH')) {
return;
}
require_once __DIR__ . '/src/autoload.php';
/**
* Registers the AI Provider for Google with the AI Client.
*
* @since 1.0.0
*
* @return void
*/
function register_provider(): void
{
if (!class_exists(AiClient::class)) {
return;
}
$registry = AiClient::defaultRegistry();
if ($registry->hasProvider(GoogleProvider::class)) {
return;
}
$registry->registerProvider(GoogleProvider::class);
}
add_action('init', __NAMESPACE__ . '\\register_provider', 5);