Uso de PHP para crear un plugin WP

  • minepress
  • Born
  • Born
  • No Avatar
  • Registrado: Ago 18, 2012
  • Mensajes: 1
  • Status: Offline

Nota Agosto 18th, 2012, 7:01 am

Hola a todos,

IM trabajando en MinepressUK un proyecto para mí aprender php y suelte una alternativa libre de la próxima minepress (desparramando ambos tuvimos la misma idea al mismo tiempo)

Me preguntaba si habría alguna forma posible de hacer que cuando alguien entradas en un formulario de configuración de su dirección ip del servidor que mostrará un mapa dinámico.

Quote:
Uso por primera vez

Al iniciar CraftBukkit, debería poder navegar a http://yourserverip:8123/ en su navegador. En caso de que se está CraftBukkit en el PC que está trabajando actualmente, puede navegar a http://localhost:8123/ . Usted debe ser capaz de ver los jugadores que están en juego. Tenga en cuenta que el mapa no está todavía representa, por lo tanto, el fondo será negro.

Si usted está planeando utilizando al procesador de HD, ahora sería un buen momento para hacerlo. Habilitar deftemplatesuffix: contrata en la parte superior de configuration.txt. Más información sobre deftemplatesuffix está disponible en configuración de plugin de Base.

Si sólo desea ver Dynmap trabajar, utilice el comando siguiente en el juego: /dynmap fullrender. El wiki contiene más información sobre comandos y permisos. El mapa debe revelarse gradualmente en el navegador, darle algún tiempo. Mensajes de progreso indican que Dynmap está trabajando y se mostrará cuando se ha completado el procesamiento.


por lo que todos tienen que escribir en el cuadro de entrada es su http:// iphere y agregará automáticamente el puerto

Aquí es lo que tengo hasta ahora:

PHP Código: [ Select ]
<?php
/*
Plugin Name: Minepress Dynmap Plugin
Plugin URI: removed
Description: A Minepress plugin which allows the user to integrate the Minecraft
 
Dynmap
Author: Bradly Spicer
Version: 0.02
Author URI: removed
*/
 
/* Runs when plugin is activated */
register_activation_hook(__FILE__,'minecraft_dynmap_install');
 
/* Runs on plugin deactivation*/
register_deactivation_hook( __FILE__, 'minecraft_dynmap_remove' );
 
function minecraft_dynmap_install() {
/* Creates new database field */
add_option("minecraft_dynmap_data", 'Default', '', 'yes');
}
 
function hello_world_remove() {
/* Deletes the database field */
delete_option('minecraft_dynmap_data');
 
if ( is_admin() ){
 
/* Call the html code */
add_action('admin_menu', 'minecraft_dynmap_admin_menu');
 
function minecraft_dynmap_admin_menu() {
add_options_page('Dynmap', 'Dynmap', 'administrator',
'hello-world', 'hello_world_html_page');
}
}
?>
The above code, is placed under is_admin() which means it only runs in the wordpress
 
admin area.
The below function has the html code for the settings page, containing the form and
 
notice how the php tag is split to accomodate the html code.
 
and the coding part is..
<?php
function minecraft_dynmap_html_page() {
?>
<div>
<h2>Dynmap Options</h2>
 
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
 
<table width="510">
<tr valign="top">
<th width="92" scope="row">Enter your server Ip:</th>
<td width="406">
<input name="hello_world_data" type="text" id="minecraft_dynmap_data"
value="<?php echo get_option('minecraft_dynmap_data'); ?>" />
(ex. minecraft_dynmap)</td>
</tr>
</table>
 
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="minecraft_dynmap_data" />
 
<p>
<input type="submit" value="<?php _e('Save Changes') ?>" />
</p>
 
</form>
</div>
  1. <?php
  2. /*
  3. Plugin Name: Minepress Dynmap Plugin
  4. Plugin URI: removed
  5. Description: A Minepress plugin which allows the user to integrate the Minecraft
  6.  
  7. Dynmap
  8. Author: Bradly Spicer
  9. Version: 0.02
  10. Author URI: removed
  11. */
  12.  
  13. /* Runs when plugin is activated */
  14. register_activation_hook(__FILE__,'minecraft_dynmap_install');
  15.  
  16. /* Runs on plugin deactivation*/
  17. register_deactivation_hook( __FILE__, 'minecraft_dynmap_remove' );
  18.  
  19. function minecraft_dynmap_install() {
  20. /* Creates new database field */
  21. add_option("minecraft_dynmap_data", 'Default', '', 'yes');
  22. }
  23.  
  24. function hello_world_remove() {
  25. /* Deletes the database field */
  26. delete_option('minecraft_dynmap_data');
  27.  
  28. if ( is_admin() ){
  29.  
  30. /* Call the html code */
  31. add_action('admin_menu', 'minecraft_dynmap_admin_menu');
  32.  
  33. function minecraft_dynmap_admin_menu() {
  34. add_options_page('Dynmap', 'Dynmap', 'administrator',
  35. 'hello-world', 'hello_world_html_page');
  36. }
  37. }
  38. ?>
  39. The above code, is placed under is_admin() which means it only runs in the wordpress
  40.  
  41. admin area.
  42. The below function has the html code for the settings page, containing the form and
  43.  
  44. notice how the php tag is split to accomodate the html code.
  45.  
  46. and the coding part is..
  47. <?php
  48. function minecraft_dynmap_html_page() {
  49. ?>
  50. <div>
  51. <h2>Dynmap Options</h2>
  52.  
  53. <form method="post" action="options.php">
  54. <?php wp_nonce_field('update-options'); ?>
  55.  
  56. <table width="510">
  57. <tr valign="top">
  58. <th width="92" scope="row">Enter your server Ip:</th>
  59. <td width="406">
  60. <input name="hello_world_data" type="text" id="minecraft_dynmap_data"
  61. value="<?php echo get_option('minecraft_dynmap_data'); ?>" />
  62. (ex. minecraft_dynmap)</td>
  63. </tr>
  64. </table>
  65.  
  66. <input type="hidden" name="action" value="update" />
  67. <input type="hidden" name="page_options" value="minecraft_dynmap_data" />
  68.  
  69. <p>
  70. <input type="submit" value="<?php _e('Save Changes') ?>" />
  71. </p>
  72.  
  73. </form>
  74. </div>
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Agosto 18th, 2012, 7:01 am

  • Zealous
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Abr 15, 2011
  • Mensajes: 1202
  • Loc: Sydney
  • Status: Online

Nota Agosto 27th, 2012, 1:30 am

¿sacaste esto ordenado?

Publicar Información

  • Total de mensajes en este tema: 2 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 168 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC