Alright, I figured out the issue. The problem is that CodeColorer generates HTML tags in the first step of the Simple Download description processing (sdm_get_item_description_output function). In order to do that I need to call my function before and after sdm_get_item_description_output, which I can’t do since there are no callbacks provided.
If “Simple Download Monitor” is willing to make a change to switch from direct WP functions invocations to a more proper way of doing that – filters, we can fix the issue (and provide a way for other plugins to integrate).
Here is the proposed change to Simple Download Monitor:
In wp-content/plugins/simple-download-monitor/sdm-post-type-content-handler.php add this:
add_filter('sdm_downloads_description', 'do_shortcode' );
add_filter('sdm_downloads_description', 'wptexturize' );
add_filter('sdm_downloads_description', 'convert_smilies' );
add_filter('sdm_downloads_description', 'convert_chars' );
add_filter('sdm_downloads_description', 'wpautop' );
add_filter('sdm_downloads_description', 'shortcode_unautop' );
add_filter('sdm_downloads_description', 'prepend_attachment');
In wp-content/plugins/sim
ple-download-monitor/includes/sdm-utility-functions.php change sdm_get_item_description_output to:
function sdm_get_item_description_output($id) {
$item_description = get_post_meta($id, 'sdm_description', true);
$isset_item_description = isset($item_description) && !empty($item_description) ? $item_description : '';
return apply_filters('sdm_downloads_description', $isset_item_description);
}
The behavior of the plugin will not change, but this will allow me and other plugin authors to integrate with Simple Download Monitor, e.g. add extract processing. For example, this will allow me to fix CodeColorer by adding two filters:
add_filter('sdm_downloads_description', array('CodeColorerLoader', 'callBeforeHighlightCodeBlock'), -1000);
add_filter('sdm_downloads_description', array('CodeColorerLoader', 'callAfterHighlightCodeBlock'), 1000);
@mbrsolution, what do you think?