summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Etym.php33
1 files changed, 1 insertions, 32 deletions
diff --git a/src/Etym.php b/src/Etym.php
index 8be0a99..39514f8 100644
--- a/src/Etym.php
+++ b/src/Etym.php
@@ -24,7 +24,7 @@ class Etym
* @param string $pasteCmd
* @author Phil Burton <phil@pgburton.com>
*/
- public function __construct(string $baseURL, string $domSearch, string $pasteCmd)
+ public function __construct(string $baseURL, string $domSearch)
{
$this->baseURL = $baseURL;
$this->domSearch = $domSearch;
@@ -53,7 +53,6 @@ class Etym
}
$definition = $this->cleanUpHtml($html[0]->innerHtml());
- $definition = $this->handleTruncation($input, $definition, $targetURL);
// echo $definition . "\n";
return $definition;
@@ -103,34 +102,4 @@ class Etym
return $clear;
}
-
- /**
- * Handle when string is too long
- *
- * @param string $input
- * @param string $definition
- * @param string $url
- * @return string
- * @author Phil Burton <phil@pgburton.com>
- */
- protected function handleTruncation(string $input, string $definition, string $url): string
- {
- $truncated = $definition;
-
- $MAX_CHARACTERS = 350;
- if (strlen($truncated) >= $MAX_CHARACTERS) {
- // Create that povjee link.
- // Capitalise the first char of the input.
- $input = ucfirst($input);
- $defAndUrl = "\"$input\"" . "\n\n" . $definition . "\n\n" . "[Original at: $url]";
-
- $safeDef = escapeshellarg($defAndUrl);
-
- $pasteBinCmd = "echo $safeDef | " . $this->pasteCmd;
- $pasteBinLink = exec($pasteBinCmd);
- $truncated = substr($truncated, 0, $MAX_CHARACTERS) . "... [More info at $pasteBinLink]";
- }
-
- return $truncated;
- }
}