Changeset 2072001
- Timestamp:
- 04/21/2019 02:02:22 PM (7 years ago)
- Location:
- inn-ao-detector/trunk
- Files:
-
- 2 edited
-
inn-ao-detector.php (modified) (17 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
inn-ao-detector/trunk/inn-ao-detector.php
r2060184 r2072001 1 1 <?php 2 3 namespace InnStudio\Plugin\InnAoDetector; 2 4 3 5 // Plugin Name: INN AO 主机环境检测器 (INN AO Detector) … … 5 7 // Description: 启用插件后访问 点击插件名称下方的【开始检测】,以检测您的主机对 INN AO 主题的健康度。(Please click the detection button to detect the host environment compatibility for INN AO theme after plugin enabled.) 6 8 // Author: Km.Van 7 // Version: 1.1.19 // Version: 2.0.0 8 10 // Author URI: https://inn-studio.com/ao 9 11 10 class Inn StudioInnAoDetector12 class InnAoDetector 11 13 { 12 private $version = '1.1.1'; 13 private $themeName = 'INN AO'; 14 private $themeUrl = 'https://inn-studio.com/ao'; 15 private $url = 'https://theme-detector.inn-studio.com/'; 16 private $actionId = ''; 17 private $basicHeathValue = 60; 14 private $version = '2.0.0'; 15 private $themeName = 'INN AO'; 16 private $themeUrl = 'https://inn-studio.com/ao'; 17 private $url = 'https://theme-detector.inn-studio.com/'; 18 private $actionId = ''; 19 private $basicHeathValue = 60; 20 private $basicSqlite3Version = '3.18'; 18 21 private $data; 19 22 private $iconCheck = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAAEzo7pQAAAAA3NCSVQICAjb4U/gAAAANlBMVEX///9Fx2dFx2dFx2dFx2dFx2dFx2dFx2f////0/Pbw+/Pd9eOL3KB/2Zdx1Ito0oRRy3FFx2dQBNkrAAAAEnRSTlMAIjNVZoi77v////////////8YBaguAAAACXBIWXMAAAsSAAALEgHS3X78AAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNi8xOC8xNwKmd+cAAAElSURBVDiNdVOLksMgCMQYUS+9M/z/zxYQE7i0O5NRZFkeGgAg4I8IqDeaO8CiGz5rfKY72GmuKEsbBIUkgixcV9ioyjIPaK2UeTOUzZv2o1GioiRcZKiTK0gWSRhNQZU8C32QqdFoB+doU1W12NJkrpbudL3oTAvZZ1UUVsLtMnEFJHCdKnZYPThOpgAXMLSUbR6cUn7rmnpWfrLdXqs5MZa9ur3sOjXGsqlYmeN1pQ3Nan+hMt+8KsZ2M3hkDFrRCTmMwPRuTn56Qw785rdb+eAfwzHK083PoC9KuW9o9OM0t+DXSgUX1trx1/3oBUCBwU8suO8n7SjezVVuzhJKcMuj+D4mgY4qfZiztWBv0/7ZB3Z3W+kxT0zwH1tBTVax3H8CvAHlLTE62e8V8AAAAABJRU5ErkJggg==" title="成功 | Success" alt="check" width="32" height="32"/>'; … … 33 36 public function filterActionLink($actions, $pluginFile) 34 37 { 35 if (false !== \stripos($pluginFile, \basename( \dirname(__FILE__)))) {38 if (false !== \stripos($pluginFile, \basename(__DIR__))) { 36 39 $adminUrl = \get_admin_url(); 37 40 $opts = <<<HTML … … 52 55 { 53 56 $this->waitCb(); 54 $this->data = $this->check(); ?><!doctype html> 55 <html <?php language_attributes(); ?>> 57 $this->data = $this->check(); 58 $url = \get_bloginfo('url'); 59 $name = \get_bloginfo('name'); 60 $items = ''; 61 foreach ($this->items() as $k => $item) { 62 ++$k; 63 $items .= <<<HTML 64 <tr> 65 <td>{$k}</td> 66 <th>{$item['th']}</th> 67 <td>{$item['host']}</td> 68 <td>{$item['theme']}</td> 69 <td>{$this->getResult($item['result'])}</td> 70 </tr> 71 HTML; 72 } 73 74 $time = \current_time('Y/m/d H:i:s'); 75 76 echo <<<HTML 77 <!doctype html> 78 <html lang="en-US"> 56 79 <head> 57 80 <meta charset="UTF-8"> … … 59 82 <meta name="renderer" content="webkit"/> 60 83 <meta name="viewport" content="width=device-width,initial-scale=1"/> 61 <title> <?php echo $this->themeName; ?> 主题主机环境检测器(v<?php echo $this->version; ?>) | <?php echo $this->themeName; ?>- Theme Host Environment Detector</title>84 <title>{$this->themeName} 主题主机环境检测器(v{$this->version}) | {$this->themeName} - Theme Host Environment Detector</title> 62 85 <style> 63 86 body{ … … 88 111 width: 100%; 89 112 background-color: #fafafa; 90 margin: 1.5rem 0 ;113 margin: 1.5rem 0 0; 91 114 border-spacing: 0; 92 115 border: none; 93 border-radius: 10px ;116 border-radius: 10px 10px 0 0; 94 117 box-shadow: 0 5px 20px rgba(0,0,0, .1); 95 118 overflow: hidden; … … 100 123 font-weight: normal; 101 124 text-shadow: 0 1px 2px rgba(0,0,0,.3); 125 word-break: break-all; 102 126 } 103 127 table thead th:first-child{ 104 128 border-radius: 10px 0 0 0; 105 }106 table thead th:last-child{107 border-radius: 0 10px 0 0;108 129 } 109 130 table tbody tr:nth-child(2n){ … … 124 145 .btn { 125 146 background-color: #44c767; 126 border-radius: 50px; 127 border: 1px solid #18ab29; 128 display: inline-block; 147 border-radius:0 0 10px 10px; 148 display: block; 129 149 color: #fff; 130 padding: .5rem 1rem;150 padding: 1rem 0; 131 151 text-decoration: none; 132 152 text-shadow: 0px 1px 1px #2f6627; 153 box-shadow: 0 5px 20px rgba(0,0,0, .1); 133 154 } 134 155 .btn:hover { … … 170 191 <body> 171 192 <h1> 172 <?php echo $this->themeName; ?> - 主题主机环境检测器(v<?php echo $this->version; ?>)<br>173 <?php echo $this->themeName; ?>- Theme Host Environment Detector193 {$this->themeName} - 主题主机环境检测器(v{$this->version})<br> 194 {$this->themeName} - Theme Host Environment Detector 174 195 </h1> 175 196 … … 178 199 <tr> 179 200 <th>序号<br>Number</th> 180 <th>检测项目<br>Detection item( <?php echo get_bloginfo('url'); ?>)</th>181 <th>当前主机环境( <?php echo get_bloginfo('name'); ?>)<br>My environment</th>201 <th>检测项目<br>Detection item({$url})</th> 202 <th>当前主机环境({$name})<br>My environment</th> 182 203 <th>主题所需环境<br>Theme required</th> 183 204 <th>检测结果<br>Detection</th> … … 185 206 </thead> 186 207 <tbody> 187 <?php foreach ($this->items() as $k => $item) { 188 ?> 189 <tr> 190 <td><?php echo $k + 1; ?></td> 191 <th><?php echo $item['th']; ?></th> 192 <td><?php echo $item['host']; ?></td> 193 <td><?php echo $item['theme']; ?></td> 194 <td><?php echo $this->getResult($item['result']); ?></td> 195 </tr> 196 <?php 197 } ?> 208 {$items} 198 209 </tbody> 199 210 </table> 200 211 201 <?php $this->tools(); ?>212 {$this->getTools()} 202 213 203 214 <footer> 204 215 <p> 205 LOCAL: <?php echo \current_time('Y/m/d H:i:s'); ?>216 LOCAL: {$time} 206 217 | 207 <a href=" <?php echo $this->themeUrl; ?>" target="_blank" title="访问主题官网 | Vistit theme official website">INN STUDIO</a>218 <a href="{$this->themeUrl}" target="_blank" title="访问主题官网 | Vistit theme official website">INN STUDIO</a> 208 219 | 209 220 <a href="javascript:window.open(false, '_self', false);window.close()" title="关闭此页面 | Close">Close</a> 210 221 </footer> 211 <?php $this->showError(); ?>222 {$this->getErrors()} 212 223 </body> 213 224 </html> 214 <?php 225 HTML; 215 226 die; 216 227 } … … 220 231 if (true === $result) { 221 232 return $this->iconCheck; 222 } elseif (false === $result) { 233 } 234 if (false === $result) { 223 235 return $this->iconTimes; 224 236 } … … 304 316 } 305 317 306 private function showError()318 private function getErrors() 307 319 { 308 320 if ($this->error) { 309 ?> 310 <fieldset class="debug"> 311 <legend>出错信息 | Error information</legend> 312 <pre><?php \var_dump($this->error); ?></pre> 313 </fieldset> 314 <?php 321 $err = \json_encode($this->error); 322 323 return <<<HTML 324 <fieldset class="debug"> 325 <legend>出错信息 | Error information</legend> 326 <pre>{$err}</pre> 327 </fieldset> 328 HTML; 315 329 } 316 330 } … … 375 389 { 376 390 return \function_exists('\\exif_imagetype') ? $this->iconCheck : $this->iconTimes; 391 } 392 393 private function getPhpSqlite3() 394 { 395 if ( ! \class_exists('\\SQLite3')) { 396 return '0.0.0'; 397 } 398 399 $version = \SQLite3::version(); 400 401 return $version['versionString']; 402 } 403 404 private function isPastPhpSqlite3() 405 { 406 $version = \SQLite3::version(); 407 408 return \version_compare($version['versionString'], $this->basicSqlite3Version, '>=') ? $this->iconCheck : $this->iconTimes; 409 } 410 411 private function getPhpMbString() 412 { 413 return \function_exists('\\mb_strcut') ? $this->iconCheck : $this->iconTimes; 377 414 } 378 415 … … 399 436 ), 400 437 array( 438 'th' => 'WordPress 健康值<br>WordPress heath value', 439 'host' => $this->getHeathValueOther2(), 440 'theme' => 100, 441 'result' => $this->getHeathValueIcon($this->getHeathValueOther2()), 442 ), 443 array( 401 444 'th' => 'PHP Imagick 扩展<br>PHP Imagick Extension', 402 445 'host' => $this->getPhpImagick(), … … 411 454 ), 412 455 array( 413 'th' => 'WordPress 健康值<br>WordPress heath value', 414 'host' => $this->getHeathValueOther2(), 415 'theme' => 100, 416 'result' => $this->getHeathValueIcon($this->getHeathValueOther2()), 456 'th' => 'PHP SQLite3 扩展<br>PHP SQLite3 Extension', 457 'host' => $this->getPhpSqlite3(), 458 'theme' => $this->basicSqlite3Version, 459 'result' => $this->isPastPhpSqlite3(), 460 ), 461 array( 462 'th' => 'PHP Multibyte String 扩展<br>PHP Multibyte String Extension', 463 'host' => $this->getPhpMbString(), 464 'theme' => $this->iconCheck, 465 'result' => $this->getPhpMbString(), 466 ), 467 array( 468 'th' => 'PHP GD 图像库<br>PHP GD library', 469 'host' => \function_exists('\\imagecreatefrompng') ? $this->iconCheck : $this->iconTimes, 470 'theme' => $this->iconCheck, 471 'result' => \function_exists('\\imagecreatefrompng') ? $this->iconCheck : $this->iconTimes, 472 ), 473 array( 474 'th' => 'wp-content 目录可写<br>wp-content directory writable', 475 'host' => \is_writable(\WP_CONTENT_DIR) ? $this->iconCheck : $this->iconTimes, 476 'theme' => $this->iconCheck, 477 'result' => \is_writable(\WP_CONTENT_DIR) ? $this->iconCheck : $this->iconTimes, 417 478 ), 418 479 array( … … 425 486 } 426 487 427 private function tools()428 { 429 ?>430 <div class="tools">431 <a href="javascript:location.reload();document.body.style.opacity='0.3';" class="btn">刷新 | Refresh</a>432 </div>433 <?php 488 private function getTools() 489 { 490 return <<<HTML 491 <div class="inn-tools"> 492 <a href="javascript:document.body.style.opacity='0.3';location.reload();" class="btn">刷新 | Refresh</a> 493 </div> 494 HTML; 434 495 } 435 496 } 436 497 437 498 if (\function_exists('add_action')) { 438 function InnStudioInnAoDetectorInit() 439 { 440 new InnStudioInnAoDetector(); 441 } 442 443 \add_action('plugins_loaded', 'InnStudioInnAoDetectorInit'); 499 \add_action('plugins_loaded', function () { 500 new InnAoDetector(); 501 }); 444 502 } -
inn-ao-detector/trunk/readme.txt
r2043988 r2072001 3 3 Tags: checker 4 4 Requires at least: 4.9.9 5 Tested up to: 5.1. 05 Tested up to: 5.1.1 6 6 Requires PHP: 5.3.0 7 7 License: GPLv2 or later … … 21 21 > Upload to the `/wp-content/plugins/` directory and ENABLE it. 22 22 23 == Changelog == 24 25 = 2.0.0 = 26 * 新增更多检测项目 27 * 优化界面
Note: See TracChangeset
for help on using the changeset viewer.