| Zeile 4... |
Zeile 4... |
| 4 |
*
|
4 |
*
|
| 5 |
* An open source application development framework for PHP
|
5 |
* An open source application development framework for PHP
|
| 6 |
*
|
6 |
*
|
| 7 |
* This content is released under the MIT License (MIT)
|
7 |
* This content is released under the MIT License (MIT)
|
| 8 |
*
|
8 |
*
|
| 9 |
* Copyright (c) 2014 - 2017, British Columbia Institute of Technology
|
9 |
* Copyright (c) 2014 - 2018, British Columbia Institute of Technology
|
| 10 |
*
|
10 |
*
|
| 11 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 12 |
* of this software and associated documentation files (the "Software"), to deal
|
12 |
* of this software and associated documentation files (the "Software"), to deal
|
| 13 |
* in the Software without restriction, including without limitation the rights
|
13 |
* in the Software without restriction, including without limitation the rights
|
| 14 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| Zeile 27... |
Zeile 27... |
| 27 |
* THE SOFTWARE.
|
27 |
* THE SOFTWARE.
|
| 28 |
*
|
28 |
*
|
| 29 |
* @package CodeIgniter
|
29 |
* @package CodeIgniter
|
| 30 |
* @author EllisLab Dev Team
|
30 |
* @author EllisLab Dev Team
|
| 31 |
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
31 |
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
| 32 |
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
|
32 |
* @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/)
|
| 33 |
* @license http://opensource.org/licenses/MIT MIT License
|
33 |
* @license http://opensource.org/licenses/MIT MIT License
|
| 34 |
* @link https://codeigniter.com
|
34 |
* @link https://codeigniter.com
|
| 35 |
* @since Version 1.0.0
|
35 |
* @since Version 1.0.0
|
| 36 |
* @filesource
|
36 |
* @filesource
|
| 37 |
*/
|
37 |
*/
|
| Zeile 391... |
Zeile 391... |
| 391 |
* @return string
|
391 |
* @return string
|
| 392 |
*/
|
392 |
*/
|
| 393 |
function auto_link($str, $type = 'both', $popup = FALSE)
|
393 |
function auto_link($str, $type = 'both', $popup = FALSE)
|
| 394 |
{
|
394 |
{
|
| 395 |
// Find and replace any URLs.
|
395 |
// Find and replace any URLs.
|
| 396 |
if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER))
|
396 |
if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[a-z0-9]+(-+[a-z0-9]+)*(\.[a-z0-9]+(-+[a-z0-9]+)*)+(/([^\s()<>;]+\w)?/?)?#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER))
|
| 397 |
{
|
397 |
{
|
| 398 |
// Set our target HTML if using popup links.
|
398 |
// Set our target HTML if using popup links.
|
| 399 |
$target = ($popup) ? ' target="_blank"' : '';
|
399 |
$target = ($popup) ? ' target="_blank" rel="noopener"' : '';
|
| Zeile 400... |
Zeile 400... |
| 400 |
|
400 |
|
| 401 |
// We process the links in reverse order (last -> first) so that
|
401 |
// We process the links in reverse order (last -> first) so that
|
| 402 |
// the returned string offsets from preg_match_all() are not
|
402 |
// the returned string offsets from preg_match_all() are not
|
| 403 |
// moved as we add more HTML.
|
403 |
// moved as we add more HTML.
|