Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
content filters architecture
#1
I was wondering if someone could offer some help on the architecture of content filters and its control structure.

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.

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.

Any ideas ?

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.

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.

Would it even be possible to make a content filter phase rule plugin, that lets you specify phase sequence order of content filters?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#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
#3
Mosty understood, but I am not referring to only hypothetical cases, or even problem cases.

In actual cases, there exists an issue, a dilemma of sorts, where plugins are limited by the fact that they can't be ran post processing when using inline replacers. Again, my search results ( a plugin ) shows dynpages tags, that's a real problem not a hypothetical one. Ideally it would show final processed content with all content filters processed. There lies a limitation.

If a plugin requires the entire final content of the page, how could that be achieved?
What if there are multiple plugins that need the final content of the pages.
Can a plugin register its own callback perhaps.
Can there be a an inline content and separate final content filter.

Is it really above users heads to allow sequencing or prioritizing a filter ?

Say my plugin requires replacements to be performed on all final output, including the output of components that were inserted with replacers like dynpages or custom tags etc.

Is there a way to implement that ?

What about a page cache plugin, how might that work ?

Not being critical, more interested in the discussion. Obviously I can make whatever I need work for me, but if I we make something a plugin for everyone I know I would prefer that.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#4
Hi Guys,

yes this is a problem and there is no easy solution at the moment.

We did toy around with adding a priority to Plugins and filters much like how Wordpress does it.

Say you have 3 or 4 plugins which need to be run last, how do we prioritize ?
Without knowing all the installed plugins and the possible effect they might have on each other
we have the same problem.

Any solution we post here to ensure your filter runs last can be used by everyone and we have the problem once again.

Anyone go any other Ideas on how we can solve this?

Mike.
My Github Repos: Github
Website: DigiMute
Reply
#5
shawn_a Wrote:Mosty understood, but I am not referring to only hypothetical cases, or even problem cases.

In actual cases, there exists an issue, a dilemma of sorts, where plugins are limited by the fact that they can't be ran post processing when using inline replacers. Again, my search results ( a plugin ) shows dynpages tags, that's a real problem not a hypothetical one. Ideally it would show final processed content with all content filters processed. There lies a limitation.

If you are writing about I18N Search, unless you use special (I think still undocumented) excerpt features, it was intended to show text only. And it is a different issue as the plugin would have to process the content of each search result separately and then create the excerpt from the final HTML.

shawn_a Wrote:If a plugin requires the entire final content of the page, how could that be achieved?
What if there are multiple plugins that need the final content of the pages.

See my previous post, last code example.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#6
the "plugin_insight" plugin

http://get-simple.info/extend/plugin/plugin-insight/13/

Will display the order in which plugins are executed aswell as the order of all hooks and filters...
Which at the moment is the order in which the plugins are loaded.

m
My Github Repos: Github
Website: DigiMute
Reply




Users browsing this thread: 1 Guest(s)