本文整理汇总了PHP中PluginHost::load_data方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginHost::load_data方法的具体用法?PHP PluginHost::load_data怎么用?PHP PluginHost::load_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginHost
的用法示例。
在下文中一共展示了PluginHost::load_data方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_rss_feed
function update_rss_feed($feed, $ignore_daemon = false, $no_cache = false)
{
$debug_enabled = defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug'];
_debug("start", $debug_enabled);
$result = db_query("SELECT id,update_interval,auth_login,\n\t\t\tfeed_url,auth_pass,cache_images,last_updated,\n\t\t\tmark_unread_on_update, owner_uid,\n\t\t\tpubsub_state, auth_pass_encrypted,\n\t\t\t(SELECT max(date_entered) FROM\n\t\t\t\tttrss_entries, ttrss_user_entries where ref_id = id AND feed_id = '{$feed}') AS last_article_timestamp\n\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
if (db_num_rows($result) == 0) {
_debug("feed {$feed} NOT FOUND/SKIPPED", $debug_enabled);
return false;
}
$last_updated = db_fetch_result($result, 0, "last_updated");
$last_article_timestamp = @strtotime(db_fetch_result($result, 0, "last_article_timestamp"));
if (defined('_DISABLE_HTTP_304')) {
$last_article_timestamp = 0;
}
$owner_uid = db_fetch_result($result, 0, "owner_uid");
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
$pubsub_state = db_fetch_result($result, 0, "pubsub_state");
$auth_pass_encrypted = sql_bool_to_bool(db_fetch_result($result, 0, "auth_pass_encrypted"));
db_query("UPDATE ttrss_feeds SET last_update_started = NOW()\n\t\t\tWHERE id = '{$feed}'");
$auth_login = db_fetch_result($result, 0, "auth_login");
$auth_pass = db_fetch_result($result, 0, "auth_pass");
if ($auth_pass_encrypted) {
require_once "crypt.php";
$auth_pass = decrypt_string($auth_pass);
}
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
$fetch_url = db_fetch_result($result, 0, "feed_url");
$feed = db_escape_string($feed);
$date_feed_processed = date('Y-m-d H:i');
$cache_filename = CACHE_DIR . "/simplepie/" . sha1($fetch_url) . ".xml";
$pluginhost = new PluginHost();
$pluginhost->set_debug($debug_enabled);
$user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
$pluginhost->load(PLUGINS, PluginHost::KIND_ALL);
$pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid);
$pluginhost->load_data();
$rss = false;
$rss_hash = false;
$force_refetch = isset($_REQUEST["force_refetch"]);
if (file_exists($cache_filename) && is_readable($cache_filename) && !$auth_login && !$auth_pass && filemtime($cache_filename) > time() - 30) {
_debug("using local cache.", $debug_enabled);
@($feed_data = file_get_contents($cache_filename));
if ($feed_data) {
$rss_hash = sha1($feed_data);
}
} else {
_debug("local cache will not be used for this feed", $debug_enabled);
}
if (!$rss) {
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) {
$feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed);
}
if (!$feed_data) {
_debug("fetching [{$fetch_url}]...", $debug_enabled);
_debug("If-Modified-Since: " . gmdate('D, d M Y H:i:s \\G\\M\\T', $last_article_timestamp), $debug_enabled);
$feed_data = fetch_file_contents($fetch_url, false, $auth_login, $auth_pass, false, $no_cache ? FEED_FETCH_NO_CACHE_TIMEOUT : FEED_FETCH_TIMEOUT, $force_refetch ? 0 : $last_article_timestamp);
global $fetch_curl_used;
if (!$fetch_curl_used) {
$tmp = @gzdecode($feed_data);
if ($tmp) {
$feed_data = $tmp;
}
}
$feed_data = trim($feed_data);
_debug("fetch done.", $debug_enabled);
/* if ($feed_data) {
$error = verify_feed_xml($feed_data);
if ($error) {
_debug("error verifying XML, code: " . $error->code, $debug_enabled);
if ($error->code == 26) {
_debug("got error 26, trying to decode entities...", $debug_enabled);
$feed_data = html_entity_decode($feed_data, ENT_COMPAT, 'UTF-8');
$error = verify_feed_xml($feed_data);
if ($error) $feed_data = '';
}
}
} */
}
if (!$feed_data) {
global $fetch_last_error;
global $fetch_last_error_code;
_debug("unable to fetch: {$fetch_last_error} [{$fetch_last_error_code}]", $debug_enabled);
$error_escaped = '';
// If-Modified-Since
if ($fetch_last_error_code != 304) {
$error_escaped = db_escape_string($fetch_last_error);
} else {
_debug("source claims data not modified, nothing to do.", $debug_enabled);
}
db_query("UPDATE ttrss_feeds SET last_error = '{$error_escaped}',\n\t\t\t\t\t\tlast_updated = NOW() WHERE id = '{$feed}'");
return;
}
}
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) {
$feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed);
//.........这里部分代码省略.........
示例2: index
//.........这里部分代码省略.........
print "<button dojoType=\"dijit.form.Button\" onclick=\"return validatePrefsReset()\">" . __('Reset to defaults') . "</button>";
print " ";
/* $checked = $_SESSION["prefs_show_advanced"] ? "checked='1'" : "";
print "<input onclick='toggleAdvancedPrefs()'
id='prefs_show_advanced'
dojoType=\"dijit.form.CheckBox\"
$checked
type=\"checkbox\"></input>
<label for='prefs_show_advanced'>" .
__("Show additional preferences") . "</label>"; */
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefPrefsPrefsOutside");
print "</form>";
print '</div>';
# inner pane
print '</div>';
# border container
print "</div>";
#pane
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Plugins') . "\">";
print "<p>" . __("You will need to reload Tiny Tiny RSS for plugin changes to take effect.") . "</p>";
print_notice(__("Download more plugins at tt-rss.org <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/forum/viewforum.php?f=22\">forums</a> or <a target=\"_blank\" class=\"visibleLink\" href=\"http://tt-rss.org/wiki/Plugins\">wiki</a>."));
print "<form dojoType=\"dijit.form.Form\" id=\"changePluginsForm\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\tevt.preventDefault();\n\t\tif (this.validate()) {\n\t\t\tnotify_progress('Saving data...', true);\n\n\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\tnotify('');\n\t\t\t\t\tif (confirm(__('Selected plugins have been enabled. Reload?'))) {\n\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t}\n\t\t\t} });\n\n\t\t}\n\t\t</script>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setplugins\">";
print "<table width='100%' class='prefPluginsList'>";
print "<tr><td colspan='4'><h3>" . __("System plugins") . "</h3></td></tr>";
print "<tr class=\"title\">\n\t\t\t\t<td width=\"5%\"> </td>\n\t\t\t\t<td width='10%'>" . __('Plugin') . "</td>\n\t\t\t\t<td width=''>" . __('Description') . "</td>\n\t\t\t\t<td width='5%'>" . __('Version') . "</td>\n\t\t\t\t<td width='10%'>" . __('Author') . "</td></tr>";
$system_enabled = array_map("trim", explode(",", PLUGINS));
$user_enabled = array_map("trim", explode(",", get_pref("_ENABLED_PLUGINS")));
$tmppluginhost = new PluginHost();
$tmppluginhost->load_all($tmppluginhost::KIND_ALL, $_SESSION["uid"]);
$tmppluginhost->load_data(true);
foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
$about = $plugin->about();
if ($about[3] && strpos($name, "example") === FALSE) {
if (in_array($name, $system_enabled)) {
$checked = "checked='1'";
} else {
$checked = "";
}
print "<tr>";
print "<td align='center'><input disabled='1'\n\t\t\t\t\t\tdojoType=\"dijit.form.CheckBox\" {$checked}\n\t\t\t\t\t\ttype=\"checkbox\"></td>";
$plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
print "<td><label><img src='images/{$plugin_icon}' alt=''> {$name}</label></td>";
print "<td>" . htmlspecialchars($about[1]);
if (@$about[4]) {
print " — <a target=\"_blank\" class=\"visibleLink\"\n\t\t\t\t\t\thref=\"" . htmlspecialchars($about[4]) . "\">" . __("more info") . "</a>";
}
print "</td>";
print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
print "<td>" . htmlspecialchars($about[2]) . "</td>";
if (count($tmppluginhost->get_all($plugin)) > 0) {
if (in_array($name, $system_enabled)) {
print "<td><a href='#' onclick=\"clearPluginData('{$name}')\"\n\t\t\t\t\t\t\tclass='visibleLink'>" . __("Clear data") . "</a></td>";
}
}
print "</tr>";
}
}
print "<tr><td colspan='4'><h3>" . __("User plugins") . "</h3></td></tr>";
print "<tr class=\"title\">\n\t\t\t\t<td width=\"5%\"> </td>\n\t\t\t\t<td width='10%'>" . __('Plugin') . "</td>\n\t\t\t\t<td width=''>" . __('Description') . "</td>\n\t\t\t\t<td width='5%'>" . __('Version') . "</td>\n\t\t\t\t<td width='10%'>" . __('Author') . "</td></tr>";
foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
$about = $plugin->about();
if (!$about[3] && strpos($name, "example") === FALSE) {
示例3: update_rss_feed
function update_rss_feed($feed, $ignore_daemon = false, $no_cache = false, $rss = false)
{
$debug_enabled = defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug'];
_debug_suppress(!$debug_enabled);
_debug("start", $debug_enabled);
$result = db_query("SELECT title FROM ttrss_feeds\n\t\t\tWHERE id = '{$feed}'");
$title = db_fetch_result($result, 0, "title");
// feed was batch-subscribed or something, we need to get basic info
// this is not optimal currently as it fetches stuff separately TODO: optimize
if ($title == "[Unknown]") {
_debug("setting basic feed info for {$feed}...");
set_basic_feed_info($feed);
}
$result = db_query("SELECT id,update_interval,auth_login,\n\t\t\tfeed_url,auth_pass,cache_images,\n\t\t\tmark_unread_on_update, owner_uid,\n\t\t\tpubsub_state, auth_pass_encrypted,\n\t\t\tfeed_language,\n\t\t\t(SELECT max(date_entered) FROM\n\t\t\t\tttrss_entries, ttrss_user_entries where ref_id = id AND feed_id = '{$feed}') AS last_article_timestamp\n\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
if (db_num_rows($result) == 0) {
_debug("feed {$feed} NOT FOUND/SKIPPED", $debug_enabled);
return false;
}
$last_article_timestamp = @strtotime(db_fetch_result($result, 0, "last_article_timestamp"));
if (defined('_DISABLE_HTTP_304')) {
$last_article_timestamp = 0;
}
$owner_uid = db_fetch_result($result, 0, "owner_uid");
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
$pubsub_state = db_fetch_result($result, 0, "pubsub_state");
$auth_pass_encrypted = sql_bool_to_bool(db_fetch_result($result, 0, "auth_pass_encrypted"));
db_query("UPDATE ttrss_feeds SET last_update_started = NOW()\n\t\t\tWHERE id = '{$feed}'");
$auth_login = db_fetch_result($result, 0, "auth_login");
$auth_pass = db_fetch_result($result, 0, "auth_pass");
if ($auth_pass_encrypted) {
require_once "crypt.php";
$auth_pass = decrypt_string($auth_pass);
}
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
$fetch_url = db_fetch_result($result, 0, "feed_url");
$feed_language = db_escape_string(mb_strtolower(db_fetch_result($result, 0, "feed_language")));
if (!$feed_language) {
$feed_language = 'english';
}
$feed = db_escape_string($feed);
$date_feed_processed = date('Y-m-d H:i');
$cache_filename = CACHE_DIR . "/simplepie/" . sha1($fetch_url) . ".xml";
$pluginhost = new PluginHost();
$pluginhost->set_debug($debug_enabled);
$user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
$pluginhost->load(PLUGINS, PluginHost::KIND_ALL);
$pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid);
$pluginhost->load_data();
if ($rss && is_object($rss) && get_class($rss) == "FeedParser") {
_debug("using previously initialized parser object");
} else {
$rss_hash = false;
$force_refetch = isset($_REQUEST["force_refetch"]);
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) {
$feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass);
}
// try cache
if (!$feed_data && file_exists($cache_filename) && is_readable($cache_filename) && !$auth_login && !$auth_pass && filemtime($cache_filename) > time() - 30) {
_debug("using local cache [{$cache_filename}].", $debug_enabled);
@($feed_data = file_get_contents($cache_filename));
if ($feed_data) {
$rss_hash = sha1($feed_data);
}
} else {
_debug("local cache will not be used for this feed", $debug_enabled);
}
// fetch feed from source
if (!$feed_data) {
_debug("fetching [{$fetch_url}]...", $debug_enabled);
_debug("If-Modified-Since: " . gmdate('D, d M Y H:i:s \\G\\M\\T', $last_article_timestamp), $debug_enabled);
$feed_data = fetch_file_contents($fetch_url, false, $auth_login, $auth_pass, false, $no_cache ? FEED_FETCH_NO_CACHE_TIMEOUT : FEED_FETCH_TIMEOUT, $force_refetch ? 0 : $last_article_timestamp);
global $fetch_curl_used;
if (!$fetch_curl_used) {
$tmp = @gzdecode($feed_data);
if ($tmp) {
$feed_data = $tmp;
}
}
$feed_data = trim($feed_data);
_debug("fetch done.", $debug_enabled);
// cache vanilla feed data for re-use
if ($feed_data && !$auth_pass && !$auth_login && is_writable(CACHE_DIR . "/simplepie")) {
$new_rss_hash = sha1($feed_data);
if ($new_rss_hash != $rss_hash) {
_debug("saving {$cache_filename}", $debug_enabled);
@file_put_contents($cache_filename, $feed_data);
}
}
}
if (!$feed_data) {
global $fetch_last_error;
global $fetch_last_error_code;
_debug("unable to fetch: {$fetch_last_error} [{$fetch_last_error_code}]", $debug_enabled);
$error_escaped = '';
// If-Modified-Since
if ($fetch_last_error_code != 304) {
$error_escaped = db_escape_string($fetch_last_error);
} else {
_debug("source claims data not modified, nothing to do.", $debug_enabled);
}
//.........这里部分代码省略.........
示例4: PluginHost
static function create_published_article($title, $url, $content, $labels_str, $owner_uid)
{
$guid = 'SHA1:' . sha1("ttshared:" . $url . $owner_uid);
// include owner_uid to prevent global GUID clash
if (!$content) {
$pluginhost = new PluginHost();
$pluginhost->load_all(PluginHost::KIND_ALL, $owner_uid);
$pluginhost->load_data();
$af_readability = $pluginhost->get_plugin("Af_Readability");
if ($af_readability) {
$enable_share_anything = $pluginhost->get($af_readability, "enable_share_anything");
if ($enable_share_anything) {
$extracted_content = $af_readability->extract_content($url);
if ($extracted_content) {
$content = db_escape_string($extracted_content);
}
}
}
}
$content_hash = sha1($content);
if ($labels_str != "") {
$labels = explode(",", $labels_str);
} else {
$labels = array();
}
$rc = false;
if (!$title) {
$title = $url;
}
if (!$title && !$url) {
return false;
}
if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
return false;
}
db_query("BEGIN");
// only check for our user data here, others might have shared this with different content etc
$result = db_query("SELECT id FROM ttrss_entries, ttrss_user_entries WHERE\n\t\t\tguid = '{$guid}' AND ref_id = id AND owner_uid = '{$owner_uid}' LIMIT 1");
if (db_num_rows($result) != 0) {
$ref_id = db_fetch_result($result, 0, "id");
$result = db_query("SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' LIMIT 1");
if (db_num_rows($result) != 0) {
$int_id = db_fetch_result($result, 0, "int_id");
db_query("UPDATE ttrss_entries SET\n\t\t\t\t\tcontent = '{$content}', content_hash = '{$content_hash}' WHERE id = '{$ref_id}'");
db_query("UPDATE ttrss_user_entries SET published = true,\n\t\t\t\t\t\tlast_published = NOW() WHERE\n\t\t\t\t\t\tint_id = '{$int_id}' AND owner_uid = '{$owner_uid}'");
} else {
db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t(ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache,\n\t\t\t\t\t\tlast_read, note, unread, last_published)\n\t\t\t\t\tVALUES\n\t\t\t\t\t('{$ref_id}', '', NULL, NULL, {$owner_uid}, true, '', '', NOW(), '', false, NOW())");
}
if (count($labels) != 0) {
foreach ($labels as $label) {
label_add_article($ref_id, trim($label), $owner_uid);
}
}
$rc = true;
} else {
$result = db_query("INSERT INTO ttrss_entries\n\t\t\t\t(title, guid, link, updated, content, content_hash, date_entered, date_updated)\n\t\t\t\tVALUES\n\t\t\t\t('{$title}', '{$guid}', '{$url}', NOW(), '{$content}', '{$content_hash}', NOW(), NOW())");
$result = db_query("SELECT id FROM ttrss_entries WHERE guid = '{$guid}'");
if (db_num_rows($result) != 0) {
$ref_id = db_fetch_result($result, 0, "id");
db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t(ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache,\n\t\t\t\t\t\tlast_read, note, unread, last_published)\n\t\t\t\t\tVALUES\n\t\t\t\t\t('{$ref_id}', '', NULL, NULL, {$owner_uid}, true, '', '', NOW(), '', false, NOW())");
if (count($labels) != 0) {
foreach ($labels as $label) {
label_add_article($ref_id, trim($label), $owner_uid);
}
}
$rc = true;
}
}
db_query("COMMIT");
return $rc;
}
示例5: update_rss_feed
function update_rss_feed($link, $feed, $ignore_daemon = false, $no_cache = false, $override_url = false)
{
require_once "lib/simplepie/simplepie.inc";
$debug_enabled = defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug'];
if ($debug_enabled) {
_debug("update_rss_feed: start");
}
$result = db_query($link, "SELECT id,update_interval,auth_login,\n\t\t\tfeed_url,auth_pass,cache_images,last_updated,\n\t\t\tmark_unread_on_update, owner_uid,\n\t\t\tpubsub_state\n\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
if (db_num_rows($result) == 0) {
if ($debug_enabled) {
_debug("update_rss_feed: feed {$feed} NOT FOUND/SKIPPED");
}
return false;
}
$last_updated = db_fetch_result($result, 0, "last_updated");
$owner_uid = db_fetch_result($result, 0, "owner_uid");
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
$pubsub_state = db_fetch_result($result, 0, "pubsub_state");
db_query($link, "UPDATE ttrss_feeds SET last_update_started = NOW()\n\t\t\tWHERE id = '{$feed}'");
$auth_login = db_fetch_result($result, 0, "auth_login");
$auth_pass = db_fetch_result($result, 0, "auth_pass");
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
$fetch_url = db_fetch_result($result, 0, "feed_url");
$feed = db_escape_string($feed);
/* if ($auth_login && $auth_pass ){
$url_parts = array();
preg_match("/(^[^:]*):\/\/(.*)/", $fetch_url, $url_parts);
if ($url_parts[1] && $url_parts[2]) {
$fetch_url = $url_parts[1] . "://$auth_login:$auth_pass@" . $url_parts[2];
}
} */
if ($override_url) {
$fetch_url = $override_url;
}
if ($debug_enabled) {
_debug("update_rss_feed: fetching [{$fetch_url}]...");
}
// Ignore cache if new feed or manual update.
$cache_age = is_null($last_updated) || $last_updated == '1970-01-01 00:00:00' ? -1 : get_feed_update_interval($link, $feed) * 60;
$simplepie_cache_dir = CACHE_DIR . "/simplepie";
if (!is_dir($simplepie_cache_dir)) {
mkdir($simplepie_cache_dir);
}
$feed_data = fetch_file_contents($fetch_url, false, $auth_login, $auth_pass, false, $no_cache ? 15 : 45);
if (!$feed_data) {
global $fetch_last_error;
if ($debug_enabled) {
_debug("update_rss_feed: unable to fetch: {$fetch_last_error}");
}
$error_escaped = db_escape_string($fetch_last_error);
db_query($link, "UPDATE ttrss_feeds SET last_error = '{$error_escaped}',\n\t\t\t\t\tlast_updated = NOW() WHERE id = '{$feed}'");
return;
}
$pluginhost = new PluginHost($link);
$pluginhost->set_debug($debug_enabled);
$user_plugins = get_pref($link, "_ENABLED_PLUGINS", $owner_uid);
$pluginhost->load(PLUGINS, $pluginhost::KIND_ALL);
$pluginhost->load($user_plugins, $pluginhost::KIND_USER, $owner_uid);
$pluginhost->load_data();
foreach ($pluginhost->get_hooks($pluginhost::HOOK_FEED_FETCHED) as $plugin) {
$feed_data = $plugin->hook_feed_fetched($feed_data);
}
if ($debug_enabled) {
_debug("update_rss_feed: fetch done, parsing...");
}
$rss = new SimplePie();
$rss->set_sanitize_class("SanitizeDummy");
// simplepie ignores the above and creates default sanitizer anyway,
// so let's override it...
$rss->sanitize = new SanitizeDummy();
$rss->set_output_encoding('UTF-8');
$rss->set_raw_data($feed_data);
if ($debug_enabled) {
_debug("feed update interval (sec): " . get_feed_update_interval($link, $feed) * 60);
}
$rss->enable_cache(!$no_cache);
if (!$no_cache) {
$rss->set_cache_location($simplepie_cache_dir);
$rss->set_cache_duration($cache_age);
}
@$rss->init();
// print_r($rss);
$feed = db_escape_string($feed);
if (!$rss->error()) {
// We use local pluginhost here because we need to load different per-user feed plugins
$pluginhost->run_hooks($pluginhost::HOOK_FEED_PARSED, "hook_feed_parsed", $rss);
if ($debug_enabled) {
_debug("update_rss_feed: processing feed data...");
}
// db_query($link, "BEGIN");
if (DB_TYPE == "pgsql") {
$favicon_interval_qpart = "favicon_last_checked < NOW() - INTERVAL '12 hour'";
} else {
$favicon_interval_qpart = "favicon_last_checked < DATE_SUB(NOW(), INTERVAL 12 HOUR)";
}
$result = db_query($link, "SELECT title,site_url,owner_uid,\n\t\t\t\t(favicon_last_checked IS NULL OR {$favicon_interval_qpart}) AS\n\t\t\t\t\t\tfavicon_needs_check\n\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
$registered_title = db_fetch_result($result, 0, "title");
$orig_site_url = db_fetch_result($result, 0, "site_url");
$favicon_needs_check = sql_bool_to_bool(db_fetch_result($result, 0, "favicon_needs_check"));
//.........这里部分代码省略.........