Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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.

## [5.3.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v5.2.0...v5.3.0) (2024-11-05)


### Features

* 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)

## [5.2.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v5.1.3...v5.2.0) (2024-11-04)


Expand Down
2 changes: 1 addition & 1 deletion PLUGIN-CHECKSUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f43f26b58da1439fef621c2813477a7d
5cd3f4c5d7825087108a651e5f73d89f
558 changes: 281 additions & 277 deletions content/template/bookingTemplate/template_A.php

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions content/template/data/ld-json.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php
global $wp_query;

if ( ! EDU()->api_connection ) {
return;
}

if ( ! empty( $wp_query->query_vars['courseId'] ) ) {
$course_id = $wp_query->query_vars['courseId'];
} elseif ( ! empty( $attributes['courseid'] ) ) {
Expand Down
4 changes: 4 additions & 0 deletions content/template/data/ogp.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php
global $wp_query;

if ( ! EDU()->api_connection ) {
return;
}

if ( ! empty( $wp_query->query_vars['courseId'] ) ) {
$course_id = $wp_query->query_vars['courseId'];
} elseif ( ! empty( $attributes['courseid'] ) ) {
Expand Down
250 changes: 127 additions & 123 deletions content/template/detailTemplate/template_A.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,148 +3,152 @@
global $wp_query;
$api_key = EDU()->get_option( 'eduadmin-api-key' );

if ( ! $api_key || empty( $api_key ) ) {
echo 'Please complete the configuration: <a href="' . esc_url( admin_url() . 'admin.php?page=eduadmin-settings' ) . '">EduAdmin - Api Authentication</a>';
if ( ! EDU()->api_connection ) {
echo esc_html_x( 'EduAdmin Booking could not connect to the API', 'frontend', 'eduadmin-booking' );
} else {
include 'course-info.php';
if ( ! $selected_course ) {
?>
<script type="text/javascript">location.href = '<?php echo esc_url( $base_url ); ?>';</script>
<?php
exit( 200 );
}
?>
<div class="eduadmin detail-view" data-courseid="<?php echo esc_attr( $selected_course['CourseTemplateId'] ); ?>"
data-eventid="<?php echo( isset( $_REQUEST['eid'] ) ? esc_attr( sanitize_text_field( $_REQUEST['eid'] ) ) : '' ); ?>">
<a href="javascript://" onclick="eduGlobalMethods.GoBack('../', event);"
class="backLink"><?php echo esc_html_x( '« Go back', 'frontend', 'eduadmin-booking' ); ?></a>
<div class="title">
<?php if ( ! empty( $selected_course['ImageUrl'] ) ) : ?>
<img src="<?php echo esc_url( $selected_course['ImageUrl'] ); ?>" class="courseImage" />
<?php endif; ?>
<h1 class="courseTitle"><?php echo esc_html( $name ); ?>
<small
class="courseLevel"><?php echo esc_html( false !== $course_level ? $course_level['Name'] : '' ); ?></small>
</h1>
</div>
<hr />
<div class="textblock">
if ( ! $api_key || empty( $api_key ) ) {
echo 'Please complete the configuration: <a href="' . esc_url( admin_url() . 'admin.php?page=eduadmin-settings' ) . '">EduAdmin - Api Authentication</a>';
} else {
include 'course-info.php';
if ( ! $selected_course ) {
?>
<script type="text/javascript">location.href = '<?php echo esc_url( $base_url ); ?>';</script>
<?php
if ( ! in_array( 'description', $hide_sections, true ) && ! empty( $selected_course['CourseDescription'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Course description', 'frontend', 'eduadmin-booking' ); ?></h3>
exit( 200 );
}
?>
<div class="eduadmin detail-view"
data-courseid="<?php echo esc_attr( $selected_course['CourseTemplateId'] ); ?>"
data-eventid="<?php echo( isset( $_REQUEST['eid'] ) ? esc_attr( sanitize_text_field( $_REQUEST['eid'] ) ) : '' ); ?>">
<a href="javascript://" onclick="eduGlobalMethods.GoBack('../', event);"
class="backLink"><?php echo esc_html_x( '« Go back', 'frontend', 'eduadmin-booking' ); ?></a>
<div class="title">
<?php if ( ! empty( $selected_course['ImageUrl'] ) ) : ?>
<img src="<?php echo esc_url( $selected_course['ImageUrl'] ); ?>" class="courseImage" />
<?php endif; ?>
<h1 class="courseTitle"><?php echo esc_html( $name ); ?>
<small
class="courseLevel"><?php echo esc_html( false !== $course_level ? $course_level['Name'] : '' ); ?></small>
</h1>
</div>
<hr />
<div class="textblock">
<?php
if ( ! in_array( 'description', $hide_sections, true ) && ! empty( $selected_course['CourseDescription'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Course description', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['CourseDescription'] );
?>
</div>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['CourseDescription'] );
?>
</div>
<?php } ?>
<?php
if ( ! in_array( 'goal', $hide_sections, true ) && ! empty( $selected_course['CourseGoal'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Course goal', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php
if ( ! in_array( 'goal', $hide_sections, true ) && ! empty( $selected_course['CourseGoal'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Course goal', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['CourseGoal'] );
?>
</div>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['CourseGoal'] );
?>
</div>
<?php } ?>
<?php
if ( ! in_array( 'target', $hide_sections, true ) && ! empty( $selected_course['TargetGroup'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Target group', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php
if ( ! in_array( 'target', $hide_sections, true ) && ! empty( $selected_course['TargetGroup'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Target group', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['TargetGroup'] );
?>
</div>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['TargetGroup'] );
?>
</div>
<?php } ?>
<?php
if ( ! in_array( 'prerequisites', $hide_sections, true ) && ! empty( $selected_course['Prerequisites'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Prerequisites', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php
if ( ! in_array( 'prerequisites', $hide_sections, true ) && ! empty( $selected_course['Prerequisites'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Prerequisites', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['Prerequisites'] );
?>
</div>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['Prerequisites'] );
?>
</div>
<?php } ?>
<?php
if ( ! in_array( 'after', $hide_sections, true ) && ! empty( $selected_course['CourseAfter'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'After the course', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php
if ( ! in_array( 'after', $hide_sections, true ) && ! empty( $selected_course['CourseAfter'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'After the course', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['CourseAfter'] );
?>
</div>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['CourseAfter'] );
?>
</div>
<?php } ?>
<?php
if ( ! in_array( 'quote', $hide_sections, true ) && ! empty( $selected_course['Quote'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Quotes', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php
if ( ! in_array( 'quote', $hide_sections, true ) && ! empty( $selected_course['Quote'] ) ) {
if ( $show_headers ) {
?>
<h3><?php echo esc_html_x( 'Quotes', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php } ?>
<div>
<?php
echo wp_kses_post( $selected_course['Quote'] );
?>
</div>
<?php } ?>
<div>
</div>
<div class="eventInformation">
<?php
if ( ! in_array( 'time', $hide_sections, true ) && ! empty( $selected_course['StartTime'] ) && ! empty( $selected_course['EndTime'] ) ) {
?>
<h3><?php echo esc_html_x( 'Time', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php
echo wp_kses_post( $selected_course['Quote'] );
/* translators: 1: Number of days */
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'] );
}

if ( ! in_array( 'price', $hide_sections, true ) && ! empty( $prices ) ) {
?>
</div>
<?php } ?>
</div>
<div class="eventInformation">
<?php
if ( ! in_array( 'time', $hide_sections, true ) && ! empty( $selected_course['StartTime'] ) && ! empty( $selected_course['EndTime'] ) ) {
<h3><?php echo esc_html_x( 'Price', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php
$currency = EDU()->get_option( 'eduadmin-currency', 'SEK' );

if ( 1 === count( $prices ) ) {
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'] ) ) );
} else {
foreach ( $prices as $up ) {
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'] ) ) );
}
}
}
?>
<h3><?php echo esc_html_x( 'Time', 'frontend', 'eduadmin-booking' ); ?></h3>
<?php
/* translators: 1: Number of days */
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'] );
}
</div>

if ( ! in_array( 'price', $hide_sections, true ) && ! empty( $prices ) ) {
<?php
include 'blocks/event-list.php';
if ( $allow_interest_reg_object && false !== $object_interest_page ) {
?>
<h3><?php echo esc_html_x( 'Price', 'frontend', 'eduadmin-booking' ); ?></h3>
<br />
<div class="inquiry">
<a class="inquiry-link"
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>
</div>
<?php
$currency = EDU()->get_option( 'eduadmin-currency', 'SEK' );

if ( 1 === count( $prices ) ) {
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'] ) ) );
} else {
foreach ( $prices as $up ) {
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'] ) ) );
}
}
}
?>
</div>

<?php
include 'blocks/event-list.php';
if ( $allow_interest_reg_object && false !== $object_interest_page ) {
?>
<br />
<div class="inquiry">
<a class="inquiry-link"
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>
</div>
<?php
}
?>
</div>
<?php
}
}

$out = ob_get_clean();

return $out;
Loading
Loading