function sameWidget($in = array(), $current) { global $registry; $output = ''; $in = $in->toArray(); $same = \App\Article::latest('published_at')->select('news_id', 'staties_id', 'img', 'slug', 'title', 'head', 'published_at')->nothis($current)->published()->orderall($in)->take(5)->get(); if (count($same) > 0) { $output .= '<div class="cat-list">'; $output .= '<ul>'; foreach ($same as $item) { $url = strpos(URL::current(), 'news_id') == false ? get_articles_url($item->staties_id, $item->slug) : get_news_url($item->news_id, $item->slug); if (!empty($item->img)) { $output .= '<li><div><a href="' . $url . '">'; $output .= '<img src="' . get_news_small_img($item->img) . '" title="' . $item->title . '" align="left">'; $output .= '</a></div>'; } $output .= '<div'; if (empty($item->img)) { $output .= ' style="width:95%" '; } $output .= '>'; $output .= '<a href="' . $url . '">'; $output .= '<h4>' . $item->title . '</h4>'; $output .= '<small>' . date('H:i | d.m.Y', strtotime($item->published_at)) . '</small><br>'; $output .= '<span>' . $item->head . '</span>'; $output .= '</a></div>'; $output .= '</li>'; } $output .= '</ul>'; $output .= '</div>'; } return $output; }
function social_meta_data($data, $type) { $out = false; if (isset($data->id) > 0) { if ($type == 1) { $url = get_articles_url($data->staties_id, $data->slug); $image = get_news_img($data->img); $desc = !empty($data->meta_desc) ? $data->meta_desc : $data->head; } else { $url = url() . get_images_url($data->id, $data->slug); $image = unserialize($data->images); $image = get_gallery_img($image[0]); $desc = !empty($data->meta_desc) ? $data->meta_desc : substr($data->body, 0, 100); } $out .= '<meta name="description" lang="ge" content="' . $data->meta_desc . '" />'; $out .= '<meta name="keywords" lang="ge" content="' . $data->meta_key . '" />'; $out .= '<title>' . $data->title . '</title>'; $out .= '<meta property="og:title" content="' . str_replace('"', '"', $data->title) . '" />'; $out .= '<meta property="og:type" content="website" />'; $out .= '<meta property="og:url" content="' . $url . '" />'; $out .= '<meta property="og:image" content="' . $image . '" />'; $out .= '<meta property="og:site_name" content=""/>'; $out .= '<meta property="og:description" content="' . $desc . '"/>'; } return $out; }