-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathscoper.inc.php
85 lines (78 loc) · 2.31 KB
/
scoper.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* PHP-Scoper configuration file.
*
* @package ai-services
*/
use Symfony\Component\Finder\Finder;
/*
* Specify the text domain for this plugin.
* It will be used in all translation strings from the underlying library, to make sure they are properly translatable
* as part of the plugin.
*/
$plugin_textdomain = 'ai-services';
/*
* You can optionally provide specific folder names from the WP OOP Plugin Lib "src" directory here to limit the
* library classes in your project to only those. If you only need a few classes from the library in your project, this
* helps keep the PHP footprint and the project's file size small.
*/
$wp_oop_plugin_lib_folders = array(
'Admin_Links',
'Admin_Pages',
'Admin_Pointers',
'Capabilities',
'Dependencies',
'Entities',
'General',
'HTTP',
'Installation',
'Meta',
'Options',
'REST_Routes',
'Validation',
);
$wp_oop_plugin_lib_folders_concat = implode( '|', $wp_oop_plugin_lib_folders );
$wp_oop_plugin_lib_folders_regex = $wp_oop_plugin_lib_folders_concat
? "/^($wp_oop_plugin_lib_folders_concat)\//"
: '/^[A-Za-z0-9_]\//';
$other_dependencies_regex = '/^(guzzlehttp|psr)\/[a-z0-9-]+\/src\//';
return array(
'prefix' => 'Felix_Arntz\AI_Services_Dependencies',
'finders' => array(
Finder::create()
->files()
->ignoreVCS( true )
->notName( '/LICENSE|.*\\.md|.*\\.json|.*\\.lock|.*\\.dist/' )
->exclude( array( 'docs', 'tests' ) )
->path( $wp_oop_plugin_lib_folders_regex )
->in( 'vendor/felixarntz/wp-oop-plugin-lib/src' ),
Finder::create()
->files()
->ignoreVCS( true )
->notName( '/LICENSE|.*\\.md|.*\\.json|.*\\.lock|.*\\.dist/' )
->exclude( array( 'docs', 'tests' ) )
->path( $other_dependencies_regex )
->in( 'vendor' ),
),
'patchers' => array(
// Patcher to replace the library text domain with the plugin text domain.
function ( $file_path, $prefix, $content ) use ( $plugin_textdomain ) {
if ( $plugin_textdomain ) {
return str_replace(
array(
"'wp-oop-plugin-lib' )",
"'wp-oop-plugin-lib')",
),
array(
"'" . $plugin_textdomain . "' )",
"'" . $plugin_textdomain . "')",
),
$content
);
}
return $content;
},
),
'exclude-namespaces' => array( 'WpOrg' ),
'exclude-classes' => array( '/^(WP|Requests)_[A-Za-z0-9_]+$/' ),
);