本文整理汇总了PHP中PluginHost::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginHost::getInstance方法的具体用法?PHP PluginHost::getInstance怎么用?PHP PluginHost::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginHost
的用法示例。
在下文中一共展示了PluginHost::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Error Log') . "\">";
if (LOG_DESTINATION == "sql") {
$result = $this->dbh->query("SELECT errno, errstr, filename, lineno,\n\t\t\t\tcreated_at, login FROM ttrss_error_log\n\t\t\t\tLEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id)\n\t\t\t\tORDER BY ttrss_error_log.id DESC\n\t\t\t\tLIMIT 100");
print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"updateSystemList()\">" . __('Refresh') . "</button> ";
print " <button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"clearSqlLog()\">" . __('Clear log') . "</button> ";
print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">";
print "<tr class=\"title\">\n\t\t\t\t<td width='5%'>" . __("Error") . "</td>\n\t\t\t\t<td>" . __("Filename") . "</td>\n\t\t\t\t<td>" . __("Message") . "</td>\n\t\t\t\t<td width='5%'>" . __("User") . "</td>\n\t\t\t\t<td width='5%'>" . __("Date") . "</td>\n\t\t\t\t</tr>";
while ($line = $this->dbh->fetch_assoc($result)) {
print "<tr class=\"errrow\">";
foreach ($line as $k => $v) {
$line[$k] = htmlspecialchars($v);
}
print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>";
print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>";
print "<td class='errstr'>" . $line["errstr"] . "</td>";
print "<td class='login'>" . $line["login"] . "</td>";
print "<td class='timestamp'>" . make_local_datetime($line["created_at"], false) . "</td>";
print "</tr>";
}
print "</table>";
} else {
print_notice("Please set LOG_DESTINATION to 'sql' in config.php to enable database logging.");
}
print "</div>";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefSystem");
print "</div>";
#container
}
示例2: catchall
function catchall($method)
{
$plugin = PluginHost::getInstance()->get_plugin($_REQUEST["plugin"]);
if ($plugin) {
if (method_exists($plugin, $method)) {
$plugin->{$method}();
} else {
print error_json(13);
}
} else {
print error_json(14);
}
}
示例3: catchall
function catchall($method)
{
$plugin = PluginHost::getInstance()->get_plugin($_REQUEST["plugin"]);
if (!$plugin) {
print json_encode(array("error" => "PLUGIN_NOT_FOUND"));
return;
}
if (!method_exists($plugin, $method)) {
print json_encode(array("error" => "METHOD_NOT_FOUND"));
return;
}
$plugin->{$method}();
}
示例4: index
function index()
{
print "<div id=\"pref-label-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">";
print "<div id=\"pref-label-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
print "<div id=\"pref-label-toolbar\" dojoType=\"dijit.Toolbar\">";
print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(true)\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>";
print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(false)\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>";
print "</div></div>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return addLabel()\">" . __('Create label') . "</button dojoType=\"dijit.form.Button\"> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedLabels()\">" . __('Remove') . "</button dojoType=\"dijit.form.Button\"> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"labelColorReset()\">" . __('Clear colors') . "</button dojoType=\"dijit.form.Button\">";
print "</div>";
#toolbar
print "</div>";
#pane
print "<div id=\"pref-label-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">";
print "<div id=\"labellistLoading\">\n\t\t<img src='images/indicator_tiny.gif'>" . __("Loading, please wait...") . "</div>";
print "<div dojoType=\"dojo.data.ItemFileWriteStore\" jsId=\"labelStore\"\n\t\t\turl=\"backend.php?op=pref-labels&method=getlabeltree\">\n\t\t</div>\n\t\t<div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"labelModel\" store=\"labelStore\"\n\t\tquery=\"{id:'root'}\" rootId=\"root\"\n\t\t\tchildrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">\n\t\t</div>\n\t\t<div dojoType=\"fox.PrefLabelTree\" id=\"labelTree\"\n\t\t\tmodel=\"labelModel\" openOnClick=\"true\">\n\t\t<script type=\"dojo/method\" event=\"onLoad\" args=\"item\">\n\t\t\tElement.hide(\"labellistLoading\");\n\t\t</script>\n\t\t<script type=\"dojo/method\" event=\"onClick\" args=\"item\">\n\t\t\tvar id = String(item.id);\n\t\t\tvar bare_id = id.substr(id.indexOf(':')+1);\n\n\t\t\tif (id.match('LABEL:')) {\n\t\t\t\teditLabel(bare_id);\n\t\t\t}\n\t\t</script>\n\t\t</div>";
print "</div>";
#pane
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefLabels");
print "</div>";
#container
}
示例5: api_get_headlines
static function api_get_headlines($feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $include_attachments, $since_id, $search = "", $include_nested = false, $sanitize_content = true, $force_update = false, $excerpt_length = 100, $check_first_id = false)
{
if ($force_update && $feed_id > 0 && is_numeric($feed_id)) {
// Update the feed if required with some basic flood control
$result = db_query("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed_id}'");
if (db_num_rows($result) != 0) {
$last_updated = strtotime(db_fetch_result($result, 0, "last_updated"));
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
if (!$cache_images && time() - $last_updated > 120) {
include "rssfuncs.php";
update_rss_feed($feed_id, true, true);
} else {
db_query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'\n\t\t\t\t\t\t\tWHERE id = '{$feed_id}'");
}
}
}
/*$qfh_ret = queryFeedHeadlines($feed_id, $limit,
$view_mode, $is_cat, $search, false,
$order, $offset, 0, false, $since_id, $include_nested);*/
//function queryFeedHeadlines($feed, $limit,
// $view_mode, $cat_view, $search, $search_mode,
// $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false,
// $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false, $check_top_id = false) {
$params = array("feed" => $feed_id, "limit" => $limit, "view_mode" => $view_mode, "cat_view" => $is_cat, "search" => $search, "override_order" => $order, "offset" => $offset, "since_id" => $since_id, "include_children" => $include_nested, "check_first_id" => $check_first_id, "api_request" => true);
$qfh_ret = queryFeedHeadlines($params);
$result = $qfh_ret[0];
$feed_title = $qfh_ret[1];
$first_id = $qfh_ret[6];
$headlines = array();
$headlines_header = array('id' => $feed_id, 'first_id' => $first_id, 'is_cat' => $is_cat);
if (!is_numeric($result)) {
while ($line = db_fetch_assoc($result)) {
$line["content_preview"] = truncate_string(strip_tags($line["content"]), $excerpt_length);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
$line = $p->hook_query_headlines($line, $excerpt_length, true);
}
$is_updated = $line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1");
$tags = explode(",", $line["tag_cache"]);
$label_cache = $line["label_cache"];
$labels = false;
if ($label_cache) {
$label_cache = json_decode($label_cache, true);
if ($label_cache) {
if ($label_cache["no-labels"] == 1) {
$labels = array();
} else {
$labels = $label_cache;
}
}
}
if (!is_array($labels)) {
$labels = get_article_labels($line["id"]);
}
//if (!$tags) $tags = get_article_tags($line["id"]);
//if (!$labels) $labels = get_article_labels($line["id"]);
$headline_row = array("id" => (int) $line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), "published" => sql_bool_to_bool($line["published"]), "updated" => (int) strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], "feed_id" => $line["feed_id"], "tags" => $tags);
if ($include_attachments) {
$headline_row['attachments'] = get_article_enclosures($line['id']);
}
if ($show_excerpt) {
$headline_row["excerpt"] = $line["content_preview"];
}
if ($show_content) {
if ($sanitize_content) {
$headline_row["content"] = sanitize($line["content"], sql_bool_to_bool($line['hide_images']), false, $line["site_url"], false, $line["id"]);
} else {
$headline_row["content"] = $line["content"];
}
}
// unify label output to ease parsing
if ($labels["no-labels"] == 1) {
$labels = array();
}
$headline_row["labels"] = $labels;
$headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title;
$headline_row["comments_count"] = (int) $line["num_comments"];
$headline_row["comments_link"] = $line["comments"];
$headline_row["always_display_attachments"] = sql_bool_to_bool($line["always_display_enclosures"]);
$headline_row["author"] = $line["author"];
$headline_row["score"] = (int) $line["score"];
$headline_row["note"] = $line["note"];
$headline_row["lang"] = $line["lang"];
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) {
$headline_row = $p->hook_render_article_api(array("headline" => $headline_row));
}
array_push($headlines, $headline_row);
}
} else {
if (is_numeric($result) && $result == -1) {
$headlines_header['first_id_changed'] = true;
}
}
return array($headlines, $headlines_header);
}
示例6: __
?>
<div id="userConfigTab" dojoType="dijit.layout.ContentPane"
href="backend.php?op=pref-users"
title="<?php
echo __('Users');
?>
"></div>
<div id="systemConfigTab" dojoType="dijit.layout.ContentPane"
href="backend.php?op=pref-system"
title="<?php
echo __('System');
?>
"></div>
<?php
}
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TABS, "hook_prefs_tabs", false);
?>
</div>
<div id="footer" dojoType="dijit.layout.ContentPane" region="bottom">
<a class="insensitive" target="_blank" href="http://tt-rss.org/">
Tiny Tiny RSS</a>
<?php
if (!defined('HIDE_VERSION')) {
?>
v<?php
echo VERSION;
?>
<?php
}
?>
示例7: clearplugindata
function clearplugindata()
{
$name = $this->dbh->escape_string($_REQUEST["name"]);
PluginHost::getInstance()->clear_data(PluginHost::getInstance()->get_plugin($name));
}
示例8: housekeeping_common
function housekeeping_common($debug)
{
expire_cached_files($debug);
expire_lock_files($debug);
expire_error_log($debug);
$count = update_feedbrowser_cache();
_debug("Feedbrowser updated, {$count} feeds processed.");
purge_orphans(true);
$rc = cleanup_tags(14, 50000);
_debug("Cleaned {$rc} cached tags.");
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", "");
}
示例9: index
function index()
{
$pluginhost = PluginHost::getInstance();
$json_conf = $pluginhost->get($this, 'json_conf');
$showInfoEnabled = $pluginhost->get($this, 'af_fullpost_showinfo');
if ($showInfoEnabled) {
$fullPostChecked = "checked=\"1\"";
} else {
$fullPostChecked = "";
}
print "<p>Comma-separated list or one address per lin of webaddresses, for which you don't would fetch the full post.<br>Example: site1.com, site2.org, site3.de</p>";
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\tevt.preventDefault();\n\t\t\tif (this.validate()) {\n\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\tif (transport.responseText.indexOf('error')>=0) notify_error(transport.responseText);\n\t\t\t\t\t\telse notify_info(transport.responseText);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//this.reset();\n\t\t\t}\n\t\t\t</script>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_fullpost\">";
print "<table width='100%'><tr><td>";
print "Show processed by Readability info on article bottom: <input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"af_fullpost_showinfo\" id=\"af_fullpost_showinfo\" {$fullPostChecked}>";
print "</tr></td>";
print "<tr><td>";
print "<textarea dojoType=\"dijit.form.SimpleTextarea\" name=\"json_conf\" style=\"font-size: 12px; width: 99%; height: 500px;\">{$json_conf}</textarea>";
print "</td></tr></table>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Save") . "</button>";
print "</form>";
}
示例10: newaction
function newaction()
{
$action = json_decode($_REQUEST["action"], true);
if ($action) {
$action_param = $this->dbh->escape_string($action["action_param"]);
$action_id = (int) $action["action_id"];
} else {
$action_param = "";
$action_id = 0;
}
print "<form name='filter_new_action_form' id='filter_new_action_form'>";
print "<div class=\"dlgSec\">" . __("Perform Action") . "</div>";
print "<div class=\"dlgSecCont\">";
print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"\n\t\t\tonchange=\"filterDlgCheckAction(this)\">";
$result = $this->dbh->query("SELECT id,description FROM ttrss_filter_actions\n\t\t\tORDER BY name");
while ($line = $this->dbh->fetch_assoc($result)) {
$is_selected = $line["id"] == $action_id ? "selected='1'" : "";
printf("<option {$is_selected} value='%d'>%s</option>", $line["id"], __($line["description"]));
}
print "</select>";
$param_box_hidden = $action_id == 7 || $action_id == 4 || $action_id == 6 || $action_id == 9 ? "" : "display : none";
$param_hidden = $action_id == 4 || $action_id == 6 ? "" : "display : none";
$label_param_hidden = $action_id == 7 ? "" : "display : none";
$plugin_param_hidden = $action_id == 9 ? "" : "display : none";
print "<span id=\"filterDlg_paramBox\" style=\"{$param_box_hidden}\">";
print " ";
//print " " . __("with parameters:") . " ";
print "<input dojoType=\"dijit.form.TextBox\"\n\t\t\tid=\"filterDlg_actionParam\" style=\"{$param_hidden}\"\n\t\t\tname=\"action_param\" value=\"{$action_param}\">";
print_label_select("action_param_label", $action_param, "id=\"filterDlg_actionParamLabel\" style=\"{$label_param_hidden}\"\n\t\t\tdojoType=\"dijit.form.Select\"");
$filter_actions = PluginHost::getInstance()->get_filter_actions();
$filter_action_hash = array();
foreach ($filter_actions as $fclass => $factions) {
foreach ($factions as $faction) {
$filter_action_hash[$fclass . ":" . $faction["action"]] = $fclass . ": " . $faction["description"];
}
}
if (count($filter_action_hash) == 0) {
$filter_plugin_disabled = "disabled";
$filter_action_hash["no-data"] = __("No actions available");
} else {
$filter_plugin_disabled = "";
}
print_select_hash("filterDlg_actionParamPlugin", $action_param, $filter_action_hash, "style=\"{$plugin_param_hidden}\" dojoType=\"dijit.form.Select\" {$filter_plugin_disabled}", "action_param_plugin");
print "</span>";
print " ";
// tiny layout hack
print "</div>";
print "<div class=\"dlgButtons\">";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewActionDlg').execute()\">" . ($action ? __("Save action") : __('Add action')) . "</button> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewActionDlg').hide()\">" . __('Cancel') . "</button>";
print "</div>";
print "</form>";
}
示例11: globalUpdateFeeds
function globalUpdateFeeds()
{
RPC::updaterandomfeed_real($this->dbh);
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", false);
}
示例12: index
function index()
{
$pluginhost = PluginHost::getInstance();
$json_conf = $pluginhost->get($this, 'json_conf');
$test_conf = $pluginhost->get($this, 'test_conf');
print Feediron_PrefTab::get_pref_tab($json_conf, $test_conf);
}
示例13: format_headlines_list
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgr_last_feed = false, $override_order = false, $include_children = false)
{
if (isset($_REQUEST["DevForceUpdate"])) {
header("Content-Type: text/plain");
}
$disable_cache = false;
$reply = array();
$rgba_cache = array();
$timing_info = microtime(true);
$topmost_article_ids = array();
if (!$offset) {
$offset = 0;
}
if ($method == "undefined") {
$method = "";
}
$method_split = explode(":", $method);
if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
// Update the feed if required with some basic flood control
$result = $this->dbh->query("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
if ($this->dbh->num_rows($result) != 0) {
$last_updated = strtotime($this->dbh->fetch_result($result, 0, "last_updated"));
$cache_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "cache_images"));
if (!$cache_images && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) {
include "rssfuncs.php";
update_rss_feed($feed, true, true);
} else {
$this->dbh->query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'\n\t\t\t\t\t\t\tWHERE id = '{$feed}'");
}
}
}
if ($method_split[0] == "MarkAllReadGR") {
catchup_feed($method_split[1], false);
}
// FIXME: might break tag display?
if (is_numeric($feed) && $feed > 0 && !$cat_view) {
$result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE id = '{$feed}' LIMIT 1");
if ($this->dbh->num_rows($result) == 0) {
$reply['content'] = "<div align='center'>" . __('Feed not found.') . "</div>";
}
}
@($search = $this->dbh->escape_string($_REQUEST["query"]));
if ($search) {
$disable_cache = true;
}
@($search_mode = $this->dbh->escape_string($_REQUEST["search_mode"]));
if ($_REQUEST["debug"]) {
$timing_info = print_checkpoint("H0", $timing_info);
}
// error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");
if ($search_mode == '' && $method != '') {
$search_mode = $method;
}
// error_log("search_mode: " . $search_mode);
if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX && $feed > LABEL_BASE_INDEX) {
$handler = PluginHost::getInstance()->get_feed_handler(PluginHost::feed_to_pfeed_id($feed));
// function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false) {
if ($handler) {
$options = array("limit" => $limit, "view_mode" => $view_mode, "cat_view" => $cat_view, "search" => $search, "search_mode" => $search_mode, "override_order" => $override_order, "offset" => $offset, "owner_uid" => $_SESSION["uid"], "filter" => false, "since_id" => 0, "include_children" => $include_children);
$qfh_ret = $handler->get_headlines(PluginHost::feed_to_pfeed_id($feed), $options);
}
} else {
$qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order, $offset, 0, false, 0, $include_children);
}
if ($_REQUEST["debug"]) {
$timing_info = print_checkpoint("H1", $timing_info);
}
$result = $qfh_ret[0];
$feed_title = $qfh_ret[1];
$feed_site_url = $qfh_ret[2];
$last_error = $qfh_ret[3];
$last_updated = strpos($qfh_ret[4], '1970-') === FALSE ? make_local_datetime($qfh_ret[4], false) : __("Never");
$vgroup_last_feed = $vgr_last_feed;
$reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url, $feed_title, $feed, $cat_view, $search, $search_mode, $view_mode, $last_error, $last_updated);
$headlines_count = $this->dbh->num_rows($result);
/* if (get_pref('COMBINED_DISPLAY_MODE')) {
$button_plugins = array();
foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {
$pclass = "button_" . trim($p);
if (class_exists($pclass)) {
$plugin = new $pclass();
array_push($button_plugins, $plugin);
}
}
} */
if ($this->dbh->num_rows($result) > 0) {
$lnum = $offset;
$num_unread = 0;
$cur_feed_title = '';
$fresh_intl = get_pref("FRESH_ARTICLE_MAX_AGE") * 60 * 60;
if ($_REQUEST["debug"]) {
$timing_info = print_checkpoint("PS", $timing_info);
}
$expand_cdm = get_pref('CDM_EXPANDED');
while ($line = $this->dbh->fetch_assoc($result)) {
$line["content_preview"] = "— " . truncate_string(strip_tags($line["content_preview"]), 250);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
$line = $p->hook_query_headlines($line, 250, false);
}
//.........这里部分代码省略.........
示例14: api_get_headlines
static function api_get_headlines($feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $include_attachments, $since_id, $search = "", $search_mode = "", $include_nested = false, $sanitize_content = true)
{
$qfh_ret = queryFeedHeadlines($feed_id, $limit, $view_mode, $is_cat, $search, $search_mode, $order, $offset, 0, false, $since_id, $include_nested);
$result = $qfh_ret[0];
$feed_title = $qfh_ret[1];
$headlines = array();
while ($line = db_fetch_assoc($result)) {
$line["content_preview"] = truncate_string(strip_tags($line["content"]), 100);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
$line = $p->hook_query_headlines($line, 100, true);
}
$is_updated = $line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1");
$tags = explode(",", $line["tag_cache"]);
$labels = json_decode($line["label_cache"], true);
//if (!$tags) $tags = get_article_tags($line["id"]);
//if (!$labels) $labels = get_article_labels($line["id"]);
$headline_row = array("id" => (int) $line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), "published" => sql_bool_to_bool($line["published"]), "updated" => (int) strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], "feed_id" => $line["feed_id"], "tags" => $tags);
if ($include_attachments) {
$headline_row['attachments'] = get_article_enclosures($line['id']);
}
if ($show_excerpt) {
$headline_row["excerpt"] = $line["content_preview"];
}
if ($show_content) {
if ($sanitize_content) {
$headline_row["content"] = sanitize($line["content"], sql_bool_to_bool($line['hide_images']), false, $line["site_url"], false, $line["id"]);
} else {
$headline_row["content"] = $line["content"];
}
}
// unify label output to ease parsing
if ($labels["no-labels"] == 1) {
$labels = array();
}
$headline_row["labels"] = $labels;
$headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title;
$headline_row["comments_count"] = (int) $line["num_comments"];
$headline_row["comments_link"] = $line["comments"];
$headline_row["always_display_attachments"] = sql_bool_to_bool($line["always_display_enclosures"]);
$headline_row["author"] = $line["author"];
$headline_row["score"] = (int) $line["score"];
$headline_row["note"] = $line["note"];
$headline_row["lang"] = $line["lang"];
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) {
$headline_row = $p->hook_render_article_api(array("headline" => $headline_row));
}
array_push($headlines, $headline_row);
}
return $headlines;
}
示例15: init_plugins
function init_plugins()
{
PluginHost::getInstance()->load(PLUGINS, PluginHost::KIND_ALL);
return true;
}