function thb_breadcrumb()
{
    global $post, $wp_query;
    $id = $wp_query->get_queried_object_id();
    echo '<aside class="breadcrumb">';
    if (!is_front_page()) {
        echo '<a href="';
        echo home_url();
        echo '">' . __('Home', THB_THEME_NAME);
        echo "</a>";
    }
    if (is_singular('portfolio')) {
        $portfolio_main = get_post_meta($post->ID, 'portfolio_main', TRUE);
        if ($portfolio_main) {
            $portfolio_link = get_permalink($portfolio_main);
        } else {
            $portfolio_link = get_portfolio_page_link(get_the_ID());
        }
        echo '<span>/</span> <a href="' . $portfolio_link . '">' . __('Portfolio', THB_THEME_NAME) . '</a>';
        echo '<span>/</span>' . get_the_title();
    }
    if (is_home()) {
        echo '<span>/</span>' . __('Blog', THB_THEME_NAME);
    }
    if (is_page() && !is_front_page()) {
        $parents = array();
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $parents[] = '<span>/</span><a href="' . get_permalink($page->ID) . '" title="' . get_the_title($page->ID) . '">' . get_the_title($page->ID) . '</a>';
            $parent_id = $page->post_parent;
        }
        $parents = array_reverse($parents);
        echo join(' ', $parents);
        echo '<span>/</span>' . get_the_title();
    }
    if (is_single() && !is_singular('portfolio')) {
        $categories = get_the_category();
        if ($categories) {
            foreach ($categories as $cat) {
                $cats[] = '<a href="' . get_category_link($cat->term_id) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
            }
            echo '<span>/</span>' . join(', ', $cats);
        }
        echo '<span>/</span>' . ShortenText(get_the_title(), 40);
    }
    if (is_archive()) {
        if (class_exists('woocommerce') && is_woocommerce() && is_shop()) {
            echo '<span>/</span>' . get_the_title(wc_get_page_id('shop'));
        } else {
            echo '<span>/</span>' . thb_which_archive();
        }
    }
    if (is_search()) {
        echo '<span>/</span>' . thb_which_archive();
    }
    echo '</aside>';
}
 public function widget_twitter_widget($h)
 {
     // your twitter username and password
     $twitter_widget_username = $h->getSetting('twitter_widget_username', 'twitter_widget');
     $twitter_widget_password = $h->getSetting('twitter_widget_password', 'twitter_widget');
     // include Twitterlibphp
     require_once PLUGINS . 'twitter_widget/libs/twitter_lib.php';
     // initialize the twitter class
     $twitter = new Twitter($twitter_widget_username, $twitter_widget_password);
     ///// testing purposes (doesn't count against your hit limit to call up remaining hits)
     if ($h->isDebug) {
         // grabs status for API rate limit for testing cache
         $calls = $twitter->rateLimitStatus();
         $hits = new SimpleXMLElement($calls);
         echo '<br/>';
         echo 'remaining hits for this hour = ' . $hits->{'remaining-hits'};
     }
     $need_cache = false;
     // check for a cached version and use it if no recent update:
     $cached_output = $h->smartCache('html', 'posts', 10, '', 'twitter_widget');
     if ($cached_output) {
         echo $cached_output;
         // cached HTML
         return true;
     } else {
         $need_cache = true;
     }
     // fetch your profile in xml format
     $user = $twitter->showUser();
     $my_info = new SimpleXMLElement($user);
     // fetch your friends (people you follow) in xml format or use getUserTimeline() to show your own
     $xml = $twitter->getFriendsTimeline();
     // fetch your session xml format
     $twitter_status = new SimpleXMLElement($xml);
     // trim characters to show for each tweet
     function ShortenText($text)
     {
         // Change here. default 77
         $chars = 77;
         $text = $text . " ";
         $text = substr($text, 0, $chars);
         $text = substr($text, 0, strrpos($text, ' '));
         $text = $text . "...";
         return $text;
     }
     // show twitter widget template
     $output = "<div class='twitter_container'>\n";
     $output .= "<div class='twitter_header'>\n";
     $output .= "<img src='" . $my_info->profile_image_url . "' alt=" . $my_info->screen_name . " title=" . $my_info->screen_name . " >\n";
     $output .= "<h3><a href='http://www.twitter.com/" . $my_info->screen_name . "'>" . $my_info->followers_count . "&nbsp;" . $h->lang['twitter_widget_followers'] . "</a></h3>\n";
     //$output .= "<br/>\n";
     $output .= "<a href='http://www.twitter.com/" . $my_info->screen_name . "'>" . $h->lang['twitter_widget_follow_us'] . "</a>\n";
     $output .= "</div>\n";
     $i = 1;
     foreach ($twitter_status->status as $status) {
         if ($i < 6) {
             //show up to 20 latest tweets default is 5
             $output .= "<div class='twitter_status'>\n";
             foreach ($status->user as $user) {
                 $output .= "<img src='" . $user->profile_image_url . "' alt=" . $user->screen_name . " title=" . $user->screen_name . " class='twitter_image'>\n";
                 $output .= "<a href='http://www.twitter.com/" . $user->screen_name . "'>" . $user->name . "</a>: \n";
             }
             $output .= ShortenText($status->text);
             $output .= "<br/>\n";
             // uncommment below to show posted time - might have to adjust CSS!
             //$output .= "<div class='twitter_posted_at'><strong>Posted at:</strong> ".$status->created_at."</div>";
             $output .= "</div>\n";
         }
         $i++;
     }
     $output .= "</div>";
     if ($need_cache) {
         $h->smartCache('html', 'posts', 10, $output, 'twitter_widget');
     }
     echo $output;
 }
