| @@ 82-100 (lines=19) @@ | ||
| 79 | $tempLine = ''; |
|
| 80 | $words = explode(' ', $text); |
|
| 81 | ||
| 82 | foreach ($words as $word) { |
|
| 83 | if (strlen($tempLine.$word) >= 99) { |
|
| 84 | if (strlen($tempLine.$word) === 99) { |
|
| 85 | // Adding the extra space will push us to the edge |
|
| 86 | // so we are done. |
|
| 87 | $lines[] = $tempLine.$word; |
|
| 88 | $tempLine = ''; |
|
| 89 | } else if (strlen($tempLine.$word) === 100) { |
|
| 90 | // We are already at the edge, so we are done. |
|
| 91 | $lines[] = $tempLine.$word; |
|
| 92 | $tempLine = ''; |
|
| 93 | } else { |
|
| 94 | $lines[] = rtrim($tempLine); |
|
| 95 | $tempLine = $word.' '; |
|
| 96 | } |
|
| 97 | } else { |
|
| 98 | $tempLine .= $word.' '; |
|
| 99 | } |
|
| 100 | }//end foreach |
|
| 101 | ||
| 102 | if ($tempLine !== '') { |
|
| 103 | $lines[] = rtrim($tempLine); |
|
| @@ 128-146 (lines=19) @@ | ||
| 125 | $tempTitle = ''; |
|
| 126 | $words = explode(' ', $firstTitle); |
|
| 127 | ||
| 128 | foreach ($words as $word) { |
|
| 129 | if (strlen($tempTitle.$word) >= 45) { |
|
| 130 | if (strlen($tempTitle.$word) === 45) { |
|
| 131 | // Adding the extra space will push us to the edge |
|
| 132 | // so we are done. |
|
| 133 | $firstTitleLines[] = $tempTitle.$word; |
|
| 134 | $tempTitle = ''; |
|
| 135 | } else if (strlen($tempTitle.$word) === 46) { |
|
| 136 | // We are already at the edge, so we are done. |
|
| 137 | $firstTitleLines[] = $tempTitle.$word; |
|
| 138 | $tempTitle = ''; |
|
| 139 | } else { |
|
| 140 | $firstTitleLines[] = $tempTitle; |
|
| 141 | $tempTitle = $word; |
|
| 142 | } |
|
| 143 | } else { |
|
| 144 | $tempTitle .= $word.' '; |
|
| 145 | } |
|
| 146 | }//end foreach |
|
| 147 | ||
| 148 | if ($tempTitle !== '') { |
|
| 149 | $firstTitleLines[] = $tempTitle; |
|
| @@ 163-181 (lines=19) @@ | ||
| 160 | $tempTitle = ''; |
|
| 161 | $words = explode(' ', $secondTitle); |
|
| 162 | ||
| 163 | foreach ($words as $word) { |
|
| 164 | if (strlen($tempTitle.$word) >= 45) { |
|
| 165 | if (strlen($tempTitle.$word) === 45) { |
|
| 166 | // Adding the extra space will push us to the edge |
|
| 167 | // so we are done. |
|
| 168 | $secondTitleLines[] = $tempTitle.$word; |
|
| 169 | $tempTitle = ''; |
|
| 170 | } else if (strlen($tempTitle.$word) === 46) { |
|
| 171 | // We are already at the edge, so we are done. |
|
| 172 | $secondTitleLines[] = $tempTitle.$word; |
|
| 173 | $tempTitle = ''; |
|
| 174 | } else { |
|
| 175 | $secondTitleLines[] = $tempTitle; |
|
| 176 | $tempTitle = $word; |
|
| 177 | } |
|
| 178 | } else { |
|
| 179 | $tempTitle .= $word.' '; |
|
| 180 | } |
|
| 181 | }//end foreach |
|
| 182 | ||
| 183 | if ($tempTitle !== '') { |
|
| 184 | $secondTitleLines[] = $tempTitle; |
|