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

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