-
Notifications
You must be signed in to change notification settings - Fork 0
/
video-seo-api.php
74 lines (65 loc) · 1.56 KB
/
video-seo-api.php
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* Yoast SEO Video plugin file.
*
* @package Yoast\VideoSEO
*/
/**
* Initializes the Video SEO module on plugins loaded.
*
* This way WordPress SEO should have set its constants and loaded its main classes.
*
* @since 0.2
*
* @return void
*/
function yoast_wpseo_video_seo_init() {
$bootstrap = new WPSEO_Video_Bootstrap();
$bootstrap->add_hooks();
}
/**
* Executes option cleanup actions on activate.
*
* There are a couple of things being done on activation:
* - Cleans up the options to be sure it's set well.
* - Activates the license, because updating the plugin results in deactivating the license.
* - Clears the sitemap cache to rebuild the sitemap.
*
* @return void
*/
function yoast_wpseo_video_activate() {
WPSEO_Video_Utils::load_textdomain();
$bootstrap = new WPSEO_Video_Bootstrap();
if ( ! $bootstrap->is_yoast_seo_active() ) {
return;
}
$option_instance = WPSEO_Option_Video::get_instance();
$option_instance->clean();
// Enable tracking.
WPSEO_Options::set( 'tracking', true );
yoast_wpseo_video_clear_sitemap_cache();
}
/**
* Empties sitemap cache on plugin deactivate.
*
* @since 3.8.0
*
* @return void
*/
function yoast_wpseo_video_deactivate() {
yoast_wpseo_video_clear_sitemap_cache();
}
/**
* Clears the sitemap index.
*
* @since 3.8.0
*
* @return void
*/
function yoast_wpseo_video_clear_sitemap_cache() {
$bootstrap = new WPSEO_Video_Bootstrap();
if ( ! $bootstrap->is_yoast_seo_active() ) {
return;
}
WPSEO_Video_Wrappers::invalidate_sitemap( WPSEO_Video_Sitemap::get_video_sitemap_basename() );
}