本文整理汇总了PHP中get_blog_permalink函数的典型用法代码示例。如果您正苦于以下问题:PHP get_blog_permalink函数的具体用法?PHP get_blog_permalink怎么用?PHP get_blog_permalink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_blog_permalink函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$limit = (int) @$instance['limit'];
$limit = $limit ? $limit : 5;
$data = new Wdpv_Options();
$voted_timeframe = @$instance['voted_timeframe'];
if (!in_array($voted_timeframe, array_keys($data->timeframes))) {
$voted_timeframe = false;
}
if (is_main_site()) {
$model = new Wdpv_Model();
$posts = $model->get_popular_on_network($limit, $voted_timeframe);
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
if (is_array($posts)) {
echo "<ul class='wdpv_popular_posts wdpv_network_popular'>";
foreach ($posts as $post) {
$data = get_blog_post($post['blog_id'], $post['post_id']);
echo "<li>";
echo '<a href="' . get_blog_permalink($post['blog_id'], $post['post_id']) . '">' . $data->post_title . '</a> ';
printf(__('<span class="wdpv_vote_count">(%s votes)</span>', 'wdpv'), $post['total']);
echo "</li>";
}
echo "</ul>";
}
echo $after_widget;
}
}
开发者ID:hscale,项目名称:webento,代码行数:32,代码来源:class_wpdv_widget_network_popular.php
示例2: rewrite_urls
function rewrite_urls($replace, $object, $result)
{
global $wp_query, $wp_rewrite;
if ($wp_rewrite->using_permalinks() && !defined('EM_DISABLE_PERMALINKS')) {
switch ($result) {
case '#_EVENTPAGEURL':
//Depreciated
//Depreciated
case '#_LINKEDNAME':
//Depreciated
//Depreciated
case '#_EVENTURL':
//Just the URL
//Just the URL
case '#_EVENTLINK':
//HTML Link
if (is_object($object) && get_class($object) == 'EM_Event') {
$EM_URI = EM_URI;
if (is_multisite() && get_site_option('dbem_ms_global_events') && get_site_option('dbem_ms_global_events_links') && !empty($object->blog_id) && is_main_site() && $object->blog_id != get_current_blog_id()) {
$EM_URI = get_blog_permalink($object->blog_id, get_blog_option($object->blog_id, 'dbem_events_page'));
}
$event_link = trailingslashit(trailingslashit($EM_URI) . 'event/' . $object->slug);
if ($result == '#_LINKEDNAME' || $result == '#_EVENTLINK') {
$replace = "<a href='{$event_link}' title='{$object->name}'>{$object->name}</a>";
} else {
$replace = $event_link;
}
}
break;
case '#_LOCATIONURL':
case '#_LOCATIONLINK':
case '#_LOCATIONPAGEURL':
//Depreciated
if (is_object($object) && get_class($object) == 'EM_Location') {
$link = trailingslashit(trailingslashit(EM_URI) . 'location/' . $object->slug);
$replace = $result == '#_LOCATIONURL' || $result == '#_LOCATIONPAGEURL' ? $link : '<a href="' . $link . '">' . $object->name . '</a>';
}
break;
case '#_CATEGORYLINK':
case '#_CATEGORYURL':
if (is_object($object) && get_class($object) == 'EM_Category') {
$link = trailingslashit(trailingslashit(EM_URI) . 'category/' . $object->slug);
$replace = $result == '#_CATEGORYURL' ? $link : '<a href="' . $link . '">' . $object->name . '</a>';
}
break;
}
}
return $replace;
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:49,代码来源:em-permalinks.php
示例3: getGroupList
public function getGroupList()
{
global $wpdb;
$group_l = array();
$group_id = array(0 => "自由博客", 1 => "运维部", 2 => "PHP部", 3 => "JAVA部", 4 => "Apple", 5 => "前端");
foreach ($group_id as $id => $v) {
$r = array();
$blogs = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs} WHERE\n\t\t\tpublic = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND blog_id != '1' and group_id = {$id}\n\t\t\tORDER BY last_updated DESC limit 5");
foreach ($blogs as $blog) {
$blogPostsTable = "wp_" . $blog . "_posts";
$thispost = $wpdb->get_results("SELECT id, post_title\n\t\t\t\tFROM {$blogPostsTable} WHERE post_status = 'publish' AND post_type = 'post'\n\t\t\t\tORDER BY id DESC limit 0,1");
$thispermalink = get_blog_permalink($blog, $thispost[0]->id);
$m = array_merge((array) $thispost[0], array("url" => $thispermalink));
array_push($r, $m);
}
$mm = array($id => array($r, "title" => $v));
$group_l += $mm;
}
return $group_l;
}
开发者ID:GeniusXalid,项目名称:php-mvc,代码行数:20,代码来源:land.model.php
示例4: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$limit = (int) $instance['limit'];
$events = Eab_Network::get_upcoming_events($limit);
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
if ($events) {
echo '<ul>';
foreach ($events as $event) {
echo '<li><a href="' . get_blog_permalink($event->blog_id, $event->ID) . '">' . $event->post_title . '</a>' . '</li>';
}
echo '</ul>';
} else {
echo '<p class="eab-widget-no_events">' . __('No upcoming events on network', $this->translation_domain) . '</p>';
}
echo $after_widget;
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:21,代码来源:NetworkUpcoming_Widget.class.php
示例5: get_archive_content
public static function get_archive_content($post, $content = false)
{
$event = $post instanceof Eab_EventModel ? $post : new Eab_EventModel($post);
if ('incsub_event' != $event->get_type()) {
return $content;
}
$start_day = date_i18n('m', $event->get_start_timestamp());
$network = $event->from_network();
$link = $network ? get_blog_permalink($network, $event->get_id()) : get_permalink($event->get_id());
$new_content = '';
$new_content .= '<div class="event ' . self::get_status_class($event) . '" itemscope itemtype="http://schema.org/Event">';
$new_content .= '<meta itemprop="name" content="' . esc_attr($event->get_title()) . '" />';
$new_content .= '<a href="' . $link . '" class="wpmudevevents-viewevent">' . __('View event', Eab_EventsHub::TEXT_DOMAIN) . '</a>';
$new_content .= apply_filters('eab-template-archive_after_view_link', '', $event);
$new_content .= '<div style="clear: both;"></div>';
$new_content .= '<hr />';
$new_content .= self::get_event_details($event);
$new_content .= self::get_rsvp_form($event);
$new_content .= '</div>';
$new_content .= '<div style="clear:both"></div>';
return $new_content;
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:22,代码来源:class_eab_template.php
示例6: process_popular_code
function process_popular_code($args)
{
$args = extract(shortcode_atts(array('limit' => 5, 'network' => false), $args));
$model = new Wdpv_Model();
$posts = $network ? $model->get_popular_on_network($limit) : $model->get_popular_on_current_site($limit);
$ret = '';
if (is_array($posts)) {
$ret .= '<ul class="wdpv_popular_posts ' . ($network ? 'wdpv_network_popular' : '') . '">';
foreach ($posts as $post) {
if ($network) {
$data = get_blog_post($post['blog_id'], $post['post_id']);
if (!$data) {
continue;
}
}
$title = $network ? $data->post_title : $post['post_title'];
$permalink = $network ? get_blog_permalink($post['blog_id'], $post['post_id']) : get_permalink($post['ID']);
$ret .= "<li>" . "<a href='{$permalink}'>{$title}</a> " . sprintf(__('<span class="wdpv_vote_count">(%s votes)</span>', 'wdpv'), $post['total']) . "</li>";
}
$ret .= '</ul>';
}
return $ret;
}
开发者ID:hscale,项目名称:webento,代码行数:23,代码来源:class_wdpv_codec.php
示例7: get_element_permalink
/**
* Get the selected blog's post permalink
*
* @since 0.1
* @access private
* @param int $blog_id
* @param int $post_id
* @uses mlp_get_linked_elements, get_current_blog_id, get_blog_post, get_blog_permalink
* @return string $permalink | the post permalink
*/
private function get_element_permalink($blog_id, $post_id)
{
// Get blog id of desired blog
$remote_blog_id = intval($blog_id);
// Get all elements linked to the current one
$elements = mlp_get_linked_elements(intval($post_id), '', get_current_blog_id());
// No linked elements found
if (array() == $elements || empty($elements[$remote_blog_id])) {
return '';
}
$remote_post_id = intval($elements[$remote_blog_id]);
$post = get_blog_post($remote_blog_id, $remote_post_id);
if (is_object($post) && 'publish' == $post->post_status) {
$permalink = get_blog_permalink($remote_blog_id, $remote_post_id);
} else {
return '';
}
if (1 < strlen($permalink)) {
return $permalink;
}
return '';
}
开发者ID:ycms,项目名称:multilingual-press,代码行数:32,代码来源:Mlp_Quicklink.php
示例8: get_edit_url
function get_edit_url()
{
if ($this->can_manage('edit_locations', 'edit_others_locations')) {
if (EM_MS_GLOBAL) {
global $current_site, $current_blog;
if (get_site_option('dbem_ms_mainblog_locations')) {
//location stored as post on main blog, but can be edited either in sub-blog admin area or if not on main blog
if (get_blog_option($this->blog_id, 'dbem_edit_locations_page') && !is_admin()) {
$link = em_add_get_params(get_blog_permalink($this->blog_id, get_blog_option($this->blog_id, 'dbem_edit_locations_page')), array('action' => 'edit', 'location_id' => $this->location_id), false);
}
if ((is_main_site() || empty($link)) && get_blog_option($current_site->blog_id, 'dbem_edit_locations_page') && !is_admin()) {
//if editing on main site and edit page exists, stay on same site
$link = em_add_get_params(get_blog_permalink(get_option('dbem_edit_locations_page')), array('action' => 'edit', 'location_id' => $this->location_id), false);
}
if (empty($link) && !is_main_site()) {
$link = get_admin_url($current_blog->blog_id, "edit.php?post_type=event&page=locations&action=edit&location_id={$this->location_id}");
} elseif (empty($link) && is_main_site()) {
$link = get_admin_url($current_site->blog_id, "post.php?post={$this->post_id}&action=edit");
}
} else {
//location stored as post on blog where location was created
if (get_blog_option($this->blog_id, 'dbem_edit_locations_page') && !is_admin()) {
$link = em_add_get_params(get_blog_permalink($this->blog_id, get_blog_option($this->blog_id, 'dbem_edit_locations_page')), array('action' => 'edit', 'location_id' => $this->location_id), false);
}
if ((is_main_site() || empty($link)) && get_blog_option($current_site->blog_id, 'dbem_edit_locations_page') && !is_admin()) {
//if editing on main site and edit page exists, stay on same site
$link = em_add_get_params(get_blog_permalink($current_site->blog_id, get_blog_option($current_site->blog_id, 'dbem_edit_locations_page')), array('action' => 'edit', 'location_id' => $this->location_id), false);
}
if (empty($link)) {
$link = get_admin_url($this->blog_id, "post.php?post={$this->post_id}&action=edit");
}
}
} else {
if (get_option('dbem_edit_locations_page') && !is_admin()) {
$link = em_add_get_params(get_permalink(get_option('dbem_edit_locations_page')), array('action' => 'edit', 'location_id' => $this->location_id), false);
}
if (empty($link)) {
$link = admin_url() . "post.php?post={$this->post_id}&action=edit";
}
}
return apply_filters('em_location_get_edit_url', $link, $this);
}
}
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:43,代码来源:em-location.php
示例9: custom_404_page
/**
* HideMyWP::custom_404_page()
*
* @param mixed $templates
* @return
*/
function custom_404_page($templates)
{
global $current_user;
$visitor = esc_attr(is_user_logged_in() ? $current_user->user_login : $_SERVER["REMOTE_ADDR"]);
if (is_multisite()) {
$permalink = get_blog_permalink(BLOG_ID_CURRENT_SITE, $this->opt('custom_404_page'));
} else {
$permalink = get_permalink($this->opt('custom_404_page'));
}
if ($this->opt('custom_404') && $this->opt('custom_404_page')) {
wp_redirect(add_query_arg(array('by_user' => $visitor, 'ref_url' => urldecode($_SERVER["REQUEST_URI"])), $permalink));
} else {
return $templates;
}
die;
}
开发者ID:roycocup,项目名称:enclothed,代码行数:22,代码来源:hide-my-wp.php
示例10: get_blog_permalink
/**
* Gets the permalink for the given post on the given blog.
*
* This gets the permalink for the post on the requested blog when in
* multisite mode, or on the root blog when running a standard installation.
*
* @param int $blog_id the ID of a blog
* @param int $post_id the ID of a post on the blog
* @return string the URL for the blog
*
* @since 0.4
*/
public static function get_blog_permalink($blog_id, $post_id)
{
if (function_exists('get_blog_permalink')) {
return get_blog_permalink($blog_id, $post_id);
} else {
return get_permalink($post_id);
}
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:20,代码来源:NXTClass.php
示例11: xpress_grobal_recent_posts
function xpress_grobal_recent_posts($num = 10,$exclusion_blog = 0, $shown_for_each_blog = false)
{
global $wpdb, $wp_rewrite , $switched , $blog_id;
if (empty($date_format)) $date_format = get_settings('date_format');
if (empty($time_format)) $time_format = get_settings('time_format');
$exclusion = explode(',' , $exclusion_blog);
$first_blogid = $blog_id;
$num = (int)$num;
// $wp_query->in_the_loop = true; //for use the_tags() in multi lopp
$data_array = array();
if (xpress_is_multiblog()){
$blogs = get_blog_list(0,'all');
foreach ($blogs AS $blog) {
if (!in_array(0, $exclusion) && in_array($blog['blog_id'], $exclusion)) continue;
switch_to_blog($blog['blog_id']);
$wp_rewrite->init(); // http://core.trac.wordpress.org/ticket/12040 is solved, it is unnecessary.
if (empty($num)){
query_posts("post_status=publish");
} else {
query_posts("showposts=$num&post_status=publish");
}
if (have_posts()){
while(have_posts()){
$data = new stdClass();
the_post();
ob_start();
the_ID();
$data->post_id = ob_get_contents();
ob_end_clean();
$data->blog_id = $blog['blog_id'];
$data->blog_name = get_bloginfo('name');
$data->blog_url = get_bloginfo('url');
$data->blog_link = '<a href="' . $data->blog_url . '">' . $data->blog_name . '</a>' ;
ob_start();
the_title();
$data->title = ob_get_contents();
ob_end_clean();
$data->post_permalink = get_blog_permalink($data->brog_id, $data->post_id);
$data->title_link = '<a href="' . $data->post_permalink . '">' . $data->title . '</a>' ;
ob_start();
the_author_posts_link();
$data->post_author = ob_get_contents();
ob_end_clean();
ob_start();
the_category(' • ');
$data->post_category = ob_get_contents();
ob_end_clean();
if (function_exists('the_tags')){
ob_start();
the_tags(__('Tags:', 'xpress') . ' ',' • ','');
$data->post_tags = ob_get_contents();
ob_end_clean();
} else {
$data->tags = '';
}
$data->the_content = xpress_the_content('echo=0');
ob_start();
the_content();
$data->the_full_content = ob_get_contents();
ob_end_clean();
ob_start();
the_modified_date($date_format);
$data->post_modified_date = ob_get_contents();
ob_end_clean();
ob_start();
the_modified_date($time_format);
$data->post_modified_time = ob_get_contents();
ob_end_clean();
$data->post_modified_date_time = $data->post_modified_date . ' ' . $data->post_modified_time;
ob_start();
the_time('U');
$data->post_unix_time = ob_get_contents();
ob_end_clean();
ob_start();
the_time($date_format);
$data->post_date = ob_get_contents();
ob_end_clean();
ob_start();
the_time($time_format);
$data->post_time = ob_get_contents();
ob_end_clean();
$data->post_date_time = $data->post_date . ' ' . $data->post_time;
//.........这里部分代码省略.........
开发者ID:nunoluciano,项目名称:uxcl,代码行数:101,代码来源:custom_functions.php
示例12: network_latest_posts
//.........这里部分代码省略.........
}
// Switch to the blog
switch_to_blog($blog_key);
// Get posts
${'posts_' . $blog_key} = get_posts($args);
// Check if posts with the defined criteria were found
if (empty(${'posts_' . $blog_key})) {
/* If no posts matching the criteria were found then
* move to the next blog
*/
next($blogs);
}
// Put everything inside an array for sorting purposes
foreach (${'posts_' . $blog_key} as $post) {
// Access all post data
setup_postdata($post);
// Sort by blog ID
if ($sort_by_blog == 'true') {
// Ignore Posts
if (!in_array($post->ID, $post_ignore)) {
// Put inside another array and use blog ID as keys
$all_posts[$blog_key . $post->post_modified] = $post;
}
} else {
// Ignore Posts
if (!in_array($post->ID, $post_ignore)) {
// Put everything inside another array using the modified date as
// the array keys
$all_posts[$post->post_modified] = $post;
}
}
// The guid is the only value which can differenciate a post from
// others in the whole network
$all_permalinks[$post->guid] = get_blog_permalink($blog_key, $post->ID);
$all_blogkeys[$post->guid] = $blog_key;
}
// Back the current blog
restore_current_blog();
}
// If no content was found
if (empty($all_posts)) {
// Nothing to do here, let people know and get out of here
echo "<div class='alert'><p>" . __("Sorry, I couldn't find any recent posts matching your parameters.", "trans-nlp") . "</p></div>";
return;
}
// Sort by date (regardless blog IDs)
if ($sort_by_date == 'true') {
// Sorting order (newer / older)
if (!empty($sorting_order)) {
switch ($sorting_order) {
// From newest to oldest
case "newer":
// Sort the array
@krsort($all_posts);
// Limit the number of posts
if (!empty($sorting_limit)) {
$all_posts = @array_slice($all_posts, 0, $sorting_limit, true);
}
break;
// From oldest to newest
// From oldest to newest
case "older":
// Sort the array
@ksort($all_posts);
// Limit the number of posts
if (!empty($sorting_limit)) {
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:67,代码来源:network-latest-posts.php
示例13: _likebtn_get_entity_url
function _likebtn_get_entity_url($entity_name, $entity_id, $url = '', $blog_id = 0)
{
if ($url) {
return $url;
}
switch ($entity_name) {
case LIKEBTN_ENTITY_COMMENT:
if (!$blog_id) {
$url = get_comment_link($entity_id);
} else {
$url = _likebtn_get_blog_comment_link($blog_id, $entity_id);
}
break;
case LIKEBTN_ENTITY_BP_ACTIVITY_POST:
case LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE:
case LIKEBTN_ENTITY_BP_ACTIVITY_COMMENT:
case LIKEBTN_ENTITY_BP_ACTIVITY_TOPIC:
if (function_exists('bp_activity_get_permalink')) {
$url = bp_activity_get_permalink($entity_id);
}
break;
case LIKEBTN_ENTITY_BP_MEMBER:
case LIKEBTN_ENTITY_BBP_USER:
if (function_exists('bp_core_get_user_domain')) {
$url = bp_core_get_user_domain($entity_id);
}
break;
case LIKEBTN_ENTITY_USER:
$url = get_author_posts_url($entity_id);
break;
default:
if (!$blog_id) {
$url = get_permalink($entity_id);
} else {
$url = get_blog_permalink($blog_id, $entity_id);
}
break;
}
return $url;
}
开发者ID:Omuze,项目名称:barakat,代码行数:40,代码来源:likebtn_like_button.php
示例14: render_output
function render_output($wgt_miss, $wgt_count, $wgt_format, $wgt_white)
{
global $switched;
global $wpdb;
$table_prefix = $wpdb->base_prefix;
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
if (!isset($wgt_miss) || $wgt_miss == '') {
$wgt_miss = array();
}
$white = 0;
if (isset($wgt_white) && $wgt_white != '' && count($wgt_white) > 0 && $wgt_white[0] && $wgt_white[0] != '') {
$white = 1;
}
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/" >
<channel>
<title><?php
bloginfo_rss('name');
wp_title_rss();
?>
</title>
<link><?php
self_link();
?>
</link>
<atom:link href="<?php
self_link();
?>
" rel="self" type="application/rss+xml" />
<description><?php
bloginfo_rss("description");
?>
</description>
<language><?php
echo get_option('rss_language');
?>
</language>
<sy:updatePeriod><?php
echo apply_filters('rss_update_period', 'hourly');
?>
</sy:updatePeriod>
<sy:updateFrequency><?php
echo apply_filters('rss_update_frequency', '1');
?>
</sy:updateFrequency><?php
$sqlstr = '';
$blog_list = get_blog_list(0, 'all');
if ($white == 0 && !in_array(1, $wgt_miss) || $white == 1 && in_array(1, $wgt_white)) {
$sqlstr = "SELECT 1 as blog_id, id, post_date_gmt, post_type from " . $table_prefix . "posts where post_status = 'publish' and post_type = 'post' ";
}
$uni = '';
foreach ($blog_list as $blog) {
if ($white == 0 && !in_array($blog['blog_id'], $wgt_miss) && $blog['blog_id'] != 1 || $white == 1 && $blog['blog_id'] != 1 && in_array($blog['blog_id'], $wgt_white)) {
if ($sqlstr != '') {
$uni = ' union ';
}
$sqlstr .= $uni . " SELECT " . $blog['blog_id'] . " as blog_id, id, post_date_gmt, post_type from " . $table_prefix . $blog['blog_id'] . "_posts where post_status = 'publish' and post_type = 'post' ";
}
}
$limit = '';
if ((int) $wgt_count > 0) {
$limit = ' LIMIT 0, ' . (int) $wgt_count;
} else {
$limit = ' LIMIT 0, 100';
}
$sqlstr .= " ORDER BY post_date_gmt desc " . $limit;
$post_list = $wpdb->get_results($sqlstr, ARRAY_A);
foreach ($post_list as $post) {
$txt = $wgt_format == '' ? '{excerpt}' : $wgt_format;
$p = get_blog_post($post["blog_id"], $post["id"]);
$ex = $p->post_excerpt;
//if (!isset($ex) || trim($ex) == '')
//$ex = substr(strip_tags($p->post_content), 0, 65) . '...';
echo "\r";
?>
<item>
<title><![CDATA[<?php
echo $p->post_title;
?>
]]></title>
<link><?php
echo get_blog_permalink($post["blog_id"], $post["id"]);
?>
</link>
<dc:creator><?php
echo get_userdata($p->post_author)->nickname;
?>
</dc:creator>
<guid isPermaLink="false"><?php
echo $p->guid;
?>
</guid>
<pubDate><?php
//.........这里部分代码省略.........
开发者ID:Wikipraca,项目名称:Wikipraca-WikiSquare,代码行数:101,代码来源:diamond-post-feed.php
示例15: likebtn_admin_statistics
//.........这里部分代码省略.........
_e('Likes minus dislikes', LIKEBTN_I18N_DOMAIN);
if ($sort_by == 'likes_minus_dislikes') {
?>
↓<?php
}
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($statistics as $statistics_item) {
?>
<?php
// URL
if (!$blogs) {
$post_url = _likebtn_get_entity_url($entity_name, $statistics_item->post_id, $statistics_item->url);
} else {
// Multisite
switch ($entity_name) {
case LIKEBTN_ENTITY_COMMENT:
$post_url = _likebtn_get_blog_comment_link($statistics_item->blog_id, $statistics_item->post_id);
break;
case LIKEBTN_ENTITY_CUSTOM_ITEM:
$post_url = $statistics_item->url;
break;
case LIKEBTN_ENTITY_BP_ACTIVITY_POST:
case LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE:
case LIKEBTN_ENTITY_BP_ACTIVITY_COMMENT:
case LIKEBTN_ENTITY_BP_ACTIVITY_TOPIC:
$post_url = bp_activity_get_permalink($statistics_item->post_id);
break;
default:
$post_url = get_blog_permalink($statistics_item->blog_id, $statistics_item->post_id);
break;
}
}
?>
<?php
$statistics_item->post_title = _likebtn_prepare_title($entity_name, $statistics_item->post_title);
?>
<tr id="item_<?php
echo $statistics_item->post_id;
?>
">
<td><input type="checkbox" class="item_checkbox" value="<?php
echo $statistics_item->post_id;
?>
" name="item[]" <?php
if ($blogs && $statistics_item->blog_id != $blog_id) {
?>
disabled="disabled"<?php
}
?>
></td>
<?php
if ($entity_name != LIKEBTN_ENTITY_CUSTOM_ITEM) {
?>
<td><?php
echo $statistics_item->post_id;
?>
</td>
<?php
}
开发者ID:pwsclau,项目名称:kurastar,代码行数:67,代码来源:likebtn_like_button.php
示例16: s4wp_build_document
function s4wp_build_document(Solarium\QueryType\Update\Query\Document\Document $doc, $post_info, $domain = NULL, $path = NULL)
{
$plugin_s4wp_settings = s4wp_get_option();
$exclude_ids = $plugin_s4wp_settings['s4wp_exclude_pages'];
if (!is_array($plugin_s4wp_settings['s4wp_exclude_pages'])) {
$exclude_ids = explode(',', $plugin_s4wp_settings['s4wp_exclude_pages']);
}
$categoy_as_taxonomy = $plugin_s4wp_settings['s4wp_cat_as_taxo'];
$index_comments = $plugin_s4wp_settings['s4wp_index_comments'];
$index_custom_fields = $plugin_s4wp_settings['s4wp_index_custom_fields'];
if (!is_array($plugin_s4wp_settings['s4wp_index_custom_fields'])) {
$index_custom_fields = explode(',', $plugin_s4wp_settings['s4wp_index_custom_fields']);
}
if ($post_info) {
# check if we need to exclude this document
if (is_multisite() && in_array(substr(site_url(), 7) . $post_info->ID, (array) $exclude_ids)) {
return NULL;
} else {
if (!is_multisite() && in_array($post_info->ID, (array) $exclude_ids)) {
return NULL;
}
}
$auth_info = get_userdata($post_info->post_author);
# wpmu specific info
if (is_multisite()) {
// if we get here we expect that we've "switched" what blog we're running
// as
if ($domain == NULL) {
$domain = $current_blog->domain;
}
if ($path == NULL) {
$path = $current_blog->path;
}
$blogid = get_blog_id_from_url($domain, $path);
$doc->setField('id', $domain . $path . $post_info->ID);
$doc->setField('permalink', get_blog_permalink($blogid, $post_info->ID));
$doc->setField('blogid', $blogid);
$doc->setField('blogdomain', $domain);
$doc->setField('blogpath', $path);
$doc->setField('wp', 'multisite');
} else {
$doc->setField('id', $post_info->ID);
$doc->setField('permalink', get_permalink($post_info->ID));
$doc->setField('wp', 'wp');
}
$numcomments = 0;
if ($index_comments) {
$comments = get_comments("status=approve&post_id={$post_info->ID}");
foreach ($comments as $comment) {
$doc->addField('comments', $comment->comment_content);
$numcomments += 1;
}
}
$doc->setField('title', $post_info->post_title);
$doc->setField('content', strip_tags($post_info->post_content));
$doc->setField('numcomments', $numcomments);
if (isset($auth_info->display_name)) {
$doc->setField('author', $auth_info->display_name);
}
if (isset($auth_info->user_nicename)) {
$doc->setField('author_s', get_author_posts_url($auth_info->ID, $auth_info->user_nicename));
}
$doc->setField('type', $post_info->post_type);
$doc->setField('date', s4wp_format_date($post_info->post_date_gmt));
$doc->setField('modified', s4wp_format_date($post_info->post_modified_gmt));
$doc->setField('displaydate', $post_info->post_date);
$doc->setField('displaymodified', $post_info->post_modified);
$categories = get_the_category($post_info->ID);
if (!$categories == NULL) {
foreach ($categories as $category) {
if ($categoy_as_taxonomy) {
$doc->addField('categories', get_category_parents($category->cat_ID, FALSE, '^^'));
} else {
$doc->addField('categories', $category->cat_name);
}
}
}
//get all the taxonomy names used by wp
$taxonomies = (array) get_taxonomies(array('_builtin' => FALSE), 'names');
foreach ($taxonomies as $parent) {
$terms = get_the_terms($post_info->ID, $parent);
if ((array) $terms === $terms) {
//we are creating *_taxonomy as dynamic fields using our schema
//so lets set up all our taxonomies in that format
$parent = $parent . "_taxonomy";
foreach ($terms as $term) {
$doc->addField($parent, $term->name);
}
}
}
$tags = get_the_tags($post_info->ID);
if (!$tags == NULL) {
foreach ($tags as $tag) {
$doc->addField('tags', $tag->name);
}
}
if (count($index_custom_fields) > 0 && count($custom_fields = get_post_custom($post_info->ID))) {
foreach ((array) $index_custom_fields as $field_name) {
// test a php error notice.
if (isset($custom_fields[$field_name])) {
//.........这里部分代码省略.........
开发者ID:Blueprint-Marketing,项目名称:solr-power,代码行数:101,代码来源:solr-power.php
示例17: do_redirect
/**
* Check for elements we can redirect to
* and do the redirect.
*
* @since 0.2
* @param int $found | Blog ID
* @param string $lang | Language code of current blog
* @return FALSE | If no related element found
*/
private function do_redirect($found, $lang)
{
// Get currently queried object
$object = get_queried_object();
if (!$object) {
if (is_home()) {
wp_redirect(get_site_url($found));
exit;
}
return FALSE;
}
$url = '';
// Can we redirect to a specific element?
// @TODO: make calling mlp_get_linked_elements easier, i.e. no parameters necessary
$linked_elements = mlp_get_linked_elements($object->ID, '', get_current_blog_id());
// Redirect to specific element within blog. Above
// function returns array() when nothing found,
// so ! is_array won't work here.
if (array() !== $linked_elements) {
$post = get_blog_post($found, $linked_elements[$found]);
// Is the post status 'publish'?
if ('publish' == $post->post_status) {
$url = get_blog_permalink($found, $linked_elements[$found]);
}
}
// No related elements found
if ('' == $url) {
return FALSE;
}
// Otherwise do the redirect
wp_redirect($url);
exit;
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:42,代码来源:class-Multilingual_Press_Redirect.php
示例18: render_output
function render_output($wgt_miss, $wgt_count, $wgt_format, $wgt_avsize, $wgt_defav, $wgt_dt, $before_item, $after_item, $before_cont, $after_cont, $wgt_mtext, $wgt_white, $post_limit = 0)
{
global $DiamondCache;
$cachekey = 'diamond_post_' . diamond_arr_to_str($wgt_miss) . '-' . $wgt_count . '-' . $wgt_format . diamond_arr_to_str($wgt_white) . '-' . $wgt_avsize . '-' . $wgt_defav . '-' . $wgt_dt . '-' . $before_item . '-' . $after_item . '-' . $before_cont . '-' . $after_cont . '-' . $wgt_mtext . '-' . $post_limit;
$output = $DiamondCache->get($cachekey, 'recent-posts');
if ($output != false) {
return $output;
}
global $switched;
global $wpdb;
$table_prefix = $wpdb->base_prefix;
if (!isset($wgt_dt) || trim($wgt_dt) == '') {
$wgt_dt = 'M. d. Y.';
}
if (!isset($wgt_avsize) || $wgt_avsize == '') {
$wgt_avsize = 96;
}
if (!isset($before_item) || $before_item == '') {
$before_item = '<li>';
}
if (!isset($after_item) || $after_item == '') {
$after_item = '</li>';
}
if (!isset($before_cont) || $before_cont == '') {
$before_cont = '<ul>';
}
if (!isset($after_cont) || $after_cont == '') {
$after_cont = '</ul>';
}
if (!isset($wgt_miss) || $wgt_miss == '') {
$wgt_miss = array();
}
$white = 0;
if (isset($wgt_white) && $wgt_white != '' && count($wgt_white) > 0 && $wgt_white[0] && $wgt_white[0] != '') {
$white = 1;
}
$limitstr = '';
if ((int) $post_limit > 0) {
$limitstr = ' LIMIT ' . (int) $post_limit;
}
$sqlstr = '';
$blog_list = get_blog_list(0, 'all');
if ($white == 0 && !in_array(1, $wgt_miss) || $white == 1 && in_array(1, $wgt_white)) {
$sqlstr = "(SELECT 1 as blog_id, id, post_date_gmt from " . $table_prefix . "posts where post_status = 'publish' and post_type = 'post' and post_title <> '" . __('Hello world!') . "' " . $limitstr . ")";
}
$uni = '';
foreach ($blog_list as $blog) {
if ($white == 0 && !in_array($blog['blog_id'], $wgt_miss) && $blog['blog_id'] != 1 || $white == 1 && $blog['blog_id'] != 1 && in_array($blog['blog_id'], $wgt_white)) {
if ($sqlstr != '') {
$uni = ' union ';
}
$sqlstr .= $uni . " (SELECT " . $blog['blog_id'] . " as blog_id, id, post_date_gmt from " . $table_prefix . $blog['blog_id'] . "_posts where post_status = 'publish' and post_type = 'post' and post_title <> '" . __('Hello world!') . "' " . $limitstr . ")";
}
}
$limit = '';
if ((int) $wgt_count > 0) {
$limit = ' LIMIT 0, ' . (int) $wgt_count;
}
$sqlstr .= " ORDER BY post_date_gmt desc " . $limit;
//echo $sqlstr;
$post_list = $wpdb->get_results($sqlstr, ARRAY_A);
//echo $wpdb->print_error();
$output = '';
$output .= $before_cont;
foreach ($post_list as $post) {
$output .= $before_item;
$wgt_format = get_format_txt($wgt_format);
$txt = $wgt_format == '' ? '<strong>{title}</strong> - {date}' : $wgt_format;
$p = get_blog_post($post["blog_id"], $post["id"]);
$av = get_avatar(get_userdata($p->post_author)->user_email, $wgt_avsize, $defav);
$ex = $p->post_excerpt;
if (!isset($ex) || tri
|
请发表评论