PluginProbe
The Innovative Form Builder – IvyForms / 0.8
The Innovative Form Builder – IvyForms v0.8
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / InstallActions / ActivationNewSiteMultisite.php

ActivationNewSiteMultisite.php in The Innovative Form Builder – IvyForms 0.8, at backend/src/Services/InstallActions/ActivationNewSiteMultisite.php

48 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Multisite hook on new site activation
5 */
6
7 namespace IvyForms\Services\InstallActions;
8
9 // phpcs:disable PSR1.Files.SideEffects
10 use IvyForms\Common\Exceptions\InvalidArgumentException;
11
12 if (!defined('ABSPATH')) {
13 exit; // Exit if accessed directly
14 }
15
16 /**
17 * Class ActivationNewSiteMultisite
18 *
19 * @package IvyForms\Services\InstallActions
20 */
21 class ActivationNewSiteMultisite
22 {
23 /**
24 * Activate the plugin for every newly created site if the plugin is network activated
25 *
26 * @param int $siteId
27 * @throws InvalidArgumentException
28 */
29 public static function init(int $siteId): void
30 {
31 if (! function_exists('is_plugin_active_for_network')) {
32 if (file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) {
33 require_once ABSPATH . 'wp-admin/includes/plugin.php';
34 }
35 }
36
37 if (
38 defined('IVYFORMS_PLUGIN_SLUG') &&
39 is_plugin_active_for_network(IVYFORMS_PLUGIN_SLUG) // @phpstan-ignore argument.type
40 ) {
41 switch_to_blog($siteId);
42 //Create database table if not exists
43 ActivationDatabaseHook::init();
44 restore_current_blog();
45 }
46 }
47 }
48