Responsive Menu - Version 3.0.16

Version Description

(21st October 2016) = * Requires PHP 5.4 * Added functionality for admin to remember last saved tab * Improved local scope of self

Download this release

Release Info

Developer ResponsiveMenu
Plugin Icon 128x128 Responsive Menu
Version 3.0.16
Comparing to
See all releases

Code changes from version 3.0.15 to 3.0.16

readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://responsive.menu/donate
4
  Tags: responsive, menu, responsive menu, mobile menu, wordpress responsive menu, wp responsive menu, tablet menu, mobile, tablet, 3 lines, 3 line, three line, three lines
5
  Requires at least: 3.5.0
6
  Tested up to: 4.6
7
- Stable tag: 3.0.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -119,6 +119,12 @@ To view our whole FAQ, please go to https://responsive.menu/faq/
119
 
120
  == Changelog ==
121
 
 
 
 
 
 
 
122
  = 3.0.15 (11th October 2016) =
123
  * **Requires PHP 5.4**
124
  * Added border size option
4
  Tags: responsive, menu, responsive menu, mobile menu, wordpress responsive menu, wp responsive menu, tablet menu, mobile, tablet, 3 lines, 3 line, three line, three lines
5
  Requires at least: 3.5.0
6
  Tested up to: 4.6
7
+ Stable tag: 3.0.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
119
 
120
  == Changelog ==
121
 
122
+ = 3.0.16 (21st October 2016) =
123
+ * **Requires PHP 5.4**
124
+ * Added functionality for admin to remember last saved tab
125
+ * Improved local scope of self = this variable in JavaScript
126
+ * Improved slide across animation option (Pro only)
127
+
128
  = 3.0.15 (11th October 2016) =
129
  * **Requires PHP 5.4**
130
  * Added border size option
responsive-menu.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Responsive Menu
5
  Plugin URI: https://responsive.menu
6
  Description: Highly Customisable Responsive Menu Plugin for WordPress
7
- Version: 3.0.15
8
  Author: Responsive Menu
9
  Text Domain: responsive-menu
10
  Author URI: https://responsive.menu
4
  Plugin Name: Responsive Menu
5
  Plugin URI: https://responsive.menu
6
  Description: Highly Customisable Responsive Menu Plugin for WordPress
7
+ Version: 3.0.16
8
  Author: Responsive Menu
9
  Text Domain: responsive-menu
10
  Author URI: https://responsive.menu
src/app/Controllers/Admin.php CHANGED
@@ -12,6 +12,10 @@ class Admin {
12
  }
13
 
14
  public function update($default_options, $new_options) {
 
 
 
 
15
  $updated_options = $this->service->combineOptions($default_options, $new_options);
16
  return $this->view->render('main', [
17
  'options' => $this->service->updateOptions($updated_options),
12
  }
13
 
14
  public function update($default_options, $new_options) {
15
+
16
+ update_option('responsive_menu_current_page', $new_options['responsive_menu_current_page']);
17
+ unset($new_options['responsive_menu_current_page']);
18
+
19
  $updated_options = $this->service->combineOptions($default_options, $new_options);
20
  return $this->view->render('main', [
21
  'options' => $this->service->updateOptions($updated_options),
src/app/Mappers/JsMapper.php CHANGED
@@ -113,7 +113,7 @@ class JsMapper {
113
  }
114
  },
115
  clearWrapperTranslate: function() {
116
- self = this;
117
  if(this.animationType == 'push') {
118
  $(this.pageWrapper).css({'transform':''});
119
  setTimeout(function() {
113
  }
114
  },
115
  clearWrapperTranslate: function() {
116
+ var self = this;
117
  if(this.animationType == 'push') {
118
  $(this.pageWrapper).css({'transform':''});
119
  setTimeout(function() {
src/app/ViewModels/Components/Admin/Boxes.php CHANGED
@@ -7,16 +7,20 @@ use ResponsiveMenu\Form;
7
  class Boxes {
8
 
9
  private $config;
 
 
10
 
11
- public function __construct(array $config, OptionsCollection $options) {
12
  $this->config = $config;
13
  $this->options = $options;
 
14
  }
15
 
16
  public function render() {
17
  $output = '';
18
  foreach($this->config as $tab_name => $sub_menus):
19
- $output .= '<div class="tab_container" id="tab_container_' . $this->i($tab_name) . '">';
 
20
  foreach($sub_menus as $sub_menu_name => $options):
21
  $output .= '
22
  <div class="postbox" id="postbox_' . $this->i($sub_menu_name).'">
7
  class Boxes {
8
 
9
  private $config;
10
+ private $options;
11
+ private $current_page;
12
 
13
+ public function __construct(array $config, OptionsCollection $options, $current_page) {
14
  $this->config = $config;
15
  $this->options = $options;
16
+ $this->current_page = $current_page;
17
  }
18
 
19
  public function render() {
20
  $output = '';
21
  foreach($this->config as $tab_name => $sub_menus):
22
+ $display = $this->i($tab_name) == $this->current_page ? 'block' : 'none';
23
+ $output .= '<div class="tab_container" id="tab_container_' . $this->i($tab_name) . '" style="display: ' . $display . ';">';
24
  foreach($sub_menus as $sub_menu_name => $options):
25
  $output .= '
26
  <div class="postbox" id="postbox_' . $this->i($sub_menu_name).'">
src/app/ViewModels/Components/Admin/Tabs.php CHANGED
@@ -5,18 +5,18 @@ namespace ResponsiveMenu\ViewModels\Components\Admin;
5
  class Tabs {
6
 
7
  private $config;
 
8
 
9
- public function __construct(array $config) {
10
  $this->config = $config;
 
11
  }
12
 
13
  public function render() {
14
- $i=0;
15
  $output = '';
16
  foreach(array_keys($this->config) as $tab_name) {
17
- $active_class = $i == 0 ? ' active_tab' : '';
18
  $output .= '<a id="tab_' . $this->i($tab_name) . '" class="tab page-title-action' . $active_class . '">' . $tab_name . '</a>';
19
- $i++;
20
  }
21
  return $output;
22
  }
5
  class Tabs {
6
 
7
  private $config;
8
+ private $current_tab;
9
 
10
+ public function __construct(array $config, $current_tab) {
11
  $this->config = $config;
12
+ $this->current_tab = $current_tab;
13
  }
14
 
15
  public function render() {
 
16
  $output = '';
17
  foreach(array_keys($this->config) as $tab_name) {
18
+ $active_class = $this->i($tab_name) == $this->current_tab ? ' active_tab' : '';
19
  $output .= '<a id="tab_' . $this->i($tab_name) . '" class="tab page-title-action' . $active_class . '">' . $tab_name . '</a>';
 
20
  }
21
  return $output;
22
  }
src/config/services.php CHANGED
@@ -3,7 +3,7 @@
3
  $container = new ResponsiveMenu\Routing\Container();
4
 
5
  $container['current_version'] = function($c) {
6
- return '3.0.15';
7
  };
8
 
9
  $container['option_helpers'] = function($c) {
3
  $container = new ResponsiveMenu\Routing\Container();
4
 
5
  $container['current_version'] = function($c) {
6
+ return '3.0.16';
7
  };
8
 
9
  $container['option_helpers'] = function($c) {
src/public/js/admin/main.js CHANGED
@@ -33,7 +33,9 @@ jQuery(function($) {
33
  });
34
 
35
  $(document).on('click', '.tab', function() {
36
- container_name = '#tab_container_' + $(this).attr('id').replace('tab_', '');
 
 
37
  $('.tab_container').css('display', 'none');
38
  $(container_name).css('display', 'block');
39
  $('.tab').removeClass('active_tab');
33
  });
34
 
35
  $(document).on('click', '.tab', function() {
36
+ tab_name = $(this).attr('id').replace('tab_', '');
37
+ container_name = '#tab_container_' + tab_name;
38
+ $('#responsive_menu_current_page').val(tab_name);
39
  $('.tab_container').css('display', 'none');
40
  $(container_name).css('display', 'block');
41
  $('.tab').removeClass('active_tab');
src/views/admin/main.phtml CHANGED
@@ -1,12 +1,14 @@
1
  <?php
2
 
3
- use ResponsiveMenu\Formatters\Tabs as Tabs;
4
- use ResponsiveMenu\Formatters\Text as Text;
 
5
  // This is horrible!
6
  include dirname(dirname(dirname(__FILE__))) . '/config/admin_ordering.php';
7
 
8
- $tabs = new ResponsiveMenu\ViewModels\Components\Admin\Tabs($order_mapping);
9
- $boxes = new ResponsiveMenu\ViewModels\Components\Admin\Boxes($order_mapping, $l['options']);
 
10
 
11
  ?>
12
  <div class="wrap">
@@ -25,10 +27,10 @@ $boxes = new ResponsiveMenu\ViewModels\Components\Admin\Boxes($order_mapping, $l
25
  <?php if(isset($l['flash']['errors'])): ?>
26
  <div class="notice notice-error is-dismissible" id="message">
27
  <ul>
28
- <?php foreach($l['flash']['errors'] as $error): ?>
29
- <li><?php _e($error, 'responsive-menu'); ?></li>
30
- <?php endforeach; ?>
31
- </ul>
32
  <button class="notice-dismiss" type="button">
33
  <span class="screen-reader-text">
34
  <?php _e('Dismiss this notice', 'responsive-menu') ?>.
@@ -52,6 +54,7 @@ $boxes = new ResponsiveMenu\ViewModels\Components\Admin\Boxes($order_mapping, $l
52
  <div class="meta-box-sortables ui-sortable" id="normal-sortables">
53
  <form action="" method="post" enctype="multipart/form-data" id="responsive_menu_form">
54
  <input type="submit" class="button submit" name="responsive_menu_submit" value="<?php _e('Update Options', 'responsive-menu'); ?>" style="display: none;" />
 
55
  <div id="options_list_container">
56
  <?php echo $boxes->render(); ?>
57
  </div>
1
  <?php
2
 
3
+ use ResponsiveMenu\Formatters\Tabs;
4
+ use ResponsiveMenu\Formatters\Text;
5
+
6
  // This is horrible!
7
  include dirname(dirname(dirname(__FILE__))) . '/config/admin_ordering.php';
8
 
9
+ $current_page = get_option('responsive_menu_current_page', 'initial_setup');
10
+ $tabs = new ResponsiveMenu\ViewModels\Components\Admin\Tabs($order_mapping, $current_page);
11
+ $boxes = new ResponsiveMenu\ViewModels\Components\Admin\Boxes($order_mapping, $l['options'], $current_page);
12
 
13
  ?>
14
  <div class="wrap">
27
  <?php if(isset($l['flash']['errors'])): ?>
28
  <div class="notice notice-error is-dismissible" id="message">
29
  <ul>
30
+ <?php foreach($l['flash']['errors'] as $error): ?>
31
+ <li><?php _e($error, 'responsive-menu'); ?></li>
32
+ <?php endforeach; ?>
33
+ </ul>
34
  <button class="notice-dismiss" type="button">
35
  <span class="screen-reader-text">
36
  <?php _e('Dismiss this notice', 'responsive-menu') ?>.
54
  <div class="meta-box-sortables ui-sortable" id="normal-sortables">
55
  <form action="" method="post" enctype="multipart/form-data" id="responsive_menu_form">
56
  <input type="submit" class="button submit" name="responsive_menu_submit" value="<?php _e('Update Options', 'responsive-menu'); ?>" style="display: none;" />
57
+ <input type="hidden" id="responsive_menu_current_page" name="menu[responsive_menu_current_page]" value="<?php echo $current_page; ?>" />
58
  <div id="options_list_container">
59
  <?php echo $boxes->render(); ?>
60
  </div>
tests/app/Controllers/AdminTest.php CHANGED
@@ -10,7 +10,13 @@ class AdminTest extends TestCase {
10
  function __($a, $b) {
11
  return $a;
12
  }
 
 
 
 
 
13
  }
 
14
  public function setUp() {
15
  $this->view = $this->createMock('ResponsiveMenu\View\AdminView');
16
  $this->service = $this->createMock('ResponsiveMenu\Services\OptionService');
@@ -25,7 +31,7 @@ class AdminTest extends TestCase {
25
  }
26
 
27
  public function testUpdate() {
28
- $this->assertTrue($this->controller->update([],[]));
29
  }
30
 
31
  public function testReset() {
10
  function __($a, $b) {
11
  return $a;
12
  }
13
+ if(!function_exists('update_option')):
14
+ function update_option($a, $b) {
15
+ return $a . ' ' . $b;
16
+ }
17
+ endif;
18
  }
19
+
20
  public function setUp() {
21
  $this->view = $this->createMock('ResponsiveMenu\View\AdminView');
22
  $this->service = $this->createMock('ResponsiveMenu\Services\OptionService');
31
  }
32
 
33
  public function testUpdate() {
34
+ $this->assertTrue($this->controller->update([],['responsive_menu_current_page' => true]));
35
  }
36
 
37
  public function testReset() {
tests/app/Database/WpDatabaseTest.php CHANGED
@@ -17,12 +17,6 @@ class WpDatabaseTest extends TestCase {
17
  return '0000';
18
  }
19
  endif;
20
-
21
- if(!function_exists('update_option')):
22
- function update_option($a, $b) {
23
- return $a . ' ' . $b;
24
- }
25
- endif;
26
  }
27
 
28
  public function testUpdate() {
17
  return '0000';
18
  }
19
  endif;
 
 
 
 
 
 
20
  }
21
 
22
  public function testUpdate() {
tests/app/ViewModels/Components/Admin/BoxesTest.php CHANGED
@@ -35,7 +35,7 @@ class BoxesTest extends TestCase {
35
  ]
36
  ]
37
  ]
38
- ], $this->collection);
39
  }
40
 
41
  public function testRender() {
35
  ]
36
  ]
37
  ]
38
+ ], $this->collection, 'a_value');
39
  }
40
 
41
  public function testRender() {
tests/app/ViewModels/Components/Admin/TabsTest.php CHANGED
@@ -9,11 +9,10 @@ use ResponsiveMenu\Collections\OptionsCollection;
9
  class TabsTest extends TestCase {
10
 
11
  public function setUp() {
12
- $this->component = new Tabs(['a one' => '1', 'b two' => '2']);
13
  }
14
 
15
  public function testRender() {
16
-
17
  $rendered = $this->component->render();
18
  $this->assertContains('id="tab_a_one"', $rendered);
19
  $this->assertContains('id="tab_b_two"', $rendered);
9
  class TabsTest extends TestCase {
10
 
11
  public function setUp() {
12
+ $this->component = new Tabs(['a one' => '1', 'b two' => '2'], 'a_one');
13
  }
14
 
15
  public function testRender() {
 
16
  $rendered = $this->component->render();
17
  $this->assertContains('id="tab_a_one"', $rendered);
18
  $this->assertContains('id="tab_b_two"', $rendered);