summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/img_adt_svc_relais.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/api/img_adt_svc_relais.php b/api/img_adt_svc_relais.php
index d62145c..18abebe 100644
--- a/api/img_adt_svc_relais.php
+++ b/api/img_adt_svc_relais.php
@@ -90,10 +90,13 @@ EOD;
function node_adt($adherent_id, $shape, $adt, $adt_title) {
$adt_title = htmlentities($adt_title);
+ $adt_title_len = strlen($adt_title);
foreach ( [ 10, 30 ] as $limit ) {
- $breakpos = strpos($adt_title, ' ', $limit);
- if ( $breakpos !== FALSE ) {
- $adt_title = substr($adt_title, 0, $breakpos) . '<br/>' . substr($adt_title, $breakpos);
+ if ( $adt_title_len > $limit ) {
+ $breakpos = strpos($adt_title, ' ', $limit);
+ if ( $breakpos !== FALSE ) {
+ $adt_title = substr($adt_title, 0, $breakpos) . '<br/>' . substr($adt_title, $breakpos);
+ }
}
}
return <<<EOD