Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. <html>
  2. <title>Get Rekt</title>
  3. <body>
  4. <a target="_blank" href="https://www.vanillamine.sk/"><img src="https://i.imgur.com/RLeKgoe.png" border="0" /></a>
  5. <hr />
  6.  
  7. <?php
  8.  
  9. /*
  10. Plugin Name: MinecraftServerStatus
  11. Plugin URI: https://github.com/WarewolfCZ/MinecraftServerStatus
  12. Description: MinecraftServerStatus widget is displaying MC server status, version and player count
  13. Version: 1.0.0
  14. Author: WarewolfCZ
  15. Author URI: http://www.warewolf.cz
  16. License: GPLv2
  17. License URI: http://www.gnu.org/licenses/gpl-2.0.html
  18. */
  19.  
  20. /*
  21. Copyright (C) 2014 WarewolfCZ
  22.  
  23. This program is free software; you can redistribute it and/or
  24. modify it under the terms of the GNU General Public License
  25. as published by the Free Software Foundation; either version 2
  26. of the License, or (at your option) any later version.
  27.  
  28. This program is distributed in the hope that it will be useful,
  29. but WITHOUT ANY WARRANTY; without even the implied warranty of
  30. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31. GNU General Public License for more details.
  32.  
  33. You should have received a copy of the GNU General Public License
  34. along with this program; if not, write to the Free Software
  35. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  36. */
  37.  
  38. ip adresa: <span style="color: #008000;"><strong>109.235.67.131:25515</strong></span>
  39. verzia: <span style="color: #008000;"><strong>1.12.2</strong></span>
  40.  
  41. defined('ABSPATH') or die("No script kiddies please!");
  42.  
  43. require_once("core/MCServer.php");
  44. require_once("core/exception/MCException.php");
  45.  
  46. add_option("server-url", "", null, 'yes');
  47. add_option("server-port", "", null, 'yes');
  48.  
  49. load_plugin_textdomain('mss_widget_domain', false, basename( dirname( __FILE__ ) ) . '/languages');
  50.  
  51. // Creating the widget
  52. class MssWidget extends WP_Widget {
  53.  
  54. function MssWidget() {
  55. $widget_ops = array( 'classname' => 'example', 'description' => __('Status of minecraft server', 'mss_widget_domain') );
  56. $this->WP_Widget( 'mss_widget', __('MinecraftServerStatus', 'mss_widget_domain'), $widget_ops);//, $control_ops );
  57. }
  58.  
  59. // widget front-end
  60. public function widget($args, $instance) {
  61. $server = new MCServer($instance['host'], $instance['port'], 5);
  62. $status = NULL;
  63. //TODO: move status query to separate script
  64. try {
  65. $status = $server->status();
  66. } catch (Exception $ex) {
  67. $status = NULL;
  68. }
  69. require dirname(__FILE__) . '/templates/widget.phtml';
  70. }
  71.  
  72. // widget Backend
  73. public function form($instance) {
  74. $defaults = array(
  75. 'title' => 'Server status',
  76. 'host' => 'yourserver.com',
  77. 'port' => '25565',
  78. 'show_status' => 'on',
  79. 'show_host' => 'on',
  80. 'show_port' => 'on',
  81. 'show_ping' => 'on',
  82. 'show_players' => 'on',
  83. 'show_auto_players' => '',
  84. 'show_version' => 'on',
  85. 'show_plugins' => 'on',
  86. 'avatar_size' => '25'
  87. );
  88.  
  89. if (empty($instance)) {
  90. $instance = wp_parse_args( (array) $instance, $defaults );
  91. }
  92.  
  93. // Widget admin form
  94. require dirname(__FILE__) . '/templates/form.phtml';
  95. }
  96.  
  97. // Updating widget replacing old instances with new
  98. public function update($new_instance, $old_instance) {
  99. $instance = array();
  100. //$instance['title'] = (!empty($new_instance['title']) ) ? strip_tags($new_instance['title']) : '';
  101. foreach ($new_instance as $option => $value) {
  102.  
  103. if((int) $value > 0 && !in_array($option, array('host'))) {
  104. $value = (int) $value;
  105. }
  106. $instance[$option] = strip_tags(trim($value));
  107. }
  108. return $instance;
  109. }
  110.  
  111. private function hydrate(array $defaults, array $instance) {
  112. foreach ($defaults as $key => $val) {
  113. if (!array_key_exists($key, $instance)) {
  114. $instance[$key] = "";
  115. }
  116. }
  117. return $instance;
  118. }
  119. }
  120.  
  121. // Class mss_widget ends here
  122. // Register and load the widget
  123. function mss_load_widget() {
  124. register_widget('MssWidget');
  125. }
  126.  
  127. add_action('widgets_init', 'mss_load_widget');
  128. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement