PluginProbe
MaxButtons – Create buttons / 6.3
MaxButtons – Create buttons v6.3
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.3, at includes/maxbuttons-support.php

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