Part 4: Power Coders

Direct processing

You can directly process any content with an expression like this:

´Nzymes_Plugin::engine()->process($content, $origin, $filter, $priority);´

where

  • ´$content´ is a string with injections
  • ´$context´ is a post ID of the current post for all enzyme’s origins that are implicit / relative; it defaults to ´Nzymes_Engine::GLOBAL_POST´
    • use ´Nzymes_Engine::GLOBAL_POST´ or ´null´ to specify that you want to use whatever is the currently global post
    • use ´Nzymes_Engine::NO_POST´ to specify that you really don’t want any post
      • if needed, the author would be ´Nzymes_Engine::NO_POST_AUTHOR´ which is set to the admin ID
  • ´$filter´ is a WordPress filter; it defaults to ´Nzymes_Engine::DIRECT_FILTER´, which is ´nzymes_process´
  • ´$priority´ is a filter priority; it defaults to ´Nzymes_Plugin::PRIORITY´

´->process()´ works by adding the usual Nzymes filter handler to the given ´$filter´ at the given ´$priority´ and immediately calling ´apply_filters()´ on the given $content and $origin. This guarantees the same behavior and functionalities both in filtering mode and in direct processing mode.


Nzymes | WordPress Plugin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.