本文整理汇总了PHP中feedwordpress_display_url函数的典型用法代码示例。如果您正苦于以下问题:PHP feedwordpress_display_url函数的具体用法?PHP feedwordpress_display_url怎么用?PHP feedwordpress_display_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了feedwordpress_display_url函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribe
function subscribe($args)
{
$ret = $this->validate($args);
if (is_array($ret)) {
// Success
// The remaining params are feed URLs
foreach ($args as $arg) {
$finder = new FeedFinder($arg, false, 1);
$feeds = array_values(array_unique($finder->find()));
if (count($feeds) > 0) {
$link_id = FeedWordPress::syndicate_link(feedwordpress_display_url($feeds[0]), $feeds[0], $feeds[0]);
$ret[] = array('added', $feeds[0], $arg);
} else {
$ret[] = array('error', $arg);
}
}
}
return $ret;
}
示例2: author_id
/**
* SyndicatedPost::author_id (): get the ID for an author name from
* the feed. Create the author if necessary.
*
* @param string $unfamiliar_author
*
* @return NULL|int The numeric ID of the author to attribute the post to
* NULL if the post should be filtered out.
*/
function author_id($unfamiliar_author = 'create')
{
global $wpdb;
$a = $this->named['author'];
$source = $this->source();
$forbidden = apply_filters('feedwordpress_forbidden_author_names', array('admin', 'administrator', 'www', 'root'));
// Prepare the list of candidates to try for author name: name from
// feed, original source title (if any), immediate source title live
// from feed, subscription title, prettied version of feed homepage URL,
// prettied version of feed URL, or, failing all, use "unknown author"
// as last resort
$candidates = array();
$candidates[] = $a['name'];
if (!is_null($source)) {
$candidates[] = $source['title'];
}
$candidates[] = $this->link->name(true);
$candidates[] = $this->link->name(false);
if (strlen($this->link->homepage()) > 0) {
$candidates[] = feedwordpress_display_url($this->link->homepage());
}
$candidates[] = feedwordpress_display_url($this->link->uri());
$candidates[] = 'unknown author';
// Pick the first one that works from the list, screening against empty
// or forbidden names.
$author = NULL;
while (is_null($author) and $candidate = each($candidates)) {
if (!is_null($candidate['value']) and strlen(trim($candidate['value'])) > 0 and !in_array(strtolower(trim($candidate['value'])), $forbidden)) {
$author = $candidate['value'];
}
}
$email = isset($a['email']) ? $a['email'] : NULL;
$authorUrl = isset($a['uri']) ? $a['uri'] : NULL;
$hostUrl = $this->link->homepage();
if (is_null($hostUrl) or strlen($hostUrl) < 0) {
$hostUrl = $this->link->uri();
}
$match_author_by_email = !('yes' == get_option("feedwordpress_do_not_match_author_by_email"));
if ($match_author_by_email and !FeedWordPress::is_null_email($email)) {
$test_email = $email;
} else {
$test_email = NULL;
}
// Never can be too careful...
$login = sanitize_user($author, true);
// Possible for, e.g., foreign script author names
if (strlen($login) < 1) {
// No usable characters in author name for a login.
// (Sometimes results from, e.g., foreign scripts.)
//
// We just need *something* in Western alphanumerics,
// so let's try the domain name.
//
// Uniqueness will be guaranteed below if necessary.
$url = parse_url($hostUrl);
$login = sanitize_user($url['host'], true);
if (strlen($login) < 1) {
// This isn't working. Frak it.
$login = 'syndicated';
}
}
$login = apply_filters('pre_user_login', $login);
$nice_author = sanitize_title($author);
$nice_author = apply_filters('pre_user_nicename', $nice_author);
$reg_author = esc_sql(preg_quote($author));
$author = esc_sql($author);
$email = esc_sql($email);
$test_email = esc_sql($test_email);
$authorUrl = esc_sql($authorUrl);
// Check for an existing author rule....
if (isset($this->link->settings['map authors']['name']['*'])) {
$author_rule = $this->link->settings['map authors']['name']['*'];
} elseif (isset($this->link->settings['map authors']['name'][strtolower(trim($author))])) {
$author_rule = $this->link->settings['map authors']['name'][strtolower(trim($author))];
} else {
$author_rule = NULL;
}
// User name is mapped to a particular author. If that author ID exists, use it.
if (is_numeric($author_rule) and get_userdata((int) $author_rule)) {
$id = (int) $author_rule;
// User name is filtered out
} elseif ('filter' == $author_rule) {
$id = NULL;
} else {
// Check the database for an existing author record that might fit
// First try the user core data table.
$id = $wpdb->get_var("SELECT ID FROM {$wpdb->users}\n\t\t\tWHERE TRIM(LCASE(display_name)) = TRIM(LCASE('{$author}'))\n\t\t\tOR TRIM(LCASE(user_login)) = TRIM(LCASE('{$author}'))\n\t\t\tOR (\n\t\t\t\tLENGTH(TRIM(LCASE(user_email))) > 0\n\t\t\t\tAND TRIM(LCASE(user_email)) = TRIM(LCASE('{$test_email}'))\n\t\t\t)");
// If that fails, look for aliases in the user meta data table
if (is_null($id)) {
$id = $wpdb->get_var("SELECT user_id FROM {$wpdb->usermeta}\n\t\t\t\tWHERE\n\t\t\t\t\t(meta_key = 'description' AND TRIM(LCASE(meta_value)) = TRIM(LCASE('{$author}')))\n\t\t\t\t\tOR (\n\t\t\t\t\t\tmeta_key = 'description'\n\t\t\t\t\t\tAND TRIM(LCASE(meta_value))\n\t\t\t\t\t\tRLIKE CONCAT(\n\t\t\t\t\t\t\t'(^|\\n)a\\.?k\\.?a\\.?( |\\t)*:?( |\\t)*',\n\t\t\t\t\t\t\tTRIM(LCASE('{$reg_author}')),\n\t\t\t\t\t\t\t'( |\\t|\\r)*(\\n|\$)'\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t");
}
//.........这里部分代码省略.........
示例3: syndication_source
public function syndication_source($original = NULL)
{
$ret = $this->meta('syndication_source', array("unproxy" => $original));
// If this is blank, fall back to a prettified URL for the blog.
if (is_null($ret) or strlen(trim($ret)) == 0) {
$ret = feedwordpress_display_url($this->syndication_source_link());
}
return $ret;
}
示例4: multiadd_box
function multiadd_box($page, $box = NULL)
{
global $fwp_post;
$localData = NULL;
if (isset($_FILES['opml_upload']['name']) and strlen($_FILES['opml_upload']['name']) > 0) {
$in = 'tag:localhost';
/*FIXME: check whether $_FILES['opml_upload']['error'] === UPLOAD_ERR_OK or not...*/
$localData = file_get_contents($_FILES['opml_upload']['tmp_name']);
$merge_all = true;
} elseif (isset($fwp_post['multilookup'])) {
$in = $fwp_post['multilookup'];
$merge_all = false;
} elseif (isset($fwp_post['opml_lookup'])) {
$in = $fwp_post['opml_lookup'];
$merge_all = true;
} else {
$in = '';
$merge_all = false;
}
if (strlen($in) > 0) {
$lines = preg_split("/\\s+/", $in, -1, PREG_SPLIT_NO_EMPTY);
$i = 0;
?>
<form id="multiadd-form" action="<?php
print $this->form_action();
?>
" method="post">
<div><?php
FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds');
?>
<input type="hidden" name="multiadd" value="<?php
print FWP_SYNDICATE_NEW;
?>
" />
<input type="hidden" name="confirm" value="multiadd" />
<input type="hidden" name="multiadd" value="<?php
print FWP_SYNDICATE_NEW;
?>
" />
<input type="hidden" name="confirm" value="multiadd" /></div>
<div id="multiadd-status">
<p><img src="<?php
print esc_url(admin_url('images/wpspin_light.gif'));
?>
" alt="" />
Looking up feed information...</p>
</div>
<div id="multiadd-buttons">
<input type="submit" class="button" name="cancel" value="<?php
_e(FWP_CANCEL_BUTTON);
?>
" />
<input type="submit" class="button-primary" value="<?php
print _e('Subscribe to selected sources →');
?>
" />
</div>
<p><?php
_e('Here are the feeds that FeedWordPress has discovered from the addresses that you provided. To opt out of a subscription, unmark the checkbox next to the feed.');
?>
</p>
<?php
print "<ul id=\"multiadd-list\">\n";
flush();
foreach ($lines as $line) {
$url = trim($line);
if (strlen($url) > 0) {
// First, use FeedFinder to check the URL.
if (is_null($localData)) {
$finder = new FeedFinder($url, false, 1);
} else {
$finder = new FeedFinder('tag:localhost', false, 1);
$finder->upload_data($localData);
}
$feeds = array_values(array_unique($finder->find()));
$found = false;
if (count($feeds) > 0) {
foreach ($feeds as $feed) {
$pie = FeedWordPress::fetch($feed);
if (!is_wp_error($pie)) {
$found = true;
$short_feed = esc_html(feedwordpress_display_url($feed));
$feed = esc_html($feed);
$title = esc_html($pie->get_title());
$checked = ' checked="checked"';
$link = esc_html($pie->get_link());
$this->display_multiadd_line(array('feed' => $feed, 'title' => $pie->get_title(), 'link' => $pie->get_link(), 'checked' => ' checked="checked"', 'i' => $i));
$i++;
// Increment field counter
if (!$merge_all) {
// Break out after first find
break;
}
}
}
//.........这里部分代码省略.........
示例5: __construct
function __construct ($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) {
global $feedwordpress;
global $wp_version;
$source = NULL;
if ($feedwordpress->subscribed($url)) :
$source = $feedwordpress->subscription($url);
endif;
$this->url = $url;
$this->timeout = $timeout;
$this->redirects = $redirects;
$this->headers = $headers;
$this->useragent = $useragent;
$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE;
global $wpdb;
global $fwp_credentials;
if ( preg_match('/^http(s)?:\/\//i', $url) ) {
$args = array( 'timeout' => $this->timeout, 'redirection' => $this->redirects);
if ( !empty($this->headers) )
$args['headers'] = $this->headers;
// Use default FWP user agent unless custom has been specified
if ( SIMPLEPIE_USERAGENT != $this->useragent ) :
$args['user-agent'] = $this->useragent;
else :
$args['user-agent'] = apply_filters('feedwordpress_user_agent',
'FeedWordPress/'.FEEDWORDPRESS_VERSION
.' (aggregator:feedwordpress; WordPress/'.$wp_version
.' + '.SIMPLEPIE_NAME.'/'.SIMPLEPIE_VERSION
.'; Allow like Gecko; +http://feedwordpress.radgeek.com/) at '
. feedwordpress_display_url(get_bloginfo('url')),
$this
);
endif;
// This is ugly as hell, but communicating up and down the chain
// in any other way is difficult.
if (!is_null($fwp_credentials)) :
$args['authentication'] = $fwp_credentials['authentication'];
$args['username'] = $fwp_credentials['username'];
$args['password'] = $fwp_credentials['password'];
elseif ($source InstanceOf SyndicatedLink) :
$args['authentication'] = $source->authentication_method();
$args['username'] = $source->username();
$args['password'] = $source->password();
endif;
FeedWordPress::diagnostic('updated_feeds:http', "HTTP [$url] ⇜ ".esc_html(FeedWordPress::val($args)));
$res = wp_remote_request($url, $args);
FeedWordPress::diagnostic('updated_feeds:http', "HTTP [$url] ⇝ ".esc_html(FeedWordPress::val($res)));
if ( is_wp_error($res) ) {
$this->error = 'WP HTTP Error: ' . $res->get_error_message();
$this->success = false;
} else {
$this->headers = wp_remote_retrieve_headers( $res );
$this->body = wp_remote_retrieve_body( $res );
$this->status_code = wp_remote_retrieve_response_code( $res );
}
if ($source InstanceOf SyndicatedLink) :
$source->update_setting('link/filesize', strlen($this->body));
$source->update_setting('link/http status', $this->status_code);
$source->save_settings(/*reload=*/ true);
endif;
} else {
if ( ! $this->body = file_get_contents($url) ) {
$this->error = 'file_get_contents could not read the file';
$this->success = false;
}
}
// SimplePie makes a strongly typed check against integers with
// this, but WordPress puts a string in. Which causes caching
// to break and fall on its ass when SimplePie is getting a 304,
// but doesn't realize it because this member is "304" instead.
$this->status_code = (int) $this->status_code;
}
示例6: display_feedfinder
function display_feedfinder()
{
global $wpdb;
$lookup = isset($_REQUEST['lookup']) ? $_REQUEST['lookup'] : NULL;
$auth = FeedWordPress::param('link_rss_auth_method');
$username = FeedWordPress::param('link_rss_username');
$password = FeedWordPress::param('link_rss_password');
$credentials = array("authentication" => $auth, "username" => $username, "password" => $password);
$feeds = array();
$feedSwitch = false;
$current = null;
if ($this->for_feed_settings()) {
// Existing feed?
$feedSwitch = true;
if (is_null($lookup)) {
// Switch Feed without a specific feed yet suggested
// Go to the human-readable homepage to look for
// auto-detection links
$lookup = $this->link->link->link_url;
$auth = $this->link->setting('http auth method');
$username = $this->link->setting('http username');
$password = $this->link->setting('http password');
// Guarantee that you at least have the option to
// stick with what works.
$current = $this->link->link->link_rss;
$feeds[] = $current;
}
$name = esc_html($this->link->link->link_name);
} else {
// Or a new subscription to add?
$name = "Subscribe to <code>" . esc_html(feedwordpress_display_url($lookup)) . "</code>";
}
?>
<div class="wrap" id="feed-finder">
<h2>Feed Finder: <?php
echo $name;
?>
</h2>
<?php
if ($feedSwitch) {
$this->display_alt_feed_box($lookup);
}
$finder = array();
if (!is_null($current)) {
$finder[$current] = new FeedFinder($current);
}
$finder[$lookup] = new FeedFinder($lookup);
foreach ($finder as $url => $ff) {
$feeds = array_merge($feeds, $ff->find(NULL, $credentials));
}
$feeds = array_values($feeds);
if (count($feeds) > 0) {
if ($feedSwitch) {
?>
<h3>Feeds Found</h3>
<?php
}
if (count($feeds) > 1) {
$option_template = 'Option %d: ';
$form_class = ' class="multi"';
?>
<p><strong>This web page provides at least <?php
print count($feeds);
?>
different feeds.</strong> These feeds may provide the same information
in different formats, or may track different items. (You can check the Feed Information and the
Sample Item for each feed to get an idea of what the feed provides.) Please select the feed that you'd like to subscribe to.</p>
<?php
} else {
$option_template = '';
$form_class = '';
}
global $fwp_credentials;
foreach ($feeds as $key => $f) {
$ofc = $fwp_credentials;
$fwp_credentials = $credentials;
// Set
$pie = FeedWordPress::fetch($f);
$fwp_credentials = $ofc;
// Re-Set
$rss = is_wp_error($pie) ? $pie : new MagpieFromSimplePie($pie);
if ($this->url_for_401($pie)) {
$this->display_alt_feed_box($lookup, array("err" => $pie, "auth" => $auth, "username" => $username, "password" => $password));
continue;
}
if ($rss and !is_wp_error($rss)) {
$feed_link = isset($rss->channel['link']) ? $rss->channel['link'] : '';
$feed_title = isset($rss->channel['title']) ? $rss->channel['title'] : $feed_link;
$feed_type = $rss->feed_type ? $rss->feed_type : 'Unknown';
$feed_version_template = '%.1f';
$feed_version = $rss->feed_version;
} else {
// Give us some sucky defaults
$feed_title = feedwordpress_display_url($lookup);
$feed_link = $lookup;
$feed_type = 'Unknown';
$feed_version_template = '';
$feed_version = '';
}
//.........这里部分代码省略.........
示例7: log_prefix
function log_prefix($date = false)
{
$home = get_bloginfo('url');
$prefix = '[' . feedwordpress_display_url($home) . '] [feedwordpress] ';
if ($date) {
$prefix = "[" . date('Y-m-d H:i:s') . "]" . $prefix;
}
return $prefix;
}
示例8: get_syndication_source
function get_syndication_source($original = NULL, $id = NULL)
{
if (is_null($original)) {
$original = FeedWordPress::use_aggregator_source_data();
}
if ($original) {
$vals = get_post_custom_values('syndication_source_original', $id);
} else {
$vals = array();
}
if (count($vals) == 0) {
$vals = get_post_custom_values('syndication_source', $id);
}
if (count($vals) > 0) {
$ret = $vals[0];
} else {
$ret = NULL;
}
if (is_null($ret) or strlen(trim($ret)) == 0) {
// Fall back to URL of blog
$ret = feedwordpress_display_url(get_syndication_source_link());
}
return $ret;
}
示例9: __construct
public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
{
global $feedwordpress;
global $wp_version;
$source = NULL;
if ($feedwordpress->subscribed($url)) {
$source = $feedwordpress->subscription($url);
}
$this->url = $url;
$this->timeout = $timeout;
$this->redirects = $redirects;
$this->headers = $headers;
$this->useragent = $useragent;
$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE;
global $wpdb;
global $fwp_credentials;
if (preg_match('/^http(s)?:\\/\\//i', $url)) {
$args = array('timeout' => $this->timeout, 'redirection' => $this->redirects);
if (!empty($this->headers)) {
$args['headers'] = $this->headers;
}
// Use default FWP user agent unless custom has been specified
if (SIMPLEPIE_USERAGENT != $this->useragent) {
$args['user-agent'] = $this->useragent;
} else {
$args['user-agent'] = apply_filters('feedwordpress_user_agent', 'FeedWordPress/' . FEEDWORDPRESS_VERSION . ' (aggregator:feedwordpress; WordPress/' . $wp_version . ' + ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . '; Allow like Gecko; +http://feedwordpress.radgeek.com/) at ' . feedwordpress_display_url(get_bloginfo('url')), $this);
}
// This is ugly as hell, but communicating up and down the chain
// in any other way is difficult.
if (!is_null($fwp_credentials)) {
$args['authentication'] = $fwp_credentials['authentication'];
$args['username'] = $fwp_credentials['username'];
$args['password'] = $fwp_credentials['password'];
} elseif ($source instanceof SyndicatedLink) {
$args['authentication'] = $source->authentication_method();
$args['username'] = $source->username();
$args['password'] = $source->password();
}
FeedWordPress::diagnostic('updated_feeds:http', "HTTP [{$url}] ⇜ " . esc_html(MyPHP::val($args)));
$res = wp_remote_request($url, $args);
FeedWordPress::diagnostic('updated_feeds:http', "HTTP [{$url}] ⇝ " . esc_html(MyPHP::val($res)));
if (is_wp_error($res)) {
$this->error = 'WP HTTP Error: ' . $res->get_error_message();
$this->success = false;
} else {
$this->headers = wp_remote_retrieve_headers($res);
$this->body = wp_remote_retrieve_body($res);
$this->status_code = wp_remote_retrieve_response_code($res);
}
if ($source instanceof SyndicatedLink) {
$source->update_setting('link/filesize', strlen($this->body));
$source->update_setting('link/http status', $this->status_code);
$source->save_settings(true);
}
// Do not allow schemes other than http(s)? for the time being.
// They are unlikely to be used; and unrestricted use of schemes
// allows for user to use an unrestricted file:/// scheme, which
// may result in exploits by WordPress users against the web
// hosting environment.
} else {
$this->error = 'FeedWordPress only allows http or https URLs';
$this->success = false;
}
// SimplePie makes a strongly typed check against integers with
// this, but WordPress puts a string in. Which causes caching
// to break and fall on its ass when SimplePie is getting a 304,
// but doesn't realize it because this member is "304" instead.
$this->status_code = (int) $this->status_code;
}
示例10: fwp_syndication_manage_page_links_table_rows
//.........这里部分代码省略.........
<div class="row-actions"><?php
if ($subscribed) {
$page->display_feed_settings_page_links(array('before' => '<div><strong>Settings ></strong> ', 'after' => '</div>', 'subscription' => $link));
}
?>
<div><strong>Actions ></strong>
<?php
if ($subscribed) {
?>
<a href="<?php
print $page->admin_page_href('syndication.php', array('action' => 'feedfinder'), $link);
?>
"><?php
echo $caption;
?>
</a>
<?php
} else {
?>
<a href="<?php
print $page->admin_page_href('syndication.php', array('action' => FWP_RESUB_CHECKED), $link);
?>
"><?php
_e('Re-subscribe');
?>
</a>
<?php
}
?>
| <a href="<?php
print $page->admin_page_href('syndication.php', array('action' => 'Unsubscribe'), $link);
?>
"><?php
_e($subscribed ? 'Unsubscribe' : 'Delete permanently');
?>
</a>
| <a href="<?php
print esc_html($link->link_url);
?>
"><?php
_e('View');
?>
</a></div>
</div>
</td>
<?php
if (strlen($link->link_rss) > 0) {
?>
<td><a href="<?php
echo esc_html($link->link_rss);
?>
"><?php
echo esc_html(feedwordpress_display_url($link->link_rss, 32));
?>
</a></td>
<?php
} else {
?>
<td class="feed-missing"><p><strong>no feed assigned</strong></p></td>
<?php
}
?>
<td><div style="float: right; padding-left: 10px">
<input type="submit" class="button" name="update_uri[<?php
print esc_html($link->link_rss);
?>
]" value="<?php
_e('Update Now');
?>
" />
</div>
<?php
print $lastUpdated;
?>
<?php
print $fileSize;
?>
<?php
print $errorsSince;
?>
<?php
print $nextUpdate;
?>
</td>
</tr>
<?php
}
} else {
?>
<tr><td colspan="4"><p>There are no websites currently listed for syndication.</p></td></tr>
<?php
}
?>
</tbody>
</table>
<?php
}
}
示例11: fwp_syndication_manage_page_links_table_rows
//.........这里部分代码省略.........
"><?php
_e('Authors');
?>
</a>
| <a href="<?php
echo $hrefPrefix . FWP_CATEGORIES_PAGE_SLUG;
?>
"><?php
print htmlspecialchars(__('Categories' . FEEDWORDPRESS_AND_TAGS));
?>
</a></div>
<?php
}
?>
<div><strong>Actions ></strong>
<?php
if ($subscribed) {
?>
<a href="<?php
echo $hrefPrefix . FWP_SYNDICATION_PAGE_SLUG;
?>
&action=feedfinder"><?php
echo $caption;
?>
</a>
<?php
} else {
?>
<a href="<?php
echo $hrefPrefix . FWP_SYNDICATION_PAGE_SLUG;
?>
&action=<?php
print FWP_RESUB_CHECKED;
?>
"><?php
_e('Re-subscribe');
?>
</a>
<?php
}
?>
| <a href="<?php
echo $hrefPrefix . FWP_SYNDICATION_PAGE_SLUG;
?>
&action=Unsubscribe"><?php
_e($subscribed ? 'Unsubscribe' : 'Delete permanently');
?>
</a>
| <a href="<?php
print esc_html($link->link_url);
?>
"><?php
_e('View');
?>
</a></div>
</div>
</td>
<?php
if (strlen($link->link_rss) > 0) {
?>
<td><a href="<?php
echo esc_html($link->link_rss);
?>
"><?php
echo esc_html(feedwordpress_display_url($link->link_rss, 32));
?>
</a></td>
<?php
} else {
?>
<td class="feed-missing"><p><strong>no feed assigned</strong></p></td>
<?php
}
?>
<td><?php
print $lastUpdated;
?>
<?php
print $errorsSince;
?>
<?php
print $nextUpdate;
?>
</td>
</tr>
<?php
}
} else {
?>
<tr><td colspan="4"><p>There are no websites currently listed for syndication.</p></td></tr>
<?php
}
?>
</tbody>
</table>
<?php
}
}