@@ -18,10 +18,10 @@ |
||
18 | 18 | */ |
19 | 19 | function smarty_function_escape_special_chars($string) |
20 | 20 | { |
21 | - if(!is_array($string)) { |
|
21 | + if (!is_array($string)) { |
|
22 | 22 | $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); |
23 | 23 | $string = htmlspecialchars($string); |
24 | - $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string); |
|
24 | + $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); |
|
25 | 25 | } |
26 | 26 | return $string; |
27 | 27 | } |
@@ -54,6 +54,6 @@ |
||
54 | 54 | */ |
55 | 55 | function smarty_modifier_strip_semicolon($text) |
56 | 56 | { |
57 | - return preg_replace("/([:]|\xEF\xBC\x9A)[\\s]*$/", '', trim($text)); |
|
57 | + return preg_replace("/([:]|\xEF\xBC\x9A)[\\s]*$/", '', trim($text)); |
|
58 | 58 | } |
59 | 59 | ?> |
60 | 60 | \ No newline at end of file |
@@ -38,7 +38,7 @@ |
||
38 | 38 | return; |
39 | 39 | } |
40 | 40 | if (DIRECTORY_SEPARATOR == '\\') { |
41 | - $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); |
|
41 | + $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); |
|
42 | 42 | $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S'); |
43 | 43 | if (strpos($format, '%e') !== false) { |
44 | 44 | $_win_from[] = '%e'; |
@@ -72,15 +72,15 @@ |
||
72 | 72 | function smarty_function_sugar_help($params, &$smarty) |
73 | 73 | { |
74 | 74 | $text = str_replace("'","\'",htmlspecialchars($params['text'])); |
75 | - //append any additional parameters. |
|
76 | - $click = "return SUGAR.util.showHelpTips(this,'$text'"; |
|
75 | + //append any additional parameters. |
|
76 | + $click = "return SUGAR.util.showHelpTips(this,'$text'"; |
|
77 | 77 | |
78 | - if (count( $params) > 1){ |
|
78 | + if (count( $params) > 1){ |
|
79 | 79 | |
80 | - $click .=",'".$params['myPos']."','".$params['atPos']."'"; |
|
81 | - } |
|
80 | + $click .=",'".$params['myPos']."','".$params['atPos']."'"; |
|
81 | + } |
|
82 | 82 | $helpImage = SugarThemeRegistry::current()->getImageURL('helpInline.png'); |
83 | - $click .= " );" ; |
|
83 | + $click .= " );" ; |
|
84 | 84 | $alt_tag = $GLOBALS['app_strings']['LBL_ALT_INFO']; |
85 | 85 | return <<<EOHTML |
86 | 86 | <img border="0" |
@@ -71,16 +71,16 @@ |
||
71 | 71 | */ |
72 | 72 | function smarty_function_sugar_help($params, &$smarty) |
73 | 73 | { |
74 | - $text = str_replace("'","\'",htmlspecialchars($params['text'])); |
|
74 | + $text = str_replace("'", "\'", htmlspecialchars($params['text'])); |
|
75 | 75 | //append any additional parameters. |
76 | - $click = "return SUGAR.util.showHelpTips(this,'$text'"; |
|
76 | + $click = "return SUGAR.util.showHelpTips(this,'$text'"; |
|
77 | 77 | |
78 | - if (count( $params) > 1){ |
|
78 | + if (count($params) > 1) { |
|
79 | 79 | |
80 | - $click .=",'".$params['myPos']."','".$params['atPos']."'"; |
|
80 | + $click .= ",'".$params['myPos']."','".$params['atPos']."'"; |
|
81 | 81 | } |
82 | 82 | $helpImage = SugarThemeRegistry::current()->getImageURL('helpInline.png'); |
83 | - $click .= " );" ; |
|
83 | + $click .= " );"; |
|
84 | 84 | $alt_tag = $GLOBALS['app_strings']['LBL_ALT_INFO']; |
85 | 85 | return <<<EOHTML |
86 | 86 | <img border="0" |
@@ -207,8 +207,8 @@ |
||
207 | 207 | * @return String representing date value |
208 | 208 | */ |
209 | 209 | function smarty_modifier_default_date_value($defaultValue) { |
210 | - global $timedate; |
|
211 | - require_once('modules/DynamicFields/templates/Fields/TemplateDate.php'); |
|
212 | - $td = new TemplateDate(); |
|
213 | - return $timedate->asUser(new SugarDateTime($td->dateStrings[$defaultValue])); |
|
210 | + global $timedate; |
|
211 | + require_once('modules/DynamicFields/templates/Fields/TemplateDate.php'); |
|
212 | + $td = new TemplateDate(); |
|
213 | + return $timedate->asUser(new SugarDateTime($td->dateStrings[$defaultValue])); |
|
214 | 214 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -45,9 +45,9 @@ |
||
45 | 45 | */ |
46 | 46 | function smarty_function_sugar_getwebpath($params, &$smarty) |
47 | 47 | { |
48 | - if(!isset($params['file'])) { |
|
49 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
50 | - } |
|
51 | - return getWebPath($params['file']); |
|
48 | + if(!isset($params['file'])) { |
|
49 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
50 | + } |
|
51 | + return getWebPath($params['file']); |
|
52 | 52 | } |
53 | 53 | ?> |
54 | 54 | \ No newline at end of file |
@@ -43,8 +43,8 @@ |
||
43 | 43 | */ |
44 | 44 | function smarty_function_sugar_getjspath($params, &$smarty) |
45 | 45 | { |
46 | - if(!isset($params['file'])) { |
|
47 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
46 | + if (!isset($params['file'])) { |
|
47 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'file'); |
|
48 | 48 | } |
49 | 49 | return getJSPath($params['file']); |
50 | 50 | } |
@@ -46,21 +46,21 @@ |
||
46 | 46 | function smarty_function_sugar_variable_constructor($params, &$smarty) |
47 | 47 | { |
48 | 48 | if (!isset($params['objectName']) || !isset($params['memberName']) || !isset($params['key'])) { |
49 | - if(!isset($params['objectName'])) |
|
49 | + if (!isset($params['objectName'])) |
|
50 | 50 | $smarty->trigger_error("sugar_variable_constructor: missing 'objectName' parameter"); |
51 | - if(!isset($params['memberName'])) |
|
51 | + if (!isset($params['memberName'])) |
|
52 | 52 | $smarty->trigger_error("sugar_variable_constructor: missing 'memberName' parameter"); |
53 | - if(!isset($params['key'])) |
|
53 | + if (!isset($params['key'])) |
|
54 | 54 | $smarty->trigger_error("sugar_variable_constructor: missing 'key' parameter"); |
55 | 55 | |
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | - if(isset($params['stringFormat'])) { |
|
60 | - $_contents = '$'. $params['objectName'] . '.' . $params['memberName'] . '.' . $params['key']; |
|
59 | + if (isset($params['stringFormat'])) { |
|
60 | + $_contents = '$'.$params['objectName'].'.'.$params['memberName'].'.'.$params['key']; |
|
61 | 61 | } |
62 | 62 | else { |
63 | - $_contents = '{$' . $params['objectName'] . '.' . $params['memberName'] . '.' . $params['key'] . '}'; |
|
63 | + $_contents = '{$'.$params['objectName'].'.'.$params['memberName'].'.'.$params['key'].'}'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $_contents; |
@@ -46,20 +46,22 @@ |
||
46 | 46 | function smarty_function_sugar_variable_constructor($params, &$smarty) |
47 | 47 | { |
48 | 48 | if (!isset($params['objectName']) || !isset($params['memberName']) || !isset($params['key'])) { |
49 | - if(!isset($params['objectName'])) |
|
50 | - $smarty->trigger_error("sugar_variable_constructor: missing 'objectName' parameter"); |
|
51 | - if(!isset($params['memberName'])) |
|
52 | - $smarty->trigger_error("sugar_variable_constructor: missing 'memberName' parameter"); |
|
53 | - if(!isset($params['key'])) |
|
54 | - $smarty->trigger_error("sugar_variable_constructor: missing 'key' parameter"); |
|
49 | + if(!isset($params['objectName'])) { |
|
50 | + $smarty->trigger_error("sugar_variable_constructor: missing 'objectName' parameter"); |
|
51 | + } |
|
52 | + if(!isset($params['memberName'])) { |
|
53 | + $smarty->trigger_error("sugar_variable_constructor: missing 'memberName' parameter"); |
|
54 | + } |
|
55 | + if(!isset($params['key'])) { |
|
56 | + $smarty->trigger_error("sugar_variable_constructor: missing 'key' parameter"); |
|
57 | + } |
|
55 | 58 | |
56 | 59 | return; |
57 | 60 | } |
58 | 61 | |
59 | 62 | if(isset($params['stringFormat'])) { |
60 | 63 | $_contents = '$'. $params['objectName'] . '.' . $params['memberName'] . '.' . $params['key']; |
61 | - } |
|
62 | - else { |
|
64 | + } else { |
|
63 | 65 | $_contents = '{$' . $params['objectName'] . '.' . $params['memberName'] . '.' . $params['key'] . '}'; |
64 | 66 | } |
65 | 67 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | // netscape and mozilla do not decode %40 (@) in BCC field (bug?) |
64 | 64 | // so, don't encode it. |
65 | 65 | $search = array('%40', '%2C'); |
66 | - $replace = array('@', ','); |
|
66 | + $replace = array('@', ','); |
|
67 | 67 | $mail_parms = array(); |
68 | 68 | foreach ($params as $var=>$value) { |
69 | 69 | switch ($var) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | case 'bcc': |
72 | 72 | case 'followupto': |
73 | 73 | if (!empty($value)) |
74 | - $mail_parms[] = $var.'='.str_replace($search,$replace,rawurlencode($value)); |
|
74 | + $mail_parms[] = $var.'='.str_replace($search, $replace, rawurlencode($value)); |
|
75 | 75 | break; |
76 | 76 | |
77 | 77 | case 'subject': |
@@ -88,39 +88,39 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $mail_parm_vals = ''; |
91 | - for ($i=0; $i<count($mail_parms); $i++) { |
|
92 | - $mail_parm_vals .= (0==$i) ? '?' : '&'; |
|
91 | + for ($i = 0; $i < count($mail_parms); $i++) { |
|
92 | + $mail_parm_vals .= (0 == $i) ? '?' : '&'; |
|
93 | 93 | $mail_parm_vals .= $mail_parms[$i]; |
94 | 94 | } |
95 | 95 | $address .= $mail_parm_vals; |
96 | 96 | |
97 | 97 | $encode = (empty($params['encode'])) ? 'none' : $params['encode']; |
98 | - if (!in_array($encode,array('javascript','javascript_charcode','hex','none')) ) { |
|
98 | + if (!in_array($encode, array('javascript', 'javascript_charcode', 'hex', 'none'))) { |
|
99 | 99 | $smarty->trigger_error("mailto: 'encode' parameter must be none, javascript or hex"); |
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | - if ($encode == 'javascript' ) { |
|
103 | + if ($encode == 'javascript') { |
|
104 | 104 | $string = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');'; |
105 | 105 | |
106 | 106 | $js_encode = ''; |
107 | - for ($x=0; $x < strlen($string); $x++) { |
|
108 | - $js_encode .= '%' . bin2hex($string[$x]); |
|
107 | + for ($x = 0; $x < strlen($string); $x++) { |
|
108 | + $js_encode .= '%'.bin2hex($string[$x]); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | return '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>'; |
112 | 112 | |
113 | - } elseif ($encode == 'javascript_charcode' ) { |
|
113 | + } elseif ($encode == 'javascript_charcode') { |
|
114 | 114 | $string = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>'; |
115 | 115 | |
116 | - for($x = 0, $y = strlen($string); $x < $y; $x++ ) { |
|
116 | + for ($x = 0, $y = strlen($string); $x < $y; $x++) { |
|
117 | 117 | $ord[] = ord($string[$x]); |
118 | 118 | } |
119 | 119 | |
120 | 120 | $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n"; |
121 | 121 | $_ret .= "<!--\n"; |
122 | 122 | $_ret .= "{document.write(String.fromCharCode("; |
123 | - $_ret .= implode(',',$ord); |
|
123 | + $_ret .= implode(',', $ord); |
|
124 | 124 | $_ret .= "))"; |
125 | 125 | $_ret .= "}\n"; |
126 | 126 | $_ret .= "//-->\n"; |
@@ -131,22 +131,22 @@ discard block |
||
131 | 131 | |
132 | 132 | } elseif ($encode == 'hex') { |
133 | 133 | |
134 | - preg_match('!^(.*)(\?.*)$!',$address,$match); |
|
135 | - if(!empty($match[2])) { |
|
134 | + preg_match('!^(.*)(\?.*)$!', $address, $match); |
|
135 | + if (!empty($match[2])) { |
|
136 | 136 | $smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript."); |
137 | 137 | return; |
138 | 138 | } |
139 | 139 | $address_encode = ''; |
140 | - for ($x=0; $x < strlen($address); $x++) { |
|
141 | - if(preg_match('!\w!',$address[$x])) { |
|
142 | - $address_encode .= '%' . bin2hex($address[$x]); |
|
140 | + for ($x = 0; $x < strlen($address); $x++) { |
|
141 | + if (preg_match('!\w!', $address[$x])) { |
|
142 | + $address_encode .= '%'.bin2hex($address[$x]); |
|
143 | 143 | } else { |
144 | 144 | $address_encode .= $address[$x]; |
145 | 145 | } |
146 | 146 | } |
147 | 147 | $text_encode = ''; |
148 | - for ($x=0; $x < strlen($text); $x++) { |
|
149 | - $text_encode .= '&#x' . bin2hex($text[$x]).';'; |
|
148 | + for ($x = 0; $x < strlen($text); $x++) { |
|
149 | + $text_encode .= '&#x'.bin2hex($text[$x]).';'; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $mailto = "mailto:"; |
@@ -70,8 +70,9 @@ |
||
70 | 70 | case 'cc': |
71 | 71 | case 'bcc': |
72 | 72 | case 'followupto': |
73 | - if (!empty($value)) |
|
74 | - $mail_parms[] = $var.'='.str_replace($search,$replace,rawurlencode($value)); |
|
73 | + if (!empty($value)) { |
|
74 | + $mail_parms[] = $var.'='.str_replace($search,$replace,rawurlencode($value)); |
|
75 | + } |
|
75 | 76 | break; |
76 | 77 | |
77 | 78 | case 'subject': |
@@ -21,7 +21,7 @@ |
||
21 | 21 | function smarty_modifier_count_words($string) |
22 | 22 | { |
23 | 23 | // split text by ' ',\r,\n,\f,\t |
24 | - $split_array = preg_split('/\s+/',$string); |
|
24 | + $split_array = preg_split('/\s+/', $string); |
|
25 | 25 | // count matches that contain alphanumerics |
26 | 26 | $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array); |
27 | 27 |