PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 5.0.4
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v5.0.4
6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 3.6.66 All 195 releases
fluentform / app / ComposerScript.php

ComposerScript.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 5.0.4, at app/ComposerScript.php

49 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App;
4
5 use Composer\Script\Event;
6 use InvalidArgumentException;
7 use RecursiveIteratorIterator;
8 use RecursiveDirectoryIterator;
9
10 class ComposerScript
11 {
12 public static function postInstall(Event $event)
13 {
14 static::postUpdate($event);
15 }
16
17 public static function postUpdate(Event $event)
18 {
19 $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
20 $composerJson = json_decode(file_get_contents($vendorDir . '/../composer.json'), true);
21 $namespace = $composerJson['extra']['wpfluent']['namespace']['current'];
22
23 if (!$namespace) {
24 throw new InvalidArgumentException("Namespace not set in composer.json file.");
25 }
26
27 $itr = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(
28 $vendorDir.'/wpfluent/framework/src/', RecursiveDirectoryIterator::SKIP_DOTS
29 ), RecursiveIteratorIterator::SELF_FIRST);
30
31 foreach ($itr as $file) {
32 if ($file->isDir()) {
33 continue;
34 }
35
36 $fileName = $file->getPathname();
37
38 $content = file_get_contents($fileName);
39 $content = str_replace(
40 'WPFluent\\',
41 $namespace . '\\Framework\\',
42 $content
43 );
44
45 file_put_contents($fileName, $content);
46 }
47 }
48 }
49