File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # Generate ACF stubs of functions only.
4
+ #
5
+
6
+ PLUGIN_VERSION=" 5.8.0"
7
+
8
+ Fix_phpdoc ()
9
+ {
10
+ # - Fix type and variable name order for @param
11
+ # - Remove remaining parentheses for @param
12
+ # - Fix type and variable name order for @return
13
+ # - Remove remaining parentheses for @return
14
+ # - Fix "void"
15
+ find ./includes/ -type f -name " *.php" -exec sed \
16
+ -e ' s#^\(\s*\*\s*@param\s\+\)\(\$\S\+\)\s\+(\(\S\+\))\(.*\)$#\1\3 \2\4#' \
17
+ -e ' s#^\(\s*\*\s*@param\s\+\)(\(\S\+\))\(.*\)$#\1\2\3#' \
18
+ -e ' s#^\(\s*\*\s*@return\s\+\)\(\$\S\+\)\s\+(\(\S\+\))\(.*\)$#\1\3 \2\4#' \
19
+ -e ' s#^\(\s*\*\s*@return\s\+\)(\(\S\+\))\(.*\)$#\1\2\3#' \
20
+ -e ' s#n/a#void#i' \
21
+ -i " {}" " ;"
22
+ }
23
+
24
+ # Check plugin
25
+ if ! grep -q ' Plugin Name:\s\+Advanced Custom Fields' ./acf.php 2> /dev/null; then
26
+ echo " Please extract ACF into the current directory!" 1>&2
27
+ echo " wget https://downloads.wordpress.org/plugin/advanced-custom-fields.${PLUGIN_VERSION} .zip && unzip advanced-custom-fields.${PLUGIN_VERSION} .zip" 1>&2
28
+ exit 10
29
+ fi
30
+
31
+ Fix_phpdoc
32
+
33
+ # Generate stubs
34
+ if [ ! -x vendor/bin/generate-stubs ]; then
35
+ composer require --no-interaction --update-no-dev --prefer-dist giacocorsiglia/stubs-generator
36
+ fi
37
+ # Functions only
38
+ vendor/bin/generate-stubs --functions --out=acf-stubs-${PLUGIN_VERSION} .php ./includes/
Original file line number Diff line number Diff line change @@ -34,4 +34,5 @@ Fix_phpdoc
34
34
if [ ! -x vendor/bin/generate-stubs ]; then
35
35
composer require --no-interaction --update-no-dev --prefer-dist giacocorsiglia/stubs-generator
36
36
fi
37
+ # Functions only
37
38
vendor/bin/generate-stubs --functions --out=acf-pro-stubs-${PLUGIN_VERSION} .php ./includes/ ./pro/
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ PLUGIN_VERSION="2.5.3"
7
7
8
8
# Check plugin
9
9
if ! grep -q ' Plugin Name:\s\+Polylang' ./polylang.php 2> /dev/null; then
10
- echo " Please extract WooCommerce into the current directory!" 1>&2
10
+ echo " Please extract Polylang into the current directory!" 1>&2
11
11
echo " git clone https://github.com/polylang/polylang.git" 1>&2
12
12
exit 10
13
13
fi
You can’t perform that action at this time.
0 commit comments