Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
content filters architecture
#2
shawn_a Wrote:I am trying to figure out how multiple content filters are supposed to work without a way to specify
sequence phases.

For example
I am using dynpages (of course) for components.
I am trying to make my own content filter.

My filter seems to process before dynpages.
So my content filter doesn't process dynpages output.

Most plugins' content filters don't need a specific order, because just a specific string, e.g. (% gallery ... %) is processed and this string is ignored by all other plugins.
The hypothetical case that a plugin like DynPages replaces something with a string for another plugin can be ignored, because in most cases there exists another way, e.g. don't put (% gallery ... %) in a component, but use <?php get_gallery(...); ?> instead.

shawn_a Wrote:I have also noticed that the I18n search plugin shows the unprocessed dynpages tags in its results or news feeds, so a similar issue there.

As described above that is no problem.

shawn_a Wrote:On a similar note.
Is there a standardized syntax for content insertion or replacer plugins ?

{% pluginname: function args %} ?

I haven't really seen a design guide for plugins so these don't wind up being a bunch of hacks as opposed to an actual plugin system.

Somebody started using (% ... %) as a syntax and this is now used in most plugins to have some consistency (although the way to pass parameters differs between plugins).
DynPages uses the {% ... %} for historic reasons.

shawn_a Wrote:So far I have seen plugins that check if other plugins functions exists and handling exceptions for it. This doesn't seem very ideal situation.

That's probably my plugins which have to run correctly with and without the I18N plugin ;-)

shawn_a Wrote:Would it even be possible to make a content filter phase rule plugin, that lets you specify phase sequence order of content filters?

How would you specify the sequence - the user doesn't know and the developer also doesn't know all plugins. I think that a plugin's content filter should work independent of the order and independent on how often it is called. This allows you to write code like the following, if your plugin needs to process the final HTML code:
Code:
function my_plugin_content($content) {
  global $my_plugin_within_content_filter;
  $my_plugin_within_content_filter = true;
  if ($my_plugin_within_content_filter) return $content;
  exec_filter('content', $content);
  ...
}
(of course, if two plugins do this, one wins)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply


Messages In This Thread
content filters architecture - by shawn_a - 2011-11-19, 00:41:00
content filters architecture - by mvlcek - 2011-11-19, 01:09:28
content filters architecture - by shawn_a - 2011-11-19, 01:53:08
content filters architecture - by n00dles101 - 2011-11-19, 02:12:40
content filters architecture - by mvlcek - 2011-11-19, 02:20:06
content filters architecture - by n00dles101 - 2011-11-19, 02:24:41



Users browsing this thread: 1 Guest(s)