Skip to content

Commit 882eacf

Browse files
authored
Review comments (#2)
* #1 Replace anonymous function * Add description and fix phpcs
1 parent d376275 commit 882eacf

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ Use local settings:
2626
- Account Key: `Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==`
2727
- Blob Service Endpoint: `http://127.0.0.1:10000/devstoreaccount1`
2828

29+
## Vendor Scoping
30+
31+
We use php-scoper to add prefixes to all vendor files, to avoid risks of fatal errors if you activate two plugins that use the same packages.
32+
33+
You need to run the command: `composer scoper` to upgrade the vendor-prefixed folder when the vendor folder is updated.
34+
2935
## Credits
3036

3137
Developed by [Dekode](https://en.dekode.no/?noredirect=en_US) for [DSS](https://www.dss.dep.no/about-us/).

gravityforms-uploads-azure.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
require_once __DIR__ . '/vendor-prefixed/autoload.php';
2323
}
2424

25-
add_action( 'gform_loaded', function() {
25+
/**
26+
* Bootstrap plugin, load it using gform_loaded hook.
27+
*
28+
* @return void
29+
*/
30+
function gform_loaded() {
2631
// Check that te GravityForms File Upload plugin is loaded before we try extending it.
2732
if ( ! method_exists( 'GFForms', 'include_feed_addon_framework' ) ) {
2833
return;
@@ -38,4 +43,6 @@
3843
add_filter( 'gform_secure_file_download_is_https', '__return_false', 200 );
3944

4045
\GFAddOn::register( __NAMESPACE__ . '\\AddOn' );
41-
}, 10 );
46+
}
47+
48+
add_action( 'gform_loaded', __NAMESPACE__ . '\\gform_loaded', 10 );

phpcs.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<arg name="extensions" value="php" />
55
<config name="testVersion" value="7.2-" />
66

7+
<exclude-pattern>vendor-prefixed</exclude-pattern>
8+
<exclude-pattern>php-scoper</exclude-pattern>
9+
710
<rule ref="Dekode">
811
<exclude name="Generic.Arrays.DisallowShortArraySyntax" />
912
<exclude name="WordPress.PHP.DisallowShortTernary.Found" />

0 commit comments

Comments
 (0)