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
maxbuttons / includes / maxbuttons-support.php

maxbuttons-support.php in MaxButtons – Create buttons 6.28, at includes/maxbuttons-support.php

255 lines 8.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace MaxButtons;
3 defined('ABSPATH') or die('No direct access permitted');
4
5 $theme = wp_get_theme();
6 $browser = maxbuttons_get_browser();
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
12 function maxbuttons_system_label($label, $value, $spaces_between) {
13 $output = "<label>$label</label>";
14 return "<div class='info'>" . $output . trim($value) . "</div>" ;
15 }
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
121 ?>
122 <?php
123 $support_link = apply_filters("mb-support-link", 'http://wordpress.org/support/plugin/maxbuttons');
124
125 $admin = MB()->getClass('admin');
126 $page_title = __("Support","maxbuttons");
127 $action = "<a href='$support_link' class='page-title-action add-new-h2' target='_blank'>" . __("Go to support","maxbuttons") . "</a>";
128 $admin->get_header(array("title" => $page_title, "title_action" => $action) );
129 ?>
130
131 <h4><?php printf(__('All support is handled through the %sSupport Forums%s.', 'maxbuttons'), "<a href='$support_link' target='_blank'>" , '</a>') ?></h4>
132
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');
140
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>
179
180
181
182
183 <h4><?php _e('You may be asked to provide the information below to help troubleshoot your issue.', 'maxbuttons') ?></h4>
184
185 <form>
186
187 <div class='system_info'>
188 ----- Begin System Info ----- <br />
189
190
191 <?php echo maxbuttons_system_label('WordPress Version:', get_bloginfo('version'), 4) ?>
192
193 <?php echo maxbuttons_system_label('PHP Version:', PHP_VERSION, 10) ?>
194
195 <?php
196 global $wpdb;
197 $mysql_version = $wpdb->db_version();
198
199
200 echo maxbuttons_system_label('MySQL Version:', $mysql_version, 8) ?>
201
202 <?php echo maxbuttons_system_label('Web Server:', $_SERVER['SERVER_SOFTWARE'], 11) ?>
203
204 <?php echo maxbuttons_system_label('WordPress URL:', get_bloginfo('wpurl'), 8) ?>
205
206 <?php echo maxbuttons_system_label('Home URL:', get_bloginfo('url'), 13) ?>
207
208 <?php echo maxbuttons_system_label('PHP cURL Support:', function_exists('curl_init') ? 'Yes' : 'No', 5) ?>
209
210 <?php echo maxbuttons_system_label('PHP GD Support:', function_exists('gd_info') ? 'Yes' : 'No', 7) ?>
211 <?php echo maxbuttons_system_label('PHP Memory Limit:', ini_get('memory_limit'), 5) ?>
212
213 <?php echo maxbuttons_system_label('PHP Post Max Size:', ini_get('post_max_size'), 4) ?>
214
215 <?php echo maxbuttons_system_label('PHP Upload Max Size:', ini_get('upload_max_filesize'), 2) ?>
216
217 <?php echo maxbuttons_system_label('WP_DEBUG:', defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set', 13) ?>
218 <?php echo maxbuttons_system_label('Multi-Site Active:', is_multisite() ? 'Yes' : 'No', 4) ?>
219
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) ?>
223
224 Active Theme:
225 <?php echo maxbuttons_system_label('-', $theme->get('Name') . ' ' . $theme->get('Version'), 1) ?>
226 <?php echo maxbuttons_system_label('', $theme->get('ThemeURI'), 2) ?>
227
228 Active Plugins:
229 <?php
230 $plugins = get_plugins();
231 $active_plugins = get_option('active_plugins', array());
232
233 foreach ($plugins as $plugin_path => $plugin) {
234 // Only show active plugins
235 if (in_array($plugin_path, $active_plugins)) {
236 echo maxbuttons_system_label('-', $plugin['Name'] . ' ' . $plugin['Version'], 1);
237
238 if (isset($plugin['PluginURI'])) {
239 echo maxbuttons_system_label('', $plugin['PluginURI'], 2);
240 }
241
242 echo "\n";
243 }
244 }
245 ?>
246 ----- End System Info -----
247 </div>
248 </form>
249 </div>
250 <div class="ad-wrap">
251 <?php do_action("mb-display-ads"); ?>
252 </div>
253
254 <?php $admin->get_footer(); ?>
255