Beispiel #3
0
include_once mnminclude . 'search.php';
include_once mnminclude . 'smartyvariables.php';
// -------------------------------------------------------------------------------------
global $the_template, $main_smarty, $db;
$body = '';
$res = "select comment_content,comment_id,link_id, " . table_links . ".link_title_url, " . table_links . ".link_category from " . table_comments . "," . table_links . " WHERE comment_link_id = link_id ORDER BY comment_date DESC limit " . comments_size_sidebar . "";
$list_comments = $db->get_results($res);
if ($list_comments) {
    foreach ($list_comments as $row) {
        if ($row->link_title_url == "") {
            $story_url = getmyurl("story", $row->link_id);
        } else {
            $story_url = getmyurl("storyURL", comments_category_safe_name($row->link_category), urlencode($row->link_title_url), $row->link_id);
        }
        $main_smarty->assign('comment_url', $story_url . "#c" . $row->comment_id);
        $main_smarty->assign('comment_text', ShortenText(save_text_to_html($row->comment_content)));
        $body .= $main_smarty->fetch($the_template . '/sidebar_comments.tpl');
    }
}
$main_smarty->assign('live_url', getmyurl("comments"));
$main_smarty->assign('sc_body', $body);
$main_smarty->display($the_template . '/sidebar_comments_wrapper.tpl');
$main_smarty->assign('ss_toggle_id', 'latcomments');
// determine the amount of characters to show for each comment
function ShortenText($text)
{
    $chars = comments_length_sidebar;
    $text = strip_tags($text);
    $text = $text . " ";
    $text = substr($text, 0, $chars);
    $text = substr($text, 0, strrpos($text, ' '));
        ?>
		    <div class="post-title">
		    	<h2><a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        the_title();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
		    </div>
		    <div class="post-content">
		    	<?php 
        echo ShortenText(get_the_content(), 200);
        ?>
		    </div>
		  	<?php 
        get_template_part('inc/postformats/post-meta');
        ?>
		  </article>
		  
		  <?php 
        if (in_array($i + 1, $counter)) {
            echo '</div>';
        }
        ?>
		  
	  <?php 
        $i++;
function thb_post($atts, $content = null)
{
    extract(shortcode_atts(array('carousel' => 'no', 'item_count' => '9', 'source' => 'by-category', 'cat' => '', 'post_ids' => '', 'tag_slugs' => '', 'author_ids' => '', 'columns' => '4'), $atts));
    $args = array('showposts' => $item_count, 'nopaging' => 0, 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'no_found_rows' => true);
    if ($source == 'by-category') {
        if (!empty($cat)) {
            $cats = explode(',', $cat);
            $args = wp_parse_args(array('showposts' => $item_count, 'category__in' => $cats), $args);
        }
    } else {
        if ($source == 'by-id') {
            $post_id_array = explode(',', $post_ids);
            $args = wp_parse_args(array('post__in' => $post_id_array, 'showposts' => 99), $args);
        } else {
            if ($source == 'by-tag') {
                $post_tag_array = explode(',', $tag_slugs);
                $args = wp_parse_args(array('showposts' => $item_count, 'tag_slug__in' => $post_tag_array), $args);
            } else {
                if ($source == 'by-author') {
                    $post_author_array = explode(',', $author_ids);
                    $args = wp_parse_args(array('showposts' => $item_count, 'author__in' => $post_author_array), $args);
                }
            }
        }
    }
    $posts = new WP_Query($args);
    ob_start();
    if ($posts->have_posts()) {
        ?>
	  <?php 
        switch ($columns) {
            case 2:
                $col = 'medium-6';
                $w = '570';
                break;
            case 3:
                $col = 'medium-4';
                $w = '370';
                break;
            case 4:
                $col = 'medium-3';
                $w = '270';
                break;
        }
        ?>
		<?php 
        if ($carousel == "yes") {
            ?>
			
			<div class="carousel-container">
				<div class="carousel posts owl row" data-columns="<?php 
            echo $columns;
            ?>
" data-navigation="true">				
					
					<?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
						<?php 
                $image_id = get_post_thumbnail_id();
                $image_link = wp_get_attachment_image_src($image_id, 'full');
                $image = aq_resize($image_link[0], $w, 180, true, false);
                $image_title = esc_attr(get_the_title(get_the_ID()));
                ?>
						<article <?php 
                post_class('post ' . $col . ' columns');
                ?>
 id="post-<?php 
                the_ID();
                ?>
">
							<figure class="post-gallery">
								<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><img  src="<?php 
                echo $image[0];
                ?>
" width="<?php 
                echo $image[1];
                ?>
" height="<?php 
                echo $image[2];
                ?>
" title="<?php 
                echo $image_title;
                ?>
" /></a>
								<time><?php 
                echo get_the_date('d');
                ?>
<br><?php 
                echo get_the_date('M');
                ?>
</time>
							</figure>
							<div class="post-title">
								<aside class="post_categories">
									<?php 
                the_category(', ');
                ?>
								</aside>
								<h2><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
							</div>
							<div class="post-content">
								<?php 
                echo ShortenText(get_the_content(), 100);
                ?>
							</div>
						</article>
					<?php 
            }
            // end of the loop.
            ?>
	 
										
				</div>
			</div>
			
		<?php 
        } else {
            ?>
 
		<div class="posts row" data-equal="article">
		
			<?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
				<?php 
                $image_id = get_post_thumbnail_id();
                $image_link = wp_get_attachment_image_src($image_id, 'full');
                $image = aq_resize($image_link[0], $w, 180, true, false);
                $image_title = esc_attr(get_the_title(get_the_ID()));
                ?>
				<article <?php 
                post_class('post small-6 ' . $col . ' columns');
                ?>
 id="post-<?php 
                the_ID();
                ?>
">
					<figure class="post-gallery">
						<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><img  src="<?php 
                echo $image[0];
                ?>
" width="<?php 
                echo $image[1];
                ?>
" height="<?php 
                echo $image[2];
                ?>
" title="<?php 
                echo $image_title;
                ?>
" /></a>
							<time><?php 
                echo get_the_date('d');
                ?>
<br><?php 
                echo get_the_date('M');
                ?>
</time>
						</figure>
						<div class="post-title">
							<aside class="post_categories">
								<?php 
                the_category(', ');
                ?>
							</aside>
							<h2><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
						</div>
						<div class="post-content">
							<?php 
                echo ShortenText(get_the_content(), 100);
                ?>
						</div>
					</article>
			<?php 
            }
            // end of the loop.
            ?>
		 
		</div>
		
		<?php 
        }
        ?>
	   
	<?php 
    }
    $out = ob_get_contents();
    if (ob_get_contents()) {
        ob_end_clean();
    }
    wp_reset_query();
    wp_reset_postdata();
    return $out;
}
Beispiel #6
0
 $result = array();
 $sql = "SELECT * FROM video_playlist_lists WHERE list_id = {$playlists_id} AND user_id  = {$user_id}";
 $query = mysql_query($sql);
 while ($result1 = mysql_fetch_array($query)) {
     $play_list_video_id = $result1['video_id'];
     $sql2 = "SELECT * FROM videos WHERE indexer = {$play_list_video_id}";
     $query2 = mysql_query($sql2);
     $results2 = mysql_fetch_array($query2);
     $merged_array = array_merge($results2, $result1);
     $result[] = $merged_array;
 }
 //get list title
 $sql = "SELECT * FROM video_playlist WHERE list_id = {$playlists_id}";
 $query = mysql_query($sql);
 $result3 = mysql_fetch_array($query);
 $shortened_name = ShortenText($result3['list_name']);
 if (empty($result)) {
     $show = 2;
 } else {
     $show = 1;
 }
 $show_title = 1;
 if ($_POST['selected_box'] == 'delete') {
     $show_title = '';
     $show = '';
 }
 $template = "themes/{$user_theme}/templates/inner_playlist_main.htm";
 $TBS = new clsTinyButStrong();
 $TBS->NoErr = true;
 $TBS->LoadTemplate("{$template}");
 $TBS->MergeBlock('blk1', $result);
Beispiel #7
0
         } else {
             if ($line['state'] == "3") {
                 $stateClass = "DHCP";
             }
         }
     }
 }
 //print table
 print '<tr class="ipSearch ' . $stateClass . '" id="' . $line['id'] . '" subnetId="' . $line['subnetId'] . '" sectionId="' . $subnet['sectionId'] . '" link="' . $section['name'] . '|' . $subnet['id'] . '">' . "\n";
 print ' <td><a href="subnets/' . $subnet['sectionId'] . '/' . $subnet['id'] . '/ipdetails/' . $line['id'] . '/">' . transform2long($line['ip_addr']) . "</a>";
 if (in_array('state', $setFields)) {
     print reformatIPState($line['state']);
 }
 print ' </td>' . "\n";
 print ' <td>' . $vlan['number'] . '</td>' . "\n";
 print ' <td>' . ShortenText($line['description'], $chars = 50) . '</td>' . "\n";
 print ' <td>' . $line['dns_name'] . '</td>' . "\n";
 # mac
 if (in_array('mac', $setFields)) {
     print '	<td>' . "\n";
     if (strlen($line['mac']) > 0) {
         print '<i class="fa fa-sitemap fa-gray" rel="tooltip" title="MAC: ' . $line['mac'] . '"></i>' . "\n";
     }
     print '	</td>' . "\n";
 }
 # switch
 if (in_array('switch', $setFields)) {
     if (strlen($line['switch']) > 0 && $line['switch'] != 0) {
         # get switch
         $switch = getDeviceDetailsById($line['switch']);
         $line['switch'] = $switch['hostname'];
Beispiel #8
0
    										   $query="update volunteer set email='" . return_field('users','id',$row['userid'],'email'). "' where id=".$row['id'];
     mysqli_query($mysqli, $query);
    
    										   }*/
    ?>
                           <tr>
                             <td  width="41"><?php 
    echo $cnt;
    ?>
</td>
                             <td style="text-align:left"><?php 
    echo $row['email'];
    ?>
 </td>
                             <td  ><?php 
    echo ShortenText($row['message'], 120);
    ?>
 </td>
							   <td style="text-align:left"><?php 
    echo $row['datesent'];
    ?>
 </td>
                             <td><i class="pointer <?php 
    echo $row['status2'] != 0 ? 'icon-ok' : 'icon-ban-circle';
    ?>
" id="statusimg_<?php 
    echo $row['id'];
    ?>
" onClick="change_status('volunteer','<?php 
    echo $row['id'];
    ?>
Beispiel #9
0
    										   $query="update volunteer set email='" . return_field('users','id',$row['userid'],'email'). "' where id=".$row['id'];
     mysqli_query($mysqli, $query);
    
    										   }*/
    ?>
                           <tr>
                             <td  width="41"><?php 
    echo $cnt;
    ?>
</td>
                             <td style="text-align:left"><?php 
    echo $row['name'];
    ?>
 </td>
                             <td  ><?php 
    echo ShortenText($row['description'], 120);
    ?>
 </td>
							   <td style="text-align:left"><?php 
    echo $row['datesent'];
    ?>
 </td>
                             <td><i class="pointer <?php 
    echo $row['status2'] != 0 ? 'icon-ok' : 'icon-ban-circle';
    ?>
" id="statusimg_<?php 
    echo $row['id'];
    ?>
" onClick="change_status('feedback','<?php 
    echo $row['id'];
    ?>
function netsposts_shortcode($atts)
{
    /* below is my updates */
    extract(shortcode_atts(array('limit' => '', 'days' => 0, 'page_title_style' => '', 'title' => '', 'titles_only' => false, 'wrap_start' => null, 'wrap_end' => null, 'thumbnail' => false, 'post_type' => 'post', 'include_blog' => null, 'exclude_blog' => null, 'exclude_post' => null, 'include_post' => null, 'title_length' => 999, 'taxonomy' => '', 'paginate' => false, 'pages' => null, 'list' => 10, 'excerpt_length' => 400, 'auto_excerpt' => false, 'show_author' => false, 'full_text' => false, 'size' => 'thumbnail', 'image_class' => 'post-thumbnail', 'date_format' => 'n/j/Y', 'end_size' => '', 'mid_size' => '', 'prev_next' => false, 'prev' => '&laquo; Previous', 'next' => 'Next &raquo;', 'column' => '1', 'column_width' => '200', 'title_color' => '', 'text_color' => '', 'meta_info' => 'true', 'wrap_title_start' => '', 'wrap_title_end' => '', 'wrap_image_start' => '', 'wrap_image_end' => '', 'wrap_text_start' => '', 'wrap_text_end' => '', 'meta_width' => '100%', 'menu_name' => '', 'menu_class' => '', 'container_class' => '', 'post_height' => null, 'manual_excerpt_length' => null, 'random' => false, 'order_post_by' => ''), $atts));
    /* my updates are finished here */
    ########  OUTPUT STAFF  ####################
    $titles_only = strtolower($titles_only) == 'true' ? true : false;
    $thumbnail = strtolower($thumbnail) == 'true' ? true : false;
    $paginate = strtolower($paginate) == 'true' ? true : false;
    $auto_excerpt = strtolower($auto_excerpt) == 'true' ? true : false;
    $show_author = strtolower($show_author) == 'true' ? true : false;
    $full_text = strtolower($full_text) == 'true' ? true : false;
    $prev_next = strtolower($prev_next) == 'true' ? true : false;
    /* below is my updates */
    $random = strtolower($random) == 'true' ? true : false;
    /* my updates are finished here */
    global $wpdb;
    global $table_prefix;
    if ($limit) {
        $limit = " LIMIT 0,{$limit} ";
    }
    ## Params for taxonomy
    if ($cat) {
        if ($tag) {
            implode(',', $cat, $tag);
        }
    } else {
        $cat = $tag;
    }
    ## Include blogs
    if ($include_blog) {
        $include_arr = explode(",", $include_blog);
        $include = " AND (";
        foreach ($include_arr as $included_blog) {
            $include .= " blog_id = {$included_blog}  OR";
        }
        $include = substr($include, 0, strlen($include) - 2);
        $include .= ")";
    } else {
        if ($exclude_blog) {
            $exclude_arr = explode(",", $exclude_blog);
            foreach ($exclude_arr as $exclude_blog) {
                $exclude .= "AND blog_id != {$exclude_blog}  ";
            }
        }
    }
    $BlogsTable = $wpdb->base_prefix . 'blogs';
    /* below is my updates */
    if ($random) {
        $page = get_query_var('paged');
        if (!$page) {
            $page = get_query_var('page');
        }
        if (!$page) {
            $page = 1;
        }
        if ($page > 1 && $paginate) {
            $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$BlogsTable} WHERE public = %d AND archived = %d AND mature = %d AND spam = %d AND deleted = %d {$include} {$exclude}  ", 1, 0, 0, 0, 0));
        } else {
            $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$BlogsTable} WHERE public = %d AND archived = %d AND mature = %d AND spam = %d AND deleted = %d {$include} {$exclude} ORDER BY RAND() ", 1, 0, 0, 0, 0));
        }
    } else {
        $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$BlogsTable} WHERE public = %d AND archived = %d AND mature = %d AND spam = %d AND deleted = %d {$include} {$exclude}  ", 1, 0, 0, 0, 0));
    }
    /* my updates are finished here */
    ## Getting posts
    $postdata = array();
    if ($blogs) {
        foreach ($blogs as $blog_id) {
            if ($blog_id == 1) {
                $OptionsTable = $wpdb->base_prefix . "options";
                $PostsTable = $wpdb->base_prefix . "posts";
                $TermRelationshipTable = $wpdb->base_prefix . "term_relationships";
                $TermTaxonomyTable = $wpdb->base_prefix . "term_taxonomy";
                $TermsTable = $wpdb->base_prefix . "terms";
            } else {
                $OptionsTableTable = $wpdb->base_prefix . $blog_id . "_options";
                $PostsTable = $wpdb->base_prefix . $blog_id . "_posts";
                $TermRelationshipTable = $wpdb->base_prefix . $blog_id . "_term_relationships";
                $TermTaxonomyTable = $wpdb->base_prefix . $blog_id . "_term_taxonomy";
                $TermsTable = $wpdb->base_prefix . $blog_id . "_terms";
            }
            if ($days > 0) {
                $old = "AND {$PostsTable}.post_date >= DATE_SUB(CURRENT_DATE(), INTERVAL {$days} DAY)";
            } else {
                $old = "";
            }
            ## Taxonomy
            if ($taxonomy) {
                $categories = explode(',', $taxonomy);
                $cat_arr = array();
                foreach ($categories as $category) {
                    $cat_id = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM {$TermsTable} WHERE slug = '{$category}' "));
                    if ($cat_id) {
                        $cat_arr[] = $cat_id;
                    }
                }
                $taxonomy_arr = array();
                foreach ($cat_arr as $cat_id) {
                    $tax_id = $wpdb->get_var($wpdb->prepare("SELECT term_taxonomy_id FROM {$TermTaxonomyTable} WHERE  term_id = {$cat_id}"));
                    if ($tax_id) {
                        $taxonomy_arr[] = $tax_id;
                    }
                }
                foreach ($taxonomy_arr as $tax_id) {
                    $post_ids = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM {$TermRelationshipTable} WHERE term_taxonomy_id = {$tax_id}"), ARRAY_A);
                    if (!empty($post_ids)) {
                        foreach ($post_ids as $key => $object_id) {
                            $ids .= " {$PostsTable}.ID = " . $object_id['object_id'] . ' OR';
                        }
                    }
                }
            }
            if ($ids) {
                $ids = ' AND  (' . substr($ids, 0, strlen($ids) - 2) . ')';
            } else {
                if ($taxonomy) {
                    $ids = ' AND  ID=null';
                }
            }
            /* below is my updates */
            $order_by = "";
            $aorder = array();
            $aorder1 = array();
            if ($order_post_by) {
                $tab_order_by1 = explode(" ", $order_post_by);
                if (($tab_order_by1[0] == "page_order" || $tab_order_by1[0] == "alphabetical_order" || $tab_order_by1[0] == "date_order") && (trim($tab_order_by1[1]) == "" || strtoupper($tab_order_by1[1]) == "DESC" || strtoupper($tab_order_by1[1]) == "ASC")) {
                    $order_by .= " ORDER BY " . $PostsTable . "." . $order_post_by;
                    $ordad = $tab_order_by1[1] ? $tab_order_by1[1] : "ASC";
                    $aorder = array_merge($aorder, array($tab_order_by1[0] => $ordad));
                    $ordad0 = "ID";
                    if ($tab_order_by1[0] == "date_order") {
                        $ordad0 = "post_date";
                    } else {
                        if ($tab_order_by1[0] == "alphabetical_order") {
                            $ordad0 = "post_title";
                        }
                    }
                    if (strtoupper($tab_order_by1[1]) == "DESC") {
                        $ordad1 = SORT_DESC;
                    } else {
                        $ordad1 = SORT_ASC;
                    }
                    $aorder1 = array_merge($aorder1, array($ordad0 => $ordad1));
                }
            }
            if ($random) {
                if ($page > 1 && $paginate) {
                    $the_post = $wpdb->get_results($wpdb->prepare("SELECT {$PostsTable}.ID, {$PostsTable}.post_title, {$PostsTable}.post_excerpt, {$PostsTable}.post_content, {$PostsTable}.post_author, {$PostsTable}.post_date, {$PostsTable}.guid, {$BlogsTable}.blog_id\n\t\t\t\t\t\tFROM {$PostsTable}, {$BlogsTable} WHERE {$BlogsTable}.blog_id  =  {$blog_id}  AND {$PostsTable}.post_status = %s {$ids}  AND {$PostsTable}.post_type = '{$post_type}'  {$old}  {$limit}", 'publish'), ARRAY_A);
                } else {
                    $the_post = $wpdb->get_results($wpdb->prepare("SELECT {$PostsTable}.ID, {$PostsTable}.post_title, {$PostsTable}.post_excerpt, {$PostsTable}.post_content, {$PostsTable}.post_author, {$PostsTable}.post_date, {$PostsTable}.guid, {$BlogsTable}.blog_id\n\t\t\t\t\t\tFROM {$PostsTable}, {$BlogsTable} WHERE {$BlogsTable}.blog_id  =  {$blog_id}  AND {$PostsTable}.post_status = %s {$ids}  AND {$PostsTable}.post_type = '{$post_type}'  {$old} ORDER BY RAND() {$limit}", 'publish'), ARRAY_A);
                }
            } else {
                $the_post = $wpdb->get_results($wpdb->prepare("SELECT {$PostsTable}.ID, {$PostsTable}.post_title, {$PostsTable}.post_excerpt, {$PostsTable}.post_content, {$PostsTable}.post_author, {$PostsTable}.post_date, {$PostsTable}.guid, {$BlogsTable}.blog_id\n\t\t\t\t\tFROM {$PostsTable}, {$BlogsTable} WHERE {$BlogsTable}.blog_id  =  {$blog_id}  AND {$PostsTable}.post_status = %s {$ids}  AND {$PostsTable}.post_type = '{$post_type}'  {$old}    {$limit}", 'publish'), ARRAY_A);
            }
            /* my updates are finished here */
            $postdata = array_merge_recursive($postdata, $the_post);
            $ids = '';
        }
    }
    /* below is my updates */
    if (!$random) {
        if ($order_by == "") {
            usort($postdata, "custom_sort");
        } else {
            $postdata = array_msort($postdata, $aorder1);
        }
    }
    /* my updates are finished here */
    /* below is my updates */
    $exclude_post2 = explode(",", $exclude_post);
    foreach ($exclude_post2 as $row) {
        $postdata = removeElementWithValue($postdata, "ID", $row);
    }
    /* my updates are finished here */
    if (isset($include_post)) {
        $include_post2 = explode(",", $include_post);
        foreach ($postdata as $postX) {
            if (in_array($postX['ID'], $include_post2)) {
                $newPostdata[] = $postX;
            }
        }
        $postdata = $newPostdata;
    }
    if ($paginate) {
        if ($column > 1) {
            $column_list = ceil($list / $column);
            $list = $column_list * $column;
            if (!$list) {
                $list = $column;
                $column_list = 1;
            }
        }
        $page = get_query_var('paged');
        if (!$page) {
            $page = get_query_var('page');
        }
        if (!$page) {
            $page = 1;
        }
        /* below is my updates */
        //$postdata = super_unique($postdata,"ID");
        /* my updates are finished here */
        /* below is my updates */
        /*$exclude_post2 = explode(",",$exclude_post);
        
                foreach($exclude_post2 as $row){
        
                    $postdata = removeElementWithValue($postdata, "ID", $row);
        
                }*/
        /* my updates are finished here */
        //if(!in_array($the_post['ID'], $exclude_post2)){
        $total_records = count($postdata);
        $total_pages = ceil($total_records / $list);
        $postdata = array_slice($postdata, ($page - 1) * $list, $list);
    } else {
        $postdata = array_slice($postdata, 0, $list);
    }
    /* my updates are finished here */
    if ($column > 1) {
        $count = count($postdata);
        if (!$paginate) {
            $column_list = ceil($count / $column);
        }
        for ($i = 0; $i < $column; ++$i) {
            if ($count < $column_list * $column) {
                $column_list = ceil($count / $column);
            }
            $colomn_data[$i] = array_slice($postdata, $i * $column_list, $column_list);
        }
    } else {
        $colomn_data[0] = $postdata;
    }
    ## OUTPUT
    if ($page_title_style) {
        ?>
	
	<style type="text/css">
	h2.pagetitle
	{
        <?php 
        echo $page_title_style;
        ?>
        <?php 
        echo get_option('net-style');
        ?>
	}
	</style>
	<?php 
    }
    $html = '<div id="netsposts-menu">';
    if ($menu_name) {
        $menu = array('menu' => $menu_name, 'menu_class' => $menu_class, 'container_class' => $container_class);
        wp_nav_menu($menu);
    }
    $html .= '</div>';
    if ($postdata) {
        $html .= "<style>";
        $html .= get_option('net-style');
        $html .= "</style>";
        $html .= '<div id="block-wrapper">';
        if (isset($post_height)) {
            $height_content = "height: " . $post_height . "px;";
        } else {
            $height_content = "";
        }
        if ($title) {
            $html .= '<span class="netsposts-title">' . $title . '</span><br />';
        }
        foreach ($colomn_data as $data) {
            if ($column > 1) {
                $html .= '<div class ="netsposts-column" style="width: ' . $column_width . 'px;">';
            }
            foreach ($data as $key => $the_post) {
                $blog_details = get_blog_details($the_post['blog_id']);
                $blog_name = $blog_details->blogname;
                $blog_url = $blog_details->siteurl;
                if ($titles_only) {
                    $title_class = 'netsposts-post-titles-only';
                } else {
                    $title_class = 'netsposts-posttitle';
                }
                $html .= html_entity_decode($wrap_start) . '<div class="netsposts-content" style="' . $height_content . '">';
                $html .= htmlspecialchars_decode($wrap_title_start);
                $html .= '<span class="' . $title_class . '" style="color: ' . $title_color . ';"><a href="' . $the_post['guid'] . '"> ' . ShortenText($the_post['post_title'], $title_length) . ' </a></span>';
                $html .= htmlspecialchars_decode($wrap_title_end);
                if (!$titles_only) {
                    $date = new DateTime(trim($the_post['post_date']));
                    $date_post = $date->format($date_format);
                    if ($meta_info != "false") {
                        if ($meta_width == "100%") {
                            $width = 'width: 100%;';
                        } else {
                            $width = "width: " . $meta_width . "px;";
                        }
                        $html .= '<span class="netsposts-source" style="height: 24px; margin-bottom: 5px; overflow: hidden; ' . $width . '"> ' . __('Published', 'netsposts') . ' ' . $date_post . ' ' . __('in', 'netsposts') . '  <a href="' . $blog_url . '">' . $blog_name . '</a>';
                    }
                    ##  Full metadata
                    if ($show_author) {
                        if ($column > 1) {
                            $html .= '<br />';
                        }
                        $html .= ' ' . __('Author', 'netsposts') . ' ' . '<a href="' . $blog_url . '?author=' . $the_post['post_author'] . '">' . get_the_author_meta('display_name', $the_post['post_author']) . ' </a>';
                    }
                    $html .= '</span>';
                    if ($thumbnail) {
                        $html .= htmlspecialchars_decode($wrap_image_start);
                        $html .= '<a href="' . $the_post['guid'] . '">' . get_thumbnail_by_blog($the_post['blog_id'], $the_post['ID'], $size, $image_class, $column) . '</a>';
                        $html .= htmlspecialchars_decode($wrap_image_end);
                        $html .= htmlspecialchars_decode($wrap_text_start);
                        $html .= '<p class="netsposts-excerpt" style="color: ' . $text_color . ';">';
                        $the_post['post_content'] = preg_replace("/<img[^>]+\\>/i", "", $the_post['post_content']);
                    }
                    if ($auto_excerpt) {
                        $exerpt = get_excerpt($excerpt_length, $the_post['post_content'], $the_post['guid']);
                    } else {
                        $exerpt = $the_post['post_excerpt'];
                    }
                    if ($full_text) {
                        $text = $the_post['post_content'];
                    } else {
                        if ($manual_excerpt_length) {
                            $text = get_excerpt($manual_excerpt_length, $exerpt, $the_post['guid']);
                        } else {
                            $text = $exerpt;
                        }
                    }
                    $html .= strip_shortcodes($text);
                    $html .= ' <a class="netsposts-read-more-link" href="' . $the_post['guid'] . '">read more&rarr;</a></p>';
                    $html .= htmlspecialchars_decode($wrap_text_end);
                }
                $html .= "</div>";
                $html .= "";
                $html .= html_entity_decode($wrap_end);
                $html .= "";
            }
            if ($column > 1) {
                $html .= '</div>';
            }
        }
        $html .= '<div class="clear"></div>';
        if ($paginate and $total_pages > 1) {
            $html .= '<div id="netsposts-paginate">';
            $big = 999999999;
            $html .= paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => $page, 'total' => $total_pages, 'prev_text' => __($prev), 'next_text' => __($next), 'end_size' => $end_size, 'mid_size' => $mid_size));
            $html .= '</div>';
        }
        $html .= '</div>';
    }
    return $html;
}