PluginProbe
MaxButtons – Create buttons / 6.28
MaxButtons – Create buttons v6.28
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
← All changes | includes/maxbuttons-support.php +185 -30 7.13.26.28 View file →
@@ -1,38 +1,191 @@
1 1 <?php
2 2 namespace MaxButtons;
3 3 defined('ABSPATH') or die('No direct access permitted');
4 4
5 -//$theme = wp_get_theme();
6 -//$browser = maxbuttons_get_browser();
5 +$theme = wp_get_theme();
6 +$browser = maxbuttons_get_browser();
7 7
8 +if(is_admin()) {
9 + // wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', '', '4.0.1', false);
10 +}
11 +
8 12 function maxbuttons_system_label($label, $value, $spaces_between) {
9 - $output = "<label>$label</label>";
13 + $output = "<label>$label</label>";
10 14 return "<div class='info'>" . $output . trim($value) . "</div>" ;
11 15 }
12 16
17 +// http://www.php.net/manual/en/function.get-browser.php#101125.
18 +// Cleaned up a bit, but overall it's the same.
19 +function maxbuttons_get_browser() {
20 + $user_agent = $_SERVER['HTTP_USER_AGENT'];
21 + $browser_name = 'Unknown';
22 + $platform = 'Unknown';
23 + $version= "";
24 +
25 + // First get the platform
26 + if (preg_match('/linux/i', $user_agent)) {
27 + $platform = 'Linux';
28 + }
29 + elseif (preg_match('/macintosh|mac os x/i', $user_agent)) {
30 + $platform = 'Mac';
31 + }
32 + elseif (preg_match('/windows|win32/i', $user_agent)) {
33 + $platform = 'Windows';
34 + }
35 +
36 + // Next get the name of the user agent yes seperately and for good reason
37 + if (preg_match('/MSIE/i', $user_agent) && !preg_match('/Opera/i', $user_agent)) {
38 + $browser_name = 'Internet Explorer';
39 + $browser_name_short = "MSIE";
40 + }
41 + elseif (preg_match('/Firefox/i', $user_agent)) {
42 + $browser_name = 'Mozilla Firefox';
43 + $browser_name_short = "Firefox";
44 + }
45 + elseif (preg_match('/Chrome/i', $user_agent)) {
46 + $browser_name = 'Google Chrome';
47 + $browser_name_short = "Chrome";
48 + }
49 + elseif (preg_match('/Safari/i', $user_agent)) {
50 + $browser_name = 'Apple Safari';
51 + $browser_name_short = "Safari";
52 + }
53 + elseif (preg_match('/Opera/i', $user_agent)) {
54 + $browser_name = 'Opera';
55 + $browser_name_short = "Opera";
56 + }
57 + elseif (preg_match('/Netscape/i', $user_agent)) {
58 + $browser_name = 'Netscape';
59 + $browser_name_short = "Netscape";
60 + }
61 +
62 + // Finally get the correct version number
63 + $known = array('Version', $browser_name_short, 'other');
64 + $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
65 + if (!preg_match_all($pattern, $user_agent, $matches)) {
66 + // We have no matching number just continue
67 + }
68 +
69 + // See how many we have
70 + $i = count($matches['browser']);
71 + if ($i != 1) {
72 + // We will have two since we are not using 'other' argument yet
73 + // See if version is before or after the name
74 + if (strripos($user_agent, "Version") < strripos($user_agent, $browser_name_short)){
75 + $version= $matches['version'][0];
76 + }
77 + else {
78 + $version= $matches['version'][1];
79 + }
80 + }
81 + else {
82 + $version= $matches['version'][0];
83 + }
84 +
85 + // Check if we have a number
86 + if ($version == null || $version == "") { $version = "?"; }
87 +
88 + return array(
89 + 'user_agent' => $user_agent,
90 + 'name' => $browser_name,
91 + 'version' => $version,
92 + 'platform' => $platform,
93 + 'pattern' => $pattern
94 + );
95 +}
96 +
97 +function check_charset() {
98 + global $maxbuttons_installed_version;
99 + global $wpdb;
100 + $check = "SHOW FULL COLUMNS FROM " . maxUtils::get_table_name();
101 + $charset = $wpdb->query($check);
102 + return $charset;
103 +}
104 + if(isset($_POST['alter_charset'])) {
105 + $kludge = 'altering table to be utf-8';
106 + global $maxbuttons_installed_version;
107 + global $wpdb;
108 + $table_name = maxUtils::get_table_name();
109 + $kludge = $table_name;
110 + // IMPORTANT: There MUST be two spaces between the PRIMARY KEY keywords
111 + // and the column name, and the column name MUST be in parenthesis.
112 + $sql = "ALTER TABLE " . $table_name . " CONVERT TO CHARACTER SET utf8";
113 + require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
114 + $wpdb->query($wpdb->prepare($sql));
115 + } else {
116 + $kludge = 'Not yet enabled';
117 + }
118 +
119 + $charr = check_charset();
120 +
13 121 ?>
14 122 <?php
15 -$support_link = apply_filters("mb-support-link", 'http://wordpress.org/support/plugin/maxbuttons');
123 +$support_link = apply_filters("mb-support-link", 'http://wordpress.org/support/plugin/maxbuttons');
16 124
17 -$admin = MB()->getClass('admin');
18 -$page_title = __("Support","maxbuttons");
125 +$admin = MB()->getClass('admin');
126 +$page_title = __("Support","maxbuttons");
19 127 $action = "<a href='$support_link' class='page-title-action add-new-h2' target='_blank'>" . __("Go to support","maxbuttons") . "</a>";
20 128 $admin->get_header(array("title" => $page_title, "title_action" => $action) );
21 129 ?>
130 +
131 + <h4><?php printf(__('All support is handled through the %sSupport Forums%s.', 'maxbuttons'), "<a href='$support_link' target='_blank'>" , '</a>') ?></h4>
22 132
23 - <div class='support tiles'>
24 - <div>
25 - <a href='https://wordpress.org/plugins/maxbuttons/#faq' target="_blank">Frequently Asked Questions</a>
26 - </div>
133 + <div class="rss-feed">
134 + <h3><?php _e('Latest Support Questions', 'maxbuttons'); ?></h3>
135 + <?php
136 + if( ini_get('allow_url_fopen') && extension_loaded('simplexml') ):
137 +
138 + try{
139 + $content = file_get_contents('https://wordpress.org/support/rss/plugin/maxbuttons');
27 140
28 - <div><?php printf(__('%sSupport Forums%s.', 'maxbuttons'), "<a href='$support_link' target='_blank'>" , '</a>') ?></div>
141 + $x = new \SimpleXmlElement($content);
142 + }
143 + catch (Exception $e)
144 + {
145 + echo "EX";
146 + }
147 +
148 + echo '<ul >';
149 + $i = 0;
150 + foreach($x->channel->item as $entry) {
151 + if(strpos($entry->title, 'Bas Schuiling') === false) {
152 + $title = $entry->title;
153 + $title = explode(" ", $title);
154 + if (count($title) <= 7)
155 + $title = array_slice($title, 2); // small reply format
156 + else
157 + $title = array_slice($title, 7);
158 + $time = $entry->pubDate;
159 + $time = substr($time, 0, -9);
160 +
161 + $support_title = '';
162 + foreach($title as $word) {
163 + $word = str_replace("\"", "", $word);
164 + $support_title .= $word . ' ';
165 + }
166 + $support_title = trim($support_title);
167 + echo '<li><a href="' . $entry->link . '" target="_blank" title="' . $support_title . '"><span>' . $support_title . '</span><br />' . $time . '</a></li>';
168 + $i++;
169 + if($i == 9) break;
170 + }
171 + }
172 + echo '</ul>';
173 + else:
174 + echo _e("Your server doesn't allow us to fetch the latest support questions", "maxbuttons");
175 +
176 + endif; // ini_get
177 + ?>
178 + </div>
29 179
30 - </div>
31 180
181 +
182 +
32 183 <h4><?php _e('You may be asked to provide the information below to help troubleshoot your issue.', 'maxbuttons') ?></h4>
33 -
34 - <div class='system_info'>
184 +
185 + <form>
186 +
187 + <div class='system_info'>
35 188 ----- Begin System Info ----- <br />
36 189
37 190
38 191 <?php echo maxbuttons_system_label('WordPress Version:', get_bloginfo('version'), 4) ?>
@@ -41,8 +194,9 @@
41 194
42 195 <?php
43 196 global $wpdb;
44 197 $mysql_version = $wpdb->db_version();
198 +
45 199
46 200 echo maxbuttons_system_label('MySQL Version:', $mysql_version, 8) ?>
47 201
48 202 <?php echo maxbuttons_system_label('Web Server:', $_SERVER['SERVER_SOFTWARE'], 11) ?>
@@ -62,30 +216,30 @@
62 216
63 217 <?php echo maxbuttons_system_label('WP_DEBUG:', defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set', 13) ?>
64 218 <?php echo maxbuttons_system_label('Multi-Site Active:', is_multisite() ? 'Yes' : 'No', 4) ?>
65 219
66 -<?php echo maxbuttons_system_label('Operating System:', $view->browser['platform'], 5) ?>
67 -<?php echo maxbuttons_system_label('Browser:', $view->browser['name'] . ' ' . $view->browser['version'], 14) ?>
68 -<?php echo maxbuttons_system_label('User Agent:', $view->browser['user_agent'], 11) ?>
220 +<?php echo maxbuttons_system_label('Operating System:', $browser['platform'], 5) ?>
221 +<?php echo maxbuttons_system_label('Browser:', $browser['name'] . ' ' . $browser['version'], 14) ?>
222 +<?php echo maxbuttons_system_label('User Agent:', $browser['user_agent'], 11) ?>
69 223
70 224 Active Theme:
71 -<?php echo maxbuttons_system_label('-', $view->theme->get('Name') . ' ' . $view->theme->get('Version'), 1) ?>
72 -<?php echo maxbuttons_system_label('', $view->theme->get('ThemeURI'), 2) ?>
225 +<?php echo maxbuttons_system_label('-', $theme->get('Name') . ' ' . $theme->get('Version'), 1) ?>
226 +<?php echo maxbuttons_system_label('', $theme->get('ThemeURI'), 2) ?>
73 227
74 228 Active Plugins:
75 229 <?php
76 -//$plugins = get_plugins();
77 -//$active_plugins = get_option('active_plugins', array());
230 +$plugins = get_plugins();
231 +$active_plugins = get_option('active_plugins', array());
78 232
79 -foreach ($view->plugins as $plugin_path => $plugin) {
233 +foreach ($plugins as $plugin_path => $plugin) {
80 234 // Only show active plugins
81 - if (in_array($plugin_path, $view->active_plugins)) {
235 + if (in_array($plugin_path, $active_plugins)) {
82 236 echo maxbuttons_system_label('-', $plugin['Name'] . ' ' . $plugin['Version'], 1);
83 -
84 - if (isset($view->plugin['PluginURI'])) {
85 - echo maxbuttons_system_label('', $view->plugin['PluginURI'], 2);
237 +
238 + if (isset($plugin['PluginURI'])) {
239 + echo maxbuttons_system_label('', $plugin['PluginURI'], 2);
86 240 }
87 -
241 +
88 242 echo "\n";
89 243 }
90 244 }
91 245 ?>
@@ -90,10 +244,11 @@
90 244 }
91 245 ?>
92 246 ----- End System Info -----
93 247 </div>
248 +</form>
94 249 </div>
95 250 <div class="ad-wrap">
96 - <?php do_action("mb-display-ads"); ?>
251 + <?php do_action("mb-display-ads"); ?>
97 252 </div>
98 -
99 -<?php $admin->get_footer(); ?>
253 +
254 +<?php $admin->get_footer(); ?>