⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 text.lib.php

📁 完美的在线教育系统
💻 PHP
字号:
<?php // $Id: text.lib.php 15174 2008-04-29 18:00:04Z yannoo $/*==============================================================================	Dokeos - elearning and course management software	Copyright (c) 2004-2008 Dokeos S.A.	Copyright (c) 2003 Ghent University (UGent)	Copyright (c) 2001 Universite catholique de Louvain (UCL)	Copyright (c) various contributors	For a full list of contributors, see "credits.txt".	The full license can be read in "license.txt".	This program is free software; you can redistribute it and/or	modify it under the terms of the GNU General Public License	as published by the Free Software Foundation; either version 2	of the License, or (at your option) any later version.	See the GNU General Public License for more details.	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com==============================================================================*//**==============================================================================*	This is the text library for Dokeos.*	Include/require it in your code to use its functionality.**	@package dokeos.library==============================================================================*//*==============================================================================		FUNCTIONS==============================================================================*//** * function make_clickable($string) * * @desc   completes url contained in the text with "<a href ...". *         However the function simply returns the submitted text without any *         transformation if it already contains some "<a href:" or "<img src=". * @param string $text text to be converted * @return text after conversion * @author Rewritten by Nathan Codding - Feb 6, 2001. *         completed by Hugues Peeters - July 22, 2002 * * Actually this function is taken from the PHP BB 1.4 script * - Goes through the given string, and replaces xxxx://yyyy with an HTML <a> tag linking * 	to that URL * - Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML <a> tag linking * 	to http://www.xxxx.yyyy[/zzzz] * - Goes through the given string, and replaces xxxx@yyyy with an HTML mailto: tag linking *		to that email address * - Only matches these 2 patterns either after a space, or at the beginning of a line * * Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe * have it require something like xxxx@yyyy.zzzz or such. We'll see. */function make_clickable($string){	if(!stristr($string,' src=') && !stristr($string,' href='))	{		$string=eregi_replace("(https?|ftp)://([a-z0-9#?/&=._+:~%-]+)","<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>",$string);		$string=eregi_replace("([a-z0-9_.-]+@[a-z0-9.-]+)","<a href=\"mailto:\\1\">\\1</a>",$string);	}	return $string;}/** * formats the date according to the locale settings * * @author  Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author  Christophe Gesch锟

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -