@@ -147,7 +147,7 @@ |
||
147 | 147 | $startDelimiterLength = strlen($startDelimiter); |
148 | 148 | $endDelimiterLength = strlen($endDelimiter); |
149 | 149 | $startFrom = 0; |
150 | - $contentStart = 0; |
|
150 | + $contentStart = 0; |
|
151 | 151 | $contentEnd = 0; |
152 | 152 | while (false !== ($contentStart = strpos($str, $startDelimiter, $startFrom))) { |
153 | 153 | $contentStart += $startDelimiterLength; |
@@ -23,9 +23,9 @@ |
||
23 | 23 | |
24 | 24 | public function getRenderedById($pageblock_id, PageBlockRepository $pageBlockRepository) |
25 | 25 | { |
26 | - $pageblock = $this->where('id', $pageblock_id)->first(); |
|
27 | - $new_pageblock = $pageBlockRepository->getRenderedByPageBlock($pageblock); |
|
28 | - return $new_pageblock; |
|
26 | + $pageblock = $this->where('id', $pageblock_id)->first(); |
|
27 | + $new_pageblock = $pageBlockRepository->getRenderedByPageBlock($pageblock); |
|
28 | + return $new_pageblock; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function getById($id) |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | { |
13 | 13 | use HasTranslations; |
14 | 14 | |
15 | - public function template(){ |
|
15 | + public function template() { |
|
16 | 16 | return $this->belongsTo('Chuckbe\Chuckcms\Models\Template'); |
17 | 17 | } |
18 | 18 | |
19 | - public function page_blocks(){ |
|
19 | + public function page_blocks() { |
|
20 | 20 | return $this->hasMany('Chuckbe\Chuckcms\Models\PageBlock')->orderBy('order'); |
21 | 21 | } |
22 | 22 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $meta[$langKey]['robots'] = $index . $follow; |
63 | 63 | $meta[$langKey]['googlebots'] = $index . $follow; |
64 | 64 | $count = count($values->get('meta_key')[$langKey]); |
65 | - for ($i=0; $i < $count; $i++) { |
|
65 | + for ($i = 0; $i < $count; $i++) { |
|
66 | 66 | $meta[$langKey][$values->get('meta_key')[$langKey][$i]] = $values->get('meta_value')[$langKey][$i]; |
67 | 67 | } |
68 | 68 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $page->setTranslation('title', $langKey, $values->get('page_title')[$langKey]); |
86 | 86 | $page->setTranslation('slug', $langKey, $values->get('page_slug')[$langKey]); |
87 | 87 | $count = count($values->get('meta_key')[$langKey]); |
88 | - for ($i=0; $i < $count; $i++) { |
|
88 | + for ($i = 0; $i < $count; $i++) { |
|
89 | 89 | $meta[$langKey][$values->get('meta_key')[$langKey][$i]] = $values->get('meta_value')[$langKey][$i]; |
90 | 90 | } |
91 | 91 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | protected $user; |
10 | 10 | |
11 | - public function __construct(User $user) |
|
11 | + public function __construct(User $user) |
|
12 | 12 | { |
13 | 13 | $this->user = $user; |
14 | 14 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $form_slug = $request->get('form_slug'); |
61 | 61 | $fields_slug = $request->get('fields_slug'); |
62 | 62 | $countFS = count($fields_slug); |
63 | - for ($i=0; $i < $countFS; $i++) { |
|
63 | + for ($i = 0; $i < $countFS; $i++) { |
|
64 | 64 | $form['fields'][$form_slug . '_' . $fields_slug[$i]]['label'] = $request->get('fields_label')[$i]; |
65 | 65 | $form['fields'][$form_slug . '_' . $fields_slug[$i]]['type'] = $request->get('fields_type')[$i]; |
66 | 66 | $form['fields'][$form_slug . '_' . $fields_slug[$i]]['class'] = $request->get('fields_class')[$i]; |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | $form['fields'][$form_slug . '_' . $fields_slug[$i]]['placeholder'] = $request->get('fields_placeholder')[$i]; |
69 | 69 | $form['fields'][$form_slug . '_' . $fields_slug[$i]]['validation'] = $request->get('fields_validation')[$i]; |
70 | 70 | $form['fields'][$form_slug . '_' . $fields_slug[$i]]['value'] = $request->get('fields_value')[$i]; |
71 | - $countFAN = count(explode(';',$request->get('fields_attributes_name')[$i])); |
|
72 | - for ($k=0; $k < $countFAN; $k++) { |
|
73 | - $form['fields'][$form_slug . '_' . $fields_slug[$i]]['attributes'][explode(';',$request->get('fields_attributes_name')[$i])[$k]] = explode(';',$request->get('fields_attributes_value')[$i])[$k]; |
|
71 | + $countFAN = count(explode(';', $request->get('fields_attributes_name')[$i])); |
|
72 | + for ($k = 0; $k < $countFAN; $k++) { |
|
73 | + $form['fields'][$form_slug . '_' . $fields_slug[$i]]['attributes'][explode(';', $request->get('fields_attributes_name')[$i])[$k]] = explode(';', $request->get('fields_attributes_value')[$i])[$k]; |
|
74 | 74 | } |
75 | 75 | $form['fields'][$form_slug . '_' . $fields_slug[$i]]['required'] = $request->get('fields_required')[$i]; |
76 | 76 | } |
77 | 77 | |
78 | 78 | $form['actions']['store'] = $request->get('action_store'); |
79 | - if($request->get('action_send') == true) { |
|
79 | + if ($request->get('action_send') == true) { |
|
80 | 80 | $countActions = count($request->get('action_send_slug')); |
81 | - for ($g=0; $g < $countActions; $g++) { |
|
81 | + for ($g = 0; $g < $countActions; $g++) { |
|
82 | 82 | $form['actions']['send'][$request->get('action_send_slug')[$g]]['to'] = $request->get('action_send_to')[$g]; |
83 | 83 | $form['actions']['send'][$request->get('action_send_slug')[$g]]['to_name'] = $request->get('action_send_to_name')[$g]; |
84 | 84 | $form['actions']['send'][$request->get('action_send_slug')[$g]]['from'] = $request->get('action_send_from')[$g]; |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $resource = Resource::firstOrNew(['slug' => $request->get('slug')[0]]); |
71 | 71 | $resource->slug = $request->get('slug')[0]; |
72 | 72 | $json = []; |
73 | - foreach(ChuckSite::getSupportedLocales() as $langKey => $langValue){ |
|
73 | + foreach (ChuckSite::getSupportedLocales() as $langKey => $langValue) { |
|
74 | 74 | $count = count($request->get('resource_key')[$langKey]); |
75 | - for ($i=0; $i < $count; $i++) { |
|
75 | + for ($i = 0; $i < $count; $i++) { |
|
76 | 76 | $json[$langKey][$request->get('resource_key')[$langKey][$i]] = $request->get('resource_value')[$langKey][$i]; |
77 | 77 | |
78 | 78 | } |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | $content_slug = $request->get('content_slug'); |
111 | 111 | $fields_slug = $request->get('fields_slug'); |
112 | 112 | $count = count($fields_slug); |
113 | - for ($i=0; $i < $count; $i++) { |
|
114 | - $content['fields'][$content_slug.'_'.$fields_slug[$i]]['label'] = $request->get('fields_label')[$i]; |
|
115 | - $content['fields'][$content_slug.'_'.$fields_slug[$i]]['type'] = $request->get('fields_type')[$i]; |
|
116 | - $content['fields'][$content_slug.'_'.$fields_slug[$i]]['class'] = $request->get('fields_class')[$i]; |
|
117 | - $content['fields'][$content_slug.'_'.$fields_slug[$i]]['placeholder'] = $request->get('fields_placeholder')[$i]; |
|
118 | - $content['fields'][$content_slug.'_'.$fields_slug[$i]]['validation'] = $request->get('fields_validation')[$i]; |
|
119 | - $content['fields'][$content_slug.'_'.$fields_slug[$i]]['value'] = $request->get('fields_value')[$i]; |
|
120 | - $fieldsCount = count(explode(';',$request->get('fields_attributes_name')[$i])); |
|
121 | - for ($k=0; $k < $fieldsCount; $k++) { |
|
122 | - $content['fields'][$content_slug . '_' . $fields_slug[$i]]['attributes'][explode(';',$request->get('fields_attributes_name')[$i])[$k]] = explode(';',$request->get('fields_attributes_value')[$i])[$k]; |
|
113 | + for ($i = 0; $i < $count; $i++) { |
|
114 | + $content['fields'][$content_slug . '_' . $fields_slug[$i]]['label'] = $request->get('fields_label')[$i]; |
|
115 | + $content['fields'][$content_slug . '_' . $fields_slug[$i]]['type'] = $request->get('fields_type')[$i]; |
|
116 | + $content['fields'][$content_slug . '_' . $fields_slug[$i]]['class'] = $request->get('fields_class')[$i]; |
|
117 | + $content['fields'][$content_slug . '_' . $fields_slug[$i]]['placeholder'] = $request->get('fields_placeholder')[$i]; |
|
118 | + $content['fields'][$content_slug . '_' . $fields_slug[$i]]['validation'] = $request->get('fields_validation')[$i]; |
|
119 | + $content['fields'][$content_slug . '_' . $fields_slug[$i]]['value'] = $request->get('fields_value')[$i]; |
|
120 | + $fieldsCount = count(explode(';', $request->get('fields_attributes_name')[$i])); |
|
121 | + for ($k = 0; $k < $fieldsCount; $k++) { |
|
122 | + $content['fields'][$content_slug . '_' . $fields_slug[$i]]['attributes'][explode(';', $request->get('fields_attributes_name')[$i])[$k]] = explode(';', $request->get('fields_attributes_value')[$i])[$k]; |
|
123 | 123 | } |
124 | 124 | $content['fields'][$content_slug . '_' . $fields_slug[$i]]['required'] = $request->get('fields_required')[$i]; |
125 | 125 | $content['fields'][$content_slug . '_' . $fields_slug[$i]]['table'] = $request->get('fields_table')[$i]; |
@@ -84,7 +84,7 @@ |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | if($page == null) { |
87 | - abort(404); |
|
87 | + abort(404); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 |
@@ -49,41 +49,41 @@ discard block |
||
49 | 49 | |
50 | 50 | public function index($slug = null) |
51 | 51 | { |
52 | - if($slug == null){ |
|
52 | + if ($slug == null) { |
|
53 | 53 | $page = $this->page->where('isHp', 1)->firstOrFail(); |
54 | - } elseif($slug !== null){ |
|
54 | + } elseif ($slug !== null) { |
|
55 | 55 | |
56 | 56 | $redirect = $this->redirect->where('slug', $slug)->first(); |
57 | - if($redirect !== null){ |
|
57 | + if ($redirect !== null) { |
|
58 | 58 | return redirect($redirect->to, $redirect->type); |
59 | 59 | } |
60 | 60 | |
61 | 61 | $repeater = $this->repeater->where('url', $slug)->first(); |
62 | - if($repeater !== null){ |
|
62 | + if ($repeater !== null) { |
|
63 | 63 | $templateHintpath = explode('::', (string)$repeater->page)[0]; |
64 | 64 | $template = $this->template->where('active', 1)->where('hintpath', $templateHintpath)->first(); |
65 | 65 | return view((string)$repeater->page, compact('template', 'repeater')); |
66 | 66 | } |
67 | 67 | |
68 | - $page = $this->page->where('slug->'.app()->getLocale(), $slug)->first(); |
|
69 | - if($page == null){ |
|
70 | - foreach(\LaravelLocalization::getSupportedLocales() as $localeCode => $properties){ |
|
71 | - $page = $this->page->where('slug->'.$localeCode, $slug)->first(); |
|
72 | - if($page !== null && $localeCode == app()->getLocale()) { |
|
68 | + $page = $this->page->where('slug->' . app()->getLocale(), $slug)->first(); |
|
69 | + if ($page == null) { |
|
70 | + foreach (\LaravelLocalization::getSupportedLocales() as $localeCode => $properties) { |
|
71 | + $page = $this->page->where('slug->' . $localeCode, $slug)->first(); |
|
72 | + if ($page !== null && $localeCode == app()->getLocale()) { |
|
73 | 73 | break; |
74 | 74 | } |
75 | 75 | |
76 | - if($page !== null && $localeCode !== app()->getLocale()){ |
|
76 | + if ($page !== null && $localeCode !== app()->getLocale()) { |
|
77 | 77 | //dd(app()->getLocale()); |
78 | 78 | app()->setLocale($localeCode); |
79 | 79 | \LaravelLocalization::setLocale($localeCode); |
80 | 80 | |
81 | - return redirect($localeCode.'/'.$slug); |
|
81 | + return redirect($localeCode . '/' . $slug); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - if($page == null) { |
|
86 | + if ($page == null) { |
|
87 | 87 | abort(404); |
88 | 88 | } |
89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $ogpageblocks = $this->pageblock->getAllByPageId($page->id); |
92 | 92 | $pageblocks = $this->pageBlockRepository->getRenderedByPageBlocks($ogpageblocks); |
93 | 93 | |
94 | - if($page->page !== null) { |
|
94 | + if ($page->page !== null) { |
|
95 | 95 | $template = $this->template->where('active', 1)->where('hintpath', explode('::', $page->page)[0])->first(); |
96 | 96 | |
97 | 97 | return view($page->page, compact('template', 'page', 'pageblocks')); |
@@ -108,9 +108,9 @@ |
||
108 | 108 | $this->validate(request(), [//@todo create custom Request class for page validation |
109 | 109 | 'page_title' => 'max:185', |
110 | 110 | ]); |
111 | - if($request['create']){ |
|
111 | + if ($request['create']) { |
|
112 | 112 | $this->page->create($request); |
113 | - } if($request['update']){ |
|
113 | + } if ($request['update']) { |
|
114 | 114 | $this->page->updatePage($request); |
115 | 115 | } |
116 | 116 | return redirect()->route('dashboard.pages'); |