mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
- Added parameter blockTags to controller Phrase
If this parameter is set to "no", it will be removed the tags <p> and </p> from the beginning and from the end of the returned phrases
This commit is contained in:
@@ -54,10 +54,11 @@ class Phrase extends APIv1_Controller
|
||||
$phrase = $this->get('phrase');
|
||||
$orgeinheit_kurzbz = $this->get('orgeinheit_kurzbz');
|
||||
$orgform_kurzbz = $this->get('orgform_kurzbz');
|
||||
$blockTags = $this->get('blockTags');
|
||||
|
||||
if (isset($app) && isset($sprache))
|
||||
{
|
||||
$result = $this->phraseslib->getPhrases($app, $sprache, $phrase, $orgeinheit_kurzbz, $orgform_kurzbz);
|
||||
$result = $this->phraseslib->getPhrases($app, $sprache, $phrase, $orgeinheit_kurzbz, $orgform_kurzbz, $blockTags);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ class PhrasesLib
|
||||
*
|
||||
* @return struct
|
||||
*/
|
||||
function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null)
|
||||
function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null, $blockTags = null)
|
||||
{
|
||||
if (isset($app) && isset($sprache))
|
||||
{
|
||||
@@ -123,7 +123,19 @@ class PhrasesLib
|
||||
|
||||
for ($i = 0; $i < count($result->retval); $i++)
|
||||
{
|
||||
$result->retval[$i]->text = $parser->textileThis($result->retval[$i]->text);
|
||||
// If no <p> tags required
|
||||
if ($blockTags == "no")
|
||||
{
|
||||
// Removes tags <p> and </p> from the beginning and from the end of the string
|
||||
$tmpText = $parser->textileThis($result->retval[$i]->text);
|
||||
$tmpText = substr($tmpText, 3, strlen($tmpText));
|
||||
$tmpText = substr($tmpText, 0, strlen($tmpText) - 4);
|
||||
$result->retval[$i]->text = $tmpText;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result->retval[$i]->text = $parser->textileThis($result->retval[$i]->text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@
|
||||
"json-forms": "1.4.0",
|
||||
"wikimedia/composer-merge-plugin": "^1.3",
|
||||
"fzaninotto/faker": "1.*",
|
||||
"netcarver/textile": "3.5.*"
|
||||
"netcarver/textile": "^3.5"
|
||||
},
|
||||
"require-dev":
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user