Restaurant Reservations - Version 1.1.1

Version Description

This update fixes problems some users reported when using the Firefox browser to modify the booking schedule. This required an update to a library that is shared with another plugin, Food and Drink Menu. If you are using that plugin, please update that one as well or you may get some odd behavior. (Thanks to sangwh and bforsoft for reporting the issue.)

Download this release

Release Info

Developer NateWr
Plugin Icon 128x128 Restaurant Reservations
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1 to 1.1.1

Files changed (25) hide show
  1. includes/Settings.class.php +1 -1
  2. lib/simple-admin-pages/README.md +16 -2
  3. lib/simple-admin-pages/classes/AdminPage.Menu.class.php +32 -0
  4. lib/simple-admin-pages/classes/AdminPage.Submenu.class.php +1 -1
  5. lib/simple-admin-pages/classes/AdminPage.Themes.class.php +1 -1
  6. lib/simple-admin-pages/classes/AdminPage.class.php +1 -1
  7. lib/simple-admin-pages/classes/AdminPageSection.class.php +1 -1
  8. lib/simple-admin-pages/classes/AdminPageSetting.Editor.class.php +1 -1
  9. lib/simple-admin-pages/classes/AdminPageSetting.HTML.class.php +1 -1
  10. lib/simple-admin-pages/classes/AdminPageSetting.OpeningHours.class.php +14 -1
  11. lib/simple-admin-pages/classes/AdminPageSetting.Scheduler.class.php +70 -2
  12. lib/simple-admin-pages/classes/AdminPageSetting.Select.class.php +1 -1
  13. lib/simple-admin-pages/classes/AdminPageSetting.SelectPost.class.php +1 -1
  14. lib/simple-admin-pages/classes/AdminPageSetting.SelectTaxonomy.class.php +1 -1
  15. lib/simple-admin-pages/classes/AdminPageSetting.Text.class.php +1 -1
  16. lib/simple-admin-pages/classes/AdminPageSetting.Textarea.class.php +2 -2
  17. lib/simple-admin-pages/classes/AdminPageSetting.Toggle.class.php +1 -1
  18. lib/simple-admin-pages/classes/AdminPageSetting.class.php +37 -1
  19. lib/simple-admin-pages/classes/Library.class.php +22 -17
  20. lib/simple-admin-pages/css/admin.css +4 -4
  21. lib/simple-admin-pages/js/opening-hours.js +20 -0
  22. lib/simple-admin-pages/js/{admin.js → scheduler.js} +42 -53
  23. lib/simple-admin-pages/lib/pickadate/translations/ar.js +1 -1
  24. readme.txt +7 -1
  25. restaurant-reservations.php +1 -1
includes/Settings.class.php CHANGED
@@ -205,7 +205,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
205
  require_once( RTB_PLUGIN_DIR . '/lib/simple-admin-pages/simple-admin-pages.php' );
206
  $sap = sap_initialize_library(
207
  $args = array(
208
- 'version' => '2.0.a.1',
209
  'lib_url' => RTB_PLUGIN_URL . '/lib/simple-admin-pages/',
210
  )
211
  );
205
  require_once( RTB_PLUGIN_DIR . '/lib/simple-admin-pages/simple-admin-pages.php' );
206
  $sap = sap_initialize_library(
207
  $args = array(
208
+ 'version' => '2.0.a.4',
209
  'lib_url' => RTB_PLUGIN_URL . '/lib/simple-admin-pages/',
210
  )
211
  );
lib/simple-admin-pages/README.md CHANGED
@@ -38,7 +38,7 @@ Here's a simple example of how you can use this library to create an admin page.
38
  require_once( 'path/to/simple-admin-pages/simple-admin-pages.php' );
39
  $sap = sap_initialize_library(
40
  array(
41
- 'version' => '2.0.a.1', // Version of the library
42
  'lib_url' => PLUGIN_URL . '/lib/simple-admin-pages/', // URL path to sap library
43
  )
44
  );
@@ -127,7 +127,7 @@ The lib_url is used to print stylesheets or scripts attached to the library.
127
  require_once( 'path/to/simple-admin-pages/simple-admin-pages.php' );
128
  $sap = sap_initialize_library(
129
  $args = array(
130
- 'version' => '2.0.a.2', // Version of the library
131
  'lib_url' => PLUGIN_URL . '/lib/simple-admin-pages/', // URL path to sap library
132
  )
133
  );
@@ -368,6 +368,20 @@ $all_page_settings[ $my_setting_id ];
368
 
369
  ## Changelog
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  - 2.0.a.1 - 2014-04-03
372
  - Save all data on a page as one row in wp_options
373
 
38
  require_once( 'path/to/simple-admin-pages/simple-admin-pages.php' );
39
  $sap = sap_initialize_library(
40
  array(
41
+ 'version' => '2.0.a.4', // Version of the library
42
  'lib_url' => PLUGIN_URL . '/lib/simple-admin-pages/', // URL path to sap library
43
  )
44
  );
