]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/Smarty/plugins/modifier.to_url.php
Release 6.5.0
[Github/sugarcrm.git] / include / Smarty / plugins / modifier.to_url.php
1 <?php
2
3 /*
4
5 Modification information for LGPL compliance
6
7 r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
8
9 r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
10
11 r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
12
13 r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3  tags and updated the build system 
14
15 r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
16
17 r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
18
19 r42807 - 2008-12-29 11:16:59 -0800 (Mon, 29 Dec 2008) - dwong - Branch from trunk/sugarcrm r42806 to branches/tokyo/sugarcrm
20
21 r38999 - 2008-08-19 19:58:56 -0700 (Tue, 19 Aug 2008) - Ajay Gupta - added missing header.
22
23 r36643 - 2008-06-11 14:28:43 -0700 (Wed, 11 Jun 2008) - dwheeler - bug 20270: Added a new smarty modifyer, to_url, which adds http:// to the begining of a string if it is unable to find another protocol. The protocol found is not checked (unknown protocols can be used, such as svn+ssh:// or ftp://)
24
25
26 */
27
28
29 /*********************************************************************************
30  * SugarCRM Community Edition is a customer relationship management program developed by
31  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
32  * 
33  * This program is free software; you can redistribute it and/or modify it under
34  * the terms of the GNU Affero General Public License version 3 as published by the
35  * Free Software Foundation with the addition of the following permission added
36  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
37  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
38  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
39  * 
40  * This program is distributed in the hope that it will be useful, but WITHOUT
41  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
42  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
43  * details.
44  * 
45  * You should have received a copy of the GNU Affero General Public License along with
46  * this program; if not, see http://www.gnu.org/licenses or write to the Free
47  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
48  * 02110-1301 USA.
49  * 
50  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
51  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
52  * 
53  * The interactive user interfaces in modified source and object code versions
54  * of this program must display Appropriate Legal Notices, as required under
55  * Section 5 of the GNU Affero General Public License version 3.
56  * 
57  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
58  * these Appropriate Legal Notices must retain the display of the "Powered by
59  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
60  * technical reasons, the Appropriate Legal Notices must display the words
61  * "Powered by SugarCRM".
62  ********************************************************************************/
63
64 /**
65  * Smarty to_url modifier plugin
66  *
67  * Type:     modifier<br>
68  * Name:     to_url<br>
69  * Purpose:  adds http:// to the begining of a string if it contains no protocol
70  * @author   SugarCRM
71  * @param string The link to modify
72  * @return string The converted link
73  */
74 function smarty_modifier_to_url($string)
75 {
76     if (preg_match('/^[^:\/]*:\/\/.*/', $string)) {
77         return $string;
78     } else {
79         return 'http://' . $string;
80     }
81 }
82
83 ?>