Update (ui)

This commit is contained in:
2023-11-21 22:17:18 +08:00
parent 4827130183
commit 028c9b5190
29 changed files with 193 additions and 159 deletions

View File

@@ -4,4 +4,4 @@
require 'geo_helper.php';
require 'platform_helper.php';
require 'proxy_helper.php';
require 'route_helper.php';
require 'route_helper.php';

View File

@@ -166,7 +166,6 @@ function get_domain_from_url($url)
}
}
if (! function_exists('get_country_name_by_iso')) {
function get_country_name_by_iso($country_iso)
{

View File

@@ -40,13 +40,12 @@ public function searchResults(Request $request, $query)
SEOTools::jsonLd();
SEOTools::setTitle($title, false);
$rss_posts = RssPost::with('category')
->where('status', 'published')
->whereRaw("to_tsvector('english', title || ' ' || bites || ' ' || keyword_list) @@ plainto_tsquery('english', ?)", [trim(preg_replace('/\s+/', ' ', $query))])
->where('published_at', '<=', now())
->orderBy('published_at', 'desc')
->cursorPaginate(60);
$rss_posts = RssPost::with('category')
->where('status', 'published')
->whereRaw("to_tsvector('english', title || ' ' || bites || ' ' || keyword_list) @@ plainto_tsquery('english', ?)", [trim(preg_replace('/\s+/', ' ', $query))])
->where('published_at', '<=', now())
->orderBy('published_at', 'desc')
->cursorPaginate(60);
// breadcrumb json ld
$listItems = [];
@@ -112,12 +111,10 @@ public function category(Request $request, $category_slug)
$category = Category::where('slug', $category_slug)->first();
if (is_null($category))
{
abort(404);
if (is_null($category)) {
abort(404);
}
$breadcrumbs = collect([
['name' => 'Home', 'url' => route('front.home')],
['name' => $category->name, 'url' => null],
@@ -125,7 +122,6 @@ public function category(Request $request, $category_slug)
$title = 'Latest News from FutureWalker';
SEOTools::metatags();
SEOTools::twitter();
SEOTools::opengraph();
@@ -154,6 +150,6 @@ public function category(Request $request, $category_slug)
'itemListElement' => $listItems,
]);
return view('front.rss_post_list', compact('rss_posts', 'breadcrumbs', 'breadcrumb_context', 'page_type','category'));
return view('front.rss_post_list', compact('rss_posts', 'breadcrumbs', 'breadcrumb_context', 'page_type', 'category'));
}
}

View File

@@ -60,7 +60,7 @@ public static function handle(int $rss_post_id)
$rss_post->body = 'EMPTY CONTENT';
}
if ((is_empty($rss_post->body)) || ($rss_post->body == 'EMPTY CONTENT') || (strlen($rss_post->body) < 800)){
if ((is_empty($rss_post->body)) || ($rss_post->body == 'EMPTY CONTENT') || (strlen($rss_post->body) < 800)) {
$rss_post->status = 'blocked';
}

View File

@@ -54,9 +54,8 @@ public static function handle(int $rss_post_id)
if (count($post_meta_response->output->keywords) > 0) {
$rss_post->keywords = $post_meta_response->output->keywords;
foreach ($post_meta_response->output->keywords as $word)
{
$words_to_add_in_body[] = $word;
foreach ($post_meta_response->output->keywords as $word) {
$words_to_add_in_body[] = $word;
}
}
}
@@ -65,9 +64,8 @@ public static function handle(int $rss_post_id)
if (count($post_meta_response->output->entities) > 0) {
$rss_post->entities = $post_meta_response->output->entities;
foreach ($post_meta_response->output->entities as $word)
{
$words_to_add_in_body[] = $word;
foreach ($post_meta_response->output->entities as $word) {
$words_to_add_in_body[] = $word;
}
}
}
@@ -106,7 +104,7 @@ public static function handle(int $rss_post_id)
$rss_post->category_id = $category->id;
}
$rss_post->keyword_list = implode(",", $words_to_add_in_body);
$rss_post->keyword_list = implode(',', $words_to_add_in_body);
$rss_post->status = 'published';
$rss_post->save();

View File

@@ -11,7 +11,6 @@
use Spatie\Feed\Feedable;
use Spatie\Feed\FeedItem;
/**
* Class RssPost
*
@@ -74,12 +73,12 @@ public function category()
public function getAllKeywordsAttribute()
{
if (!is_empty($this->keyword_list))
{
return array_unique(explode(",",$this->keyword_list));
}
return [];
if (! is_empty($this->keyword_list)) {
return array_unique(explode(',', $this->keyword_list));
}
return [];
}
public function toFeedItem(): FeedItem