Skip to content

Commit 01c63cf

Browse files
authored
Merge pull request #110 from Bit-Apps-Pro/chore/bump-version
bump plugin version
2 parents 6293b51 + 8d9a8a4 commit 01c63cf

File tree

4 files changed

+93
-33
lines changed

4 files changed

+93
-33
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
'multiline_whitespace_before_semicolons' => false,
8181
'no_whitespace_before_comma_in_array' => true,
8282
'native_function_casing' => true,
83-
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
83+
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => false],
8484
'new_with_braces' => true,
8585
'no_alias_language_construct_call' => true,
8686
'no_alternative_syntax' => true,

bin/bump-version.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
if ($argc < 2) {
4+
echo "Usage: composer bump-version [new-version]\n";
5+
exit(1);
6+
}
7+
8+
$newVersion = $argv[1];
9+
$pluginFile = 'bitwpfi.php';
10+
$configFile = 'includes/Config.php';
11+
$readmeFile = 'readme.txt';
12+
13+
if (!file_exists($pluginFile) || !file_exists($readmeFile) || !file_exists($configFile)) {
14+
echo "Required files not found.\n";
15+
exit(1);
16+
}
17+
18+
$pluginContent = file_get_contents($pluginFile);
19+
$configContent = file_get_contents($configFile);
20+
$readmeContent = file_get_contents($readmeFile);
21+
22+
$pluginContent = preg_replace_callback(
23+
'/^(\s*\*\s*Version:\s*)([\d\.]+)/m',
24+
function ($matches) use ($newVersion) {
25+
return $matches[1] . $newVersion;
26+
},
27+
$pluginContent
28+
);
29+
30+
$pluginContent = preg_replace_callback(
31+
"/(define\s*\(\s*'BTCBI_VERSION'\s*,\s*')[\d\.]+('\s*\);)/",
32+
function ($matches) use ($newVersion) {
33+
return $matches[1] . $newVersion . $matches[2];
34+
},
35+
$pluginContent
36+
);
37+
38+
$configContent = preg_replace_callback(
39+
"/(public\s+const\s+VERSION\s*=\s*')([\d\.]+)(';)/",
40+
function ($matches) use ($newVersion) {
41+
return $matches[1] . $newVersion . $matches[3];
42+
},
43+
$configContent
44+
);
45+
46+
$readmeContent = preg_replace_callback(
47+
'/^(Stable tag:\s*)([\d\.]+)/m',
48+
function ($matches) use ($newVersion) {
49+
return $matches[1] . $newVersion;
50+
},
51+
$readmeContent
52+
);
53+
54+
file_put_contents($pluginFile, $pluginContent);
55+
file_put_contents($configFile, $configContent);
56+
file_put_contents($readmeFile, $readmeContent);
57+
58+
echo "Updated Version v{$newVersion}\n";

composer.json

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
{
2-
"name": "bitapps/bit-integrations",
3-
"description": "An Integration plugin for wordpress",
4-
"license": "GPL-2.0-or-later",
5-
"autoload": {
6-
"psr-4": {
7-
"BitCode\\FI\\": "includes/"
8-
}
9-
},
10-
"require-dev": {
11-
"phpcompatibility/phpcompatibility-wp": "*",
12-
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
13-
"friendsofphp/php-cs-fixer": "^3.54"
14-
},
15-
"scripts": {
16-
"version-checker": "phpcs -p --standard=PHPCompatibilityWP --runtime-set testVersion 5.6- includes"
17-
},
18-
"config": {
19-
"allow-plugins": {
20-
"dealerdirect/phpcodesniffer-composer-installer": true,
21-
"typisttech/imposter-plugin": true
22-
}
23-
},
24-
"require": {
25-
"bitapps/wp-telemetry": "v0.0.9",
26-
"typisttech/imposter-plugin": "*"
27-
},
2+
"name": "bitapps/bit-integrations",
3+
"description": "An Integration plugin for wordpress",
4+
"license": "GPL-2.0-or-later",
5+
"autoload": {
6+
"psr-4": {
7+
"BitCode\\FI\\": "includes/"
8+
}
9+
},
10+
"require-dev": {
11+
"phpcompatibility/phpcompatibility-wp": "*",
12+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
13+
"friendsofphp/php-cs-fixer": "^3.54"
14+
},
15+
"scripts": {
16+
"version-checker": "phpcs -p --standard=PHPCompatibilityWP --runtime-set testVersion 7.4- includes",
17+
"bump-version": "php ./bin/bump-version.php"
18+
},
19+
"config": {
20+
"allow-plugins": {
21+
"dealerdirect/phpcodesniffer-composer-installer": true,
22+
"typisttech/imposter-plugin": true
23+
}
24+
},
25+
"require": {
26+
"bitapps/wp-telemetry": "v0.0.9",
27+
"typisttech/imposter-plugin": "*"
28+
},
2829
"extra": {
29-
"imposter": {
30-
"namespace": "BTCBI\\Deps\\"
31-
}
30+
"imposter": {
31+
"namespace": "BTCBI\\Deps\\"
3232
}
33+
}
3334
}

includes/Actions/WooCommerce/WooCommerceMetaFields.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ public static function metaBoxFields($module)
2626
$metaBoxFields = [];
2727
$metaBoxUploadFields = [];
2828

29-
if (\function_exists('rwmb_meta')) {
29+
if (\function_exists('rwmb_get_registry') && \function_exists('rwmb_get_object_fields')) {
3030
if ($module === 'customer') {
31-
$field_registry = rwmb_get_registry('field');
31+
$field_registry = \rwmb_get_registry('field');
3232
$meta_boxes = $field_registry->get_by_object_type($object_type = 'user');
3333
$metaFields = isset($meta_boxes['user']) && \is_array($meta_boxes['user']) ? array_values($meta_boxes['user']) : [];
3434
} else {
35-
$metaFields = array_values(rwmb_get_object_fields($module));
35+
$metaFields = array_values(\rwmb_get_object_fields($module));
3636
}
37+
3738
foreach ($metaFields as $index => $field) {
3839
if (!\in_array($field['type'], $fileTypes)) {
3940
$metaBoxFields[$index] = (object) [

0 commit comments

Comments
 (0)