PluginProbe
Polylang / 3.8.6
Polylang v3.8.6
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / src / install / abstract-activate.php

abstract-activate.php in Polylang 3.8.6, at src/install/abstract-activate.php

44 lines 1015 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 *
5 * /!\ THE CONSTANTS `POLYLANG_BASENAME` AND `POLYLANG_VERSION` MUST BE DEFINED.
6 */
7
8 /**
9 * A generic activation class compatible with multisite.
10 *
11 * @since 3.8
12 */
13 abstract class PLL_Abstract_Activate extends PLL_Abstract_Activable {
14 /**
15 * Adds the required hooks.
16 *
17 * @since 3.8
18 *
19 * @return void
20 */
21 public static function add_hooks(): void {
22 // Plugin activation.
23 register_activation_hook( static::get_plugin_basename(), array( static::class, 'do_for_all_blogs' ) );
24
25 // Site creation on multisite.
26 add_action( 'wp_initialize_site', array( static::class, 'new_site' ), 50 ); // After WP (prio 10).
27 }
28
29 /**
30 * Site creation on multisite (to set default options).
31 *
32 * @since 2.6.8
33 * @since 3.8 Moved from the class `PLL_Install_Base`.
34 *
35 * @param WP_Site $new_site New site object.
36 * @return void
37 */
38 public static function new_site( $new_site ): void {
39 switch_to_blog( $new_site->id );
40 static::process();
41 restore_current_blog();
42 }
43 }
44