Skip to content

Commit 7bd1201

Browse files
committedJan 31, 2023
Merge branch 'develop'
2 parents 35c963d + 5caff6a commit 7bd1201

10 files changed

+29
-26
lines changed
 

‎src/Controllers/BinshopsReaderController.php

+10-8
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public function index($locale = null, Request $request, $category_slug = null)
8585
'categories' => $rootList,
8686
'posts' => $posts,
8787
'title' => $title,
88+
'routeWithoutLocale' => $request->get("routeWithoutLocale")
8889
]);
8990
}
9091

@@ -110,13 +111,14 @@ public function search(Request $request)
110111
BinshopsCategory::loadSiblingsWithList($rootList);
111112

112113
return view("binshopsblog::search", [
113-
'lang_id' => $request->get('lang_id'),
114-
'locale' => $request->get("locale"),
115-
'categories' => $rootList,
116-
'query' => $query,
117-
'search_results' => $search_results]
114+
'lang_id' => $request->get('lang_id'),
115+
'locale' => $request->get("locale"),
116+
'categories' => $rootList,
117+
'query' => $query,
118+
'search_results' => $search_results,
119+
'routeWithoutLocale' => $request->get("routeWithoutLocale")
120+
]
118121
);
119-
120122
}
121123

122124
/**
@@ -167,8 +169,8 @@ public function viewSinglePost(Request $request)
167169
->get(),
168170
'captcha' => $captcha,
169171
'categories' => $categories,
170-
'locale' => $request->get("locale")
172+
'locale' => $request->get("locale"),
173+
'routeWithoutLocale' => $request->get("routeWithoutLocale")
171174
]);
172175
}
173-
174176
}

‎src/Middleware/DetectLanguage.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
namespace BinshopsBlog\Middleware;
54

65
use BinshopsBlog\Models\BinshopsConfiguration;
@@ -12,23 +11,25 @@ class DetectLanguage
1211
public function handle($request, Closure $next)
1312
{
1413
$locale = $request->route('locale');
15-
$noLocaleRoute = false;
14+
$routeWithoutLocale = false;
1615

1716
if (!$request->route('locale')){
18-
$noLocaleRoute = true;
17+
$routeWithoutLocale = true;
1918
$locale = BinshopsConfiguration::get('DEFAULT_LANGUAGE_LOCALE');
2019
}
20+
2121
$lang = BinshopsLanguage::where('locale', $locale)
2222
->where('active', true)
2323
->first();
2424

2525
if (!$lang){
2626
return abort(404);
2727
}
28+
2829
$request->attributes->add([
2930
'lang_id' => $lang->id,
3031
'locale' => $lang->locale,
31-
'noLocaleRoute' => $noLocaleRoute
32+
'routeWithoutLocale' => $routeWithoutLocale
3233
]);
3334

3435
return $next($request);

‎src/Models/BinshopsCategoryTranslation.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function language()
3535
* Returns the public facing URL of showing blog posts in this category
3636
* @return string
3737
*/
38-
public function url($locale, $noLocaleRoute = false)
38+
public function url($locale, $routeWithoutLocale = false)
3939
{
4040
$theChainString = "";
4141
$cat = $this->category()->get();
@@ -44,7 +44,7 @@ public function url($locale, $noLocaleRoute = false)
4444
$theChainString .= "/" . $category->categoryTranslations()->where('lang_id' , $this->lang_id)->first()->slug;
4545
}
4646

47-
return $noLocaleRoute ? route("binshopsblog.view_category",["", $theChainString]) : route("binshopsblog.view_category",[$locale, $theChainString]);
47+
return $routeWithoutLocale ? route("binshopsblog.view_category",["", $theChainString]) : route("binshopsblog.view_category",[$locale, $theChainString]);
4848
}
4949

5050
/**

‎src/Models/BinshopsPostTranslation.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ public function gen_seo_title()
222222
*
223223
* @return string
224224
*/
225-
public function url($loacle, $noLocaleRoute = false)
225+
public function url($loacle, $routeWithoutLocale = false)
226226
{
227-
return $noLocaleRoute ? route("binshopsblog.single", ["", $this->slug]) : route("binshopsblog.single", [$loacle, $this->slug]);
227+
return $routeWithoutLocale ? route("binshopsblog.single", ["", $this->slug]) : route("binshopsblog.single", [$loacle, $this->slug]);
228228
}
229229

230230
/**

‎src/Views/binshopsblog/index.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class='btn border btn-outline-primary btn-sm '>
6464
@include("binshopsblog::partials._category_partial", [
6565
'category_tree' => $categories,
6666
'name_chain' => $nameChain = "",
67-
'noLocaleRoute' => $noLocaleRoute
67+
'routeWithoutLocale' => $routeWithoutLocale
6868
])
6969
@else
7070
<span>No Categories</span>

‎src/Views/binshopsblog/partials/_category_partial.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<li class="category-item-wrapper">
55
@php $nameChain = $nameChain .'/'. $trans->slug @endphp
66

7-
<a href="{{ $noLocaleRoute ? route("binshopsblog.view_category",["", $nameChain]) : route("binshopsblog.view_category",[$locale, $nameChain])}}">
7+
<a href="{{ $routeWithoutLocale ? route("binshopsblog.view_category",["", $nameChain]) : route("binshopsblog.view_category",[$locale, $nameChain])}}">
88
<span class="category-item" value='{{$category->category_id}}'>
99
{{$trans->category_name}}
1010

@@ -13,7 +13,7 @@
1313
@include("binshopsblog::partials._category_partial", [
1414
'category_tree' => $category->siblings,
1515
'name_chain' => $nameChain,
16-
'noLocaleRoute' => $noLocaleRoute
16+
'routeWithoutLocale' => $routeWithoutLocale
1717
])
1818
</ul>
1919
@endif

‎src/Views/binshopsblog/partials/categories.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class=''>
22
@foreach($categories as $category)
3-
<a class='btn btn-outline-secondary btn-sm m-1' href='{{$category->categoryTranslations[0]->url($locale, $noLocaleRoute)}}'>
3+
<a class='btn btn-outline-secondary btn-sm m-1' href='{{$category->categoryTranslations[0]->url($locale, $routeWithoutLocale)}}'>
44
{{$category->categoryTranslations[0]->category_name}}
55
</a>
66
@endforeach

‎src/Views/binshopsblog/partials/index_loop.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<?=$post->image_tag("medium", true, ''); ?>
99
</div>
1010
<div class="blog-inner-item">
11-
<h3 class=''><a href='{{$post->url($locale, $noLocaleRoute)}}'>{{$post->title}}</a></h3>
11+
<h3 class=''><a href='{{$post->url($locale, $routeWithoutLocale)}}'>{{$post->title}}</a></h3>
1212
<h5 class=''>{{$post->subtitle}}</h5>
1313

1414
@if (config('binshopsblog.show_full_text_at_list'))
@@ -21,7 +21,7 @@
2121
<span class="light-text">Authored by: </span> {{$post->post->author->name}} <span class="light-text">Posted at: </span> {{date('d M Y ', strtotime($post->post->posted_at))}}
2222
</div>
2323
<div class='text-center'>
24-
<a href="{{$post->url($locale, $noLocaleRoute)}}" class="btn btn-primary">View Post</a>
24+
<a href="{{$post->url($locale, $routeWithoutLocale)}}" class="btn btn-primary">View Post</a>
2525
</div>
2626
</div>
2727
</div>

‎src/Views/binshopsblog_admin/layouts/admin_layout.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<ul class="navbar-nav ml-auto">
6161
<!-- Authentication Links -->
6262

63-
<li class='nav-item px-2'><a class='nav-link' href='{{route("binshopsblog.index" , app('request')->get('locale'))}}'>Blog home</a></li>
63+
<li class='nav-item px-2'><a class='nav-link' href='{{route("binshopsblog.index" , app('request')->get('locale'))}}' target="_blank">Blog home</a></li>
6464

6565
<li class="nav-item ">
6666
<a id="" class="nav-link " href="#" role="button"

‎src/Views/binshopsblog_admin/setup/setup.blade.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
<div class="tab-pane" id="language">
4444
<div class="row">
4545
<div class="col-sm-12">
46-
<h4 class="info-text">Your default language is set to English. You can add more language from admin panel.</h4>
46+
<h4 class="info-text">Your default language will be set to English. You can add more language through the admin panel.</h4>
4747

4848
<h6 class="info-text">
49-
Version v9.2.x
49+
Version v9.3.x
5050
</h6>
5151
</div>
5252

@@ -108,7 +108,7 @@ class="form-control"
108108

109109
<div class="footer">
110110
<div class="container">
111-
Created by Binshops Blog
111+
Created by BINSHOPS
112112
</div>
113113
</div>
114114
</div>

0 commit comments

Comments
 (0)
Failed to load comments.