echo network_get_permalink();
        ?>
">
							<strong><?php 
        network_the_title();
        ?>
</strong>
						</a><br>
						<?php 
        $the_content = preg_replace("~(?:\\[/?)[^/\\]]+/?\\]~s", '', network_get_the_content());
        ?>
						<?php 
        echo $substr(strip_tags($the_content), 0, 250);
        ?>
 (<a href="<?php 
        echo network_get_permalink();
        ?>
"><?php 
        _e('More', 'globalsitesearch');
        ?>
</a>)
					</td>
				</tr>
			<?php 
    }
    ?>
		</table>
	</div>

	<div class="gssnav"><?php 
    echo global_site_search_get_pagination();
 public function network_pro_posts_cb($atts)
 {
     if (!is_main_site() && !ALLOW_SUBSITE_PRO_POSTS) {
         return 'Sorry! This shortcode is only available for main site.';
     }
     $defaults = array('posts_per_page' => 10, 'post_type' => 'post', 'randomize' => false, 'include_main_site' => false, 'pro_level' => 'all');
     extract(shortcode_atts($defaults, $atts));
     $posts = $sites = array();
     if ($pro_level == 'all') {
         $levels = get_site_option('psts_levels');
     } else {
         $levels = array($pro_level => 1);
     }
     foreach ($levels as $key => $value) {
         $sql = 'SELECT * from ' . $this->db->base_prefix . "pro_sites where level = '" . $key . "'";
         $sites = $this->db->get_results($sql, OBJECT);
     }
     if ($include_main_site) {
         $main_site = new stdClass();
         $main_site->blog_ID = 1;
         array_unshift($sites, $main_site);
     }
     foreach ($sites as $site) {
         if ($site->blog_ID == 0) {
             continue;
         }
         if (!is_pro_site($site->blog_ID)) {
             continue;
         }
         $sql = "SELECT * from " . $this->db->base_prefix . "network_posts where BLOG_ID = '" . $site->blog_ID . "' AND post_type = '" . $post_type . "' LIMIT 0, " . $posts_per_page;
         $subsite_posts = $this->db->get_results($sql, OBJECT);
         foreach ($subsite_posts as $subsite_post) {
             array_push($posts, $subsite_post);
         }
     }
     if ($randomize) {
         shuffle($posts);
     }
     $html = '<div class="pro_sites_posts">';
     $html .= '<ul>';
     foreach ($posts as $post) {
         $html .= '<li>';
         $html .= '<h3><a href="' . network_get_permalink($post->BLOG_ID, $post->ID) . '">' . $post->post_title . '</a></h3>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</div>';
     return $html;
 }
예제 #3
0
function network_get_the_content($more_link_text = null, $stripteaser = false)
{
    global $network_post, $more, $page, $pages, $multipage, $preview;
    if (null === $more_link_text) {
        $more_link_text = __('(more...)');
    }
    $output = '';
    $hasTeaser = false;
    if ($page > count($pages)) {
        // if the requested page doesn't exist
        $page = count($pages);
    }
    // give them the highest numbered page that DOES exist
    $content = $pages[$page - 1];
    if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
        $content = explode($matches[0], $content, 2);
        if (!empty($matches[1]) && !empty($more_link_text)) {
            $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
        }
        $hasTeaser = true;
    } else {
        $content = array($content);
    }
    if (false !== strpos($network_post->post_content, '<!--noteaser-->') && (!$multipage || $page == 1)) {
        $stripteaser = true;
    }
    $teaser = $content[0];
    if ($more && $stripteaser && $hasTeaser) {
        $teaser = '';
    }
    $output .= $teaser;
    if (count($content) > 1) {
        if ($more) {
            $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
        } else {
            if (!empty($more_link_text)) {
                $output .= apply_filters('network_the_content_more_link', ' <a href="' . network_get_permalink($network_post->BLOG_ID, $network_post->ID) . "#more-{$network_post->ID}\" class=\"more-link\">{$more_link_text}</a>", $more_link_text);
            }
            $output = force_balance_tags($output);
        }
    }
    if ($preview) {
        // preview fix for javascript bug with foreign languages
        $output = preg_replace_callback('/\\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);
    }
    return $output;
}