Skip to content

Commit c9b9f6f

Browse files
author
Chris
committed
Merge branch 'master' into production
2 parents 5c95914 + e1548e3 commit c9b9f6f

182 files changed

Lines changed: 14646 additions & 26179 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.scrutinizer.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ build:
1111
filter:
1212
dependency_paths:
1313
- wordpress/
14+
- includes/eduadmin-api-client/
15+
- libraries/
1416
excluded_paths:
1517
- 'tests/*'
16-
- 'languages/*'
17-
- 'includes/loApiClient.php'
18+
- scripts/

.travis.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,42 @@ env:
1313
- WP_PROJECT_TYPE=plugin WP_VERSION=latest WP_MULTISITE=0 WP_TEST_URL=http://localhost:12000 WP_TEST_USER=test WP_TEST_USER_PASS=test
1414
matrix:
1515
fast_finish: true
16-
before_install:
17-
- phpenv config-rm xdebug.ini
1816
before_script:
19-
- git clone https://github.com/Seravo/wordpress-test-template wp-tests
20-
- bash wp-tests/bin/install-wp-tests.sh test root '' localhost $WP_VERSION
21-
17+
- export PATH="$HOME/.composer/vendor/bin:$PATH"
18+
- |
19+
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
20+
phpenv config-rm xdebug.ini
21+
else
22+
echo "xdebug.ini does not exist"
23+
fi
24+
- |
25+
if [[ ! -z "$WP_VERSION" ]] ; then
26+
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
27+
composer global require "phpunit/phpunit=4.8.*|5.7.*"
28+
fi
29+
- |
30+
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
31+
composer global require wp-coding-standards/wpcs
32+
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
33+
fi
2234
script:
23-
- cd wp-tests/spec && bundle exec rspec test.rb && cd .. && cd .. && phpunit
35+
- |
36+
if [[ ! -z "$WP_VERSION" ]] ; then
37+
phpunit
38+
WP_MULTISITE=1 phpunit
39+
fi
40+
- |
41+
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
42+
phpcs
43+
fi
2444
2545
deploy:
46+
- provider: script
47+
skip_cleanup: true
48+
script: chmod +x $TRAVIS_BUILD_DIR/scripts/trunk.sh && $TRAVIS_BUILD_DIR/scripts/trunk.sh
49+
on:
50+
branch: master
51+
php: 5.6
2652
- provider: script
2753
skip_cleanup: true
2854
script: chmod +x $TRAVIS_BUILD_DIR/scripts/deploy.sh && $TRAVIS_BUILD_DIR/scripts/deploy.sh

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
### 1.0.26
2+
- Some more styles to some buttons
3+
- Making it easier to edit some templates
4+
- If there are no dates provided to the date-function, render an empty string instead of 01 January, 1970
5+
- Adding support for `showmore` in `[eduadmin-detailinfo]` as attribute
6+
- Bugfix: Don't load already loaded classes
7+
8+
### 1.0.25
9+
- Bugfix: Missing styles
10+
11+
### 1.0.24
12+
- Bugfix: Booking button gets disabled, and aborts the form post.. For some reason
13+
14+
### [1.0.23]
15+
- Translations are wiped, so that 3rd-party plugins can translate the plugin better (and language packs for default phrases)
16+
- Adding first version of EduAdmin PHP API Client
17+
- Redoing how template blocks are rendered (now using a single template, instead of 3 separate to update)
18+
- Removed lots of the changelog to a separate file found at https://github.com/MultinetInteractive/EduAdmin-WordPress/blob/master/CHANGELOG.md
19+
20+
### [1.0.22]
21+
- Disabling the book-button when the form is valid and the booking is under way
22+
- Fixes some styles to use `px` instead of `rem`
23+
- Adding `data-price` to the fields that were missing, that (for some reason) the price-calculation wanted
24+
125
### [1.0.21]
226
- Lots of design fixes and changes, to make the plugin more mobile friendly
327
- Login widget bug fixed
@@ -457,6 +481,8 @@
457481
#### Added
458482
- Added inquiry support in course
459483

484+
[1.0.23]: https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v1.0.22...v1.0.23
485+
[1.0.22]: https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v1.0.21...v1.0.22
460486
[1.0.21]: https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v1.0.20...v1.0.21
461487
[1.0.20]: https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v1.0.19...v1.0.20
462488
[1.0.19]: https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v1.0.18...v1.0.19

bin/install-wp-tests.sh

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
#!/usr/bin/env bash
2+
3+
if [ $# -lt 3 ]; then
4+
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
5+
exit 1
6+
fi
7+
8+
DB_NAME=$1
9+
DB_USER=$2
10+
DB_PASS=$3
11+
DB_HOST=${4-localhost}
12+
WP_VERSION=${5-latest}
13+
SKIP_DB_CREATE=${6-false}
14+
15+
TMPDIR=${TMPDIR-/tmp}
16+
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
17+
WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
18+
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}
19+
20+
download() {
21+
if [ `which curl` ]; then
22+
curl -s "$1" > "$2";
23+
elif [ `which wget` ]; then
24+
wget -nv -O "$2" "$1"
25+
fi
26+
}
27+
28+
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
29+
WP_TESTS_TAG="branches/$WP_VERSION"
30+
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
31+
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
32+
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
33+
WP_TESTS_TAG="tags/${WP_VERSION%??}"
34+
else
35+
WP_TESTS_TAG="tags/$WP_VERSION"
36+
fi
37+
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
38+
WP_TESTS_TAG="trunk"
39+
else
40+
# http serves a single offer, whereas https serves multiple. we only want one
41+
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
42+
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
43+
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
44+
if [[ -z "$LATEST_VERSION" ]]; then
45+
echo "Latest WordPress version could not be found"
46+
exit 1
47+
fi
48+
WP_TESTS_TAG="tags/$LATEST_VERSION"
49+
fi
50+
51+
set -ex
52+
53+
install_wp() {
54+
55+
if [ -d $WP_CORE_DIR ]; then
56+
return;
57+
fi
58+
59+
mkdir -p $WP_CORE_DIR
60+
61+
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
62+
mkdir -p $TMPDIR/wordpress-nightly
63+
download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip
64+
unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/
65+
mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
66+
else
67+
if [ $WP_VERSION == 'latest' ]; then
68+
local ARCHIVE_NAME='latest'
69+
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then
70+
# https serves multiple offers, whereas http serves single.
71+
download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json
72+
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
73+
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
74+
LATEST_VERSION=${WP_VERSION%??}
75+
else
76+
# otherwise, scan the releases and get the most up to date minor version of the major release
77+
local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'`
78+
LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1)
79+
fi
80+
if [[ -z "$LATEST_VERSION" ]]; then
81+
local ARCHIVE_NAME="wordpress-$WP_VERSION"
82+
else
83+
local ARCHIVE_NAME="wordpress-$LATEST_VERSION"
84+
fi
85+
else
86+
local ARCHIVE_NAME="wordpress-$WP_VERSION"
87+
fi
88+
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz
89+
tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR
90+
fi
91+
92+
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
93+
}
94+
95+
install_test_suite() {
96+
# portable in-place argument for both GNU sed and Mac OSX sed
97+
if [[ $(uname -s) == 'Darwin' ]]; then
98+
local ioption='-i .bak'
99+
else
100+
local ioption='-i'
101+
fi
102+
103+
# set up testing suite if it doesn't yet exist
104+
if [ ! -d $WP_TESTS_DIR ]; then
105+
# set up testing suite
106+
mkdir -p $WP_TESTS_DIR
107+
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
108+
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
109+
fi
110+
111+
if [ ! -f wp-tests-config.php ]; then
112+
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
113+
# remove all forward slashes in the end
114+
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
115+
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
116+
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
117+
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
118+
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
119+
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
120+
fi
121+
122+
}
123+
124+
install_db() {
125+
126+
if [ ${SKIP_DB_CREATE} = "true" ]; then
127+
return 0
128+
fi
129+
130+
# parse DB_HOST for port or socket references
131+
local PARTS=(${DB_HOST//\:/ })
132+
local DB_HOSTNAME=${PARTS[0]};
133+
local DB_SOCK_OR_PORT=${PARTS[1]};
134+
local EXTRA=""
135+
136+
if ! [ -z $DB_HOSTNAME ] ; then
137+
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
138+
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
139+
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
140+
EXTRA=" --socket=$DB_SOCK_OR_PORT"
141+
elif ! [ -z $DB_HOSTNAME ] ; then
142+
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
143+
fi
144+
fi
145+
146+
# create database
147+
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
148+
}
149+
150+
install_wp
151+
install_test_suite
152+
install_db
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
// phpcs:disable WordPress.NamingConventions
3+
class EduAdmin_APIController {
4+
public $namespace;
5+
6+
public function __construct() {
7+
$this->namespace = 'edu/v1';
8+
}
9+
10+
public function register_routes() {
11+
register_rest_route( $this->namespace, '/courselist', array(
12+
'methods' => 'POST',
13+
'callback' => 'edu_listview_courselist',
14+
'args' => array(
15+
'city' => array(),
16+
'category' => array(),
17+
'subject' => array(),
18+
'subjectid' => array(),
19+
'courselevel' => array(),
20+
'search' => array(),
21+
'template' => array(),
22+
'eid' => array(),
23+
'eventinquiry' => array(),
24+
'orderby' => array(),
25+
'order' => array(),
26+
),
27+
) );
28+
29+
register_rest_route( $this->namespace, '/courselist/events', array(
30+
'methods' => 'POST',
31+
'callback' => 'edu_api_listview_eventlist',
32+
'args' => array(
33+
'city' => array(),
34+
'category' => array(),
35+
'subject' => array(),
36+
'subjectid' => array(),
37+
'courselevel' => array(),
38+
'search' => array(),
39+
'template' => array(),
40+
'numberofevents' => array(),
41+
'eid' => array(),
42+
'eventinquiry' => array(),
43+
'orderby' => array(),
44+
'order' => array(),
45+
),
46+
) );
47+
48+
register_rest_route( $this->namespace, '/eventlist', array(
49+
'methods' => 'POST',
50+
'callback' => 'edu_api_eventlist',
51+
'args' => array(
52+
'objectid' => array( 'required' => true ),
53+
'city' => array(),
54+
'groupbycity' => array(),
55+
'baseUrl' => array(),
56+
'courseFolder' => array(),
57+
'showmore' => array(),
58+
'spotsleft' => array(),
59+
'fewspots' => array(),
60+
'spotsettings' => array(),
61+
'eid' => array(),
62+
'numberofevents' => array(),
63+
'fetchmonths' => array(),
64+
'showvenue' => array(),
65+
'eventinquiry' => array(),
66+
),
67+
) );
68+
69+
register_rest_route( $this->namespace, '/loginwidget', array(
70+
'methods' => 'POST',
71+
'callback' => 'edu_api_loginwidget',
72+
'args' => array(
73+
'logintext' => array(),
74+
'logouttext' => array(),
75+
'guesttext' => array(),
76+
),
77+
) );
78+
79+
register_rest_route( $this->namespace, '/coupon/check', array(
80+
'methods' => 'POST',
81+
'callback' => 'edu_api_check_coupon_code',
82+
'args' => array(
83+
'code' => array( 'required' => true ),
84+
'eventId' => array( 'required' => true ),
85+
),
86+
) );
87+
}
88+
}

0 commit comments

Comments
 (0)