PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 3.1.26
Responsive Menu – Create Mobile-Friendly Menu v3.1.26
4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 All 90 releases
← All changes | config/twig.php +37 -1 3.1.83.1.26 View file →
@@ -4,9 +4,8 @@
4 4 dirname(dirname(__FILE__)) . '/views',
5 5 dirname(dirname(__FILE__)) . '/public',
6 6 ]), ['autoescape' => false, 'debug' => false]);
7 7
8 -//$twig->addExtension(new Twig_Extension_Debug());
9 8 if(!is_admin()):
10 9
11 10 $twig->addFilter(new Twig_SimpleFilter('shortcode', function($string) {
12 11 return do_shortcode($string);
@@ -68,8 +67,12 @@
68 67
69 68 return wp_get_nav_menu_items($menu);
70 69 }));
71 70
71 + $twig->addFunction(new Twig_SimpleFunction('all_pages', function() {
72 + return get_pages();
73 + }));
74 +
72 75 $twig->addFunction(new Twig_SimpleFunction('font_icons', function($array) {
73 76 $new_array = [];
74 77 for($i=0; $i < count($array['id']); $i++):
75 78 $new_array[$i] = [
@@ -83,10 +86,43 @@
83 86
84 87 $twig->addGlobal('admin_url', get_admin_url());
85 88 $twig->addGlobal('shortcode', '[responsive_menu]');
86 89
90 + $twig->addFunction(new Twig_SimpleFunction('get_available_themes', function() {
91 + $theme_folder_path = wp_upload_dir()['basedir'] . '/responsive-menu-themes';
92 + $theme_folders = glob($theme_folder_path . '/*' , GLOB_ONLYDIR);
93 +
94 + $themes = [];
95 + foreach($theme_folders as $theme_folder):
96 + $config = json_decode(file_get_contents($theme_folder . '/config.json'), true);
97 + $themes[basename($theme_folder)]['version'] = $config['version'];
98 + $themes[basename($theme_folder)]['name'] = $config['name'];
99 + endforeach;
100 +
101 + return $themes;
102 + }));
103 +
104 + $twig->addGlobal('themes_folder_url', wp_upload_dir()['baseurl'] . '/responsive-menu-themes/');
105 + $twig->addGlobal('themes_folder_dir', wp_upload_dir()['basedir'] . '/responsive-menu-themes/');
106 +
87 107 $twig->addFunction(new Twig_SimpleFunction('hide_pro_options', function() {
88 108 return get_option('hide_pro_options', 'no');
109 + }));
110 +
111 + $twig->addFunction(new Twig_SimpleFunction('nav_menus', function() {
112 + $menus_array = [];
113 + foreach(get_terms('nav_menu') as $menu)
114 + $menus_array[$menu->slug] = $menu->name;
115 +
116 + return $menus_array;
117 + }));
118 +
119 + $twig->addFunction(new Twig_SimpleFunction('location_menus', function() {
120 + $location_menus = ['' => 'None'];
121 + foreach(get_registered_nav_menus() as $location => $menu)
122 + $location_menus[$location] = $menu;
123 +
124 + return $location_menus;
89 125 }));
90 126
91 127 endif;
92 128