## Filters: edu-sharing Filter

filter_edusharing
Maintained by Christian Ernst, Steffen Hippeli
The edu-sharing filter displays embedded edu-sharing content.
29 sites
2 fans
Moodle 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7

The edu-sharing filter displays embedded edu-sharing content.

### Dependencies

Depends on the edu-sharing activity module. The filter is only needed together the editor plugin.

### Installation

Activate the edu-sharing filter, set it up for moodle and html texts and push it to the first position in the filter overview list

For a full documentation with screenshots of the post installation steps for the edu-sharing plugin pakage visit the documentation pages.

### Awards

• Wed, Apr 27, 2016, 3:54 PM
Prechecker results: 367 errors/47 warnings
http://integration.moodle.org/job/Precheck%20remote%20branch/23128/artifact/work/smurf.html

* Please provide a full description of the plugin. You can describe the plugin's features, purpose and typical usage scenarios there, for example.
* Bug tracker is not specified for your plugin. Providing a place for users of your plugin to report issues encourages participation and provides a way for users to report bugs, make feature requests, or suggest other types of improvements.
* In order to facilitate easier sharing and further development of your open-source plugin, please provide publicly accessible URL of your code repository. The suggested naming convention of the repository is moodle-{plugintype}_{pluginname}.
* Please add a screenshot of your plugin to help folks get an idea of what it looks like when installed.
• Sat, Aug 27, 2016, 12:03 AM

Thanks Steffen for sharing this filter with the Moodle community. I've been looking at this together with reviewing the edusharing activity module. One thing I noticed is that your filter does a lot of things on all pages by default - such as it tries to prevent the browser from caching them, it includes the module's jQuery and other JS modules and it attempts to connect to the edu-sharing server via SOAP. This all seems to happen on every single page even if there is no edu-sharing contents on it.

I am afraid of potential performance impacts due to such behaviour. I believe it would be much cleaner if the filter's filter() method first checked via a quick and check strpos()call that the passed \$text contains a substring like es:resource_id. It would then perform all the required steps only then, otherwise it would quit early.

Such an approach is recommended even for plugins that make much less than your filter does. I am marking this as needing more work now so you can evaluate this and provide a new fixed version. Thanks for your patience with the plugin approval process.

• Thu, Sep 29, 2016, 10:22 PM
Hi David,
finally i had the time to change this issue. Now the scripts will be loaded only if actually there is some edu-sharaing content in the text.
• Thu, Nov 24, 2016, 5:20 AM

Hi Steffen, and sorry for the delay in finishing the review of your plugin. There are couple of issues I spotted that should be addressed in a future version.

• You call reset_text_filters_cache() every time you initialize the filter. As a consequence, your filter effectively switches off all caching for all filters (and even worse, adds some extra processing on top of it). I don't think the filter is supposed to use this function like this.
• Performance wise, the preg_match_all() is generally much slower than strpos() check. I still think it would make sense to use the latter one first to see if a substring like es:resource_id is present at all. And only if so, call preg_match_all() and gather the actual matches.
• Your CSS file styles.css uses too generic selectors like .inner and is likely to affect other parts of the Moodle interface. Please refer to https://docs.moodle.org/dev/Plugin_contribution_checklist#CSS_styles
• As you are using your own low level curl calls to obtain the remote content, the plugin does not respect other related site's settings (such as proxy etc). It might be better (and safer) to stick to using Moodle core API for these things.

Some of these issues are quite serious and normally I would prefer to see them fixed before publishing the plugin here. But I am going to approve this now anyway as the filter is an essential companion of the edusharing set and I believe you will improve it soon. You are cleared to land, welcome to the Plugins directory.