127
  require_once( 'path/to/simple-admin-pages/simple-admin-pages.php' );
128
  $sap = sap_initialize_library(
129
  $args = array(
130
+ 'version' => '2.0.a.4', // Version of the library
131
  'lib_url' => PLUGIN_URL . '/lib/simple-admin-pages/', // URL path to sap library
132
  )
133
  );
368
 
369
  ## Changelog
370
 
371
+ - 2.0.a.4 - 2014-05-15
372
+ - Only load assets when component is called
373
+ - Revert adding version number to script handles
374
+ - Fix localized script handler for Scheduler
375
+ - Fix pickadate CSS rule specificity
376
+
377
+ - 2.0.a.3 - 2014-05-14
378
+ - Fix undefined function error in Scheduler javascript when using Firefox
379
+ - Add version number to style and script handles so different versions will be enqueued
380
+
381
+ - 2.0.a.2 - 2014-05-11
382
+ - Add support for top-level menus
383
+ - Support line breaks in textarea components
384
+
385
  - 2.0.a.1 - 2014-04-03
386
  - Save all data on a page as one row in wp_options
387
 
lib/simple-admin-pages/classes/AdminPage.Menu.class.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Register, display and save an settings page as a submenu item in the
5
+ * WordPress admin menu.
6
+ *
7
+ * @since 1.1
8
+ * @package Simple Admin Pages
9
+ */
10
+
11
+ class sapAdminPageMenu_2_0_a_4 extends sapAdminPage_2_0_a_4 {
12
+
13
+ public $setup_function = 'add_menu_page'; // WP function to register the page
14
+
15
+ /**
16
+ * Add the page to the appropriate menu slot.
17
+ * @since 1.0
18
+ */
19
+ public function add_admin_menu() {
20
+
21
+ call_user_func(
22
+ $this->setup_function,
23
+ $this->title,
24
+ $this->menu_title,
25
+ $this->capability,
26
+ $this->id,
27
+ array( $this, 'display_admin_menu' ),
28
+ $this->icon,
29
+ $this->position
30
+ );
31
+ }
32
+ }
lib/simple-admin-pages/classes/AdminPage.Submenu.class.php CHANGED
@@ -8,7 +8,7 @@
8
  * @package Simple Admin Pages
9
  */
10
 
