Skip to content

Commit d9e0762

Browse files
author
Chris Gårdenberg
committed
chg: Filter on subjectid should now be instant (instead of waiting for ajax to kick in)
chg: Improved check for customtemplate
1 parent 574b856 commit d9e0762

6 files changed

Lines changed: 30 additions & 19 deletions

File tree

class/class-eduadminrouter.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ public function register_post_types() {
4444
}
4545

4646
public function register_routes() {
47+
$this->register_programme_routes();
48+
/*
49+
* Course template routes
50+
*/
51+
}
52+
53+
private function register_programme_routes() {
4754
$programme_list_id = get_option( 'eduadmin-programme-list' );
4855
$programme_detail_id = get_option( 'eduadmin-programme-detail' );
4956
$programme_book_id = get_option( 'eduadmin-programme-book' );
@@ -69,9 +76,6 @@ public function register_routes() {
6976
'index.php?page_id=' . $programme_book_id . '&edu_programme=$matches[1]',
7077
'top'
7178
);
72-
/*
73-
* Course template routes
74-
*/
7579
}
7680
}
7781
}

content/template/listTemplate/list-events.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
$filters[] = 'Subjects/any(s:s/SubjectName eq \'' . sanitize_text_field( $attributes['subject'] ) . '\')';
5656
}
5757

58+
if ( ! empty( $attributes['subjectid'] ) ) {
59+
$filters[] = 'Subjects/any(s:s/SubjectId eq ' . intval( $attributes['subjectid'] ) . ')';
60+
}
61+
5862
if ( ! empty( $_REQUEST['eduadmin-subject'] ) ) {
5963
$filters[] = 'Subjects/any(s:s/SubjectId eq ' . intval( $_REQUEST['eduadmin-subject'] ) . ')';
6064
$attributes['subjectid'] = intval( $_REQUEST['eduadmin-subject'] );

eduadmin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Plugin URI: https://www.eduadmin.se
1010
* Description: EduAdmin plugin to allow visitors to book courses at your website
1111
* Tags: booking, participants, courses, events, eduadmin, lega online
12-
* Version: 2.1
12+
* Version: 2.0.1
1313
* GitHub Plugin URI: multinetinteractive/eduadmin-wordpress
1414
* GitHub Plugin URI: https://github.com/multinetinteractive/eduadmin-wordpress
1515
* Requires at least: 4.7

includes/edu-shortcodes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ function eduadmin_get_detail_view( $attributes ) {
102102
}
103103

104104
EDU()->session->regenerate_id( true );
105-
106-
if ( ! isset( $attributes['customtemplate'] ) || 1 !== $attributes['customtemplate'] ) {
105+
if ( empty( $attributes['customtemplate'] ) || 1 !== intval( $attributes['customtemplate'] ) ) {
107106
$str = include_once EDUADMIN_PLUGIN_PATH . '/content/template/detailTemplate/' . $attributes['template'] . '.php';
108107
EDU()->stop_timer( $t );
109108

110109
return $str;
111110
}
111+
112112
EDU()->stop_timer( $t );
113113

114114
return '';

includes/general-settings.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ function edu_render_general_settings() {
1818
}
1919
?>
2020
<div class="eduadmin wrap">
21-
<h2><?php echo sprintf( __( "EduAdmin settings - %s", 'eduadmin-booking' ), __( "General", 'eduadmin-booking' ) ); ?></h2>
21+
<h2><?php echo esc_html( sprintf( __( 'EduAdmin settings - %s', 'eduadmin-booking' ), __( 'General', 'eduadmin-booking' ) ) ); ?></h2>
2222

2323
<form method="post" action="options.php">
2424
<?php settings_fields( 'eduadmin-rewrite' ); ?>
2525
<?php do_settings_sections( 'eduadmin-rewrite' ); ?>
2626
<div class="block">
27-
<h3><?php _e( "General settings", 'eduadmin-booking' ); ?></h3>
28-
<?php _e( "Availability text", 'eduadmin-booking' ); ?>
27+
<h3><?php esc_html_e( 'General settings', 'eduadmin-booking' ); ?></h3>
28+
<?php esc_html_e( 'Availability text', 'eduadmin-booking' ); ?>
2929
<br />
3030
<?php
3131
$spotLeft = get_option( 'eduadmin-spotsLeft', 'exactNumbers' );
@@ -44,30 +44,30 @@ function edu_render_general_settings() {
4444
<div class="eduadmin-spotsSettings">
4545
<div id="eduadmin-intervalSetting">
4646
<br />
47-
<b><?php _e( "Interval settings", 'eduadmin-booking' ); ?></b>
47+
<b><?php esc_html_e( "Interval settings", 'eduadmin-booking' ); ?></b>
4848
<br />
49-
<?php _e( "Insert one interval range per row (1-3, 4-10, 10+)", 'eduadmin-booking' ); ?>
49+
<?php esc_html_e( "Insert one interval range per row (1-3, 4-10, 10+)", 'eduadmin-booking' ); ?>
5050
<br />
5151
<textarea name="eduadmin-spotsSettings" class="form-control" rows="5" cols="30"><?php echo get_option( 'eduadmin-spotsSettings', "1-5\n5-10\n10+" ); ?></textarea>
5252
</div>
5353
<div id="eduadmin-alwaysFewSpots">
5454
<br />
55-
<b><?php _e( "Number of participants before showing as \"Few spots left\"", 'eduadmin-booking' ); ?></b>
55+
<b><?php esc_html_e( "Number of participants before showing as \"Few spots left\"", 'eduadmin-booking' ); ?></b>
5656
<br />
5757
<input type="number" name="eduadmin-alwaysFewSpots" value="<?php echo esc_attr( get_option( 'eduadmin-alwaysFewSpots', "3" ) ); ?>" />
5858
</div>
5959
</div>
6060
<br />
61-
<?php _e( "Number of months to fetch events for", 'eduadmin-booking' ); ?>
61+
<?php esc_html_e( "Number of months to fetch events for", 'eduadmin-booking' ); ?>
6262
<br />
6363
<input type="number" name="eduadmin-monthsToFetch" value="<?php echo esc_attr( get_option( 'eduadmin-monthsToFetch', '6' ) ); ?>" /> <?php _e( "months", 'eduadmin-booking' ); ?>
6464
<br />
6565
<p class="submit">
6666
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( "Save settings", 'eduadmin-booking' ); ?>" />
6767
</p>
68-
<h3><?php _e( "Rewrite settings", 'eduadmin-booking' ); ?></h3>
68+
<h3><?php esc_html_e( "Rewrite settings", 'eduadmin-booking' ); ?></h3>
6969
<p>
70-
<?php echo __( "Enter the URL you want to use with the application (please check that the URL does not exists)", 'eduadmin-booking' ); ?>
70+
<?php echo esc_html__( "Enter the URL you want to use with the application (please check that the URL does not exists)", 'eduadmin-booking' ); ?>
7171
</p>
7272
<?php echo home_url(); ?>/<input style="width: 200px;" type="text" class="form-control folder" name="eduadmin-rewriteBaseUrl" id="eduadmin-rewriteBaseUrl" value="<?php echo esc_attr( get_option( 'eduadmin-rewriteBaseUrl' ) ); ?>" placeholder="<?php echo __( "URL", 'eduadmin-booking' ); ?>" />/
7373
<?php
@@ -79,13 +79,13 @@ function edu_render_general_settings() {
7979
}
8080
}
8181
?>
82-
<h3><?php _e( 'Course templates', 'eduadmin-booking' ); ?></h3>
82+
<h3><?php esc_html_e( 'Course templates', 'eduadmin-booking' ); ?></h3>
8383
<table>
8484
<tr>
85-
<td><?php _e( "List view page", 'eduadmin-booking' ); ?></td>
85+
<td><?php esc_html_e( 'List view page', 'eduadmin-booking' ); ?></td>
8686
<td>
8787
<select class="form-control" style="width: 300px;" name="eduadmin-listViewPage" id="eduadmin-listViewPage">
88-
<option value="">-- <?php _e( "No page selected", 'eduadmin-booking' ); ?>--
88+
<option value="">-- <?php esc_html_e( "No page selected", 'eduadmin-booking' ); ?>--
8989
</option>
9090
<?php
9191
$listPage = get_option( 'eduadmin-listViewPage' );
@@ -251,7 +251,7 @@ function edu_render_general_settings() {
251251
</tr>
252252
</table>
253253
<?php
254-
$pages = get_pages();
254+
$pages = get_pages();
255255
$programme_pages = array();
256256
foreach ( $pages as $p ) {
257257
if ( strstr( $p->post_content, '[eduadmin' ) ) {

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ and redo your own customization.
4747

4848
== Changelog ==
4949

50+
### 2.0.1 ###
51+
- chg: Better check against `customtemplate`
52+
5053
### 2.0 ###
5154
- add: Adding page for certificates
5255
- chg: Bumping major version, since we're using a brand new API

0 commit comments

Comments
 (0)