PDA

View Full Version : Small World - PHP Code at php.net


mkarolow
28th of June 2004 (Mon), 14:40
Pekka,

I was perusing php.net's EXIF function site and noticed that you have posted the code from EE for handling Photoshop CS' EXIF data (http://www.photography-on-the.net/ee/beta/cs_xmp_to_exif.php).

You said on that page:
Feel free to improve this, post new versions for all to see.
You didn't specically mention a license. Do you consider it public domain, as I was thinking about trying to shoehorn it into another gallery, licensed under the GPL.

Thanks!

Pekka
28th of June 2004 (Mon), 15:42
It's like all content in manuals and user comments in and linked in php.net documents and discussions, of course you may use them in your code but keep the copyright notes intact if there are some, but you can not expect the code taken to fall under your licence whatever that may be. I have for example in my fetchsettings.php noted the source like this:


// from http://www.php.net/manual/en/function.preg-replace.php
function ee_parseHyper($string) {
$search = array
("/([\w\.\/\&\=\?\-]+)@([\w\.\/\&\=\?\#\-]+)/",
"/((ftp(7?):\/\/)|(ftp\.))([\w\.\/\&\~\=\?\#\-]+)/",
"/((http(s?):\/\/)|(www\.))([\w\.\/\&\~\=\?\#\-]+)/");
$replace = array ("<a href='mailto:$1@$2'>$1@$2</a>",
"<a href='ftp$3://$4$5'>$4$5</a>",
"<a href='http$3://$4$5' target=\"link\">$4$5</a>");
return preg_replace ($search, $replace, $string);
}

The comment will hopefully show that this code portion is from php.net (i.e. Open Source function). I used that function because I really suck with RegExp :roll:

If the function is altered by you so much that is not really the same function any more one may of course leave the original source out by own discretion - php.net and many other php tutorial sites are places to learn and those samples are just tools in that. If you improve the functions you got and benefit from them it is of course very nice if you could give something back to all in turn in form of some new and useful function, right? :)

I don't think there are strict rules about all this but above is how I think it is ethical to do it. Other example site is http://www.zend.com/codex.php which only says...

The Code Gallery features snippets of PHP code that can be integrated into your PHP application.

...and there is link Open Source to http://www.devshed.com/ so I think this approach is the right one: treat each publicly submitted function as "Open Source function".

P.S. Thanks for asking!