11
- class sapAdminPageSubmenu_2_0_a_1 extends sapAdminPage_2_0_a_1 {
12
 
13
  public $setup_function = 'add_submenu_page'; // WP function to register the page
14
 
8
  * @package Simple Admin Pages
9
  */
10
 
11
+ class sapAdminPageSubmenu_2_0_a_4 extends sapAdminPage_2_0_a_4 {
12
 
13
  public $setup_function = 'add_submenu_page'; // WP function to register the page
14
 
lib/simple-admin-pages/classes/AdminPage.Themes.class.php CHANGED
@@ -8,7 +8,7 @@
8
  * @package Simple Admin Pages
9
  */
10
 
11
- class sapAdminPageThemes_2_0_a_1 extends sapAdminPage_2_0_a_1 {
12
 
13
  public $setup_function = 'add_theme_page'; // WP function to register the page
14
 
8
  * @package Simple Admin Pages
9
  */
10
 
11
+ class sapAdminPageThemes_2_0_a_4 extends sapAdminPage_2_0_a_4 {
12
 
13
  public $setup_function = 'add_theme_page'; // WP function to register the page
14
 
lib/simple-admin-pages/classes/AdminPage.class.php CHANGED
@@ -7,7 +7,7 @@
7
  * @package Simple Admin Pages
8
  */
9
 
10
- class sapAdminPage_2_0_a_1 {
11
 
12
  public $title;
13
  public $menu_title;
7
  * @package Simple Admin Pages
8
  */
9
 
10
+ class sapAdminPage_2_0_a_4 {
11
 
12
  public $title;
13
  public $menu_title;
lib/simple-admin-pages/classes/AdminPageSection.class.php CHANGED
@@ -7,7 +7,7 @@
7
  * @package Simple Admin Pages
8
  */
9
 
10
- class sapAdminPageSection_2_0_a_1 {
11
 
12
  // Page defaults
13
  public $id; // unique id for this section
7
  * @package Simple Admin Pages
8
  */
9
 
10
+ class sapAdminPageSection_2_0_a_4 {
11
 
12
  // Page defaults
13
  public $id; // unique id for this section
lib/simple-admin-pages/classes/AdminPageSetting.Editor.class.php CHANGED
@@ -7,7 +7,7 @@
7
  * @package Simple Admin Pages
8
  */
9
 
10
- class sapAdminPageSettingEditor_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
11
 
12
  public $sanitize_callback = 'wp_kses_post';
13
 
7
  * @package Simple Admin Pages
8
  */
9
 
10
+ class sapAdminPageSettingEditor_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
11
 
12
  public $sanitize_callback = 'wp_kses_post';
13
 
lib/simple-admin-pages/classes/AdminPageSetting.HTML.class.php CHANGED
@@ -14,7 +14,7 @@
14
  * @package Simple Admin Pages
15
  */
16
 
17
- class sapAdminPageSettingHTML_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
18
 
19
  public $sanitize_callback = 'sanitize_text_field';
20
 
14
  * @package Simple Admin Pages
15
  */
16
 
17
+ class sapAdminPageSettingHTML_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
18
 
19
  public $sanitize_callback = 'sanitize_text_field';
20
 
lib/simple-admin-pages/classes/AdminPageSetting.OpeningHours.class.php CHANGED
@@ -25,9 +25,22 @@
25
  * @package Simple Admin Pages
26
  */
27
 
28
- class sapAdminPageSettingOpeningHours_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
29
 
30
  public $sanitize_callback = 'sanitize_text_field';
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  // Array of days of the week
33
  public $weekdays = array(
25
  * @package Simple Admin Pages
26
  */
27
 
28
+ class sapAdminPageSettingOpeningHours_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
29
 
30
  public $sanitize_callback = 'sanitize_text_field';
31
+
32
+ /**
33
+ * Scripts that must be loaded for this component
34
+ * @since 2.0.a.4
35
+ */
36
+ public $scripts = array(
37
+ 'sap-opening-hours' => array(
38
+ 'path' => 'js/opening-hours.js',
39
+ 'dependencies' => array( 'jquery' ),
40
+ 'version' => '2.0.a.4',
41
+ 'footer' => true,
42
+ ),
43
+ );
44
 
45
  // Array of days of the week
46
  public $weekdays = array(
lib/simple-admin-pages/classes/AdminPageSetting.Scheduler.class.php CHANGED
@@ -10,9 +10,73 @@
10
  * @package Simple Admin Pages
11
  */
12
 
13
- class sapAdminPageSettingScheduler_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
14
 
15
  public $sanitize_callback = 'sanitize_text_field';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  public $weekdays = array(
18
  'monday' => 'Mo',
@@ -165,7 +229,7 @@ class sapAdminPageSettingScheduler_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
165
  // This gets called multiple times, but only the last call is actually
166
  // pushed to the script.
167
  wp_localize_script(
168
- 'sap-admin-script',
169
  'sap_scheduler',
170
  array(
171
  'settings' => $sap_scheduler_settings
@@ -548,6 +612,10 @@ class sapAdminPageSettingScheduler_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
548
  public function sanitize_callback_wrapper( $values ) {
549
 
550
  $output = array();
 
 
 
 
551
 
552
  foreach ( $values as $i => $rule ) {
553
 
10
  * @package Simple Admin Pages
11
  */
12
 
13
+ class sapAdminPageSettingScheduler_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
14
 
15
  public $sanitize_callback = 'sanitize_text_field';
16
+
17
+ /**
18
+ * Scripts that must be loaded for this component
19
+ * @since 2.0.a.4
20
+ */
21
+ public $scripts = array(
22
+ 'pickadate' => array(
23
+ 'path' => 'lib/pickadate/picker.js',
24
+ 'dependencies' => array( 'jquery' ),
25
+ 'version' => '3.5.0',
26
+ 'footer' => true,
27
+ ),
28
+ 'pickadate-date' => array(
29
+ 'path' => 'lib/pickadate/picker.date.js',
30
+ 'dependencies' => array( 'jquery' ),
31
+ 'version' => '3.5.0',
32
+ 'footer' => true,
33
+ ),
34
+ 'pickadate-time' => array(
35
+ 'path' => 'lib/pickadate/picker.time.js',
36
+ 'dependencies' => array( 'jquery' ),
37
+ 'version' => '3.5.0',
38
+ 'footer' => true,
39
+ ),
40
+ 'pickadate-legacy' => array(
41
+ 'path' => 'lib/pickadate/legacy.js',
42
+ 'dependencies' => array( 'jquery' ),
43
+ 'version' => '3.5.0',
44
+ 'footer' => true,
45
+ ),
46
+ 'sap-scheduler' => array(
47
+ 'path' => 'js/scheduler.js',
48
+ 'dependencies' => array( 'jquery' ),
49
+ 'version' => '2.0.a.4',
50
+ 'footer' => true,
51
+ ),
52
+ // @todo there should be some way to load alternate language .js files
53
+ // and RTL CSS scripts
54
+ );
55
+
56
+ /**
57
+ * Styles that must be loaded for this component
58
+ * @since 2.0.a.4
59
+ */
60
+ public $styles = array(
61
+ 'pickadate-default' => array(
62
+ 'path' => 'lib/pickadate/themes/default.css',
63
+ 'dependencies' => '',
64
+ 'version' => '3.5.0',
65
+ 'media' => null,
66
+ ),
67
+ 'pickadate-date' => array(
68
+ 'path' => 'lib/pickadate/themes/default.date.css',
69
+ 'dependencies' => '',
70
+ 'version' => '3.5.0',
71
+ 'media' => null,
72
+ ),
73
+ 'pickadate-time' => array(
74
+ 'path' => 'lib/pickadate/themes/default.time.css',
75
+ 'dependencies' => '',
76
+ 'version' => '3.5.0',
77
+ 'media' => null,
78
+ ),
79
+ );
80
 
81
  public $weekdays = array(
82
  'monday' => 'Mo',
229
  // This gets called multiple times, but only the last call is actually
230
  // pushed to the script.
231
  wp_localize_script(
232
+ 'sap-scheduler',
233
  'sap_scheduler',
234
  array(
235
  'settings' => $sap_scheduler_settings
612
  public function sanitize_callback_wrapper( $values ) {
613
 
614
  $output = array();
615
+
616
+ if ( !is_array( $values ) || !count( $values ) ) {
617
+ return $output;
618
+ }
619
 
620
  foreach ( $values as $i => $rule ) {
621
 
lib/simple-admin-pages/classes/AdminPageSetting.Select.class.php CHANGED
@@ -21,7 +21,7 @@
21
  * @package Simple Admin Pages
22
  */
23
 
24
- class sapAdminPageSettingSelect_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
25
 
26
  public $sanitize_callback = 'sanitize_text_field';
27
 
21
  * @package Simple Admin Pages
22
  */
23
 
24
+ class sapAdminPageSettingSelect_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
25
 
26
  public $sanitize_callback = 'sanitize_text_field';
27
 
lib/simple-admin-pages/classes/AdminPageSetting.SelectPost.class.php CHANGED
@@ -17,7 +17,7 @@
17
  * @package Simple Admin Pages
18
  */
19
 
20
- class sapAdminPageSettingSelectPost_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
21
 
22
  public $sanitize_callback = 'intval';
23
 
17
  * @package Simple Admin Pages
18
  */
19
 
20
+ class sapAdminPageSettingSelectPost_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
21
 
22
  public $sanitize_callback = 'intval';
23
 
lib/simple-admin-pages/classes/AdminPageSetting.SelectTaxonomy.class.php CHANGED
@@ -19,7 +19,7 @@
19
  * @package Simple Admin Pages
20
  */
21
 
22
- class sapAdminPageSettingSelectTaxonomy_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
23
 
24
  public $sanitize_callback = 'intval';
25
 
19
  * @package Simple Admin Pages
20
  */
21
 
22
+ class sapAdminPageSettingSelectTaxonomy_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
23
 
24
  public $sanitize_callback = 'intval';
25
 
lib/simple-admin-pages/classes/AdminPageSetting.Text.class.php CHANGED
@@ -7,7 +7,7 @@
7
  * @package Simple Admin Pages
8
  */
9
 
10
- class sapAdminPageSettingText_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
11
 
12
  public $sanitize_callback = 'sanitize_text_field';
13
 
7
  * @package Simple Admin Pages
8
  */
9
 
10
+ class sapAdminPageSettingText_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
11
 
12
  public $sanitize_callback = 'sanitize_text_field';
13
 
lib/simple-admin-pages/classes/AdminPageSetting.Textarea.class.php CHANGED
@@ -9,7 +9,7 @@
9
  * @todo textareas should have an option to swap new lines for <br>s
10
  */
11
 
12
- class sapAdminPageSettingTextarea_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
13
 
14
  /*
15
  * Size of this textarea
@@ -20,7 +20,7 @@ class sapAdminPageSettingTextarea_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
20
  */
21
  public $size = 'small';
22
 
23
- public $sanitize_callback = 'sanitize_text_field';
24
 
25
  /**
26
  * Escape the value to display it safely HTML textarea fields
9
  * @todo textareas should have an option to swap new lines for <br>s
10
  */
11
 
12
+ class sapAdminPageSettingTextarea_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
13
 
14
  /*
15
  * Size of this textarea
20
  */
21
  public $size = 'small';
22
 
23
+ public $sanitize_callback = 'wp_kses';
24
 
25
  /**
26
  * Escape the value to display it safely HTML textarea fields
lib/simple-admin-pages/classes/AdminPageSetting.Toggle.class.php CHANGED
@@ -17,7 +17,7 @@
17
  * @package Simple Admin Pages
18
  */
19
 
20
- class sapAdminPageSettingToggle_2_0_a_1 extends sapAdminPageSetting_2_0_a_1 {
21
 
22
  public $sanitize_callback = 'sanitize_text_field';
23
 
17
  * @package Simple Admin Pages
18
  */
19
 
20
+ class sapAdminPageSettingToggle_2_0_a_4 extends sapAdminPageSetting_2_0_a_4 {
21
 
22
  public $sanitize_callback = 'sanitize_text_field';
23
 
lib/simple-admin-pages/classes/AdminPageSetting.class.php CHANGED
@@ -15,7 +15,7 @@
15
  * @package Simple Admin Pages
16
  */
17
 
18
- abstract class sapAdminPageSetting_2_0_a_1 {
19
 
20
  // Page defaults
21
  public $id; // used in form fields and database to track and store setting
@@ -35,6 +35,42 @@ abstract class sapAdminPageSetting_2_0_a_1 {
35
  * @since 1.0
36
  */
37
  public $sanitize_callback = 'sanitize_text_field';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  /**
40
  * Initialize the setting
15
  * @package Simple Admin Pages
16
  */
17
 
18
+ abstract class sapAdminPageSetting_2_0_a_4 {
19
 
20
  // Page defaults
21
  public $id; // used in form fields and database to track and store setting
35
  * @since 1.0
36
  */
37
  public $sanitize_callback = 'sanitize_text_field';
38
+
39
+ /**
40
+ * Scripts that must be loaded for this component
41
+ * @since 2.0.a.4
42
+ */
43
+ public $scripts = array(
44
+ /**
45
+ * Example
46
+ * See: http://codex.wordpress.org/Function_Reference/wp_enqueue_script
47
+ *
48
+ 'handle' => array(
49
+ 'path' => 'path/from/simple-admin-pages/file.js',
50
+ 'dependencies' => array( 'jquery' ),
51
+ 'version' => '3.5.0',
52
+ 'footer' => true,
53
+ ),
54
+ */
55
+ );
56
+
57
+ /**
58
+ * Styles that must be loaded for this component
59
+ * @since 2.0.a.4
60
+ */
61
+ public $styles = array(
62
+ /**
63
+ * Example
64
+ * See: http://codex.wordpress.org/Function_Reference/wp_enqueue_style
65
+ *
66
+ 'handle' => array(
67
+ 'path' => 'path/from/simple-admin-pages/file.css',
68
+ 'dependencies' => 'array( 'another-handle')', // or empty string
69
+ 'version' => '3.5.0',
70
+ 'media' => null,
71
+ ),
72
+ */
73
+ );
74
 
75
  /**
76
  * Initialize the setting
lib/simple-admin-pages/classes/Library.class.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ( !class_exists( 'sapLibrary_2_0_a_1' ) ) {
3
  /**
4
  * This library class loads and provides access to the correct version of the
5
  * Simple Admin Pages library.
@@ -7,10 +7,10 @@ if ( !class_exists( 'sapLibrary_2_0_a_1' ) ) {
7
  * @since 1.0
8
  * @package Simple Admin Pages
9
  */
10
- class sapLibrary_2_0_a_1 {
11
 
12
  // Version of the library
13
- private $version = '2.0.a.1';
14
 
15
  // A full URL to the library which is used to correctly link scripts and
16
  // stylesheets.
@@ -206,6 +206,9 @@ class sapLibrary_2_0_a_1 {
206
  if ( $menu_location == 'themes' ) {
207
  $this->load_class( 'sapAdminPageThemes', 'AdminPage.Themes.class.php' );
208
  $class = $this->get_versioned_classname( 'sapAdminPageThemes' );
 
 
 
209
  } elseif ( $menu_location == 'submenu' ) {
210
  $this->load_class( 'sapAdminPageSubmenu', 'AdminPage.Submenu.class.php' );
211
  $class = $this->get_versioned_classname( 'sapAdminPageSubmenu' );
@@ -365,26 +368,28 @@ class sapLibrary_2_0_a_1 {
365
  }
366
 
367
  /**
368
- * Enqueue the CSS stylesheet
369
  * @since 1.0
370
  * @todo complex settings should enqueue their assets only when loaded
371
  */
372
  public function enqueue_scripts() {
373
-
374
- // Load the pickadate library
375
- wp_enqueue_style( 'pickadate-default', $this->lib_url . 'lib/pickadate/themes/default.css' );
376
- wp_enqueue_style( 'pickadate-date', $this->lib_url . 'lib/pickadate/themes/default.date.css' );
377
- wp_enqueue_style( 'pickadate-time', $this->lib_url . 'lib/pickadate/themes/default.time.css' );
378
- wp_enqueue_script( 'pickadate', $this->lib_url . 'lib/pickadate/picker.js', array( 'jquery' ), '', true );
379
- wp_enqueue_script( 'pickadate-date', $this->lib_url . 'lib/pickadate/picker.date.js', array( 'jquery' ), '', true );
380
- wp_enqueue_script( 'pickadate-time', $this->lib_url . 'lib/pickadate/picker.time.js', array( 'jquery' ), '', true );
381
- wp_enqueue_script( 'pickadate-legacy', $this->lib_url . 'lib/pickadate/legacy.js', array( 'jquery' ), '', true );
382
- // @todo is there some way I can enqueue this for RTL languages
383
- // wp_enqueue_style( 'pickadate-rtl', $this->lib_url . 'lib/pickadate/themes/rtl.css' );
 
 
 
384
 
385
  // Default styles and scripts
386
- wp_enqueue_style( 'sap-admin-style', $this->lib_url . 'css/admin.css' );
387
- wp_enqueue_script( 'sap-admin-script', $this->lib_url . 'js/admin.js', array( 'jquery' ), '1.0', true );
388
  }
389
 
390
  /**
1
  <?php
2
+ if ( !class_exists( 'sapLibrary_2_0_a_4' ) ) {
3
  /**
4
  * This library class loads and provides access to the correct version of the
5
  * Simple Admin Pages library.
7
  * @since 1.0
8
  * @package Simple Admin Pages
9
  */
10
+ class sapLibrary_2_0_a_4 {
11
 
12
  // Version of the library
13
+ private $version = '2.0.a.4';
14
 
15
  // A full URL to the library which is used to correctly link scripts and
16
  // stylesheets.
206
  if ( $menu_location == 'themes' ) {
207
  $this->load_class( 'sapAdminPageThemes', 'AdminPage.Themes.class.php' );
208
  $class = $this->get_versioned_classname( 'sapAdminPageThemes' );
209
+ } elseif ( $menu_location == 'menu' ) {
210
+ $this->load_class( 'sapAdminPageMenu', 'AdminPage.Menu.class.php' );
211
+ $class = $this->get_versioned_classname( 'sapAdminPageMenu' );
212
  } elseif ( $menu_location == 'submenu' ) {
213
  $this->load_class( 'sapAdminPageSubmenu', 'AdminPage.Submenu.class.php' );
214
  $class = $this->get_versioned_classname( 'sapAdminPageSubmenu' );
368
  }
369
 
370
  /**
371
+ * Enqueue the stylesheets and scripts
372
  * @since 1.0
373
  * @todo complex settings should enqueue their assets only when loaded
374
  */
375
  public function enqueue_scripts() {
376
+
377
+ // Enqueue assets for specific settings
378
+ foreach ( $this->pages as $page ) {
379
+ foreach ( $page->sections as $section ) {
380
+ foreach ( $section->settings as $setting ) {
381
+ foreach( $setting->scripts as $handle => $script ) {
382
+ wp_enqueue_script( $handle, $this->lib_url . $script['path'], $script['dependencies'], $script['version'], $script['footer'] );
383
+ }
384
+ foreach( $setting->styles as $handle => $style ) {
385
+ wp_enqueue_style( $handle . '-' . $this->version, $this->lib_url . $style['path'], $style['dependencies'], $style['version'], $style['media'] );
386
+ }
387
+ }
388
+ }
389
+ }
390
 
391
  // Default styles and scripts
392
+ wp_enqueue_style( 'sap-admin-style-' . $this->version, $this->lib_url . 'css/admin.css' );
 
393
  }
394
 
395
  /**
lib/simple-admin-pages/css/admin.css CHANGED
@@ -136,7 +136,7 @@ input.sap-opening-hours-hours {
136
  max-width: 8em;
137
  }
138
  .sap-scheduler-all-day {
139
- display: inline-block;
140
  margin-top: 1.7em;
141
  font-style: italic;
142
  padding: 1em;
@@ -213,11 +213,11 @@ input.sap-opening-hours-hours {
213
  /**
214
  * Adjustements to pickadate library css to override WP admin styles
215
  */
216
- .picker__table {
217
  table-layout: auto;
218
  }
219
- .picker__table th,
220
- .picker__table td {
221
  text-align: center;
222
  display: table-cell;
223
  padding: 0.5em;
136
  max-width: 8em;
137
  }
138
  .sap-scheduler-all-day {
139
+ display: block;
140
  margin-top: 1.7em;
141
  font-style: italic;
142
  padding: 1em;
213
  /**
214
  * Adjustements to pickadate library css to override WP admin styles
215
  */
216
+ .picker .picker__table {
217
  table-layout: auto;
218
  }
219
+ .picker .picker__table th,
220
+ .picker .picker__table td {
221
  text-align: center;
222
  display: table-cell;
223
  padding: 0.5em;
lib/simple-admin-pages/js/opening-hours.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Javascript functions for Opening Hours component
3
+ *
4
+ * @package Simple Admin Pages
5
+ */
6
+
7
+ jQuery(document).ready(function ($) {
8
+
9
+ /**
10
+ * Opening Hours
11
+ ***************/
12
+
13
+ /**
14
+ * Update the name of each day when the select option is changed
15
+ */
16
+ $( '.sap-opening-hours-day' ).change( function() {
17
+ $( $(this).data( 'target' ) ).val( $(this).children( 'option:selected' ).data( 'name' ) );
18
+ });
19
+
20
+ });
lib/simple-admin-pages/js/{admin.js → scheduler.js} RENAMED
@@ -1,69 +1,17 @@
1
  /**
2
- * Javascript functions for the admin interface components of Simple Admin Pages
3
  *
4
  * @package Simple Admin Pages
5
  */
6
 
7
  jQuery(document).ready(function ($) {
8
 
9
- /**
10
- * Opening Hours
11
- ***************/
12
-
13
- /**
14
- * Update the name of each day when the select option is changed
15
- */
16
- $( '.sap-opening-hours-day' ).change( function() {
17
- $( $(this).data( 'target' ) ).val( $(this).children( 'option:selected' ).data( 'name' ) );
18
- });
19
-
20
  /**
21
  * Scheduler
22
  ***********/
23
 
24
  if ( typeof sap_scheduler != 'undefined' ) {
25
 
26
- /**
27
- * Register click events on load
28
- */
29
- sap_scheduler_register_events();
30
-
31
- /**
32
- * Enable datepickers on load
33
- */
34
- if ( typeof sap_scheduler.settings != 'undefined' ) {
35
- for ( var key in sap_scheduler.settings ) {
36
- var obj = sap_scheduler.settings[key];
37
- $( '#' + key + ' .sap-scheduler-date-input input' ).pickadate({
38
- format: obj.date_format,
39
- });
40
- $( '#' + key + ' .sap-scheduler-time-input input' ).pickatime({
41
- interval: obj.time_interval,
42
- format: obj.time_format,
43
- });
44
- }
45
- }
46
-
47
- /**
48
- * Add a new scheduler panel
49
- */
50
- $( '.sap-add-scheduler a' ).click( function() {
51
- var scheduler = $(this).parent().siblings( '.sap-scheduler' );
52
- var scheduler_id = scheduler.attr( 'id' );
53
- var scheduler_settings = sap_scheduler.settings[ scheduler_id ];
54
- scheduler.append( scheduler_settings.template.replace( /\[0\]/g, '[' + scheduler.children( '.sap-scheduler-rule' ).length + ']' ) );
55
- scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find( '.sap-scheduler-date-input input' ).pickadate({
56
- format: scheduler_settings.date_format,
57
- });
58
- scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find( '.sap-scheduler-time-input input' ).pickatime({
59
- interval: scheduler_settings.time_interval,
60
- format: scheduler_settings.time_format,
61
- });
62
- sap_scheduler_register_events();
63
-
64
- return false;
65
- });
66
-
67
  /**
68
  * Register event handlers on the scheduler rules. This is run on page load
69
  * and every time a rule is added.
@@ -335,6 +283,47 @@ jQuery(document).ready(function ($) {
335
  return scheduler_rule.find( '.sap-scheduler-brief .time .value' ).html( start + sap_scheduler.settings[scheduler_id].summaries['separator'] + end );
336
  }
337
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  }
339
 
340
  });
1
  /**
2
+ * Javascript functions for the Scheduler component
3
  *
4
  * @package Simple Admin Pages
5
  */
6
 
7
  jQuery(document).ready(function ($) {
8
 
 
 
 
 
 
 
 
 
 
 
 
9
  /**
10
  * Scheduler
11
  ***********/
12
 
13
  if ( typeof sap_scheduler != 'undefined' ) {
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  /**
16
  * Register event handlers on the scheduler rules. This is run on page load
17
  * and every time a rule is added.
283
  return scheduler_rule.find( '.sap-scheduler-brief .time .value' ).html( start + sap_scheduler.settings[scheduler_id].summaries['separator'] + end );
284
  }
285
  }
286
+
287
+ /**
288
+ * Register click events on load
289
+ */
290
+ sap_scheduler_register_events();
291
+
292
+ /**
293
+ * Enable datepickers on load
294
+ */
295
+ if ( typeof sap_scheduler.settings != 'undefined' ) {
296
+ for ( var key in sap_scheduler.settings ) {
297
+ var obj = sap_scheduler.settings[key];
298
+ $( '#' + key + ' .sap-scheduler-date-input input' ).pickadate({
299
+ format: obj.date_format,
300
+ });
301
+ $( '#' + key + ' .sap-scheduler-time-input input' ).pickatime({
302
+ interval: obj.time_interval,
303
+ format: obj.time_format,
304
+ });
305
+ }
306
+ }
307
+
308
+ /**
309
+ * Add a new scheduler panel
310
+ */
311
+ $( '.sap-add-scheduler a' ).click( function() {
312
+ var scheduler = $(this).parent().siblings( '.sap-scheduler' );
313
+ var scheduler_id = scheduler.attr( 'id' );
314
+ var scheduler_settings = sap_scheduler.settings[ scheduler_id ];
315
+ scheduler.append( scheduler_settings.template.replace( /\[0\]/g, '[' + scheduler.children( '.sap-scheduler-rule' ).length + ']' ) );
316
+ scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find( '.sap-scheduler-date-input input' ).pickadate({
317
+ format: scheduler_settings.date_format,
318
+ });
319
+ scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find( '.sap-scheduler-time-input input' ).pickatime({
320
+ interval: scheduler_settings.time_interval,
321
+ format: scheduler_settings.time_format,
322
+ });
323
+ sap_scheduler_register_events();
324
+
325
+ return false;
326
+ });
327
  }
328
 
329
  });
lib/simple-admin-pages/lib/pickadate/translations/ar.js CHANGED
@@ -1 +1 @@
1
- jQuery.extend(jQuery.fn.pickadate.defaults,{monthsFull:["يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","اغسطس","سبتمبر","اكتوبر","نوفمبر","ديسمبر"],monthsShort:["يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","اغسطس","سبتمبر","اكتوبر","نوفمبر","ديسمبر"],weekdaysFull:["الاحد","الاثنين","الثلاثاء","الاربعاء","الخميس","الجمعة","السبت"],weekdaysShort:["الاحد","الاثنين","الثلاثاء","الاربعاء","الخميس","الجمعة","السبت"],today:"اليوم",clear:"مسح",format:"yyyy mmmm dd",formatSubmit:"yyyy/mm/dd"});
1
+ $.extend($.fn.pickadate.defaults,{monthsFull:["يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","اغسطس","سبتمبر","اكتوبر","نوفمبر","ديسمبر"],monthsShort:["يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","اغسطس","سبتمبر","اكتوبر","نوفمبر","ديسمبر"],weekdaysFull:["الاحد","الاثنين","الثلاثاء","الاربعاء","الخميس","الجمعة","السبت"],weekdaysShort:["الاحد","الاثنين","الثلاثاء","الاربعاء","الخميس","الجمعة","السبت"],today:"اليوم",clear:"مسح",format:"yyyy mmmm dd",formatSubmit:"yyyy/mm/dd"});
readme.txt CHANGED
@@ -5,7 +5,7 @@ Plugin URL: http://themeofthecrop.com
5
  Requires at Least: 3.8
6
  Tested Up To: 3.9.1
7
  Tags: restaurant, reservations, bookings, table bookings, restaurant reservation, table reservation
8
- Stable tag: 1.1
9
  License: GPLv2 or later
10
  Donate link: http://themeofthecrop.com
11
 
@@ -56,6 +56,9 @@ This plugin is packed with hooks so you can extend it, customize it and rebrand
56
 
57
  == Changelog ==
58
 
 
 
 
59
  = 1.1 (2014-05-12) =
60
  * Attempt to load the correct language for the datepicker from the WordPress settings
61
  * Add support for choosing a language for the datepicker if different from WordPress settings
@@ -73,6 +76,9 @@ This plugin is packed with hooks so you can extend it, customize it and rebrand
73
 
74
  == Upgrade Notice ==
75
 
 
 
 
76
  = 1.1 =
77
  This update improves internationalization (i8n) by attempting to determine the appropriate language for the booking form datepicker from your WordPress settings. It also adds a setting to pick a language manually from a list of supported languages. This update also adds options to block late bookings at least 4 hours or 1 day in advance. Thanks to Remco and Roland for their early feedback.
78
 
5
  Requires at Least: 3.8
6
  Tested Up To: 3.9.1
7
  Tags: restaurant, reservations, bookings, table bookings, restaurant reservation, table reservation
8
+ Stable tag: 1.1.1
9
  License: GPLv2 or later
10
  Donate link: http://themeofthecrop.com
11
 
56
 
57
  == Changelog ==
58
 
59
+ = 1.1.1 (2014-05-14) =
60
+ * Update Simple Admin Pages library to fix broken Scheduler in Firefox
61
+
62
  = 1.1 (2014-05-12) =
63
  * Attempt to load the correct language for the datepicker from the WordPress settings
64
  * Add support for choosing a language for the datepicker if different from WordPress settings
76
 
77
  == Upgrade Notice ==
78
 
79
+ = 1.1.1 =
80
+ This update fixes problems some users reported when using the Firefox browser to modify the booking schedule. This required an update to a library that is shared with another plugin, Food and Drink Menu. If you are using that plugin, please update that one as well or you may get some odd behavior. (Thanks to sangwh and bforsoft for reporting the issue.)
81
+
82
  = 1.1 =
83
  This update improves internationalization (i8n) by attempting to determine the appropriate language for the booking form datepicker from your WordPress settings. It also adds a setting to pick a language manually from a list of supported languages. This update also adds options to block late bookings at least 4 hours or 1 day in advance. Thanks to Remco and Roland for their early feedback.
84
 
restaurant-reservations.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Restaurant Reservations
4
  * Plugin URI: http://themeofthecrop.com
5
  * Description: Accept restaurant reservations and bookings online.
6
- * Version: 1.1
7
  * Author: Theme of the Crop
8
  * Author URI: http://themeofthecrop.com
9
  * License: GNU General Public License v2.0 or later
3
  * Plugin Name: Restaurant Reservations
4
  * Plugin URI: http://themeofthecrop.com
5
  * Description: Accept restaurant reservations and bookings online.
6
+ * Version: 1.1.1
7
  * Author: Theme of the Crop
8
  * Author URI: http://themeofthecrop.com
9
  * License: GNU General Public License v2.0 or later