Nzymes vs Enzymes 2
Enzymes 2.3 still works flawlessly after many years and many WordPress versions. Due to a glitch in the matrix, I couldn’t offer a direct automatic update from Enzymes 2.3 to Enzymes 3. In WordPress it’s not possible any of the following:
- to require the auto-update of a plugin to save a backup of the installed version
- to disable the auto-update of a plugin while allowing the auto-install
- to tell users of a plugin that they have to save a backup of the installed version
So I had to choose the only professional update path that would guarantee Enzymes 2.3 users the expected experience.
Nzymes is a brand new plugin that shares almost the same syntax of the Enzymes 2 injections. It is completely independent from Enzymes 2.3 and you can, in fact, install and use both at the same time without any issue.
However, Nzymes is substantially better than Enzyme 2.3. Here are all the differences.
Controlled access
- Enzymes 2.3 has no roles nor permissions: either you activate the plugin and everything is available to everyone or… well, you deactivate it.
- Nzymes has enough roles and permissions to allow you (the admin) to fine tune the right access level for the right users.
Execution model
- Enzymes 2.3 interprets injections from left to right by means of esoteric mechanisms: the pathway and the content. It’s a bit complicated.
- Nzymes allows blog owners to effortlessly read an injection and foresee its result.
- The value ´return´ed by an enzyme replaces the enzyme (and all of its arguments, if any) in the injection.
- The value ´return´ed by the last enzyme replaces all the injection.
- All output is captured and sent to the browser’s console.
Arguments vs Reverse Polish Notation
- Enzymes 2.3 executions’ arguments, like ´.anything(.args)´ are passed by means of an esoteric mechanism: the substrate. It’s a bit complicated and not very flexible.
- Nzymes executions’ arguments, like ´.arg1 | .arg2 | … | .argN | .anything(N)´ are passed into an ´$arguments´ array. For example, to get 7 from ´{[ 3 | 4 | .+(2) ]}´ all you need is a ´+´ custom field whose value is ´list($a, $b) = $arguments; return $a + $b;´.
Engine access
- Enzymes 2.3 plugin’s engine is a global object. It can execute not only as a filter but also directly, both from outside posts and from inside custom fields. The global ´metabolize()´ function is used for that.
- Nzymes plugin’s engine is a singleton object. It achieves exactly the same by means of the ´Nzymes_Engine::metabolize()´ method.
Default post
- Enzymes 2.3 always uses the global post by default, if the engine is called directly, without a post object.
- Nzymes always uses what is explicitly provided. If the engine needs to work without a post object, ´Nzymes_Engine::NO_POST´ must be passed. If the engine needs to work with the global post, ´get_post()´ can be passed.
Templates support
- Enzymes 2.3 supports templates, which are files used to output what the injection has prepared. They are a bit complicated and not really useful.
- Nzymes has no templates. But you can easily achieve the same result with an execution enzyme, if you have at least the Coder role (strengthened security).
Author prefix
- Enzymes 2.3 uses ´~author´ to get to the author of a post. A ´/´ introduces templates.
- Nzymes uses ´/author´ instead. A ´/´ is much easier to find on a keyboard than a ´~´.
Quoted custom fields
- Enzymes 2.3 allows to inject alphanumeric names without wrapping them into ´=´ quotes.
- Nzymes allows to inject unquoted names containing symbols, except ´. = | ] }´.
Standard attributes
- Enzymes 2.3 uses its own attribute names. For example, ´{[ :date_gmt ]}´ would show the GMT date on which the injection post was created.
- Nzymes uses WordPress raw attribute names. For the same date you inject ´{[ :post_date_gmt ]}´. This allows a simpler engine and better documentation.
Plugin priority
- Enzymes 2.3 handles WordPress content filtering at priority 10. You can change it by editing the ´enzymes/enzymes.php´ file, and the change affects the whole engine.
- Nzymes handles WordPress content filtering at priority 9. You can change it by editing the ´nzymes/src/Enzymes/Plugin.php´ file, and the change affects the whole engine. If you use both Enzymes 2.3 and Nzymes, always set the latter priority higher than the former.
Injection priority
- Enzymes 2.3 does not support any other priority than the one for the plugin.
- Nzymes allows you to set the priority at which an injection is supposed to be processed.
Debugging help
- Enzymes 2.3 doesn’t help you in any way while developing execution enzymes. If something fails, you either get a broken post or deleted injection.
- Nzymes tries its best at providing you with meaningful information about where the error occurred and why. This information is always sent to the JavaScript console.
|
|
Nzymes | WordPress Plugin |
© 2015 by Andrea Ercolino |