本文整理汇总了PHP中Publisher::publish_update方法的典型用法代码示例。如果您正苦于以下问题:PHP Publisher::publish_update方法的具体用法?PHP Publisher::publish_update怎么用?PHP Publisher::publish_update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Publisher
的用法示例。
在下文中一共展示了Publisher::publish_update方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_to_endpoints
public function post_to_endpoints(Post $post)
{
$feeds = array(URL::get('atom_feed'));
foreach (Options::get('pubsubhubbub__endpoints') as $endpoint) {
$p = new Publisher($endpoint);
$p->publish_update($feeds);
}
}
示例2: pubsub_post
function pubsub_post()
{
require_once mnminclude . 'pubsubhubbub/publisher.php';
global $globals;
if (!$globals['pubsub']) {
return false;
}
$rss = 'http://' . get_server_name() . $globals['base_url'] . 'rss2.php';
$p = new Publisher($globals['pubsub']);
if ($p->publish_update($rss)) {
syslog(LOG_NOTICE, "Meneame: posted to pubsub ({$rss})");
} else {
syslog(LOG_NOTICE, "Meneame: failed to post to pubsub ({$rss})");
}
}
示例3: publish_to_hub
function publish_to_hub($post_id)
{
// we want to notify the hub for every feed
$feed_urls = array();
$feed_urls[] = get_bloginfo('atom_url');
$feed_urls[] = get_bloginfo('rss_url');
$feed_urls[] = get_bloginfo('rdf_url');
$feed_urls[] = get_bloginfo('rss2_url');
// remove dups (ie. they all point to feedburner)
$feed_urls = array_unique($feed_urls);
// get the address of the publish endpoint on the hub
$hub_url = get_pubsub_endpoint();
$p = new Publisher($hub_url);
// need better error handling
if (!$p->publish_update($feed_urls, "http_post_wp")) {
print_r($p->last_response());
}
return $post_id;
}
示例4: updateArticle
function updateArticle()
{
$article_ids = array_filter(explode(",", $this->dbh->escape_string($_REQUEST["article_ids"])), is_numeric);
$mode = (int) $this->dbh->escape_string($_REQUEST["mode"]);
$data = $this->dbh->escape_string($_REQUEST["data"]);
$field_raw = (int) $this->dbh->escape_string($_REQUEST["field"]);
$field = "";
$set_to = "";
switch ($field_raw) {
case 0:
$field = "marked";
$additional_fields = ",last_marked = NOW()";
break;
case 1:
$field = "published";
$additional_fields = ",last_published = NOW()";
break;
case 2:
$field = "unread";
$additional_fields = ",last_read = NOW()";
break;
case 3:
$field = "note";
}
switch ($mode) {
case 1:
$set_to = "true";
break;
case 0:
$set_to = "false";
break;
case 2:
$set_to = "NOT {$field}";
break;
}
if ($field == "note") {
$set_to = "'{$data}'";
}
if ($field && $set_to && count($article_ids) > 0) {
$article_ids = join(", ", $article_ids);
$result = $this->dbh->query("UPDATE ttrss_user_entries SET {$field} = {$set_to} {$additional_fields} WHERE ref_id IN ({$article_ids}) AND owner_uid = " . $_SESSION["uid"]);
$num_updated = $this->dbh->affected_rows($result);
if ($num_updated > 0 && $field == "unread") {
$result = $this->dbh->query("SELECT DISTINCT feed_id FROM ttrss_user_entries\n\t\t\t\t\tWHERE ref_id IN ({$article_ids})");
while ($line = $this->dbh->fetch_assoc($result)) {
ccache_update($line["feed_id"], $_SESSION["uid"]);
}
}
if ($num_updated > 0 && $field == "published") {
if (PUBSUBHUBBUB_HUB) {
$rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key(-2, false);
$p = new Publisher(PUBSUBHUBBUB_HUB);
$pubsub_result = $p->publish_update($rss_link);
}
}
$this->wrap(self::STATUS_OK, array("status" => "OK", "updated" => $num_updated));
} else {
$this->wrap(self::STATUS_ERR, array("error" => 'INCORRECT_USAGE'));
}
}
示例5: update_rss_feed
//.........这里部分代码省略.........
_debug("user record not found, creating...", $debug_enabled);
if ($score >= -500 && !find_article_filter($article_filters, 'catchup')) {
$unread = 'true';
$last_read_qpart = 'NULL';
} else {
$unread = 'false';
$last_read_qpart = 'NOW()';
}
if (find_article_filter($article_filters, 'mark') || $score > 1000) {
$marked = 'true';
} else {
$marked = 'false';
}
if (find_article_filter($article_filters, 'publish')) {
$published = 'true';
} else {
$published = 'false';
}
// N-grams
if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) {
$result = db_query("SELECT COUNT(*) AS similar FROM\n\t\t\t\t\t\t\t\t\tttrss_entries,ttrss_user_entries\n\t\t\t\t\t\t\t\tWHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'\n\t\t\t\t\t\t\t\t\tAND similarity(title, '{$entry_title}') >= " . _NGRAM_TITLE_DUPLICATE_THRESHOLD . "\n\t\t\t\t\t\t\t\t\tAND owner_uid = {$owner_uid}");
$ngram_similar = db_fetch_result($result, 0, "similar");
_debug("N-gram similar results: {$ngram_similar}", $debug_enabled);
if ($ngram_similar > 0) {
$unread = 'false';
}
}
$last_marked = $marked == 'true' ? 'NOW()' : 'NULL';
$last_published = $published == 'true' ? 'NOW()' : 'NULL';
$result = db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid,\n\t\t\t\t\t\t\t\tlast_marked, last_published)\n\t\t\t\t\t\t\tVALUES ('{$ref_id}', '{$owner_uid}', '{$feed}', {$unread},\n\t\t\t\t\t\t\t\t{$last_read_qpart}, {$marked}, {$published}, '{$score}', '', '',\n\t\t\t\t\t\t\t\t'', {$last_marked}, {$last_published})");
if (PUBSUBHUBBUB_HUB && $published == 'true') {
$rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key(-2, false, $owner_uid);
$p = new Publisher(PUBSUBHUBBUB_HUB);
$pubsub_result = $p->publish_update($rss_link);
}
$result = db_query("SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\t\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND\n\t\t\t\t\t\t\t\tfeed_id = '{$feed}' LIMIT 1");
if (db_num_rows($result) == 1) {
$entry_int_id = db_fetch_result($result, 0, "int_id");
}
} else {
_debug("user record FOUND", $debug_enabled);
$entry_ref_id = db_fetch_result($result, 0, "ref_id");
$entry_int_id = db_fetch_result($result, 0, "int_id");
}
_debug("RID: {$entry_ref_id}, IID: {$entry_int_id}", $debug_enabled);
$post_needs_update = false;
$update_insignificant = false;
if ($orig_num_comments != $num_comments) {
$post_needs_update = true;
$update_insignificant = true;
}
if ($entry_plugin_data != $orig_plugin_data) {
$post_needs_update = true;
$update_insignificant = true;
}
if ($content_hash != $orig_content_hash) {
$post_needs_update = true;
$update_insignificant = false;
}
if (db_escape_string($orig_title) != $entry_title) {
$post_needs_update = true;
$update_insignificant = false;
}
// if post needs update, update it and mark all user entries
// linking to this post as updated
if ($post_needs_update) {
示例6: pubsubhub
function pubsubhub()
{
if (!empty($GLOBALS['config']['PUBSUBHUB_URL'])) {
$p = new Publisher($GLOBALS['config']['PUBSUBHUB_URL']);
$topic_url = array(index_url($_SERVER) . '?do=atom', index_url($_SERVER) . '?do=rss');
$p->publish_update($topic_url);
}
}
示例7: publ
function publ()
{
$pub = $_REQUEST["pub"];
$id = db_escape_string($_REQUEST["id"]);
$note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
if ($pub == "1") {
$pub = "true";
} else {
$pub = "false";
}
$result = db_query($this->link, "UPDATE ttrss_user_entries SET\n\t\t\tpublished = {$pub}\n\t\t\tWHERE ref_id = '{$id}' AND owner_uid = " . $_SESSION["uid"]);
$pubsub_result = false;
if (PUBSUBHUBBUB_HUB) {
$rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($this->link, -2, false);
$p = new Publisher(PUBSUBHUBBUB_HUB);
$pubsub_result = $p->publish_update($rss_link);
}
print json_encode(array("message" => "UPDATE_COUNTERS", "pubsub_result" => $pubsub_result));
}
示例8: publishArticlesById
private function publishArticlesById($link, $ids, $cmode)
{
$tmp_ids = array();
foreach ($ids as $id) {
array_push($tmp_ids, "ref_id = '{$id}'");
}
$ids_qpart = join(" OR ", $tmp_ids);
if ($cmode == 0) {
db_query($link, "UPDATE ttrss_user_entries SET\n\t\t\tpublished = false,last_read = NOW()\n\t\t\tWHERE ({$ids_qpart}) AND owner_uid = " . $_SESSION["uid"]);
} else {
if ($cmode == 1) {
db_query($link, "UPDATE ttrss_user_entries SET\n\t\t\tpublished = true,last_read = NOW()\n\t\t\tWHERE ({$ids_qpart}) AND owner_uid = " . $_SESSION["uid"]);
} else {
db_query($link, "UPDATE ttrss_user_entries SET\n\t\t\tpublished = NOT published,last_read = NOW()\n\t\t\tWHERE ({$ids_qpart}) AND owner_uid = " . $_SESSION["uid"]);
}
}
if (PUBSUBHUBBUB_HUB) {
$rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($link, -2, false);
$p = new Publisher(PUBSUBHUBBUB_HUB);
$pubsub_result = $p->publish_update($rss_link);
}
}
示例9: update_rss_feed
//.........这里部分代码省略.........
}
if ($score >= -500 && !find_article_filter($article_filters, 'catchup')) {
$unread = 'true';
$last_read_qpart = 'NULL';
} else {
$unread = 'false';
$last_read_qpart = 'NOW()';
}
if (find_article_filter($article_filters, 'mark') || $score > 1000) {
$marked = 'true';
} else {
$marked = 'false';
}
if (find_article_filter($article_filters, 'publish')) {
$published = 'true';
} else {
$published = 'false';
}
// N-grams
if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) {
$result = db_query($link, "SELECT COUNT(*) AS similar FROM\n\t\t\t\t\t\t\t\t\tttrss_entries,ttrss_user_entries\n\t\t\t\t\t\t\t\tWHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'\n\t\t\t\t\t\t\t\t\tAND similarity(title, '{$entry_title}') >= " . _NGRAM_TITLE_DUPLICATE_THRESHOLD . "\n\t\t\t\t\t\t\t\t\tAND owner_uid = {$owner_uid}");
$ngram_similar = db_fetch_result($result, 0, "similar");
if ($debug_enabled) {
_debug("update_rss_feed: N-gram similar results: {$ngram_similar}");
}
if ($ngram_similar > 0) {
$unread = 'false';
}
}
$result = db_query($link, "INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid)\n\t\t\t\t\t\t\tVALUES ('{$ref_id}', '{$owner_uid}', '{$feed}', {$unread},\n\t\t\t\t\t\t\t\t{$last_read_qpart}, {$marked}, {$published}, '{$score}', '', '', '')");
if (PUBSUBHUBBUB_HUB && $published == 'true') {
$rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($link, -2, false, $owner_uid);
$p = new Publisher(PUBSUBHUBBUB_HUB);
$pubsub_result = $p->publish_update($rss_link);
}
$result = db_query($link, "SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\t\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND\n\t\t\t\t\t\t\t\tfeed_id = '{$feed}' LIMIT 1");
if (db_num_rows($result) == 1) {
$entry_int_id = db_fetch_result($result, 0, "int_id");
}
} else {
if ($debug_enabled) {
_debug("update_rss_feed: user record FOUND");
}
$entry_ref_id = db_fetch_result($result, 0, "ref_id");
$entry_int_id = db_fetch_result($result, 0, "int_id");
}
if ($debug_enabled) {
_debug("update_rss_feed: RID: {$entry_ref_id}, IID: {$entry_int_id}");
}
$post_needs_update = false;
$update_insignificant = false;
if ($orig_num_comments != $num_comments) {
$post_needs_update = true;
$update_insignificant = true;
}
if ($content_hash != $orig_content_hash) {
$post_needs_update = true;
$update_insignificant = false;
}
if (db_escape_string($orig_title) != $entry_title) {
$post_needs_update = true;
$update_insignificant = false;
}
// if post needs update, update it and mark all user entries
// linking to this post as updated
if ($post_needs_update) {
示例10: publishArticlesById
private function publishArticlesById($ids, $cmode)
{
$tmp_ids = array();
foreach ($ids as $id) {
array_push($tmp_ids, "ref_id = '{$id}'");
}
$ids_qpart = join(" OR ", $tmp_ids);
if ($cmode == 0) {
$newValuepublished = "false";
} elseif ($cmode == 1) {
$newValuepublished = "true";
} else {
$newValuepublished = "published";
}
$this->dbh->query("UPDATE ttrss_user_entries SET\n published = " . $newValue . ",last_published = NOW()\n WHERE ({$ids_qpart}) AND owner_uid = " . $_SESSION["uid"]);
if (PUBSUBHUBBUB_HUB) {
$rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key(-2, false);
$p = new Publisher(PUBSUBHUBBUB_HUB);
/* $pubsub_result = */
$p->publish_update($rss_link);
}
}
示例11: update_rss_feed
//.........这里部分代码省略.........
$marked = 'true';
} else {
$marked = 'false';
}
if (find_article_filter($article_filters, 'publish')) {
$published = 'true';
} else {
$published = 'false';
}
// N-grams
/* if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) {
$result = db_query("SELECT COUNT(*) AS similar FROM
ttrss_entries,ttrss_user_entries
WHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'
AND similarity(title, '$entry_title') >= "._NGRAM_TITLE_DUPLICATE_THRESHOLD."
AND owner_uid = $owner_uid");
$ngram_similar = db_fetch_result($result, 0, "similar");
_debug("N-gram similar results: $ngram_similar", $debug_enabled);
if ($ngram_similar > 0) {
$unread = 'false';
}
} */
$last_marked = $marked == 'true' ? 'NOW()' : 'NULL';
$last_published = $published == 'true' ? 'NOW()' : 'NULL';
$result = db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid,\n\t\t\t\t\t\t\t\tlast_marked, last_published)\n\t\t\t\t\t\t\tVALUES ('{$ref_id}', '{$owner_uid}', '{$feed}', {$unread},\n\t\t\t\t\t\t\t\t{$last_read_qpart}, {$marked}, {$published}, '{$score}', '', '',\n\t\t\t\t\t\t\t\t'', {$last_marked}, {$last_published})");
if (PUBSUBHUBBUB_HUB && $published == 'true') {
$rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key(-2, false, $owner_uid);
$p = new Publisher(PUBSUBHUBBUB_HUB);
/* $pubsub_result = */
$p->publish_update($rss_link);
}
$result = db_query("SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\t\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND\n\t\t\t\t\t\t\t\tfeed_id = '{$feed}' LIMIT 1");
if (db_num_rows($result) == 1) {
$entry_int_id = db_fetch_result($result, 0, "int_id");
}
} else {
_debug("user record FOUND", $debug_enabled);
$entry_ref_id = db_fetch_result($result, 0, "ref_id");
$entry_int_id = db_fetch_result($result, 0, "int_id");
}
_debug("RID: {$entry_ref_id}, IID: {$entry_int_id}", $debug_enabled);
if (DB_TYPE == "pgsql") {
$tsvector_combined = db_escape_string(mb_substr($entry_title . ' ' . strip_tags($entry_content), 0, 1000000));
$tsvector_qpart = "tsvector_combined = to_tsvector('{$feed_language}', '{$tsvector_combined}'),";
} else {
$tsvector_qpart = "";
}
db_query("UPDATE ttrss_entries\n\t\t\t\t\t\tSET title = '{$entry_title}',\n\t\t\t\t\t\t\tcontent = '{$entry_content}',\n\t\t\t\t\t\t\tcontent_hash = '{$entry_current_hash}',\n\t\t\t\t\t\t\tupdated = '{$entry_timestamp_fmt}',\n\t\t\t\t\t\t\t{$tsvector_qpart}\n\t\t\t\t\t\t\tnum_comments = '{$num_comments}',\n\t\t\t\t\t\t\tplugin_data = '{$entry_plugin_data}',\n\t\t\t\t\t\t\tauthor = '{$entry_author}',\n\t\t\t\t\t\t\tlang = '{$entry_language}'\n\t\t\t\t\t\tWHERE id = '{$ref_id}'");
// update aux data
db_query("UPDATE ttrss_user_entries\n\t\t\t\t\t\t\tSET score = '{$score}' WHERE ref_id = '{$ref_id}'");
if ($mark_unread_on_update) {
db_query("UPDATE ttrss_user_entries\n\t\t\t\t\t\t\tSET last_read = null, unread = true WHERE ref_id = '{$ref_id}'");
}
}
db_query("COMMIT");
_debug("assigning labels [other]...", $debug_enabled);
foreach ($article_labels as $label) {
label_add_article($entry_ref_id, $label[1], $owner_uid);
}
_debug("assigning labels [filters]...", $debug_enabled);
assign_article_to_label_filters($entry_ref_id, $article_filters, $owner_uid, $article_labels);
_debug("looking for enclosures...", $debug_enabled);
示例12: Publisher
// process form
if ($_POST['sub']) {
$hub_url = $_POST['hub_url'];
$topic_url = $_POST['topic_url'];
// check that a hub url is specified
if (!$hub_url) {
echo "Please specify a hub url.<br /><br /><a href='publisher_example.php'>back</a>";
exit;
}
// check that a topic url is specified
if (!$topic_url) {
echo "Please specify a topic url to publish.<br /><br /><a href='publisher_example.php'>back</a>";
exit;
}
// $hub_url = "http://pubsubhubbub.appspot.com/publish";
$p = new Publisher($hub_url);
if ($p->publish_update($topic_url)) {
echo "<i>{$topic_url}</i> was successfully published to <i>{$hub_url}</i><br /><br /><a href='publisher_example.php'>back</a>";
} else {
echo "ooops...";
print_r($p->last_response());
}
} else {
// display a primitive form for testing
echo "<form action='publisher_example.php' method='POST'>";
echo "hub url: <input name='hub_url' type='text' value='http://pubsubhubbub.appspot.com/publish' size='50'/><br />";
echo "topic url: <input name='topic_url' type='text' value='http://www.onlineaspect.com' size='50' /><br />";
echo "<input name='sub' type='submit' value='Publish' /><br />";
echo "</form>";
}
echo "</center>";
示例13: update_rss_feed
//.........这里部分代码省略.........
}
if ($score >= -500 && !find_article_filter($article_filters, 'catchup')) {
$unread = 'true';
$last_read_qpart = 'NULL';
} else {
$unread = 'false';
$last_read_qpart = 'NOW()';
}
if (find_article_filter($article_filters, 'mark') || $score > 1000) {
$marked = 'true';
} else {
$marked = 'false';
}
if (find_article_filter($article_filters, 'publish')) {
$published = 'true';
} else {
$published = 'false';
}
// N-grams
if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) {
$result = db_query($link, "SELECT COUNT(*) AS similar FROM\n\t\t\t\t\t\t\t\t\tttrss_entries,ttrss_user_entries\n\t\t\t\t\t\t\t\tWHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'\n\t\t\t\t\t\t\t\t\tAND similarity(title, '{$entry_title}') >= " . _NGRAM_TITLE_DUPLICATE_THRESHOLD . "\n\t\t\t\t\t\t\t\t\tAND owner_uid = {$owner_uid}");
$ngram_similar = db_fetch_result($result, 0, "similar");
if ($debug_enabled) {
_debug("update_rss_feed: N-gram similar results: {$ngram_similar}");
}
if ($ngram_similar > 0) {
$unread = 'false';
}
}
$result = db_query($link, "INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid)\n\t\t\t\t\t\t\tVALUES ('{$ref_id}', '{$owner_uid}', '{$feed}', {$unread},\n\t\t\t\t\t\t\t\t{$last_read_qpart}, {$marked}, {$published}, '{$score}', '', '', '')");
if (PUBSUBHUBBUB_HUB && $published == 'true') {
$rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($link, -2, false, $owner_uid);
$p = new Publisher(PUBSUBHUBBUB_HUB);
$pubsub_result = $p->publish_update($rss_link);
}
$result = db_query($link, "SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\t\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND\n\t\t\t\t\t\t\t\tfeed_id = '{$feed}' LIMIT 1");
if (db_num_rows($result) == 1) {
$entry_int_id = db_fetch_result($result, 0, "int_id");
}
} else {
if ($debug_enabled) {
_debug("update_rss_feed: user record FOUND");
}
$entry_ref_id = db_fetch_result($result, 0, "ref_id");
$entry_int_id = db_fetch_result($result, 0, "int_id");
}
if ($debug_enabled) {
_debug("update_rss_feed: RID: {$entry_ref_id}, IID: {$entry_int_id}");
}
$post_needs_update = false;
$update_insignificant = false;
if ($orig_num_comments != $num_comments) {
$post_needs_update = true;
$update_insignificant = true;
}
if ($entry_plugin_data != $orig_plugin_data) {
$post_needs_update = true;
$update_insignificant = true;
}
if ($content_hash != $orig_content_hash) {
$post_needs_update = true;
$update_insignificant = false;
}
if (db_escape_string($orig_title) != $entry_title) {
$post_needs_update = true;
$update_insignificant = false;
示例14: PDO
mb_language('ja');
mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');
header('Content-Type: text/html; charset=UTF-8');
require_once 'assets/php/config.php';
try {
$dbh = new PDO(DSN, DB_USER, DB_PASSWORD);
$stmt = $dbh->query("SET NAMES utf8;");
} catch (PDOException $e) {
echo $e->getMessage();
exit;
}
$sql = "SELECT * FROM contents WHERE created > current_timestamp + interval -10 minute";
$within_10min = $dbh->query($sql);
$within_10min->execute();
$get_c = $within_10min->fetch();
if ($get_c !== FALSE) {
// ライブラリを読み込む
require_once 'assets/php/publisher.php';
// プッシュ通知先のURL(Googleに通知する場合は変更しない)
$hub_url = 'http://pubsubhubbub.appspot.com/';
// インスタンスを作成し、そのパスを$pshbに代入する
$pshb = new Publisher($hub_url);
while ($get_contents = $within_10min->fetch(PDO::FETCH_ASSOC)) {
// インデックスさせたい記事のURLアドレス
$post_url = 'https://monostudio.jp/' . $get_contents["id"];
// プッシュ通知
$pshb->publish_update($post_url);
}
}