PageRenderTime 26ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/web aztheme.net/wp-content/plugins/ckeditor-for-wordpress/includes/overview.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 255 lines | 203 code | 13 blank | 39 comment | 19 complexity | 9a42a15fc321639cda7516ff005fb34f MD5 | raw file
  1. <?php
  2. /*
  3. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
  4. For licensing, see LICENSE.md or http://ckeditor.com/license
  5. */
  6. /**
  7. * ckeditor_admin_overview()
  8. *
  9. * Add the admin overview the dashboard style
  10. * @return mixed content
  11. */
  12. function ckeditor_admin_overview() {
  13. ?>
  14. <div class="wrap ckeditor-wrap">
  15. <div id="icon-wp-ckeditor" class="icon32"><br /></div>
  16. <h2><?php _e('CKEditor For WordPress', 'ckeditor_wordpress') ?> <?php /*echo $this->version*/?>&nbsp;</h2>
  17. <div id="dashboard-widgets-wrap" class="ckeditor-overview">
  18. <div id="dashboard-widgets" class="metabox-holder">
  19. <div id="post-body">
  20. <div id="dashboard-widgets-main-content">
  21. <div class="postbox-container" style="width:49%;">
  22. <?php do_meta_boxes('ckeditor_overview', 'left', ''); ?>
  23. </div>
  24. <div class="postbox-container" style="width:49%;">
  25. <?php do_meta_boxes('ckeditor_overview', 'right', ''); ?>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <script type="text/javascript">
  33. //<![CDATA[
  34. jQuery(document).ready( function($) {
  35. // postboxes setup
  36. postboxes.add_postbox_toggles('ckeditor-overview');
  37. });
  38. //]]>
  39. </script>
  40. <?php
  41. }
  42. /**
  43. * http://www.php.net/manual/en/function.phpinfo.php
  44. * code at adspeed dot com
  45. * 09-Dec-2005 11:31
  46. * This function parses the phpinfo output to get details about a PHP module.
  47. */
  48. function ckeditor_parse_php_info() {
  49. ob_start();
  50. phpinfo(INFO_MODULES);
  51. $s = ob_get_contents();
  52. ob_end_clean();
  53. $s = strip_tags($s,'<h2><th><td>');
  54. $s = preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$s);
  55. $s = preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$s);
  56. $vTmp = preg_split('/(<h2>[^<]+<\/h2>)/',$s,-1,PREG_SPLIT_DELIM_CAPTURE);
  57. $vModules = array();
  58. for ($i=1;$i<count($vTmp);$i++) {
  59. if (preg_match('/<h2>([^<]+)<\/h2>/',$vTmp[$i],$vMat)) {
  60. $vName = trim($vMat[1]);
  61. $vTmp2 = explode("\n",$vTmp[$i+1]);
  62. foreach ($vTmp2 AS $vOne) {
  63. $vPat = '<info>([^<]+)<\/info>';
  64. $vPat3 = "/$vPat\s*$vPat\s*$vPat/";
  65. $vPat2 = "/$vPat\s*$vPat/";
  66. if (preg_match($vPat3,$vOne,$vMat)) { // 3cols
  67. $vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]),trim($vMat[3]));
  68. }
  69. elseif (preg_match($vPat2,$vOne,$vMat)) { // 2cols
  70. $vModules[$vName][trim($vMat[1])] = trim($vMat[2]);
  71. }
  72. }
  73. }
  74. }
  75. return $vModules;
  76. }
  77. /**
  78. * Show the server settings in a dashboard widget
  79. *
  80. * @return void
  81. */
  82. function ckeditor_overview_server() {
  83. if (ini_get('safe_mode'))
  84. $safe_mode = __('On', 'ckeditor_wordpress');
  85. else
  86. $safe_mode = __('Off', 'ckeditor_wordpress');
  87. if (!($upload_max = ini_get('upload_max_filesize')))
  88. $upload_max = __('N/A', 'ckeditor_wordpress');
  89. if (!($post_max = ini_get('post_max_size')))
  90. $post_max = __('N/A', 'ckeditor_wordpress');
  91. if (!($memory_limit = ini_get('memory_limit')))
  92. $memory_limit = __('N/A', 'ckeditor_wordpress');
  93. $php_info = ckeditor_parse_php_info();
  94. ?>
  95. <div id="dashboard_server_settings" class="dashboard-widget-holder wp_dashboard_empty">
  96. <div class="ngg-dashboard-widget">
  97. <div class="dashboard-widget-content">
  98. <span class="description" style="">
  99. <?php
  100. _e('* CKEditor is a JavaScript application and as such does not require any specific PHP configuration.', 'ckeditor_wordpress').' ';
  101. _e('This information might be useful if you decide to enable a file browser.', 'ckeditor_wordpress');
  102. ?>
  103. </span>
  104. <table class="form-table">
  105. <tr>
  106. <td><?php _e('PHP Version', 'ckeditor_wordpress'); ?></td><td><?php echo phpversion(); ?></td>
  107. </tr>
  108. <tr>
  109. <td><?php _e('PHP Safe Mode', 'ckeditor_wordpress'); ?></td><td><?php echo ckeditor_colorify_value($safe_mode, 'Off'); ?></td>
  110. </tr>
  111. <tr>
  112. <td><?php _e('PHP Max Upload Size', 'ckeditor_wordpress'); ?></td><td><?php echo $upload_max; ?></td>
  113. </tr>
  114. <tr>
  115. <td><?php _e('PHP Max Post Size', 'ckeditor_wordpress'); ?></td><td><?php echo $post_max; ?></td>
  116. </tr>
  117. <tr>
  118. <td><?php _e('PHP Memory Limit', 'ckeditor_wordpress'); ?></td><td><?php echo $memory_limit; ?></td>
  119. </tr>
  120. <?php
  121. if (isset($php_info['gd']) && is_array($php_info['gd']))
  122. {
  123. foreach ($php_info['gd'] as $key => $val) {
  124. if (!preg_match('/(WBMP|XBM|Freetype|T1Lib)/i', $key) && $key != 'Directive' && $key != 'gd.jpeg_ignore_warning') {
  125. echo '<tr>';
  126. echo '<td>'.$key.'</td>';
  127. if (stripos($key, 'support') === false) {
  128. echo '<td>'.$val.'</td>';
  129. }
  130. else {
  131. echo '<td>'.ckeditor_colorify_value($val, 'enabled').'</td>';
  132. }
  133. echo '</tr>';
  134. }
  135. }
  136. }
  137. ?>
  138. </table>
  139. </div>
  140. </div>
  141. </div>
  142. <?php
  143. }
  144. function ckeditor_colorify_value($value, $expected) {
  145. if (strcasecmp($value, $expected) == 0) {
  146. return '<span class="ckeditor_ok">'.$value.'</span>';
  147. }
  148. else {
  149. return '<span class="ckeditor_error">'.$value.'</span>';
  150. }
  151. }
  152. /**
  153. * Show compatibility logos
  154. *
  155. * @return void
  156. */
  157. function ckeditor_overview_compatibility() {
  158. ?>
  159. <div>
  160. <table class="form-table compat_logos">
  161. <tr valign="top">
  162. <td class="logos ie"> </td><td>IE 8+</td>
  163. <td class="logos firefox"> </td><td>Firefox</td>
  164. <td class="logos chrome"> </td><td>Google Chrome</td>
  165. </tr>
  166. <tr valign="top">
  167. <td class="logos safari"> </td><td>Safari</td>
  168. <td class="logos opera"> </td><td>Opera</td>
  169. <td></td><td></td>
  170. </tr>
  171. </table>
  172. </div>
  173. <?php
  174. }
  175. /**
  176. * Show CKEditor information
  177. *
  178. * @return void
  179. */
  180. function ckeditor_overview_configuration() {
  181. ?>
  182. <div>
  183. <table class="form-table">
  184. <tr valign="top">
  185. <td>Plugin Version</td><td><?php echo $GLOBALS['ckeditor_plugin_version']; ?></td>
  186. </tr>
  187. <tr valign="top">
  188. <td>Editor Version</td><td><?php echo $GLOBALS['ckeditor_version']; ?></td>
  189. </tr>
  190. <tr valign="top">
  191. <td>CKFinder</td><td><?php echo $GLOBALS['ckfinder_status']; ?></td>
  192. </tr>
  193. </table>
  194. </div>
  195. <?php
  196. }
  197. function ckeditor_reset_settings() {
  198. ?>
  199. <div>
  200. <span class="description">
  201. <?php _e('Press the button below to reset CKEditor settings to default values.', 'ckeditor_wordpress'); ?>
  202. </span>
  203. <form method="post" style="margin-top:15px">
  204. <?php wp_nonce_field('ckeditor_create_nonce_overview','csrf_ckeditor-for-wordpress'); ?>
  205. <input type="hidden" name="reset" value="1" />
  206. <p class="submit">
  207. <input type="submit" value="Reset settings to defaults" name="submit_reset" class="button-secondary" id="default-reset" />
  208. </p>
  209. </form>
  210. </div>
  211. <?php
  212. }
  213. /**
  214. * Show useful links
  215. *
  216. * @return void
  217. */
  218. function ckeditor_overview_help() {
  219. ?>
  220. <div>
  221. <table class="form-table ckeditor_links">
  222. <tr valign="top">
  223. <td class="cke"><a href="http://ckeditor.com"><?php _e('CKEditor Site', 'ckeditor_wordpress');?></a></td>
  224. <td class="help"><a href="http://docs.cksource.com/CKEditor_3.x/Users_Guide"><?php _e('User Guide', 'ckeditor_wordpress');?></a></td>
  225. <td class="plug"><a href="http://wordpress.org/extend/plugins/ckeditor-for-wordpress/"><?php _e('Plugin Site', 'ckeditor_wordpress');?></a></td>
  226. </tr>
  227. <tr valign="top">
  228. <td class="excl"><a href="http://wordpress.ckeditor.com/troubleshooting"><?php _e('Troubleshooting', 'ckeditor_wordpress');?></a></td>
  229. <td class="docs"><a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide"><?php _e('CKEditor Documentation', 'ckeditor_wordpress');?></a></td>
  230. <td class="conf"><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html"><?php _e('Configuration Options', 'ckeditor_wordpress');?></a></td>
  231. </tr>
  232. </table>
  233. </div>
  234. <?php
  235. }
  236. add_meta_box('dashboard_overview_configuration', __('CKEditor Information', 'ckeditor_wordpress'), 'ckeditor_overview_configuration', 'ckeditor_overview', 'left', 'core');
  237. add_meta_box('dashboard_overview_help', __('Useful Links', 'ckeditor_wordpress'), 'ckeditor_overview_help', 'ckeditor_overview', 'left', 'core');
  238. add_meta_box('dashboard_overview_compatibility', __('CKEditor Compatibility', 'ckeditor_wordpress'), 'ckeditor_overview_compatibility', 'ckeditor_overview', 'right', 'core');
  239. add_meta_box('dashboard_overview_server', __('Server Information', 'ckeditor_wordpress'), 'ckeditor_overview_server', 'ckeditor_overview', 'right', 'core');
  240. add_meta_box('dashboard_reset_settings', __('Reset Plugin Settings', 'ckeditor_wordpress'), 'ckeditor_reset_settings', 'ckeditor_overview', 'left', 'core');
  241. ckeditor_admin_overview();
  242. ?>