Merge pull request #374 from dzaikos/plugin-hook-enclosures

Plugin hook enclosures
This commit is contained in:
Andrew Dolgov 2014-05-14 12:09:01 +04:00
commit a283bf2643
2 changed files with 11 additions and 1 deletions

View file

@ -40,6 +40,7 @@ class PluginHost {
const HOOK_QUERY_HEADLINES = 23;
const HOOK_HOUSE_KEEPING = 24;
const HOOK_SEARCH = 25;
const HOOK_FORMAT_ENCLOSURES = 26;
const KIND_ALL = 1;
const KIND_SYSTEM = 2;

View file

@ -1846,8 +1846,17 @@
$result = get_article_enclosures($id);
$rv = '';
if (count($result) > 0) {
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FORMAT_ENCLOSURES) as $plugin) {
$retval = $plugin->hook_format_enclosures($rv, $result, $id, $always_display_enclosures, $article_content, $hide_images);
if (is_array($retval)) {
$rv = $retval[0];
$result = $retval[1];
} else {
$rv = $retval;
}
}
if ($rv === '' && !empty($result)) {
$entries_html = array();
$entries = array();
$entries_inline = array();