Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I found some functions that I want to get from WordPress source code and add want to add them into my project which is going to be open source.

Do I simply get the functions that I want and add them to my project with a little comment saying that I got it from WP like:

/**
  * Author: WordPress
**/

or is there anything else I have to consider before getting the code?

Also, is there anything else apart from the above question that I have to consider if I want to sell to someone my project with these functions?

share|improve this question
    
Can you edit your question to point us to the relevant file and functions you want to copy? Ideally provide a link to the file on core.svn.wordpress.org –  Roberto Tyley Aug 2 '11 at 15:18
    
their 2 functions from formatting.php - core.svn.wordpress.org/trunk/wp-includes/formatting.php –  fxuser Aug 3 '11 at 17:18
add comment

3 Answers 3

up vote 1 down vote accepted

Generally if you take code from a GPL project and re-use it in anyway, and then redistribute that code (as it appears you intend to do by open sourcing your derived work), then your code must adhere to the GPL as well. In other words, your entire project will also need to be licensed under the GPL. Sounds crazy I know. But if that doesn't bother you, then you should feel free to use and re-use code to your hearts content.

Personally, I would package those functions you borrow from WordPress in a separate file. That way you keep a clear separation between your code (which you own the copyright to) and WordPress' code (which you do not own the copyright to). That way in the future you could easily replace the functions you borrowed with functions you author yourself, allowing you more freedom in how you license your project.

In the file that contains all of the functions borrowed from WordPress, make sure you clearly call out that the file contains code borrowed from WordPress. If you can indicate the version of WordPress it was borrowed from and the line numbers it was pulled from. What you want to do is be as transparent as you can about where code comes from, and/or how you have modified it. That is helpful not only to you later on, but also to the WordPress folks in case they want to understand the changes you made and reintegrate them back into their source code. I might have a header that looks something like this:

/* 
 * This file contains code that was borrowed from WordPress.
 * 
 * This is free software: you can redistribute it and/or modify it under the terms of
 * the GNU General Public License version 2 as published by the Free Software
 * Foundation.
 * 
 * This software 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.
 * 
 * Copyright: mixed. See WordPress.org for copyright and licensing information.
 */ 
share|improve this answer
    
thanks byrne, i will do that and hope its okay. –  fxuser Aug 3 '11 at 17:19
add comment

The WordPress source code licence is GPLv2:

http://wordpress.org/about/license/

-you should be able to see the GPL notice at the top of the files you're copying the source code from.

The GPL doesn't prohibit selling stuff based off GPL'd code, but you do need to preserve the original GPL header and publish any derived changes under the same licence.

You can read more about the GPL here:

http://www.gnu.org/copyleft/gpl.html

-and you might want to read this post from a guy coming at it from the opposite side:

http://meta.wordpress.stackexchange.com/questions/256/gpl-copyright-and-code-snippets

share|improve this answer
    
From GPLv2 : For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. ---- so that means that i can use the code but i have to comment and say where i got it from etc... am i correct? –  fxuser Aug 2 '11 at 11:41
    
btw, on the file that i want to copy the functions, it doesnt have any gpl notice, just explains that its a WP API, and its package. –  fxuser Aug 2 '11 at 12:51
add comment

If you take code from Wordpress, then you must ensure that your usage of the code is in compliance with the license under which Wordpress is released. These licenses will typically allow you to re-use, modify or make derivative works based on Wordpress or its code, providing that your work is also licensed under the same license.

Check the specific wordpress license to see what restrictions it imposes on usage - and also check that you are happy for your derived project to be released under the same license.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.