Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webprofile-jwg2024
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Siti Aisah
webprofile-jwg2024
Commits
97da0bda
Commit
97da0bda
authored
Jan 06, 2023
by
Siti Aisah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add allowed tags for post
parent
68a15f61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
36 deletions
+36
-36
app/Http/Controllers/Webprofile/Backend/PostController.php
+36
-36
No files found.
app/Http/Controllers/Webprofile/Backend/PostController.php
View file @
97da0bda
...
...
@@ -89,8 +89,8 @@ class PostController extends Controller
public
function
store
(
Request
$request
)
{
// dd($request);
$request
[
'content'
]
=
$request
->
content
;
$request
[
'title'
]
=
$request
->
title
;
$request
[
'content'
]
=
strip_tags
(
$request
->
content
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
])
;
$request
[
'title'
]
=
strip_tags
(
$request
->
title
,
[
'b'
,
'i'
,
'u'
])
;
$request
->
validate
([
'title'
=>
'required'
,
'categories'
=>
'required'
,
...
...
@@ -227,13 +227,13 @@ class PostController extends Controller
private
function
createEn
(
$data
,
$post
)
{
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'title'
]
);
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'title'
],
[
'b'
,
'i'
,
'u'
])
);
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
if
(
$data
[
'content'
]
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]));
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
]
));
$dataEn
[
'post_id'
]
=
$post
->
id
;
$dataEn
[
'title'
]
=
$title
;
...
...
@@ -245,13 +245,13 @@ class PostController extends Controller
private
function
createDe
(
$data
,
$post
)
{
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
$data
[
'title'
]
);
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'title'
],
[
'b'
,
'i'
,
'u'
])
);
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
if
(
$data
[
'content'
]
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'content'
]));
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'content'
]
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
]
));
$dataDe
[
'post_id'
]
=
$post
->
id
;
$dataDe
[
'title'
]
=
$title
;
...
...
@@ -263,13 +263,13 @@ class PostController extends Controller
private
function
createSa
(
$data
,
$post
)
{
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
$data
[
'title'
]
);
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'title'
],
[
'b'
,
'i'
,
'u'
])
);
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
if
(
$data
[
'content'
]
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'content'
]));
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'content'
]
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
]
));
$dataSa
[
'post_id'
]
=
$post
->
id
;
$dataSa
[
'title'
]
=
$title
;
...
...
@@ -281,13 +281,13 @@ class PostController extends Controller
private
function
createZh
(
$data
,
$post
)
{
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
$data
[
'title'
]
);
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'title'
],
[
'b'
,
'i'
,
'u'
])
);
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
if
(
$data
[
'content'
]
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'content'
]));
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'content'
]
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
]
));
$dataZh
[
'post_id'
]
=
$post
->
id
;
$dataZh
[
'title'
]
=
$title
;
...
...
@@ -356,16 +356,16 @@ class PostController extends Controller
*/
public
function
update
(
Request
$request
,
$id
)
{
$request
[
'content'
]
=
$request
->
content
;
$request
[
'content_en'
]
=
$request
->
content_en
;
$request
[
'content_de'
]
=
$request
->
content_de
;
$request
[
'content_sa'
]
=
$request
->
content_sa
;
$request
[
'content_zh'
]
=
$request
->
content_zh
;
$request
[
'title'
]
=
$request
->
title
;
$request
[
'title_en'
]
=
$request
->
title_en
;
$request
[
'title_de'
]
=
$request
->
title_de
;
$request
[
'title_sa'
]
=
$request
->
title_sa
;
$request
[
'title_zh'
]
=
$request
->
title_zh
;
$request
[
'content'
]
=
strip_tags
(
$request
->
content
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
])
;
$request
[
'content_en'
]
=
strip_tags
(
$request
->
content_en
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
])
;
$request
[
'content_de'
]
=
strip_tags
(
$request
->
content_de
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
])
;
$request
[
'content_sa'
]
=
strip_tags
(
$request
->
content_sa
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
])
;
$request
[
'content_zh'
]
=
strip_tags
(
$request
->
content_zh
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
])
;
$request
[
'title'
]
=
strip_tags
(
$request
->
title
,
[
'b'
,
'i'
,
'u'
])
;
$request
[
'title_en'
]
=
strip_tags
(
$request
->
title_en
,
[
'b'
,
'i'
,
'u'
])
;
$request
[
'title_de'
]
=
strip_tags
(
$request
->
title_de
,
[
'b'
,
'i'
,
'u'
])
;
$request
[
'title_sa'
]
=
strip_tags
(
$request
->
title_sa
,
[
'b'
,
'i'
,
'u'
])
;
$request
[
'title_zh'
]
=
strip_tags
(
$request
->
title_zh
,
[
'b'
,
'i'
,
'u'
])
;
$request
->
validate
([
// 'title' => 'required',
...
...
@@ -437,13 +437,13 @@ class PostController extends Controller
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
if
(
$data
[
'content'
]
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'title'
]
);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]));
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'title'
],
[
'b'
,
'i'
,
'u'
])
);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
]
));
// dd($title);
$dataEn
[
'title'
]
=
$title
;
$dataEn
[
'content'
]
=
$content
;
...
...
@@ -460,13 +460,13 @@ class PostController extends Controller
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
if
(
$data
[
'content'
]
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
$data
[
'title'
]
);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'content'
]));
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'title'
],
[
'b'
,
'i'
,
'u'
])
);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'content'
]
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
]
));
$dataDe
[
'title'
]
=
$title
;
$dataDe
[
'content'
]
=
$content
;
}
...
...
@@ -481,13 +481,13 @@ class PostController extends Controller
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
if
(
$data
[
'content'
]
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
$data
[
'title'
]
);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'content'
]));
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'title'
],
[
'b'
,
'i'
,
'u'
])
);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'content'
]
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
]
));
$dataSa
[
'title'
]
=
$title
;
$dataSa
[
'content'
]
=
$content
;
}
...
...
@@ -501,13 +501,13 @@ class PostController extends Controller
$dataZh
[
'content'
]
=
$data
[
'content_zh'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
if
(
$data
[
'content'
]
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
$data
[
'title'
]
);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'content'
]));
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'title'
],
[
'b'
,
'i'
,
'u'
])
);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'content'
]
,
[
'a'
,
'br'
,
'p'
,
'b'
,
'i'
,
'u'
,
'ul'
,
'li'
,
'ol'
,
'img'
]
));
$dataZh
[
'title'
]
=
$title
;
$dataZh
[
'content'
]
=
$content
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment