|
@@ -6,6 +6,7 @@ use Cake\Utility\Hash;
|
|
|
use Cake\View\Helper\TextHelper as CakeTextHelper;
|
|
use Cake\View\Helper\TextHelper as CakeTextHelper;
|
|
|
use Cake\View\View;
|
|
use Cake\View\View;
|
|
|
use Tools\Utility\Number;
|
|
use Tools\Utility\Number;
|
|
|
|
|
+use Tools\Utility\Utility;
|
|
|
|
|
|
|
|
if (!defined('CHAR_HELLIP')) {
|
|
if (!defined('CHAR_HELLIP')) {
|
|
|
define('CHAR_HELLIP', '…'); # � (horizontal ellipsis = three dot leader)
|
|
define('CHAR_HELLIP', '…'); # � (horizontal ellipsis = three dot leader)
|
|
@@ -60,7 +61,7 @@ class TextHelper extends CakeTextHelper {
|
|
|
return $url;
|
|
return $url;
|
|
|
}
|
|
}
|
|
|
// http:// etc has not to be displayed, so
|
|
// http:// etc has not to be displayed, so
|
|
|
- $url = $this->stripProtocol($url);
|
|
|
|
|
|
|
+ $url = Utility::stripProtocol($url);
|
|
|
// cut the parameters
|
|
// cut the parameters
|
|
|
if (mb_strpos($url, '/') !== false) {
|
|
if (mb_strpos($url, '/') !== false) {
|
|
|
$url = strtok($url, '/');
|
|
$url = strtok($url, '/');
|
|
@@ -82,21 +83,6 @@ class TextHelper extends CakeTextHelper {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Remove http:// or other protocols from the link
|
|
|
|
|
- *
|
|
|
|
|
- * @param string $url
|
|
|
|
|
- * @return string strippedUrl
|
|
|
|
|
- */
|
|
|
|
|
- public function stripProtocol($url) {
|
|
|
|
|
- $pieces = parse_url($url);
|
|
|
|
|
- // Already stripped?
|
|
|
|
|
- if (empty($pieces['scheme'])) {
|
|
|
|
|
- return $url;
|
|
|
|
|
- }
|
|
|
|
|
- return mb_substr($url, mb_strlen($pieces['scheme']) + 3); # +3 <=> :// # can only be 4 with "file" (file:///)...
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
* Transforming int values into ordinal numbers (1st, 3rd, ...).
|
|
* Transforming int values into ordinal numbers (1st, 3rd, ...).
|
|
|
* When using HTML, you can use <sup>, as well.
|
|
* When using HTML, you can use <sup>, as well.
|
|
|
*
|
|
*
|