Plugins (III) Licencia

Cuando se desarrolla un plugin es muy importante, si no obligatorio, incluir la licencia de software bajo la que se publica el plugin.

El lugar para colocar dicha licencia es debajo del encabezado, y aunque no es necesaria para el funcionamiento de nuestro plugin si es recomendable ya que un bloque de comentarios de licencia como el que vemos aquí, indica que no seremos responsables si alguien afirma que nuestro plugin ha destruido su web.

El siguiente comentario muestra una licencia GPL estándard bajo la cual se distribuyen la mayor parte de los plugins de WordPress:

/*  Copyright 2015 Miguel A. López Torralba  (email : miguel@mialtoweb.es)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

Para utilizar esta licencia en nuestro plugin lo único que tenemos que hacer es es modificar el año, nuestro nombre y nuestro mail, de este modo tan simple obtendremos nuestra licencia GPL.

WordPress se rige bajo la licencia GPLv2, muy habitual en los proyectos de código abierto.

De esta forma nuestro plugin ya tendría el bloque de comentarios completo y esta listo para comenzar a introducir código en él tal y como vemos a continuación, donde se aúna el bloque de encabezamiento y la licencia.

<?php
/*
Plugin Name: Mi primer plugin
Plugin URI: http://mialtoweb.es
Description: Este es un plugin de prueba que no hace nada excepcional
Version: 1.0
Author: Miguel A. López Torralba
Author URI: http://mialtoweb.es
License: GPLv2
*/

/*  Copyright 2015 Miguel A. López Torralba  (email : miguel@mialtoweb.es)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
?>