Version Description
(5th July 2016) = * Requires PHP 5.4 - Please ensure you have it installed to work * Version 3 released! * Please login to your admin and hit 'Update Options' upon installing on all sites * Awesome FontIcon integration * Much Smoother Animations * Button Animations * And much, much more * Many bug fixes * Completely re-written from the ground up
Download this release
Release Info
Developer | ResponsiveMenu |
Plugin | Responsive Menu |
Version | 3.0.0 |
Comparing to | |
See all releases |
Version 3.0.0
- autoload.php +13 -0
- readme.txt +370 -0
- responsive-menu.php +42 -0
- src/app/Collections/OptionsCollection.php +79 -0
- src/app/Controllers/Admin/Base.php +16 -0
- src/app/Controllers/Admin/Main.php +97 -0
- src/app/Controllers/Base.php +16 -0
- src/app/Controllers/Front.php +44 -0
- src/app/Database/Database.php +11 -0
- src/app/Database/Migration.php +193 -0
- src/app/Database/WpDatabase.php +42 -0
- src/app/Factories/AdminSaveFactory.php +45 -0
- src/app/Factories/CssFactory.php +34 -0
- src/app/Factories/FrontDisplayFactory.php +41 -0
- src/app/Factories/JsFactory.php +23 -0
- src/app/Factories/OptionFactory.php +35 -0
- src/app/Filesystem/FileCreator.php +30 -0
- src/app/Filters/Filter.php +8 -0
- src/app/Filters/HtmlFilter.php +12 -0
- src/app/Filters/JsonFilter.php +12 -0
- src/app/Filters/TextFilter.php +12 -0
- src/app/Form/Checkbox.php +28 -0
- src/app/Form/Colour.php +19 -0
- src/app/Form/Export.php +13 -0
- src/app/Form/FontIconPageList.php +74 -0
- src/app/Form/FormComponent.php +8 -0
- src/app/Form/HeaderBarOrdering.php +49 -0
- src/app/Form/Image.php +25 -0
- src/app/Form/Import.php +14 -0
- src/app/Form/MenuOrdering.php +49 -0
- src/app/Form/Reset.php +13 -0
- src/app/Form/Select.php +24 -0
- src/app/Form/Text.php +20 -0
- src/app/Form/TextArea.php +17 -0
- src/app/Formatters/Minify.php +24 -0
- src/app/Formatters/Tabs.php +53 -0
- src/app/Formatters/Text.php +16 -0
- src/app/Mappers/JsMapper.php +186 -0
- src/app/Mappers/ScssBaseMapper.php +235 -0
- src/app/Mappers/ScssButtonMapper.php +62 -0
- src/app/Mappers/ScssMapper.php +19 -0
- src/app/Mappers/ScssMenuMapper.php +149 -0
- src/app/Mappers/scssphp/.travis.yml +7 -0
- src/app/Mappers/scssphp/LICENSE.md +660 -0
- src/app/Mappers/scssphp/Makefile +3 -0
- src/app/Mappers/scssphp/README.md +34 -0
- src/app/Mappers/scssphp/composer.json +28 -0
- src/app/Mappers/scssphp/phpunit.xml.dist +28 -0
- src/app/Mappers/scssphp/pscss +53 -0
- src/app/Mappers/scssphp/scss.inc.php +4576 -0
- src/app/Mappers/scssphp/tests/ApiTest.php +80 -0
- src/app/Mappers/scssphp/tests/ExceptionTest.php +86 -0
- src/app/Mappers/scssphp/tests/InputTest.php +83 -0
- src/app/Mappers/scssphp/tests/compare-scss.sh +25 -0
- src/app/Mappers/scssphp/tests/inputs/builtins.scss +171 -0
- src/app/Mappers/scssphp/tests/inputs/comments.scss +28 -0
- src/app/Mappers/scssphp/tests/inputs/compass_extract.scss +248 -0
- src/app/Mappers/scssphp/tests/inputs/content.scss +61 -0
- src/app/Mappers/scssphp/tests/inputs/content_with_function.scss +17 -0
- src/app/Mappers/scssphp/tests/inputs/default_args.scss +15 -0
- src/app/Mappers/scssphp/tests/inputs/directives.scss +108 -0
- src/app/Mappers/scssphp/tests/inputs/extends.scss +184 -0
- src/app/Mappers/scssphp/tests/inputs/filter_effects.scss +48 -0
- src/app/Mappers/scssphp/tests/inputs/functions.scss +81 -0
- src/app/Mappers/scssphp/tests/inputs/ie7.scss +12 -0
- src/app/Mappers/scssphp/tests/inputs/if.scss +76 -0
- src/app/Mappers/scssphp/tests/inputs/if_on_null.scss +8 -0
- src/app/Mappers/scssphp/tests/inputs/import.scss +23 -0
- src/app/Mappers/scssphp/tests/inputs/imports/_partial.scss +10 -0
- src/app/Mappers/scssphp/tests/inputs/imports/simple.scss +4 -0
- src/app/Mappers/scssphp/tests/inputs/interpolation.scss +86 -0
- src/app/Mappers/scssphp/tests/inputs/keyword_args.scss +24 -0
- src/app/Mappers/scssphp/tests/inputs/list.scss +15 -0
- src/app/Mappers/scssphp/tests/inputs/looping.scss +51 -0
- src/app/Mappers/scssphp/tests/inputs/media.scss +208 -0
- src/app/Mappers/scssphp/tests/inputs/mixins.scss +158 -0
- src/app/Mappers/scssphp/tests/inputs/nesting.scss +45 -0
- src/app/Mappers/scssphp/tests/inputs/null.scss +41 -0
- src/app/Mappers/scssphp/tests/inputs/operators.scss +143 -0
- src/app/Mappers/scssphp/tests/inputs/placeholder_selector.scss +18 -0
- src/app/Mappers/scssphp/tests/inputs/scss_css.scss +986 -0
- src/app/Mappers/scssphp/tests/inputs/selectors.scss +187 -0
- src/app/Mappers/scssphp/tests/inputs/values.scss +43 -0
- src/app/Mappers/scssphp/tests/inputs/variables.scss +56 -0
- src/app/Mappers/scssphp/tests/outputs/builtins.css +126 -0
- src/app/Mappers/scssphp/tests/outputs/comments.css +19 -0
- src/app/Mappers/scssphp/tests/outputs/compass_extract.css +28 -0
- src/app/Mappers/scssphp/tests/outputs/content.css +29 -0
- src/app/Mappers/scssphp/tests/outputs/content_with_function.css +2 -0
- src/app/Mappers/scssphp/tests/outputs/default_args.css +3 -0
- src/app/Mappers/scssphp/tests/outputs/directives.css +77 -0
- src/app/Mappers/scssphp/tests/outputs/extends.css +87 -0
- src/app/Mappers/scssphp/tests/outputs/filter_effects.css +20 -0
- src/app/Mappers/scssphp/tests/outputs/functions.css +22 -0
- src/app/Mappers/scssphp/tests/outputs/ie7.css +8 -0
- src/app/Mappers/scssphp/tests/outputs/if.css +21 -0
- src/app/Mappers/scssphp/tests/outputs/if_on_null.css +2 -0
- src/app/Mappers/scssphp/tests/outputs/import.css +27 -0
- src/app/Mappers/scssphp/tests/outputs/interpolation.css +54 -0
- src/app/Mappers/scssphp/tests/outputs/keyword_args.css +6 -0
- src/app/Mappers/scssphp/tests/outputs/list.css +7 -0
- src/app/Mappers/scssphp/tests/outputs/looping.css +45 -0
- src/app/Mappers/scssphp/tests/outputs/media.css +103 -0
- src/app/Mappers/scssphp/tests/outputs/mixins.css +83 -0
- src/app/Mappers/scssphp/tests/outputs/nesting.css +22 -0
- src/app/Mappers/scssphp/tests/outputs/null.css +21 -0
- src/app/Mappers/scssphp/tests/outputs/operators.css +105 -0
- src/app/Mappers/scssphp/tests/outputs/placeholder_selector.css +7 -0
- src/app/Mappers/scssphp/tests/outputs/scss_css.css +741 -0
- src/app/Mappers/scssphp/tests/outputs/selectors.css +335 -0
- src/app/Mappers/scssphp/tests/outputs/values.css +34 -0
- src/app/Mappers/scssphp/tests/outputs/variables.css +24 -0
- src/app/Models/ComplexOption.php +130 -0
- src/app/Models/Option.php +13 -0
- src/app/Models/SimpleOption.php +36 -0
- src/app/Repositories/Options/BaseOptionRepository.php +13 -0
- src/app/Repositories/Options/ComplexOptionRepository.php +25 -0
- src/app/Repositories/Options/ReadRepository.php +7 -0
- src/app/Repositories/Options/Repository.php +9 -0
- src/app/Repositories/Options/SimpleOptionReadRepository.php +18 -0
- src/app/Routing/Container.php +282 -0
- src/app/Routing/Routing.php +8 -0
- src/app/Routing/WpRouting.php +57 -0
- src/app/View/AdminView.php +40 -0
- src/app/View/FrontView.php +24 -0
- src/app/View/View.php +8 -0
- src/app/ViewModels/Button.php +19 -0
- src/app/ViewModels/Components/Admin/Boxes.php +102 -0
- src/app/ViewModels/Components/Admin/Tabs.php +23 -0
- src/app/ViewModels/Components/Button/Button.php +35 -0
- src/app/ViewModels/Components/Menu/AdditionalContent.php +20 -0
- src/app/ViewModels/Components/Menu/Menu.php +30 -0
- src/app/ViewModels/Components/Menu/Search.php +21 -0
- src/app/ViewModels/Components/Menu/Title.php +29 -0
- src/app/ViewModels/Components/ViewComponent.php +11 -0
- src/app/ViewModels/Menu.php +32 -0
- src/app/WPML/WPML.php +15 -0
- src/app/Walkers/WpWalker.php +118 -0
- src/config/admin_ordering.php +1127 -0
- src/config/default_options.php +151 -0
- src/config/option_helpers.php +19 -0
- src/config/route_dependencies.php +35 -0
- src/public/css/admin/main.css +695 -0
- src/public/js/admin/main.js +70 -0
- src/public/js/admin/postbox-edit.js +4 -0
- src/public/js/admin/sticky-sidebar.js +9 -0
- src/public/scss/hamburgers/_base.scss +69 -0
- src/public/scss/hamburgers/hamburgers.scss +58 -0
- src/public/scss/hamburgers/types/_boring.scss +30 -0
- src/views/admin/main.phtml +91 -0
- src/views/button.phtml +1 -0
- src/views/header_bar.phtml +3 -0
- src/views/menu.phtml +8 -0
autoload.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
spl_autoload_register( function( $class_name ) {
|
4 |
+
|
5 |
+
$strip_namespace = str_replace( 'ResponsiveMenu\\', '', $class_name );
|
6 |
+
$file_name = str_replace( '\\', '/', $strip_namespace );
|
7 |
+
|
8 |
+
$file = __DIR__ . '/src/app/' . $file_name . '.php';
|
9 |
+
|
10 |
+
if(file_exists($file))
|
11 |
+
include $file;
|
12 |
+
|
13 |
+
} );
|
readme.txt
ADDED
@@ -0,0 +1,370 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Responsive Menu ===
|
2 |
+
Contributors: ResponsiveMenu
|
3 |
+
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
|
4 |
+
Requires at least: 3.5.0
|
5 |
+
Tested up to: 4.5.3
|
6 |
+
Stable tag: 3.0.0
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
This is a Highly Customisable Responsive Menu Plugin for WordPress
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
This is a Highly Customisable Responsive Menu Plugin for WordPress, with over 120 customisable options giving you a combination of 14,000 options!
|
15 |
+
<br /><br />
|
16 |
+
**Requires PHP 5.4+**, please ensure you have this installed before upgrading.
|
17 |
+
<br /><br />
|
18 |
+
With this plugin, you can edit the following and more:
|
19 |
+
<ul>
|
20 |
+
<li>Menu Title</li>
|
21 |
+
<li>Menu Title Image</li>
|
22 |
+
<li>Button Title</li>
|
23 |
+
<li>Button Title Image</li>
|
24 |
+
<li>Menu To Responsify</li>
|
25 |
+
<li>Media Query Breakpoint Width</li>
|
26 |
+
<li>CSS Options For Hiding Specific Elements</li>
|
27 |
+
<li>Menu Depth To Display</li>
|
28 |
+
<li>Top Location</li>
|
29 |
+
<li>Right Percentage Location</li>
|
30 |
+
<li>Line & Text Colour</li>
|
31 |
+
<li>Menu Button Background Colour</li>
|
32 |
+
<li>Absolute and Fixed Positioning</li>
|
33 |
+
<li>Menu Font</li>
|
34 |
+
<li>Menu Title Colour</li>
|
35 |
+
<li>Menu Title Hover Colour</li>
|
36 |
+
<li>Menu Title Background Colour</li>
|
37 |
+
<li>Menu Text Colour</li>
|
38 |
+
<li>Menu Text Hover Colour</li>
|
39 |
+
<li>Menu Background Colour</li>
|
40 |
+
<li>Menu Link Background Hover Colour</li>
|
41 |
+
<li>Menu Text Size</li>
|
42 |
+
<li>Menu Button Text Size</li>
|
43 |
+
<li>Menu Links Text Size</li>
|
44 |
+
<li>Choose Overlay or Push Animations</li>
|
45 |
+
<li>Slide Animation Speed</li>
|
46 |
+
<li>Ability to auto expand/hide sub-menus</li>
|
47 |
+
<li>Inclusion/Exclusion of Search Box</li>
|
48 |
+
<li>Choice of Positioning of Search Box</li>
|
49 |
+
<li>Transition speed</li>
|
50 |
+
<li>Slide Animation Speed</li>
|
51 |
+
<li>Menu Link Heights</li>
|
52 |
+
<li>Text Alignment</li>
|
53 |
+
<li>Choice of side to slide in from (left, right, top, bottom)</li>
|
54 |
+
<li>Choice to use inline/external stylesheets and scripts</li>
|
55 |
+
<li>Option to include JavaScript in footer</li>
|
56 |
+
<li>Option to remove CSS !important tags</li>
|
57 |
+
<li>Choice to Minify created CSS and JS files (saves up to 50% file space)</li>
|
58 |
+
<li>Choice to auto-close menu items on click (for single page sites)</li>
|
59 |
+
<li>Choice to replace 3 lines with an x on click</li>
|
60 |
+
<li>Minimum width of menu</li>
|
61 |
+
<li>Maximum width of menu</li>
|
62 |
+
<li>Choice to Auto Expand Parent Links</li>
|
63 |
+
<li>Choice to Ignore Clicks on Ancestor Links</li>
|
64 |
+
<li>Choice to Close Menu Automatically on Page Clicks</li>
|
65 |
+
<li>Choice to Specify Title Menu Link</li>
|
66 |
+
<li>Choice to Specify Title Menu Link Location</li>
|
67 |
+
<li>Ability to add custom HTML snippet inside the menu</li>
|
68 |
+
<li>Choice of location for custom HTML snippet inside the menu</li>
|
69 |
+
<li>Choice of using shortode or not</li>
|
70 |
+
<li>Ability to change the 3 lines height</li>
|
71 |
+
<li>Ability to change the 3 lines width</li>
|
72 |
+
<li>Ability to Export Options</li>
|
73 |
+
<li>Ability to Import Options</li>
|
74 |
+
<li>Ability to set sub menu arrow shape/image Options</li>
|
75 |
+
<li>Ability to set custom click trigger</li>
|
76 |
+
<li>Ability to push menu button with animation</li>
|
77 |
+
<li>Ability to change Current Page background hover colour</li>
|
78 |
+
<li>Ability to change Current Page Link hover colour</li>
|
79 |
+
<li>Ability to provide a custom walker option</li>
|
80 |
+
<li>Ability to choose to use transient caching or not</li>
|
81 |
+
<li>Ability to choose if menu is shown on left or right of screen</li>
|
82 |
+
<li>Ability to set theme location menu</li>
|
83 |
+
<li>Ability to reset to default</li>
|
84 |
+
<li>Ability to set menu text location</li>
|
85 |
+
<li>Ability to set menu text line height</li>
|
86 |
+
<li>Plus more...</li>
|
87 |
+
</ul>
|
88 |
+
The plugin creates a nice three-lined mobile menu button (or custom image if you choose) that users can click on to bring a slide out menu (from the left, right, top or bottom - again your choice), which is easily navigated.
|
89 |
+
<br /><br />
|
90 |
+
It is fully responsive if you have the viewport meta tag on your site, using media queries with the widths defined by you. It can be used as a responsive menu, mobile menu, tablet menu or full dedicated menu for your main site.
|
91 |
+
<br /><br />
|
92 |
+
It requires no shortcodes (although you can use them) or fancy php code to be inserted by yourself making it very easy to install and you can design it to look exactly as you want to or leave it with its default values to have it looking amazing in just a matter of seconds.
|
93 |
+
<br /><br />
|
94 |
+
You have the choice to include the stylesheets and scripts inline to avoid adding any extra HTTP requests to your site or through external stylesheets created by the plug-in. Either way, the code added is extremely small (only a little jQuery and CSS) and there is even an option to minify the output if you wish saving a further 50% on file space.
|
95 |
+
<br /><br />
|
96 |
+
It also includes the following functionality:
|
97 |
+
<ul>
|
98 |
+
<li>WPML/Polylang Support</li>
|
99 |
+
</ul>
|
100 |
+
If you decide to go Pro then you will also get the following functionality:
|
101 |
+
<ul>
|
102 |
+
<li>FontIcon Support for individual menu items</li>
|
103 |
+
<li>Button Animation Effects</li>
|
104 |
+
<li>Colour Opacity option</li>
|
105 |
+
<li>Header Bar</li>
|
106 |
+
<li>Single Menu Option</li>
|
107 |
+
</ul>
|
108 |
+
For more reasons to go Pro, please visit <a target="_blank" href="https://responsive.menu/why-go-pro/">this page</a>.
|
109 |
+
If you would like to see any other options added to the plugin or would like to help with translating the plugin into various languages then please email me or place them in a support ticket.
|
110 |
+
<br />
|
111 |
+
|
112 |
+
== Installation ==
|
113 |
+
|
114 |
+
1. Upload `responsive-menu` to the `/wp-content/plugins/` directory
|
115 |
+
2. Activate the plugin through the `Plugins` menu in WordPress
|
116 |
+
3. Set your options from the Responsive Menu admin area
|
117 |
+
|
118 |
+
Alternatively:
|
119 |
+
|
120 |
+
1. Login to your WordPress admin area
|
121 |
+
2. Search for `Responsive Menu`
|
122 |
+
3. Click install `Responsive Menu`
|
123 |
+
4. Activate through the `Plugins` menu in WordPress or when asked during installation
|
124 |
+
5. Set your options from the Responsive Menu admin area
|
125 |
+
|
126 |
+
== Frequently Asked Questions ==
|
127 |
+
|
128 |
+
1. Why do I get the error `Parse error: syntax error, unexpected '[' in /home/..../wp-content/plugins/responsive-menu/src/app/Routing/WpRouting.php on line 19`?
|
129 |
+
|
130 |
+
This is due to your PHP version not being high enough, you need at least PHP 5.4 for the plugin to work.
|
131 |
+
|
132 |
+
2. I am getting a message similar to `Fatal error: Uncaught exception 'Exception' with message 'parse error: failed at $hamburger-layer-color: ;`, why?
|
133 |
+
|
134 |
+
All you need to do is login to your WordPress admin, go to my plugin page and hit 'Update Options' to fix this.
|
135 |
+
|
136 |
+
To view our whole FAQ, please go to https://responsive.menu/faq/
|
137 |
+
|
138 |
+
== Screenshots ==
|
139 |
+
|
140 |
+
1. Fully customisable Admin Screen
|
141 |
+
|
142 |
+
2. Example Front End Menu Button
|
143 |
+
|
144 |
+
3. Example Front End Expanded Menu
|
145 |
+
|
146 |
+
== Changelog ==
|
147 |
+
|
148 |
+
= 3.0.0 (5th July 2016) =
|
149 |
+
* **Requires PHP 5.4** - Please ensure you have it installed to work
|
150 |
+
* Version 3 released!
|
151 |
+
* Please login to your admin and hit 'Update Options' upon installing on all sites
|
152 |
+
* Awesome FontIcon integration
|
153 |
+
* Much Smoother Animations
|
154 |
+
* Button Animations
|
155 |
+
* And much, much more
|
156 |
+
* Many bug fixes
|
157 |
+
* Completely re-written from the ground up
|
158 |
+
|
159 |
+
= 2.8.9 (17th June 2016) =
|
160 |
+
* Last Version 2 release with beta notice
|
161 |
+
|
162 |
+
= 2.8.8 (12th May 2016) =
|
163 |
+
* Added class to body when menu is opened
|
164 |
+
|
165 |
+
= 2.8.7 =
|
166 |
+
* Added absolute paths to file inclusions
|
167 |
+
* Added ability to set menu title text location (top, bottom, left, right)
|
168 |
+
* Added ability to set menu title text line height (useful for above)
|
169 |
+
* Fixed width on custom menu images for consistency
|
170 |
+
|
171 |
+
= 2.8.6 (28th January 2016) =
|
172 |
+
* Added Menu Title Link to WPML
|
173 |
+
* Fixed issue with fixed menu widths and push animation
|
174 |
+
|
175 |
+
= 2.8.5 (11th Sept 2015) =
|
176 |
+
* Fixed menu not opening on first click bug
|
177 |
+
* Added empty check to additional html content
|
178 |
+
|
179 |
+
= 2.8.4 (19th Aug 2015) =
|
180 |
+
* Fixed middle mouse scroll button bug
|
181 |
+
|
182 |
+
= 2.8.3 (13th Aug 2015) =
|
183 |
+
* Fixed bug with accordion sub arrows not re-setting correctly
|
184 |
+
|
185 |
+
= 2.8.2 (13th Aug 2015) =
|
186 |
+
* Fixed bug with push animation from right side
|
187 |
+
|
188 |
+
= 2.8.1 (27th July 2015) =
|
189 |
+
* Import/Export issue with geometric shapes fixed
|
190 |
+
* Default export.xml file added
|
191 |
+
* Other bugfixes
|
192 |
+
|
193 |
+
= 2.8 (26th July 2015) =
|
194 |
+
* Launched Pro Version 1.0 with:
|
195 |
+
- Ability to use as the only menu on the site (responsive and desktop)
|
196 |
+
- Option to only show on mobile using wp_is_mobile()
|
197 |
+
- Various colour themes
|
198 |
+
- Header bar creator
|
199 |
+
- Menu Auto-Height option
|
200 |
+
- Background scrolling disabled option
|
201 |
+
* Added "Reset to default" option
|
202 |
+
* Removed Metatag check
|
203 |
+
* Improved transient caching
|
204 |
+
* Bugfixes
|
205 |
+
|
206 |
+
= 2.7 (14th June 2015) =
|
207 |
+
* Added Navigation Tabs for Admin Pages -thanks to mkdgs for this!
|
208 |
+
* Bugfixes
|
209 |
+
|
210 |
+
= 2.6 (26th May 2015) =
|
211 |
+
* Added Theme Location options - useful for Polylang - Thanks to mkdgs for this
|
212 |
+
* Fixed Issue with Auto-Expanding Links
|
213 |
+
* Fixed Issue with Data Folders Incorrect Location
|
214 |
+
|
215 |
+
= 2.5 (20th May 2015) =
|
216 |
+
* Fixed issue with duplicate sub menu arrows
|
217 |
+
* Added option to set if menu is shown on left or right
|
218 |
+
* Fixed issue with custom sub menu classes
|
219 |
+
* Button now compatible with Apple Voiceover
|
220 |
+
* Changed "X" close icon to the math symbol "x" - Thanks to patlog for the idea!
|
221 |
+
* Added many more shortcode options as below:
|
222 |
+
|
223 |
+
- "title"
|
224 |
+
- "title_link"
|
225 |
+
- "title_open"
|
226 |
+
- "title_img"
|
227 |
+
- "html"
|
228 |
+
- "html_loc"
|
229 |
+
- "search_loc"
|
230 |
+
- "btn_img"
|
231 |
+
- "btn_img_clicked"
|
232 |
+
- "btn_title"
|
233 |
+
|
234 |
+
= 2.4 (18th Feb 2015) =
|
235 |
+
|
236 |
+
* Added option to turn transient caching off as it causes issues with active link colours etc.
|
237 |
+
* Made Menu clear the transient caches and rebuild menu on Menu/Page/Post updates.
|
238 |
+
|
239 |
+
= 2.3 (16th Feb 2015) =
|
240 |
+
|
241 |
+
* Added ability to set custom click menu trigger
|
242 |
+
* Added ability to set custom walker function - Thanks to Mickael Desgranges for this
|
243 |
+
* Added option to push menu button with animation
|
244 |
+
* Added option to change Current Page background hover colour
|
245 |
+
* Added option to change Current Page Link hover colour
|
246 |
+
* Fixed issue with accordion menu not retracting
|
247 |
+
* Enabled 0 values for animation speed to in affect remove animation
|
248 |
+
* Added easy view of Shortcode options in admin
|
249 |
+
* Added ability to place shortcodes in extra html content - Thanks to Mickael Desgranges for this
|
250 |
+
* Leveraged WordPress persistent transient caching to significantly increase load speed
|
251 |
+
|
252 |
+
= 2.2 (29th Oct 2014) =
|
253 |
+
|
254 |
+
* Added Ability to Export Options
|
255 |
+
* Added Ability to Import Options
|
256 |
+
* Added option to change 3 lines width
|
257 |
+
* Added option to change 3 lines height
|
258 |
+
* Added option to change 3 lines margin
|
259 |
+
* Added option to change sub arrows using HTML shape or Image
|
260 |
+
* Added option to change the click menu image once clicked
|
261 |
+
* Sub Menu Animation added to improve smoothness
|
262 |
+
* Accordion sub menu animation option
|
263 |
+
* Added shortcode option to change menu (use "RM" argument) eg. [responsive-menu RM="footer-menu"]
|
264 |
+
* Minor bug fixes
|
265 |
+
|
266 |
+
= 2.1 (17th Aug 2014) =
|
267 |
+
|
268 |
+
* Basic shortcode support added - To use, tick the option in the admin and use the shortcode [responsive-menu]
|
269 |
+
* Multiple bug fixes
|
270 |
+
|
271 |
+
= 2.0 (13th Aug 2014) =
|
272 |
+
|
273 |
+
*** WE HAVE REACHED OVER 50 CUSTOMISABLE OPTIONS! ***
|
274 |
+
|
275 |
+
* Complete overhaul of the codebase
|
276 |
+
* Increased menu depth to 5
|
277 |
+
* Added Spanish Translation - Massive thanks to Andrew @ <a href="http://www.webhostinghub.com">WebHostingHub</a> for this!
|
278 |
+
* 'Double Click' menu bug fixed
|
279 |
+
* Various bug fixes
|
280 |
+
* Added Choice to Auto Expand Parent Links
|
281 |
+
* Added Choice to Ignore Clicks on Ancestor Links
|
282 |
+
* Added Choice to Close Menu Automatically on Page Clicks
|
283 |
+
* Added Top and Bottom Slide Options
|
284 |
+
* Added Option to set a Maximum Width for the menu
|
285 |
+
* Added Choice of Positioning of Search Box
|
286 |
+
* Added Choice to Specify Title Menu Link
|
287 |
+
* Added Choice to Specify Title Menu Link Location
|
288 |
+
* Added Ability to add custom HTML snippet inside the menu
|
289 |
+
* Added Choice of location for custom HTML snippet inside the menu
|
290 |
+
* Detect if WP Login bar is active and adjust accordingly
|
291 |
+
|
292 |
+
= 1.9 (5th Apr 2014) =
|
293 |
+
|
294 |
+
* Changed where custom CSS/JS files are stored. If you have issues when upgrading, please just click "Update Options" from admin and this should return back to normal.
|
295 |
+
* Added option to include scripts in footer
|
296 |
+
* Added ability to upload custom menu button image to replace the 3 lines
|
297 |
+
* Added ability to close menu on each link click (good for single page sites)
|
298 |
+
* Added ability to minify output (saving 50% on file size)
|
299 |
+
* Remove title section if title and image are empty
|
300 |
+
* Added ability to change 3 lines to an x when clicked
|
301 |
+
* Added ability to set the minimum width of the menu
|
302 |
+
* Added Croatian Translation - Massive thanks to <a href="https://www.facebook.com/pages/Neverone-design/490262371018076">Neverone Design</a> for this!
|
303 |
+
|
304 |
+
= 1.8 (26th Mar 2014) =
|
305 |
+
|
306 |
+
* Added option to include styles/scripts externally/internally
|
307 |
+
* Added WPML Support
|
308 |
+
* Added internationalisation functionality, awaiting translations
|
309 |
+
* Added ability to choose which side the menu slides in from
|
310 |
+
* Minor Code Improvements
|
311 |
+
|
312 |
+
= 1.7 (13th Mar 2014) =
|
313 |
+
|
314 |
+
* Ability to auto expand/hide sub-menus
|
315 |
+
* Inclusion/Exclusion of Search Box
|
316 |
+
* Transition speed
|
317 |
+
* Slide Animation Speed
|
318 |
+
* Menu Link Heights
|
319 |
+
* Text Alignment
|
320 |
+
* Removed potential jQuery conflicts
|
321 |
+
* Minor Code Improvements
|
322 |
+
|
323 |
+
= 1.6 (6th Mar 2014) =
|
324 |
+
|
325 |
+
* Added Animation Options Section
|
326 |
+
* Added Animation Speed Customisation Option
|
327 |
+
* Added Choice Of Slide Animation (Overlay or Push)
|
328 |
+
* Added Menu Title Background Colour Customisation Option
|
329 |
+
* Added Menu Title Font Size Customisation Option
|
330 |
+
* Added Click Menu Title Font Size Customisation Option
|
331 |
+
* Added Menu Links Font Size Customisation Option
|
332 |
+
* Removed Image Size Restriction
|
333 |
+
* Minor Code Improvements
|
334 |
+
|
335 |
+
= 1.5 (4th Mar 2014) =
|
336 |
+
|
337 |
+
* Added Menu Title Colour Customisation Option
|
338 |
+
* Added Menu Title Hover Colour Customisation Option
|
339 |
+
* Added Menu Text Colour Customisation Option
|
340 |
+
* Added Menu Text Hover Colour Customisation Option
|
341 |
+
* Added Menu Background Colour Customisation Option
|
342 |
+
* Added Menu Link Background Hover Colour Customisation Option
|
343 |
+
* Minor Code Improvements
|
344 |
+
|
345 |
+
= 1.4 (2nd Mar 2014) =
|
346 |
+
|
347 |
+
* Improved menu sliding animation.
|
348 |
+
* Fixed bug where the menu wouldn't retract on re-size.
|
349 |
+
* Removed the use of namespaces to support pre PHP 5.3 systems.
|
350 |
+
|
351 |
+
= 1.3 (1st Mar 2014) =
|
352 |
+
|
353 |
+
* Added ability to upload image for menu title.
|
354 |
+
* Added ability to switch between fixed and non-fixed positioning.
|
355 |
+
* Added ability to change menu font.
|
356 |
+
* Minor updates.
|
357 |
+
|
358 |
+
= 1.2 (28th Feb 2014) =
|
359 |
+
|
360 |
+
* Added support to include all site menus.
|
361 |
+
|
362 |
+
= 1.1 (25th Feb 2014) =
|
363 |
+
|
364 |
+
* Added transparent menu background option.
|
365 |
+
|
366 |
+
= 1.0 (22nd Feb 2014) =
|
367 |
+
|
368 |
+
* Initial Version Released.
|
369 |
+
|
370 |
+
== Upgrade Notice ==
|
responsive-menu.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: Responsive Menu
|
5 |
+
Plugin URI: http://responsive.menu
|
6 |
+
Description: Highly Customisable Responsive Menu Plugin for WordPress
|
7 |
+
Version: 3.0.0
|
8 |
+
Author: Responsive Menu
|
9 |
+
Text Domain: responsive-menu
|
10 |
+
Author URI: http://responsive.menu
|
11 |
+
License: GPL2
|
12 |
+
Tags: responsive, menu, responsive menu
|
13 |
+
*/
|
14 |
+
|
15 |
+
/* Check correct PHP version first */
|
16 |
+
register_activation_hook(__FILE__, 'activate_responsive_menu');
|
17 |
+
function activate_responsive_menu() {
|
18 |
+
if(version_compare(PHP_VERSION, '5.4', '<')):
|
19 |
+
deactivate_plugins(plugin_basename(__FILE__ ));
|
20 |
+
wp_die(sprintf('Responsive Menu requires PHP 5.4 or higher. You are still on %s', PHP_VERSION));
|
21 |
+
endif;
|
22 |
+
}
|
23 |
+
|
24 |
+
/* Required includes for plugin to function */
|
25 |
+
include dirname(__FILE__) . '/autoload.php';
|
26 |
+
include dirname(__FILE__) . '/src/config/route_dependencies.php';
|
27 |
+
|
28 |
+
/* Internationalise the plugin */
|
29 |
+
add_action('plugins_loaded', function() {
|
30 |
+
load_plugin_textdomain('responsive-menu', false, basename(dirname(__FILE__)) . '/translations/');
|
31 |
+
});
|
32 |
+
|
33 |
+
/* Route the plugin */
|
34 |
+
$wp_router = new ResponsiveMenu\Routing\WpRouting($container);
|
35 |
+
$wp_router->route();
|
36 |
+
|
37 |
+
if(is_admin()):
|
38 |
+
include dirname(__FILE__) . '/src/config/default_options.php';
|
39 |
+
$migration = new ResponsiveMenu\Database\Migration($container['database'], $default_options);
|
40 |
+
$migration->setup();
|
41 |
+
$migration->synchronise();
|
42 |
+
endif;
|
src/app/Collections/OptionsCollection.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Collections;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
|
6 |
+
class OptionsCollection implements \ArrayAccess {
|
7 |
+
|
8 |
+
private $options;
|
9 |
+
|
10 |
+
public function add(Option $option) {
|
11 |
+
$this->options[$option->getName()] = $option;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function get($name) {
|
15 |
+
return $this->options[$name];
|
16 |
+
}
|
17 |
+
|
18 |
+
public function all() {
|
19 |
+
return $this->options;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function usesFontIcons() {
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getActiveArrow() {
|
27 |
+
if($this->options['active_arrow_image'] && $this->options['active_arrow_image']->getValue())
|
28 |
+
return '<img src="' . $this->options['active_arrow_image'] .'" />';
|
29 |
+
else
|
30 |
+
return $this->options['active_arrow_shape'];
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getInActiveArrow() {
|
35 |
+
if($this->options['inactive_arrow_image'] && $this->options['inactive_arrow_image']->getValue())
|
36 |
+
return '<img src="' . $this->options['inactive_arrow_image'] .'" />';
|
37 |
+
else
|
38 |
+
return $this->options['inactive_arrow_shape'];
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getTitleImage() {
|
43 |
+
if($this->options['menu_title_image'] && $this->options['menu_title_image']->getValue())
|
44 |
+
return '<img src="' . $this->options['menu_title_image'] .'" />';
|
45 |
+
else
|
46 |
+
return null;
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getButtonIcon() {
|
51 |
+
if($this->options['button_image'] && $this->options['button_image']->getValue())
|
52 |
+
return '<img src="' . $this->options['button_image'] .'" class="responsive-menu-button-icon responsive-menu-button-icon-active" />';
|
53 |
+
else
|
54 |
+
return '<span class="responsive-menu-inner"></span>';
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getButtonIconActive() {
|
58 |
+
if($this->options['button_image'] && $this->options['button_image']->getValue())
|
59 |
+
return '<img src="' . $this->options['button_image_when_clicked'] .'" class=" responsive-menu-button-icon responsive-menu-button-icon-inactive" />';
|
60 |
+
}
|
61 |
+
|
62 |
+
public function offsetExists($offset) {
|
63 |
+
return array_key_exists($offset, $this->options);
|
64 |
+
}
|
65 |
+
|
66 |
+
public function offsetGet($offset) {
|
67 |
+
return $this->options[$offset];
|
68 |
+
}
|
69 |
+
|
70 |
+
public function offsetSet($offset, $value) {
|
71 |
+
if(isset($this->options[$offset]))
|
72 |
+
$this->options[$offset]->setValue($value);
|
73 |
+
}
|
74 |
+
|
75 |
+
public function offsetUnset($offset) {
|
76 |
+
unset($this->options[$offset]);
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
src/app/Controllers/Admin/Base.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Controllers\Admin;
|
4 |
+
use ResponsiveMenu\View\View as View;
|
5 |
+
use ResponsiveMenu\Repositories\Options\Repository as Repository;
|
6 |
+
|
7 |
+
class Base
|
8 |
+
{
|
9 |
+
|
10 |
+
public function __construct(Repository $repository, View $view)
|
11 |
+
{
|
12 |
+
$this->repository = $repository;
|
13 |
+
$this->view = $view;
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
src/app/Controllers/Admin/Main.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Controllers\Admin;
|
4 |
+
use ResponsiveMenu\Factories\OptionFactory as OptionFactory;
|
5 |
+
use ResponsiveMenu\Factories\AdminSaveFactory as SaveFactory;
|
6 |
+
use ResponsiveMenu\WPML\WPML as WPML;
|
7 |
+
|
8 |
+
class Main extends Base
|
9 |
+
{
|
10 |
+
|
11 |
+
public function update($default_options)
|
12 |
+
{
|
13 |
+
|
14 |
+
$options = array_merge($default_options, $_POST['menu']);
|
15 |
+
|
16 |
+
foreach($options as $key => $val):
|
17 |
+
$option_factory = new OptionFactory;
|
18 |
+
$option = $option_factory->build($key, $val);
|
19 |
+
$this->repository->update($option);
|
20 |
+
endforeach;
|
21 |
+
|
22 |
+
$options = $this->repository->all();
|
23 |
+
$save_factory = new SaveFactory();
|
24 |
+
$flash['errors'] = $save_factory->build($options);
|
25 |
+
$flash['success'] = __('Responsive Menu Options Updated Successfully', 'responsive-menu');
|
26 |
+
|
27 |
+
$wpml = new WPML;
|
28 |
+
$wpml->saveFromOptions($options);
|
29 |
+
|
30 |
+
$this->view->render('main', ['options' => $options, 'flash' => $flash]);
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
public function reset($default_options)
|
35 |
+
{
|
36 |
+
|
37 |
+
foreach($default_options as $key => $val):
|
38 |
+
$option_factory = new OptionFactory;
|
39 |
+
$option = $option_factory->build($key, $val);
|
40 |
+
$this->repository->update($option);
|
41 |
+
endforeach;
|
42 |
+
|
43 |
+
$options = $this->repository->all();
|
44 |
+
$save_factory = new SaveFactory();
|
45 |
+
$flash['errors'] = $save_factory->build($options);
|
46 |
+
$flash['success'] = __('Responsive Menu Options Reset Successfully', 'responsive-menu');
|
47 |
+
|
48 |
+
$wpml = new WPML;
|
49 |
+
$wpml->saveFromOptions($options);
|
50 |
+
|
51 |
+
$this->view->render('main', ['options' => $options, 'flash' => $flash]);
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
public function index() {
|
56 |
+
$this->view->render('main', ['options' => $this->repository->all()]);
|
57 |
+
}
|
58 |
+
|
59 |
+
public function import() {
|
60 |
+
|
61 |
+
if(!empty($_FILES['responsive_menu_import_file']['tmp_name'])):
|
62 |
+
$file = file_get_contents($_FILES['responsive_menu_import_file']['tmp_name']);
|
63 |
+
$decoded = json_decode($file);
|
64 |
+
foreach($decoded as $key => $val):
|
65 |
+
$option_factory = new OptionFactory;
|
66 |
+
$option = $option_factory->build($key, $val);
|
67 |
+
$this->repository->update($option);
|
68 |
+
endforeach;
|
69 |
+
|
70 |
+
$options = $this->repository->all();
|
71 |
+
$save_factory = new SaveFactory();
|
72 |
+
$flash['errors'] = $save_factory->build($options);
|
73 |
+
$flash['success'] = __('Responsive Menu Options Reset Successfully', 'responsive-menu');
|
74 |
+
else:
|
75 |
+
$flash['errors'][] = __('No file selected', 'responsive-menu');
|
76 |
+
$options = $this->repository->all();
|
77 |
+
endif;
|
78 |
+
|
79 |
+
$wpml = new WPML;
|
80 |
+
$wpml->saveFromOptions($options);
|
81 |
+
|
82 |
+
$this->view->render('main', ['options' => $options, 'flash' => $flash]);
|
83 |
+
}
|
84 |
+
|
85 |
+
public function export() {
|
86 |
+
nocache_headers();
|
87 |
+
header( 'Content-Type: application/json; charset=utf-8' );
|
88 |
+
header( 'Content-Disposition: attachment; filename=export.json' );
|
89 |
+
header( "Expires: 0" );
|
90 |
+
$final = [];
|
91 |
+
foreach($this->repository->all()->all() as $option)
|
92 |
+
$final[$option->getName()] = $option->getValue();
|
93 |
+
echo json_encode($final);
|
94 |
+
exit();
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
src/app/Controllers/Base.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Controllers;
|
4 |
+
use ResponsiveMenu\View\View as View;
|
5 |
+
use ResponsiveMenu\Repositories\Options\ReadRepository as Repository;
|
6 |
+
|
7 |
+
class Base
|
8 |
+
{
|
9 |
+
|
10 |
+
public function __construct(Repository $repository, View $view)
|
11 |
+
{
|
12 |
+
$this->repository = $repository;
|
13 |
+
$this->view = $view;
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
src/app/Controllers/Front.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Controllers;
|
4 |
+
use ResponsiveMenu\Controllers\Base as Base;
|
5 |
+
use ResponsiveMenu\ViewModels\Menu as MenuViewModel;
|
6 |
+
use ResponsiveMenu\ViewModels\Button as ButtonViewModel;
|
7 |
+
use ResponsiveMenu\Factories\FrontDisplayFactory as DisplayFactory;
|
8 |
+
use ResponsiveMenu\Shortcodes\ResponsiveMenuShortcode as Shortcode;
|
9 |
+
|
10 |
+
class Front extends Base
|
11 |
+
{
|
12 |
+
public function index()
|
13 |
+
{
|
14 |
+
# Get Latest Options
|
15 |
+
$options = $this->repository->all();
|
16 |
+
|
17 |
+
# This needs refactoring - Martin Fowler HELP!
|
18 |
+
$display_factory = new DisplayFactory();
|
19 |
+
$display_factory->build($options);
|
20 |
+
|
21 |
+
# Build Our Menu Display
|
22 |
+
$menu = new MenuViewModel($options);
|
23 |
+
$html = new ButtonViewModel($options);
|
24 |
+
|
25 |
+
# Only render if we don't have shortcodes turned on
|
26 |
+
if($options['shortcode'] == 'off'):
|
27 |
+
$this->view->render('button', ['options' => $options, 'button' => $html->getHtml()]);
|
28 |
+
$this->view->render('menu', ['options' => $options, 'menu' => $menu->getHtml()]);
|
29 |
+
else:
|
30 |
+
add_shortcode('responsive_menu', function($atts) use($options, $html, $menu) {
|
31 |
+
|
32 |
+
if($atts)
|
33 |
+
array_walk($atts, function($a, $b) use ($options) { $options[$b] = $a; });
|
34 |
+
|
35 |
+
$html = $this->view->make('button', ['options' => $options, 'button' => $html->getHtml()]);
|
36 |
+
|
37 |
+
return $html . $this->view->make('menu', ['options' => $options, 'menu' => $menu->getHtml()]);
|
38 |
+
|
39 |
+
});
|
40 |
+
endif;
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
src/app/Database/Database.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Database;
|
4 |
+
|
5 |
+
interface Database
|
6 |
+
{
|
7 |
+
public function update(array $to_update, array $where);
|
8 |
+
public function delete($name);
|
9 |
+
public function all();
|
10 |
+
public function insert(array $arguments);
|
11 |
+
}
|
src/app/Database/Migration.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Database;
|
4 |
+
use ResponsiveMenu\Options\Options as Options;
|
5 |
+
use ResponsiveMenu\Database\Database as Database;
|
6 |
+
|
7 |
+
class Migration{
|
8 |
+
|
9 |
+
protected $db;
|
10 |
+
|
11 |
+
protected static $version_var = 'RMVer';
|
12 |
+
protected static $old_options_var = 'RMOptions';
|
13 |
+
|
14 |
+
public function __construct(Database $db, $default_options)
|
15 |
+
{
|
16 |
+
$this->db = $db;
|
17 |
+
$this->defaults = $default_options;
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function addNewOptions()
|
21 |
+
{
|
22 |
+
# If DB is empty we need to fill it up!
|
23 |
+
$options = $this->db->all();
|
24 |
+
if(empty($options)):
|
25 |
+
foreach($this->defaults as $name => $value)
|
26 |
+
$this->db->insert(array('name' => $name, 'value' => $value));
|
27 |
+
# Otherwise we only add new options
|
28 |
+
else:
|
29 |
+
foreach($options as $converted)
|
30 |
+
$current[$converted->name] = $converted->value;
|
31 |
+
$final = array_diff_key($this->defaults, $current);
|
32 |
+
if(is_array($final)):
|
33 |
+
foreach($final as $name => $value)
|
34 |
+
$this->db->insert(array('name' => $name, 'value' => $value));
|
35 |
+
endif;
|
36 |
+
endif;
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function tidyUpOptions()
|
40 |
+
{
|
41 |
+
$current = array_map(function($a) { return $a->name; }, $this->db->all());
|
42 |
+
foreach(array_diff($current, array_keys($this->defaults)) as $to_delete)
|
43 |
+
$this->db->delete(array('name' => $to_delete));
|
44 |
+
}
|
45 |
+
|
46 |
+
public function setup()
|
47 |
+
{
|
48 |
+
# Create the database table if it doesn't exist
|
49 |
+
$sql = "CREATE TABLE IF NOT EXISTS " . $this->db->table . " (
|
50 |
+
name varchar(50) NOT NULL,
|
51 |
+
value varchar(5000) DEFAULT NULL,
|
52 |
+
created_at datetime NOT NULL,
|
53 |
+
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
54 |
+
PRIMARY KEY (name)
|
55 |
+
) " . $this->db->db->get_charset_collate() . ";";
|
56 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php' );
|
57 |
+
dbDelta($sql);
|
58 |
+
}
|
59 |
+
|
60 |
+
public function synchronise()
|
61 |
+
{
|
62 |
+
# First Thing we need to do is migrate any old options
|
63 |
+
if(!$this->isVersion3($this->getOldVersion())):
|
64 |
+
$this->migrateVersion2Options();
|
65 |
+
endif;
|
66 |
+
|
67 |
+
# Now we can add any new options
|
68 |
+
$this->addNewOptions();
|
69 |
+
|
70 |
+
# Finally delete any that are no longer used
|
71 |
+
$this->tidyUpOptions();
|
72 |
+
|
73 |
+
# Perform any version specific updates
|
74 |
+
if($this->needsUpdate($this->getOldVersion(), $this->getCurrentVersion())):
|
75 |
+
$this->updateVersion();
|
76 |
+
endif;
|
77 |
+
}
|
78 |
+
|
79 |
+
protected function needsUpdate($current_version, $old_version)
|
80 |
+
{
|
81 |
+
return version_compare($current_version, $old_version, '<');
|
82 |
+
}
|
83 |
+
|
84 |
+
protected function getOldVersion()
|
85 |
+
{
|
86 |
+
return get_option(self::$version_var);
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function updateVersion()
|
90 |
+
{
|
91 |
+
update_option(self::$version_var, $this->getCurrentVersion());
|
92 |
+
}
|
93 |
+
|
94 |
+
protected function isVersion3($version)
|
95 |
+
{
|
96 |
+
return substr($version, 0, 1) == 3;
|
97 |
+
}
|
98 |
+
|
99 |
+
protected function migrateVersion2Options()
|
100 |
+
{
|
101 |
+
$old_options = get_option(self::$old_options_var);
|
102 |
+
|
103 |
+
$new_options = [
|
104 |
+
'menu_to_use' => $old_options['RM'] ? $old_options['RM'] : '',
|
105 |
+
'breakpoint' => $old_options['RMBreak'] ? $old_options['RMBreak'] : '',
|
106 |
+
'menu_depth' => $old_options['RMDepth'] ? $old_options['RMDepth'] : '',
|
107 |
+
'button_top' => $old_options['RMTop'] ? $old_options['RMTop'] : '',
|
108 |
+
'button_distance_from_side' => $old_options['RMRight'] ? $old_options['RMRight'] : '',
|
109 |
+
'menu_to_hide' => $old_options['RMCss'] ? $old_options['RMCss'] : '',
|
110 |
+
'menu_title' => $old_options['RMTitle'] ? $old_options['RMTitle'] : '',
|
111 |
+
'button_line_colour' => $old_options['RMLineCol'] ? $old_options['RMLineCol'] : '',
|
112 |
+
'button_background_colour' => $old_options['RMClickBkg'] ? $old_options['RMClickBkg'] : '',
|
113 |
+
'button_title' => $old_options['RMClickTitle'] ? $old_options['RMClickTitle'] : '',
|
114 |
+
'button_transparent_background' => $old_options['RMBkgTran'] ? 'on' : 'off',
|
115 |
+
'menu_font' => $old_options['RMFont'] ? $old_options['RMFont'] : '',
|
116 |
+
'button_position_type' => $old_options['RMPos'] ? 'fixed' : '',
|
117 |
+
'menu_title_image' => $old_options['RMImage'] ? $old_options['RMImage'] : '',
|
118 |
+
'menu_width' => $old_options['RMWidth'] ? $old_options['RMWidth'] : '',
|
119 |
+
'menu_item_background_colour' => $old_options['RMBkg'] ? $old_options['RMBkg'] : '',
|
120 |
+
'menu_background_colour' => $old_options['RMBkg'] ? $old_options['RMBkg'] : '',
|
121 |
+
'menu_sub_arrow_background_colour' => $old_options['RMBkg'] ? $old_options['RMBkg'] : '',
|
122 |
+
'menu_item_background_hover_colour' => $old_options['RMBkgHov'] ? $old_options['RMBkgHov'] : '',
|
123 |
+
'menu_sub_arrow_background_hover_colour' => $old_options['RMBkgHov'] ? $old_options['RMBkgHov'] : '',
|
124 |
+
'menu_title_colour' => $old_options['RMTitleCol'] ? $old_options['RMTitleCol'] : '',
|
125 |
+
'menu_link_colour' => $old_options['RMTextCol'] ? $old_options['RMTextCol'] : '',
|
126 |
+
'menu_sub_arrow_shape_colour' => $old_options['RMTextCol'] ? $old_options['RMTextCol'] : '',
|
127 |
+
'menu_item_border_colour' => $old_options['RMBorCol'] ? $old_options['RMBorCol'] : '',
|
128 |
+
'menu_item_border_colour_hover' => $old_options['RMBorCol'] ? $old_options['RMBorCol'] : '',
|
129 |
+
'menu_sub_arrow_border_colour' => $old_options['RMBorCol'] ? $old_options['RMBorCol'] : '',
|
130 |
+
'menu_sub_arrow_border_hover_colour' => $old_options['RMBorCol'] ? $old_options['RMBorCol'] : '',
|
131 |
+
'menu_link_hover_colour' => $old_options['RMTextColHov'] ? $old_options['RMTextColHov'] : '',
|
132 |
+
'menu_sub_arrow_shape_hover_colour' => $old_options['RMTextColHov'] ? $old_options['RMTextColHov'] : '',
|
133 |
+
'menu_title_hover_colour' => $old_options['RMTitleColHov'] ? $old_options['RMTitleColHov'] : '',
|
134 |
+
'animation_type' => $old_options['RMAnim'] == 'overlay' ? 'slide' : 'push',
|
135 |
+
'page_wrapper' => $old_options['RMPushCSS'] ? $old_options['RMPushCSS'] : '',
|
136 |
+
'menu_title_background_colour' => $old_options['RMTitleBkg'] ? $old_options['RMTitleBkg'] : '',
|
137 |
+
'menu_title_background_hover_colour' => $old_options['RMTitleBkg'] ? $old_options['RMTitleBkg'] : '',
|
138 |
+
'menu_font_size' => $old_options['RMFontSize'] ? $old_options['RMFontSize'] : '',
|
139 |
+
'menu_title_font_size' => $old_options['RMTitleSize'] ? $old_options['RMTitleSize'] : '',
|
140 |
+
'button_font_size' => $old_options['RMBtnSize'] ? $old_options['RMBtnSize'] : '',
|
141 |
+
'menu_current_item_background_colour' => $old_options['RMCurBkg'] ? $old_options['RMCurBkg'] : '',
|
142 |
+
'menu_current_link_colour' => $old_options['RMCurCol'] ? $old_options['RMCurCol'] : '',
|
143 |
+
'animation_speed' => $old_options['RMAnimSpd'] ? $old_options['RMAnimSpd'] : '',
|
144 |
+
'transition_speed' => $old_options['RMTranSpd'] ? $old_options['RMTranSpd'] : '',
|
145 |
+
'menu_text_alignment' => $old_options['RMTxtAlign'] ? $old_options['RMTxtAlign'] : '',
|
146 |
+
'auto_expand_all_submenus' => $old_options['RMExpand'] ? 'on' : 'off',
|
147 |
+
'menu_links_height' => $old_options['RMLinkHeight'] ? $old_options['RMLinkHeight'] + 24 : '',
|
148 |
+
'submenu_arrow_height' => $old_options['RMLinkHeight'] ? $old_options['RMLinkHeight'] + 24 : '',
|
149 |
+
'submenu_arrow_width' => $old_options['RMLinkHeight'] ? $old_options['RMLinkHeight'] + 24 : '',
|
150 |
+
'external_files' => $old_options['RMExternal'] ? 'on' : 'off',
|
151 |
+
'menu_appear_from' => $old_options['RMSide'] ? $old_options['RMSide'] : '',
|
152 |
+
'scripts_in_footer' => $old_options['RMFooter'] ? 'on' : 'off',
|
153 |
+
'button_image' => $old_options['RMClickImg'] ? $old_options['RMClickImg'] : '',
|
154 |
+
'minify_scripts' => $old_options['RMMinify'] ? 'on' : 'off',
|
155 |
+
'menu_close_on_link_click' => $old_options['RMClickClose'] ? 'on' : 'off',
|
156 |
+
'menu_minimum_width' => $old_options['RMMinWidth'] ? $old_options['RMMinWidth'] : '',
|
157 |
+
'menu_maximum_width' => $old_options['RMMaxWidth'] ? $old_options['RMMaxWidth'] : '',
|
158 |
+
'auto_expand_current_submenus' => $old_options['RMExpandPar'] ? 'on' : 'off',
|
159 |
+
'menu_item_click_to_trigger_submenu' => $old_options['RMIgnParCli'] ? 'on' : 'off',
|
160 |
+
'menu_close_on_body_click' => $old_options['RMCliToClo'] ? 'on' : 'off',
|
161 |
+
'menu_title_link' => $old_options['RMTitleLink'] ? $old_options['RMTitleLink'] : '',
|
162 |
+
'menu_additional_content' => $old_options['RMHtml'] ? $old_options['RMHtml'] : '',
|
163 |
+
'shortcode' => $old_options['RMShortcode'] ? 'on' : 'off',
|
164 |
+
'button_line_height' => $old_options['RMLineHeight'] ? $old_options['RMLineHeight'] : '',
|
165 |
+
'button_line_width' => $old_options['RMLineWidth'] ? $old_options['RMLineWidth'] : '',
|
166 |
+
'button_line_margin' => $old_options['RMLineMargin'] ? $old_options['RMLineMargin'] : '',
|
167 |
+
'button_image_when_clicked' => $old_options['RMClickImgClicked'] ? $old_options['RMClickImgClicked'] : '',
|
168 |
+
'accordion_animation' => $old_options['RMAccordion'] ? 'on' : 'off',
|
169 |
+
'active_arrow_shape' => $old_options['RMArShpA'] ? json_decode($old_options['RMArShpA']) : '',
|
170 |
+
'inactive_arrow_shape' => $old_options['RMArShpI'] ? json_decode($old_options['RMArShpI']) : '',
|
171 |
+
'active_arrow_image' => $old_options['RMArImgA'] ? $old_options['RMArImgA'] : '',
|
172 |
+
'inactive_arrow_image' => $old_options['RMArImgI'] ? $old_options['RMArImgI'] : '',
|
173 |
+
'button_push_with_animation' => $old_options['RMPushBtn'] ? 'on' : 'off',
|
174 |
+
'menu_current_item_background_hover_colour' => $old_options['RMCurBkgHov'] ? $old_options['RMCurBkgHov'] : '',
|
175 |
+
'menu_current_link_hover_colour' => $old_options['RMCurColHov'] ? $old_options['RMCurColHov'] : '',
|
176 |
+
'custom_walker' => $old_options['RMWalker'] ? $old_options['RMWalker'] : '',
|
177 |
+
'button_left_or_right' => $old_options['RMLoc'] ? $old_options['RMLoc'] : '',
|
178 |
+
'theme_location_menu' => $old_options['RMThemeLocation'] ? $old_options['RMThemeLocation'] : '',
|
179 |
+
'button_title_position' => $old_options['RMClickTitlePos'] ? $old_options['RMClickTitlePos'] : '',
|
180 |
+
];
|
181 |
+
|
182 |
+
foreach(array_filter($new_options) as $key => $val)
|
183 |
+
$this->db->insert(array('name' => $key, 'value' => $val));
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
public function getCurrentVersion()
|
188 |
+
{
|
189 |
+
$plugin_data = get_plugin_data(dirname(dirname(dirname(dirname(__FILE__)))) . '/responsive-menu.php', false, false);
|
190 |
+
return $plugin_data['Version'];
|
191 |
+
}
|
192 |
+
|
193 |
+
}
|
src/app/Database/WpDatabase.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Database;
|
4 |
+
|
5 |
+
class WpDatabase implements Database {
|
6 |
+
|
7 |
+
protected static $table_name = 'responsive_menu';
|
8 |
+
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
global $wpdb;
|
12 |
+
$this->db = $wpdb;
|
13 |
+
$this->table = $this->db->prefix . self::$table_name;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function update(array $to_update, array $where)
|
17 |
+
{
|
18 |
+
$this->db->update($this->table, $to_update, $where);
|
19 |
+
}
|
20 |
+
|
21 |
+
public function delete($name)
|
22 |
+
{
|
23 |
+
$this->db->delete($this->table, $name);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function all()
|
27 |
+
{
|
28 |
+
return $this->db->get_results("SELECT * FROM $this->table");
|
29 |
+
}
|
30 |
+
|
31 |
+
public function insert(array $arguments)
|
32 |
+
{
|
33 |
+
$arguments['created_at'] = current_time('mysql');
|
34 |
+
$this->db->insert($this->table, $arguments);
|
35 |
+
}
|
36 |
+
|
37 |
+
public function select($column, $value)
|
38 |
+
{
|
39 |
+
return $this->db->get_results("SELECT * FROM $this->table WHERE $column = '$value';");
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
src/app/Factories/AdminSaveFactory.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Filesystem\FileCreator as FileCreator;
|
5 |
+
use ResponsiveMenu\Factories\CssFactory as CssFactory;
|
6 |
+
use ResponsiveMenu\Factories\JsFactory as JsFactory;
|
7 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
8 |
+
|
9 |
+
class AdminSaveFactory {
|
10 |
+
|
11 |
+
public function build(OptionsCollection $options) {
|
12 |
+
|
13 |
+
$flash = [];
|
14 |
+
|
15 |
+
if($options['external_files'] == 'on'):
|
16 |
+
|
17 |
+
$css_factory = new CssFactory;
|
18 |
+
$js_factory = new JsFactory;
|
19 |
+
$file_creator = new FileCreator;
|
20 |
+
|
21 |
+
# Create Data Folders if They don't exist
|
22 |
+
$data_folder_dir = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/responsive-menu-data';
|
23 |
+
$js_folder = $data_folder_dir . '/js';
|
24 |
+
$css_folder = $data_folder_dir . '/css';
|
25 |
+
if($options['external_files'] == 'on' && !is_dir($data_folder_dir)):
|
26 |
+
if(!mkdir($data_folder_dir)) $flash['errors'][] = __('Unable to make data directory', 'responsive-menu');
|
27 |
+
if(!mkdir($css_folder)) $flass['errors'][] = __('Unable to make CSS data directory', 'responsive-menu');
|
28 |
+
if(!mkdir($js_folder)) $flash['errors'][] = __('Unable to make JS data directory', 'responsive-menu');
|
29 |
+
endif;
|
30 |
+
|
31 |
+
$css = $css_factory->build($options);
|
32 |
+
$js = $js_factory->build($options);
|
33 |
+
|
34 |
+
if(!$file_creator->createCssFile($css_folder, 'responsive-menu-' . get_current_blog_id() . '.css', $css))
|
35 |
+
$flash['errors'][] = __('Unable to create CSS file', 'responsive-menu');
|
36 |
+
|
37 |
+
if(!$file_creator->createJsFile($js_folder, 'responsive-menu-' . get_current_blog_id() . '.js', $js))
|
38 |
+
$flash['errors'][] = __('Unable to create JS file', 'responsive-menu');
|
39 |
+
|
40 |
+
endif;
|
41 |
+
|
42 |
+
return empty($flash) ? null : $flash;
|
43 |
+
|
44 |
+
}
|
45 |
+
}
|
src/app/Factories/CssFactory.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Mappers\ScssBaseMapper as ScssBaseMapper;
|
5 |
+
use ResponsiveMenu\Mappers\ScssButtonMapper as ScssButtonMapper;
|
6 |
+
use ResponsiveMenu\Mappers\ScssMenuMapper as ScssMenuMapper;
|
7 |
+
use ResponsiveMenu\Formatters\Minify as Minify;
|
8 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
9 |
+
|
10 |
+
class CssFactory {
|
11 |
+
|
12 |
+
public function build(OptionsCollection $options) {
|
13 |
+
|
14 |
+
$css_base_mapper = new ScssBaseMapper($options);
|
15 |
+
$css_base = $css_base_mapper->map();
|
16 |
+
|
17 |
+
$css_button_mapper = new ScssButtonMapper($options);
|
18 |
+
$css_button = $css_button_mapper->map();
|
19 |
+
|
20 |
+
$css_menu_mapper = new ScssMenuMapper($options);
|
21 |
+
$css_menu = $css_menu_mapper->map();
|
22 |
+
|
23 |
+
$css = $css_base . $css_button . $css_menu;
|
24 |
+
|
25 |
+
if($options['minify_scripts'] == 'on'):
|
26 |
+
$minifier = new Minify;
|
27 |
+
$css = $minifier->minify($css);
|
28 |
+
endif;
|
29 |
+
|
30 |
+
return $css;
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
src/app/Factories/FrontDisplayFactory.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Factories\CssFactory as CssFactory;
|
5 |
+
use ResponsiveMenu\Factories\JsFactory as JsFactory;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class FrontDisplayFactory {
|
9 |
+
|
10 |
+
public function build(OptionsCollection $options) {
|
11 |
+
|
12 |
+
$css_factory = new CssFactory;
|
13 |
+
$js_factory = new JsFactory;
|
14 |
+
|
15 |
+
$css = $css_factory->build($options);
|
16 |
+
$js = $js_factory->build($options);
|
17 |
+
|
18 |
+
add_filter('body_class', function($classes) use($options) {
|
19 |
+
$classes[] = 'responsive-menu-' . $options['animation_type'] . '-' . $options['menu_appear_from'];
|
20 |
+
return $classes;
|
21 |
+
});
|
22 |
+
|
23 |
+
wp_enqueue_script('jquery');
|
24 |
+
|
25 |
+
if($options['external_files'] == 'on') :
|
26 |
+
$data_folder_dir = plugins_url(). '/responsive-menu-data';
|
27 |
+
$css_file = $data_folder_dir . '/css/responsive-menu-' . get_current_blog_id() . '.css';
|
28 |
+
$js_file = $data_folder_dir . '/js/responsive-menu-' . get_current_blog_id() . '.js';
|
29 |
+
wp_enqueue_style('responsive-menu', $css_file, null, false);
|
30 |
+
wp_enqueue_script('responsive-menu', $js_file, ['jquery'], false, $options['scripts_in_footer'] == 'on' ? true : false);
|
31 |
+
else :
|
32 |
+
add_action('wp_head', function() use ($css) {
|
33 |
+
echo '<style>' . $css . '</style>';
|
34 |
+
}, 100);
|
35 |
+
add_action($options['scripts_in_footer'] == 'on' ? 'wp_footer' : 'wp_head', function() use ($js) {
|
36 |
+
echo '<script>' . $js . '</script>';
|
37 |
+
}, 100);
|
38 |
+
endif;
|
39 |
+
|
40 |
+
}
|
41 |
+
}
|
src/app/Factories/JsFactory.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Mappers\JsMapper as JsMapper;
|
5 |
+
use ResponsiveMenu\Formatters\Minify as Minify;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class JsFactory {
|
9 |
+
|
10 |
+
public function build(OptionsCollection $options) {
|
11 |
+
|
12 |
+
$js_mapper = new JsMapper($options);
|
13 |
+
$js = $js_mapper->map();
|
14 |
+
|
15 |
+
if($options['minify_scripts'] == 'on'):
|
16 |
+
$minifier = new Minify;
|
17 |
+
$js = $minifier->minify($js);
|
18 |
+
endif;
|
19 |
+
|
20 |
+
return $js;
|
21 |
+
|
22 |
+
}
|
23 |
+
}
|
src/app/Factories/OptionFactory.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Models\ComplexOption as ComplexOption;
|
5 |
+
use ResponsiveMenu\Helpers\OptionHelper as Helper;
|
6 |
+
|
7 |
+
class OptionFactory
|
8 |
+
{
|
9 |
+
public function build($name, $value)
|
10 |
+
{
|
11 |
+
include dirname(dirname(dirname(__FILE__))) . '/config/option_helpers.php';
|
12 |
+
include dirname(dirname(dirname(__FILE__))) . '/config/default_options.php';
|
13 |
+
|
14 |
+
$filter = isset($option_helpers[$name]['filter'])
|
15 |
+
? new $option_helpers[$name]['filter']
|
16 |
+
: new \ResponsiveMenu\Filters\TextFilter;
|
17 |
+
|
18 |
+
$form_component = isset($option_helpers[$name]['form_component'])
|
19 |
+
? new $option_helpers[$name]['form_component']
|
20 |
+
: new \ResponsiveMenu\Form\Text;
|
21 |
+
|
22 |
+
$value = isset($value) || $value === '0' ? $value : $default_options[$name];
|
23 |
+
$value = stripslashes_deep($value);
|
24 |
+
$option = new ComplexOption($name, $value);
|
25 |
+
$option->setFilter($filter);
|
26 |
+
$option->setFormComponent($form_component);
|
27 |
+
$option->setData(isset($option_helpers[$name]['custom'])?$option_helpers[$name]['custom']:null);
|
28 |
+
$option->setIsPro(isset($option_helpers[$name]['pro'])?$option_helpers[$name]['pro']:null);
|
29 |
+
$option->setIsSemiPro(isset($option_helpers[$name]['semi_pro'])?$option_helpers[$name]['semi_pro']:null);
|
30 |
+
$option->setPosition(isset($option_helpers[$name]['position'])?$option_helpers[$name]['position']:null);
|
31 |
+
$option->setLabel(isset($option_helpers[$name]['label'])?$option_helpers[$name]['label']:null);
|
32 |
+
return $option;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
src/app/Filesystem/FileCreator.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filesystem;
|
4 |
+
|
5 |
+
class FileCreator
|
6 |
+
{
|
7 |
+
|
8 |
+
public function createCssFile($folder, $file_name, $css)
|
9 |
+
{
|
10 |
+
return $this->open_write_and_close($folder . '/' . $file_name, $css);
|
11 |
+
}
|
12 |
+
|
13 |
+
public function createJsFile($folder, $file_name, $js)
|
14 |
+
{
|
15 |
+
return $this->open_write_and_close($folder . '/' . $file_name, $js);
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function open_write_and_close($file_name, $data)
|
19 |
+
{
|
20 |
+
if($file = fopen($file_name, 'w')):
|
21 |
+
fwrite($file, $data);
|
22 |
+
fclose($file);
|
23 |
+
else:
|
24 |
+
return false;
|
25 |
+
endif;
|
26 |
+
|
27 |
+
return true;
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
src/app/Filters/Filter.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filters;
|
4 |
+
|
5 |
+
interface Filter
|
6 |
+
{
|
7 |
+
public function filter($data);
|
8 |
+
}
|
src/app/Filters/HtmlFilter.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filters;
|
4 |
+
|
5 |
+
class HtmlFilter implements Filter
|
6 |
+
{
|
7 |
+
public function filter($data)
|
8 |
+
{
|
9 |
+
return $data;
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
src/app/Filters/JsonFilter.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filters;
|
4 |
+
|
5 |
+
class JsonFilter implements Filter
|
6 |
+
{
|
7 |
+
public function filter($data)
|
8 |
+
{
|
9 |
+
return is_string($data) ? $data : json_encode($data);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
src/app/Filters/TextFilter.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filters;
|
4 |
+
|
5 |
+
class TextFilter implements Filter
|
6 |
+
{
|
7 |
+
public function filter($data)
|
8 |
+
{
|
9 |
+
return strip_tags($data);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
src/app/Form/Checkbox.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class Checkbox implements FormComponent
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option)
|
11 |
+
{
|
12 |
+
$checked = $option->getValue() == 'on' ? 'checked="checked"' : '';
|
13 |
+
|
14 |
+
echo "<div class='onoffswitch'>
|
15 |
+
<input type='checkbox'
|
16 |
+
class='checkbox onoffswitch-checkbox'
|
17 |
+
id='{$option->getName()}'
|
18 |
+
$checked
|
19 |
+
name='menu[{$option->getName()}]'
|
20 |
+
value='on' />
|
21 |
+
<label class='onoffswitch-label' for='{$option->getName()}'>
|
22 |
+
<span class='onoffswitch-inner'></span>
|
23 |
+
<span class='onoffswitch-switch'></span>
|
24 |
+
</label>
|
25 |
+
</div>";
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
src/app/Form/Colour.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class Colour implements FormComponent
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option)
|
11 |
+
{
|
12 |
+
echo "<input type='text'
|
13 |
+
class='colour wp-color-picker'
|
14 |
+
id='{$option->getName()}'
|
15 |
+
name='menu[{$option->getName()}]'
|
16 |
+
value='{$option->getValue()}' />";
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
src/app/Form/Export.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
|
5 |
+
class Export
|
6 |
+
{
|
7 |
+
|
8 |
+
public function render()
|
9 |
+
{
|
10 |
+
echo '<input type="submit" class="button submit" name="responsive_menu_export" value="' . __('Export Options', 'responsive-menu') . '" />';
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
src/app/Form/FontIconPageList.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|