Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-11-18 17:24:26

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

pat_amazon_isbn


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#2 2013-11-18 18:11:24

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: pat_amazon_isbn

Pat64 wrote:

Website

what a cool website and even cooler plugin.

PS why when we go to http://cara-tm.com does an opinion poll start-up? did you intend this?

Last edited by bici (2013-11-19 06:15:18)


…. texted postive

Offline

#3 2013-11-20 14:29:48

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: pat_amazon_isbn

Free lite version added (only redirect to Amazon Spanish stores).
Check the plugin website.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#4 2013-11-20 15:01:03

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: pat_amazon_isbn

FYI: Textpattern shows a preview of a plugin’s code before the user finally installs it in her system. This is done with the intention to find malevolent plugin code before it even touches a site’s database.

The plugin advertised in this thread contains obfuscated PHP code. Users cannot read all of its code in the plugin preview stage mentioned above and thus will have to jump through extra hoops to learn about it’s real inner workings.

Personally I cannot think of any sensible reason why the author chose to use this uncommon method of code distribution.

Offline

#5 2013-11-21 08:16:24

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: pat_amazon_isbn

wet wrote:

Personally I cannot think of any sensible reason why the author chose to use this uncommon method of code distribution.

Hi Robert

The plugin is now free for download. And there is no obfuscated PHP code in it.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#6 2013-11-21 10:19:17

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: pat_amazon_isbn

I don’t see issues in distributing obfuscated plugin packages. If you want to do that, its fine. It’s your right, as long as you follow GNU General Public License version 2 terms. Selling plugins is fine too.

The plugin code contains:

@license: commercial

What is this mentioned “commercial” license? I don’t see terms. This license should be, no matter whether the plugin is commercial or not, GPLv2 (or compatible).

To comment on the source itself:

$isbn = implode( '', explode('-', $number) );

Is same as str_replace('-', '', $number); used elsewhere in the code.

function validate_url ($host)function validate_isbn ($isbn)

Both function definitions should either be prefixed or namespaced to avoid conflicts and collisions. Plugins should never defined elements in global namespace without it being prefixed with your plugin author prefix.

trigger_error('error with the url attribute', E_USER_WARNING);

Textpattern has a localized error string for invalid attributes you can use, I believe.

$host = parse_url($host);
preg_match('/(.*?)((\.co)?.[a-z]{2,4})$/i', $host['host'], $m);
$link = isset($m[2]) ? 'http://www.amazon'.$m[2].'/dp/' : trigger_error('error with the url attribute', E_USER_WARNING);

That seems rather strange. It works as long as processed domains are limited, but still seems strange to openly parse the tld to only use hard-coded amazon as the TLD. I would rather just ask a TLD from the user and then use that as the target.

@param:

These look like docblocks, but they aren’t. The comment syntax many PHP projects use, including Textpattern, is an actual syntax and is used by IDE and to generate API documentation, opposed to being stylistically chosen. For instance the comment for validate_url could look like:

/**
 * Validates and builds an URL.
 *
 * Extracts the TLD extension from the given URL, and
 * uses it to create a link to a specific international Amazon
 * store.
 *
 * @param  string $host The Amazon store URL
 * @return string URL to the Amazon store based on the given $host extension
 */

Formatted according the PHPdoc spec:

  • DocBlocks are indicated with /** opening. They are their own comment type in PHP.
  • First paragraph is short description. Should be single liner, short. Usually used as a tag line or as a tooltip in documentation pages and IDEs.
  • Long description, separated by empty line. Describes the element in question. Can use limited set of HTML formatting.
  • Tags such as param and return, documenting arguments and returned values.

Last edited by Gocom (2013-11-21 10:23:44)

Offline

Board footer

Powered by FluxBB