PluginProbe
The Innovative Form Builder – IvyForms / 0.6
The Innovative Form Builder – IvyForms v0.6
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.6, at backend/src/Services/InstallActions/ActivationNewSiteMultisite.php

45 lines 1.1 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 if (!defined('ABSPATH')) {
11 exit; // Exit if accessed directly
12 }
13
14 /**
15 * Class ActivationNewSiteMultisite
16 *
17 * @package IvyForms\Services\InstallActions
18 */
19 class ActivationNewSiteMultisite
20 {
21 /**
22 * Activate the plugin for every newly created site if the plugin is network activated
23 *
24 * @param int $siteId
25 */
26 public static function init(int $siteId): void
27 {
28 if (! function_exists('is_plugin_active_for_network')) {
29 if (file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) {
30 require_once ABSPATH . 'wp-admin/includes/plugin.php';
31 }
32 }
33
34 if (
35 defined('IVYFORMS_PLUGIN_SLUG') &&
36 is_plugin_active_for_network(IVYFORMS_PLUGIN_SLUG) // @phpstan-ignore argument.type
37 ) {
38 switch_to_blog($siteId);
39 //Create database table if not exists
40 ActivationDatabaseHook::init();
41 restore_current_blog();
42 }
43 }
44 }
45