tra('HTML Feed Link'), 'documentation' => 'PluginHtmlFeedlink', 'description' => tra('Receive and display content from another site sent using PluginHTMLFeed'), 'prefs' => [ 'feature_wiki', 'wikiplugin_htmlfeedlink', 'feature_htmlfeed' ], 'body' => tra('Initial Value'), 'iconname' => 'link', 'filter' => 'rawhtml_unsafe', 'tags' => [ 'basic' ], 'introduced' => 9, 'params' => [ 'feed' => [ 'required' => false, 'name' => tra('Feed Location'), 'description' => tra(''), 'since' => '9.0', ], 'name' => [ 'required' => false, 'name' => tra('Content Name'), 'description' => tra(''), 'since' => '9.0', ], 'style' => [ 'required' => false, 'name' => tra('Content Style'), 'since' => '9.0', 'options' => [ ['text' => tra('None'), 'value' => ''], ['text' => tra('Highlight'), 'value' => 'highlight'], ['text' => tra('Asterisk'), 'value' => 'asterisk'], ], ], 'type' => [ 'required' => false, 'name' => tra('HTML Feed Link Type'), 'since' => '9.0', 'default' => 'replace', 'options' => [ ['text' => tra('Replace'), 'value' => 'replace'], ['text' => tra('Backlink'), 'value' => 'backlink'], ['text' => tra('Popup'), 'value' => 'popup'], ['text' => tra('Hover'), 'value' => 'hover'], ], ], 'moderate' => [ 'required' => false, 'name' => tra('Moderated?'), 'since' => '9.0', 'default' => 'n', 'options' => [ ['text' => '', 'value' => ''], ['text' => tra('Yes'), 'value' => 'y'], ['text' => tra('No'), 'value' => 'n'] ], ], 'date' => [ 'required' => false, 'name' => tra('Date'), 'description' => tr('Date of last accepted HTML item, not used if not moderated'), 'since' => '9.0', 'default' => '', ], ], ]; } function wikiplugin_htmlfeedlink($data, $params) { global $page, $caching; $headerlib = TikiLib::lib('header'); $tikilib = TikiLib::lib('tiki'); static $htmlFeedLinkI = 0; ++$htmlFeedLinkI; $params = array_merge( [ "feed" => "", "name" => "", "type" => "replace", "moderate" => "y", "style" => "", "date" => "" ], $params ); extract($params, EXTR_SKIP); if (empty($feed)) { return $data; } if (isset($caching)) { return $data; //caching is running, if no return, causes recursive parsing } $htmlFeed = new Feed_Html_Receive($feed); $headerlib->add_jq_onready( "if (!$.fn.htmlFeedPopup) { $.fn.htmlFeedPopup = function(s) { $(this).each(function() { $(this) .css('cursor', 'pointer') .hover(function(){ $(this).css('background-color', 'yellow'); },function(){ $(this).css('background-color', ''); }) .click(function() { $('
' + s.description + '
') .dialog({ title: s.name }); }); }); return this; }; } $(document) .off('plugin_htmlfeedlink_ready') .on('plugin_htmlfeedlink_ready', function(e) { var name = $(e.container).find('#param_name input:first'); name.hide(); var nameSelect = $(' ~/np~"; } else { $data = "~np~" . $item->description . "~/np~"; } } else { $data = $item->description; } break; case "backlink": $data = "" . $data . ""; break; case "popup": $headerlib->add_jq_onready( "$('#backlink') .htmlFeedPopup(" . $link . ");" ); break; case "hover": break; } $link = json_encode($link); } $result = "" . $data . ""; switch ($style) { case "highlight": $headerlib->add_jq_onready( "$('#htmlFeedLink$htmlFeedLinkI') .css('border', '1px solid red');" ); break; case "asterisk": $result = "*" . $result; break; } $archives = ""; foreach ($htmlFeed->getItemFromDates($item->name) as $archive) { $archives .= "" . htmlspecialchars($archive->name) . " " . htmlspecialchars($archive->date) . "
"; } if (strlen($archives) > 0) { $result .= "~np~ ~/np~"; $headerlib->add_jq_onready( <<') .html(item.description) .dialog(); }); return false; }); }); JQ ); } return $result; }