Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
cc4ecf8c
Commit
cc4ecf8c
authored
8 years ago
by
Phil Höfer
Browse files
Options
Downloads
Patches
Plain Diff
!bangs lokalisiert (Deutsch + Englisch)
parent
9e0fee3e
No related branches found
No related tags found
1 merge request
!1365
Resolve "Filter Options for MetaGer"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Http/Controllers/MetaGerSearch.php
+28
-29
28 additions, 29 deletions
app/Http/Controllers/MetaGerSearch.php
resources/lang/de/metaGerSearch.php
+3
-0
3 additions, 0 deletions
resources/lang/de/metaGerSearch.php
resources/lang/en/metaGerSearch.php
+3
-0
3 additions, 0 deletions
resources/lang/en/metaGerSearch.php
with
34 additions
and
29 deletions
app/Http/Controllers/MetaGerSearch.php
+
28
−
29
View file @
cc4ecf8c
...
@@ -52,40 +52,39 @@ class MetaGerSearch extends Controller
...
@@ -52,40 +52,39 @@ class MetaGerSearch extends Controller
$quicktips
=
[];
$quicktips
=
[];
$spruch
=
""
;
$spruch
=
""
;
if
(
APP
::
getLocale
()
===
"de"
)
{
# DuckDuckGo-!bangs
try
{
# DuckDuckGo-!bangs
$placeholder
=
"0X0plchldr0X0"
;
try
{
$searchWords
=
explode
(
" "
,
$q
);
$placeholder
=
"0X0plchldr0X0"
;
$dummyQuery
=
""
;
$searchWords
=
explode
(
" "
,
$q
);
$realQuery
=
""
;
$dummyQuery
=
""
;
foreach
(
$searchWords
as
$index
=>
$word
)
{
$realQuery
=
""
;
if
(
$word
[
0
]
===
"!"
)
{
foreach
(
$searchWords
as
$index
=>
$word
)
{
$dummyQuery
.
=
$word
.
" "
;
if
(
$word
[
0
]
===
"!"
)
{
}
else
{
$dummyQuery
.
=
$word
.
" "
;
$realQuery
.
=
$word
;
}
else
{
$realQuery
.
=
$word
;
}
}
}
if
(
$dummyQuery
!==
""
)
{
}
$dummyQuery
.
=
$placeholder
;
if
(
$dummyQuery
!==
""
)
{
$url
=
"https://api.duckduckgo.com/?format=json&no_redirect=1&t=MetaGerDE&q="
.
urlencode
(
$dummyQuery
);
$dummyQuery
.
=
$placeholder
;
$url
=
"https://api.duckduckgo.com/?format=json&no_redirect=1&t=MetaGerDE&q="
.
urlencode
(
$dummyQuery
);
$result
=
json_decode
(
$this
->
get
(
$url
),
true
);
$result
=
json_decode
(
$this
->
get
(
$url
),
true
);
if
(
isset
(
$result
[
"Redirect"
]))
{
$bang
=
[];
$bang
[
"title"
]
=
"!bang-Weiterleitung"
;
$bang
[
"URL"
]
=
str_replace
(
$placeholder
,
urlencode
(
trim
(
$realQuery
)),
$result
[
"Redirect"
]);
$bang
[
"summary"
]
=
'<a href="'
.
$bang
[
"URL"
]
.
'" target=_blank class="btn btn-primary" style="margin-top:5px;color: #fff">Weitersuchen auf '
.
parse_url
(
$bang
[
"URL"
],
PHP_URL_HOST
)
.
'…</a>'
;
$bang
[
"gefVon"
]
=
"von <a href =
\"
https://api.duckduckgo.com/
\"
target=
\"
_blank
\"
rel=
\"
noopener
\"
>DuckDuckGo</a>"
;
$mquicktips
[]
=
$bang
;
}
if
(
isset
(
$result
[
"Redirect"
]))
{
$bang
=
[];
$bang
[
"title"
]
=
trans
(
'metaGerSearch.quicktips.bang.title'
);
$bang
[
"URL"
]
=
str_replace
(
$placeholder
,
urlencode
(
trim
(
$realQuery
)),
$result
[
"Redirect"
]);
$bang
[
"summary"
]
=
'<a href="'
.
$bang
[
"URL"
]
.
'" target=_blank class="btn btn-primary" style="margin-top:5px;color: #fff">'
.
trans
(
'metaGerSearch.quicktips.bang.buttonlabel'
)
.
" "
.
parse_url
(
$bang
[
"URL"
],
PHP_URL_HOST
)
.
'…</a>'
;
$bang
[
"gefVon"
]
=
trans
(
'metaGerSearch.quicktips.bang.from'
)
.
" <a href =
\"
https://api.duckduckgo.com/
\"
target=
\"
_blank
\"
rel=
\"
noopener
\"
>DuckDuckGo</a>"
;
$mquicktips
[]
=
$bang
;
}
}
}
catch
(
\ErrorException
$e
)
{
}
}
}
catch
(
\ErrorException
$e
)
{
}
if
(
APP
::
getLocale
()
===
"de"
)
{
# Spruch
# Spruch
$spruecheFile
=
storage_path
()
.
"/app/public/sprueche.txt"
;
$spruecheFile
=
storage_path
()
.
"/app/public/sprueche.txt"
;
if
(
file_exists
(
$spruecheFile
)
&&
$request
->
has
(
'sprueche'
))
{
if
(
file_exists
(
$spruecheFile
)
&&
$request
->
has
(
'sprueche'
))
{
...
...
This diff is collapsed.
Click to expand it.
resources/lang/de/metaGerSearch.php
+
3
−
0
View file @
cc4ecf8c
...
@@ -4,4 +4,7 @@ return [
...
@@ -4,4 +4,7 @@ return [
'quicktips.wikipedia.adress'
=>
'aus <a href="https://de.wikipedia.org" target="_blank" rel="noopener">Wikipedia, der freien Enzyklopädie</a>'
,
'quicktips.wikipedia.adress'
=>
'aus <a href="https://de.wikipedia.org" target="_blank" rel="noopener">Wikipedia, der freien Enzyklopädie</a>'
,
'quicktips.dictcc.adress'
=>
'aus <a href="https://www.dict.cc/" target="_blank" rel="noopener">dict.cc</a>'
,
'quicktips.dictcc.adress'
=>
'aus <a href="https://www.dict.cc/" target="_blank" rel="noopener">dict.cc</a>'
,
'quicktips.tips.title'
=>
'Wussten Sie schon?'
,
'quicktips.tips.title'
=>
'Wussten Sie schon?'
,
'quicktips.bang.title'
=>
'!bang-Weiterleitung'
,
'quicktips.bang.buttonlabel'
=>
'Weitersuchen auf'
,
'quicktips.bang.from'
=>
'von'
,
];
];
This diff is collapsed.
Click to expand it.
resources/lang/en/metaGerSearch.php
+
3
−
0
View file @
cc4ecf8c
...
@@ -4,4 +4,7 @@ return [
...
@@ -4,4 +4,7 @@ return [
"quicktips.wikipedia.adress"
=>
"from <a href=
\"
https://en.wikipedia.org
\"
target=
\"
_blank
\"
rel=
\"
noopener
\"
> Wikipedia, The Free Encyclopedia</a>"
,
"quicktips.wikipedia.adress"
=>
"from <a href=
\"
https://en.wikipedia.org
\"
target=
\"
_blank
\"
rel=
\"
noopener
\"
> Wikipedia, The Free Encyclopedia</a>"
,
"quicktips.dictcc.adress"
=>
'from <a href="https://www.dict.cc/" target="_blank" rel="noopener">dict.cc</a>'
,
"quicktips.dictcc.adress"
=>
'from <a href="https://www.dict.cc/" target="_blank" rel="noopener">dict.cc</a>'
,
"quicktips.tips.title"
=>
"Did you know?"
,
"quicktips.tips.title"
=>
"Did you know?"
,
'quicktips.bang.title'
=>
'!bang redirect'
,
'quicktips.bang.buttonlabel'
=>
'Continue on'
,
'quicktips.bang.from'
=>
'from'
,
];
];
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment