Skip to content

Commit 538abf1

Browse files
authored
Merge pull request #534 from MultinetInteractive/master
v5.3.0
2 parents d03b206 + 960e765 commit 538abf1

29 files changed

Lines changed: 2665 additions & 2423 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [5.3.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v5.2.0...v5.3.0) (2024-11-05)
6+
7+
8+
### Features
9+
10+
* Handle API being down/blocked, instead of making the site hang until the configured timeout happens. ([a1a5104](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/a1a51042d4b7687830de5eaa9127ae2959a3f577)), closes [#153](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/153)
11+
512
## [5.2.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v5.1.3...v5.2.0) (2024-11-04)
613

714

PLUGIN-CHECKSUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f43f26b58da1439fef621c2813477a7d
1+
5cd3f4c5d7825087108a651e5f73d89f

content/template/bookingTemplate/template_A.php

Lines changed: 281 additions & 277 deletions
Large diffs are not rendered by default.

content/template/data/ld-json.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22
global $wp_query;
33

4+
if ( ! EDU()->api_connection ) {
5+
return;
6+
}
7+
48
if ( ! empty( $wp_query->query_vars['courseId'] ) ) {
59
$course_id = $wp_query->query_vars['courseId'];
610
} elseif ( ! empty( $attributes['courseid'] ) ) {

content/template/data/ogp.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22
global $wp_query;
33

4+
if ( ! EDU()->api_connection ) {
5+
return;
6+
}
7+
48
if ( ! empty( $wp_query->query_vars['courseId'] ) ) {
59
$course_id = $wp_query->query_vars['courseId'];
610
} elseif ( ! empty( $attributes['courseid'] ) ) {

content/template/detailTemplate/template_A.php

Lines changed: 127 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -3,148 +3,152 @@
33
global $wp_query;
44
$api_key = EDU()->get_option( 'eduadmin-api-key' );
55

6-
if ( ! $api_key || empty( $api_key ) ) {
7-
echo 'Please complete the configuration: <a href="' . esc_url( admin_url() . 'admin.php?page=eduadmin-settings' ) . '">EduAdmin - Api Authentication</a>';
6+
if ( ! EDU()->api_connection ) {
7+
echo esc_html_x( 'EduAdmin Booking could not connect to the API', 'frontend', 'eduadmin-booking' );
88
} else {
9-
include 'course-info.php';
10-
if ( ! $selected_course ) {
11-
?>
12-
<script type="text/javascript">location.href = '<?php echo esc_url( $base_url ); ?>';</script>
13-
<?php
14-
exit( 200 );
15-
}
16-
?>
17-
<div class="eduadmin detail-view" data-courseid="<?php echo esc_attr( $selected_course['CourseTemplateId'] ); ?>"
18-
data-eventid="<?php echo( isset( $_REQUEST['eid'] ) ? esc_attr( sanitize_text_field( $_REQUEST['eid'] ) ) : '' ); ?>">
19-
<a href="javascript://" onclick="eduGlobalMethods.GoBack('../', event);"
20-
class="backLink"><?php echo esc_html_x( '« Go back', 'frontend', 'eduadmin-booking' ); ?></a>
21-
<div class="title">
22-
<?php if ( ! empty( $selected_course['ImageUrl'] ) ) : ?>
23-
<img src="<?php echo esc_url( $selected_course['ImageUrl'] ); ?>" class="courseImage" />
24-
<?php endif; ?>
25-
<h1 class="courseTitle"><?php echo esc_html( $name ); ?>
26-
<small
27-
class="courseLevel"><?php echo esc_html( false !== $course_level ? $course_level['Name'] : '' ); ?></small>
28-
</h1>
29-
</div>
30-
<hr />
31-
<div class="textblock">
9+
if ( ! $api_key || empty( $api_key ) ) {
10+
echo 'Please complete the configuration: <a href="' . esc_url( admin_url() . 'admin.php?page=eduadmin-settings' ) . '">EduAdmin - Api Authentication</a>';
11+
} else {
12+
include 'course-info.php';
13+
if ( ! $selected_course ) {
14+
?>
15+
<script type="text/javascript">location.href = '<?php echo esc_url( $base_url ); ?>';</script>
3216
<?php
33-
if ( ! in_array( 'description', $hide_sections, true ) && ! empty( $selected_course['CourseDescription'] ) ) {
34-
if ( $show_headers ) {
35-
?>
36-
<h3><?php echo esc_html_x( 'Course description', 'frontend', 'eduadmin-booking' ); ?></h3>
17+
exit( 200 );
18+
}
19+
?>
20+
<div class="eduadmin detail-view"
21+
data-courseid="<?php echo esc_attr( $selected_course['CourseTemplateId'] ); ?>"
22+
data-eventid="<?php echo( isset( $_REQUEST['eid'] ) ? esc_attr( sanitize_text_field( $_REQUEST['eid'] ) ) : '' ); ?>">
23+
<a href="javascript://" onclick="eduGlobalMethods.GoBack('../', event);"
24+
class="backLink"><?php echo esc_html_x( '« Go back', 'frontend', 'eduadmin-booking' ); ?></a>
25+
<div class="title">
26+
<?php if ( ! empty( $selected_course['ImageUrl'] ) ) : ?>
27+
<img src="<?php echo esc_url( $selected_course['ImageUrl'] ); ?>" class="courseImage" />
28+
<?php endif; ?>
29+
<h1 class="courseTitle"><?php echo esc_html( $name ); ?>
30+
<small
31+
class="courseLevel"><?php echo esc_html( false !== $course_level ? $course_level['Name'] : '' ); ?></small>
32+
</h1>
33+
</div>
34+
<hr />
35+
<div class="textblock">
36+
<?php
37+
if ( ! in_array( 'description', $hide_sections, true ) && ! empty( $selected_course['CourseDescription'] ) ) {
38+
if ( $show_headers ) {
39+
?>
40+
<h3><?php echo esc_html_x( 'Course description', 'frontend', 'eduadmin-booking' ); ?></h3>
41+
<?php } ?>
42+
<div>
43+
<?php
44+
echo wp_kses_post( $selected_course['CourseDescription'] );
45+
?>
46+
</div>
3747
<?php } ?>
38-
<div>
39-
<?php
40-
echo wp_kses_post( $selected_course['CourseDescription'] );
41-
?>
42-
</div>
43-
<?php } ?>
44-
<?php
45-
if ( ! in_array( 'goal', $hide_sections, true ) && ! empty( $selected_course['CourseGoal'] ) ) {
46-
if ( $show_headers ) {
47-
?>
48-
<h3><?php echo esc_html_x( 'Course goal', 'frontend', 'eduadmin-booking' ); ?></h3>
48+
<?php
49+
if ( ! in_array( 'goal', $hide_sections, true ) && ! empty( $selected_course['CourseGoal'] ) ) {
50+
if ( $show_headers ) {
51+
?>
52+
<h3><?php echo esc_html_x( 'Course goal', 'frontend', 'eduadmin-booking' ); ?></h3>
53+
<?php } ?>
54+
<div>
55+
<?php
56+
echo wp_kses_post( $selected_course['CourseGoal'] );
57+
?>
58+
</div>
4959
<?php } ?>
50-
<div>
51-
<?php
52-
echo wp_kses_post( $selected_course['CourseGoal'] );
53-
?>
54-
</div>
55-
<?php } ?>
56-
<?php
57-
if ( ! in_array( 'target', $hide_sections, true ) && ! empty( $selected_course['TargetGroup'] ) ) {
58-
if ( $show_headers ) {
59-
?>
60-
<h3><?php echo esc_html_x( 'Target group', 'frontend', 'eduadmin-booking' ); ?></h3>
60+
<?php
61+
if ( ! in_array( 'target', $hide_sections, true ) && ! empty( $selected_course['TargetGroup'] ) ) {
62+
if ( $show_headers ) {
63+
?>
64+
<h3><?php echo esc_html_x( 'Target group', 'frontend', 'eduadmin-booking' ); ?></h3>
65+
<?php } ?>
66+
<div>
67+
<?php
68+
echo wp_kses_post( $selected_course['TargetGroup'] );
69+
?>
70+
</div>
6171
<?php } ?>
62-
<div>
63-
<?php
64-
echo wp_kses_post( $selected_course['TargetGroup'] );
65-
?>
66-
</div>
67-
<?php } ?>
68-
<?php
69-
if ( ! in_array( 'prerequisites', $hide_sections, true ) && ! empty( $selected_course['Prerequisites'] ) ) {
70-
if ( $show_headers ) {
71-
?>
72-
<h3><?php echo esc_html_x( 'Prerequisites', 'frontend', 'eduadmin-booking' ); ?></h3>
72+
<?php
73+
if ( ! in_array( 'prerequisites', $hide_sections, true ) && ! empty( $selected_course['Prerequisites'] ) ) {
74+
if ( $show_headers ) {
75+
?>
76+
<h3><?php echo esc_html_x( 'Prerequisites', 'frontend', 'eduadmin-booking' ); ?></h3>
77+
<?php } ?>
78+
<div>
79+
<?php
80+
echo wp_kses_post( $selected_course['Prerequisites'] );
81+
?>
82+
</div>
7383
<?php } ?>
74-
<div>
75-
<?php
76-
echo wp_kses_post( $selected_course['Prerequisites'] );
77-
?>
78-
</div>
79-
<?php } ?>
80-
<?php
81-
if ( ! in_array( 'after', $hide_sections, true ) && ! empty( $selected_course['CourseAfter'] ) ) {
82-
if ( $show_headers ) {
83-
?>
84-
<h3><?php echo esc_html_x( 'After the course', 'frontend', 'eduadmin-booking' ); ?></h3>
84+
<?php
85+
if ( ! in_array( 'after', $hide_sections, true ) && ! empty( $selected_course['CourseAfter'] ) ) {
86+
if ( $show_headers ) {
87+
?>
88+
<h3><?php echo esc_html_x( 'After the course', 'frontend', 'eduadmin-booking' ); ?></h3>
89+
<?php } ?>
90+
<div>
91+
<?php
92+
echo wp_kses_post( $selected_course['CourseAfter'] );
93+
?>
94+
</div>
8595
<?php } ?>
86-
<div>
87-
<?php
88-
echo wp_kses_post( $selected_course['CourseAfter'] );
89-
?>
90-
</div>
91-
<?php } ?>
92-
<?php
93-
if ( ! in_array( 'quote', $hide_sections, true ) && ! empty( $selected_course['Quote'] ) ) {
94-
if ( $show_headers ) {
95-
?>
96-
<h3><?php echo esc_html_x( 'Quotes', 'frontend', 'eduadmin-booking' ); ?></h3>
96+
<?php
97+
if ( ! in_array( 'quote', $hide_sections, true ) && ! empty( $selected_course['Quote'] ) ) {
98+
if ( $show_headers ) {
99+
?>
100+
<h3><?php echo esc_html_x( 'Quotes', 'frontend', 'eduadmin-booking' ); ?></h3>
101+
<?php } ?>
102+
<div>
103+
<?php
104+
echo wp_kses_post( $selected_course['Quote'] );
105+
?>
106+
</div>
97107
<?php } ?>
98-
<div>
108+
</div>
109+
<div class="eventInformation">
110+
<?php
111+
if ( ! in_array( 'time', $hide_sections, true ) && ! empty( $selected_course['StartTime'] ) && ! empty( $selected_course['EndTime'] ) ) {
112+
?>
113+
<h3><?php echo esc_html_x( 'Time', 'frontend', 'eduadmin-booking' ); ?></h3>
99114
<?php
100-
echo wp_kses_post( $selected_course['Quote'] );
115+
/* translators: 1: Number of days */
116+
echo esc_html( ( $selected_course['Days'] > 0 ? sprintf( _n( '%1$d day', '%1$d days', $selected_course['Days'], 'eduadmin-booking' ), $selected_course['Days'] ) . ', ' : '' ) . $selected_course['StartTime'] . ' - ' . $selected_course['EndTime'] );
117+
}
118+
119+
if ( ! in_array( 'price', $hide_sections, true ) && ! empty( $prices ) ) {
101120
?>
102-
</div>
103-
<?php } ?>
104-
</div>
105-
<div class="eventInformation">
106-
<?php
107-
if ( ! in_array( 'time', $hide_sections, true ) && ! empty( $selected_course['StartTime'] ) && ! empty( $selected_course['EndTime'] ) ) {
121+
<h3><?php echo esc_html_x( 'Price', 'frontend', 'eduadmin-booking' ); ?></h3>
122+
<?php
123+
$currency = EDU()->get_option( 'eduadmin-currency', 'SEK' );
124+
125+
if ( 1 === count( $prices ) ) {
126+
echo wp_kses_post( sprintf( '<div class="pricename"><span class="pricename-description">%1$s</span> <span class="pricename-price">%2$s</span></div>', current( $prices )['PriceNameDescription'], edu_get_price( current( $prices )['Price'], $selected_course['ParticipantVat'] ) ) );
127+
} else {
128+
foreach ( $prices as $up ) {
129+
echo wp_kses_post( sprintf( '<div class="pricename"><span class="pricename-description">%1$s</span> <span class="pricename-price">%2$s</span></div>', $up['PriceNameDescription'], edu_get_price( $up['Price'], $selected_course['ParticipantVat'] ) ) );
130+
}
131+
}
132+
}
108133
?>
109-
<h3><?php echo esc_html_x( 'Time', 'frontend', 'eduadmin-booking' ); ?></h3>
110-
<?php
111-
/* translators: 1: Number of days */
112-
echo esc_html( ( $selected_course['Days'] > 0 ? sprintf( _n( '%1$d day', '%1$d days', $selected_course['Days'], 'eduadmin-booking' ), $selected_course['Days'] ) . ', ' : '' ) . $selected_course['StartTime'] . ' - ' . $selected_course['EndTime'] );
113-
}
134+
</div>
114135

115-
if ( ! in_array( 'price', $hide_sections, true ) && ! empty( $prices ) ) {
136+
<?php
137+
include 'blocks/event-list.php';
138+
if ( $allow_interest_reg_object && false !== $object_interest_page ) {
116139
?>
117-
<h3><?php echo esc_html_x( 'Price', 'frontend', 'eduadmin-booking' ); ?></h3>
140+
<br />
141+
<div class="inquiry">
142+
<a class="inquiry-link"
143+
href="<?php echo esc_url( $base_url . '/' . make_slugs( $name ) . '__' . $selected_course['CourseTemplateId'] . '/interest/' . edu_get_query_string( '?' ) . '&_=' . time() ); ?>"><?php echo esc_html_x( 'Send inquiry about this course', 'frontend', 'eduadmin-booking' ); ?></a>
144+
</div>
118145
<?php
119-
$currency = EDU()->get_option( 'eduadmin-currency', 'SEK' );
120-
121-
if ( 1 === count( $prices ) ) {
122-
echo wp_kses_post( sprintf( '<div class="pricename"><span class="pricename-description">%1$s</span> <span class="pricename-price">%2$s</span></div>', current( $prices )['PriceNameDescription'], edu_get_price( current( $prices )['Price'], $selected_course['ParticipantVat'] ) ) );
123-
} else {
124-
foreach ( $prices as $up ) {
125-
echo wp_kses_post( sprintf( '<div class="pricename"><span class="pricename-description">%1$s</span> <span class="pricename-price">%2$s</span></div>', $up['PriceNameDescription'], edu_get_price( $up['Price'], $selected_course['ParticipantVat'] ) ) );
126-
}
127-
}
128146
}
129147
?>
130148
</div>
131-
132149
<?php
133-
include 'blocks/event-list.php';
134-
if ( $allow_interest_reg_object && false !== $object_interest_page ) {
135-
?>
136-
<br />
137-
<div class="inquiry">
138-
<a class="inquiry-link"
139-
href="<?php echo esc_url( $base_url . '/' . make_slugs( $name ) . '__' . $selected_course['CourseTemplateId'] . '/interest/' . edu_get_query_string( '?' ) . '&_=' . time() ); ?>"><?php echo esc_html_x( 'Send inquiry about this course', 'frontend', 'eduadmin-booking' ); ?></a>
140-
</div>
141-
<?php
142-
}
143-
?>
144-
</div>
145-
<?php
150+
}
146151
}
147-
148152
$out = ob_get_clean();
149153

150154
return $out;

0 commit comments

Comments
 (0)