Advertisement
Guest User

Search

a guest
Sep 9th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.08 KB | None | 0 0
  1. if(!empty($phrase)) {
  2.                 $network_query_posts = network_query_posts( $parameters );
  3.                 $i = 0;
  4.                 //found_posts
  5.                 if( network_have_posts() && isset($GLOBALS['network_query']->found_posts) && $GLOBALS['network_query']->found_posts > intval( $global_site_search_per_page ) ) {
  6.                     $next = 'yes';
  7.                     $navigation_content = $this->new_pagination( $GLOBALS['network_query'], $current_site->path . $this->global_site_search_base . '/' . urlencode($phrase) );
  8.                 }
  9.  
  10.                 if ( network_have_posts() ) {
  11.                     $content .= (isset($navigation_content)) ? $navigation_content : '';
  12.  
  13.                     $content .= '<div style="float:left; width:100%">';
  14.                     $content .= '<table border="0" border="0" width="100%" bgcolor="">';
  15.                     $content .= '<tr>';
  16.                     $content .= '<td style="background-color:' . $global_site_search_background_color . '; border-bottom-style:solid; border-bottom-color:' . $global_site_search_border_color . '; border-bottom-width:1px; font-size:12px;" width="10%"> </td>';
  17.                     $content .= '<td style="background-color:' . $global_site_search_background_color . '; border-bottom-style:solid; border-bottom-color:' . $global_site_search_border_color . '; border-bottom-width:1px; font-size:12px;" width="90%"><center><strong>' .  __('Posts', 'globalsitesearch') . '</strong></center></td>';
  18.                     $content .= '</tr>';
  19.  
  20.                     // Search results
  21.  
  22.                     $avatar_default = get_option('avatar_default');
  23.                     $tic_toc = 'toc';
  24.  
  25.                     while( network_have_posts()) {
  26.                         network_the_post();
  27.  
  28.                         //=============================//
  29.                         $author_id = network_get_the_author_id();
  30.                         $the_author = get_user_by( 'id', $author_id );
  31.  
  32.                         if(!$the_author) {
  33.                             $post_author_display_name = __('Unknown', 'globalsitesearch');
  34.                         } else {
  35.                             $post_author_display_name = $the_author->display_name;
  36.                         }
  37.                         $tic_toc = ($tic_toc == 'toc') ? 'tic' : 'toc';
  38.                         $bg_color = ($tic_toc == 'tic') ? $global_site_search_alternate_background_color : $global_site_search_background_color;
  39.  
  40.                         //=============================//
  41.                         $content .= '<tr>';
  42.                             $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px; text-align: center;" valign="top" width="10%"><a style="text-decoration:none;" href="' . network_get_permalink() . '">' . get_avatar( $author_id, 32, $avatar_default ) . '</a></td>';
  43.                             $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px; vertical-align: top;" width="90%" valign="top">';
  44.                             $content .= '<strong><a style="text-decoration:none;" href="' . network_get_permalink() . '">' . network_get_the_title() . '</a></strong> - ';
  45.                             $content .= __('Post by ', 'globalsitesearch');
  46.                             if ( function_exists('members_directory_site_admin_options') ) {
  47.                                 $post_author_nicename = $the_author->user_nicename;
  48.                                 $content .= '<strong><a style="text-decoration:none;" href="http://' . $current_site->domain . $current_site->path . $members_directory_base . '/' . $post_author_nicename . '/">' . $post_author_display_name . '</a> </strong> ';
  49.                             } else {
  50.                                 $content .= '<strong>' . $post_author_display_name . ': </strong> ';
  51.                             }
  52.                             $content .= ' on ';
  53.                             $content .= date("d M Y", strtotime($network_query_posts[$i]->post_date));
  54.                             $content .= ' in ';
  55.                             $blog_details = get_blog_details($network_query_posts[$i]->BLOG_ID);
  56.                             $content .= '<a href="'.$blog_details->siteurl.'" target="_blank">'.$blog_details->blogname.'</a>';
  57.                             $content .= '<br>';
  58.                             $the_content = network_get_the_content();
  59.                             $content .= substr(strip_tags( $the_content ),0, 250) . ' (<a href="' . network_get_permalink() . '">' . __('More', 'globalsitesearch') . '</a>)';
  60.                             $content .= '</td>';
  61.                         $content .= '</tr>';
  62.                         $i++;
  63.  
  64.                     }
  65.  
  66.  
  67.                     $content .= '</table>';
  68.                     $content .= '</div>';
  69.                     $content .= (isset($navigation_content)) ? $navigation_content : '';
  70.                 } else {
  71.                     $content .= '<p>';
  72.                     $content .= '<center>';
  73.                     $content .= __('Nothing found for search term(s).', 'globalsitesearch');
  74.                     $content .= '</center>';
  75.                     $content .= '</p>';
  76.                 }
  77.  
  78.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement