@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function smarty_modifier_regex_replace($string, $search, $replace) |
24 | 24 | { |
25 | - if(is_array($search)) { |
|
26 | - foreach($search as $idx => $s) |
|
25 | + if (is_array($search)) { |
|
26 | + foreach ($search as $idx => $s) |
|
27 | 27 | $search[$idx] = _smarty_regex_replace_check($s); |
28 | 28 | } else { |
29 | 29 | $search = _smarty_regex_replace_check($search); |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | |
35 | 35 | function _smarty_regex_replace_check($search) |
36 | 36 | { |
37 | - if (($pos = strpos($search,"\0")) !== false) |
|
38 | - $search = substr($search,0,$pos); |
|
37 | + if (($pos = strpos($search, "\0")) !== false) |
|
38 | + $search = substr($search, 0, $pos); |
|
39 | 39 | if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) { |
40 | 40 | /* remove eval-modifier from $search */ |
41 | - $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]); |
|
41 | + $search = substr($search, 0, -strlen($match[1])).preg_replace('![e\s]+!', '', $match[1]); |
|
42 | 42 | } |
43 | 43 | return $search; |
44 | 44 | } |
@@ -52,25 +52,25 @@ |
||
52 | 52 | function smarty_function_sugar_getlink($params, &$smarty) { |
53 | 53 | |
54 | 54 | // error checking for required parameters |
55 | - if(!isset($params['url'])) |
|
56 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'url'); |
|
57 | - if(!isset($params['title'])) |
|
58 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'title'); |
|
55 | + if (!isset($params['url'])) |
|
56 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'url'); |
|
57 | + if (!isset($params['title'])) |
|
58 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'title'); |
|
59 | 59 | |
60 | 60 | // set defaults |
61 | - if(!isset($params['attr'])) |
|
61 | + if (!isset($params['attr'])) |
|
62 | 62 | $params['attr'] = ''; |
63 | - if(!isset($params['img_name'])) |
|
63 | + if (!isset($params['img_name'])) |
|
64 | 64 | $params['img_name'] = ''; |
65 | - if(!isset($params['img_attr'])) |
|
65 | + if (!isset($params['img_attr'])) |
|
66 | 66 | $params['img_attr'] = ''; |
67 | - if(!isset($params['img_width'])) |
|
67 | + if (!isset($params['img_width'])) |
|
68 | 68 | $params['img_width'] = null; |
69 | - if(!isset($params['img_height'])) |
|
69 | + if (!isset($params['img_height'])) |
|
70 | 70 | $params['height'] = null; |
71 | - if(!isset($params['img_placement'])) |
|
71 | + if (!isset($params['img_placement'])) |
|
72 | 72 | $params['img_placement'] = 'imageonly'; |
73 | - if(!isset($params['img_alt'])) |
|
73 | + if (!isset($params['img_alt'])) |
|
74 | 74 | $params['img_alt'] = ''; |
75 | 75 | |
76 | 76 | return SugarThemeRegistry::current()->getLink($params['url'], $params['title'], $params['attr'], $params['img_name'], |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | |
58 | 58 | |
59 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
59 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
60 | 60 | /********************************************************************************* |
61 | 61 | * SugarCRM Community Edition is a customer relationship management program developed by |
62 | 62 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | $bean = $params['bean']; |
102 | 102 | $field = $params['field']; |
103 | 103 | $type = $bean->field_name_map[$field]['type']; |
104 | - if($type == 'text') { |
|
105 | - echo strlen($bean->$field) > 50 ? substr($bean->$field, 0, 47) . '...' : $bean->field; |
|
106 | - } else if($type == 'link') { |
|
104 | + if ($type == 'text') { |
|
105 | + echo strlen($bean->$field) > 50 ? substr($bean->$field, 0, 47).'...' : $bean->field; |
|
106 | + } else if ($type == 'link') { |
|
107 | 107 | echo "<a href='{$bean->$field}' target='_blank'>{$bean->$field}</a>"; |
108 | 108 | } else { |
109 | 109 | echo $bean->$field; |
@@ -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 | } |
@@ -64,17 +64,17 @@ |
||
64 | 64 | function smarty_function_sugar_currency_format($params, &$smarty) { |
65 | 65 | |
66 | 66 | // Bug #47406 : Currency field doesn't accept 0.00 as default value |
67 | - if(!isset($params['var']) || $params['var'] === '') { |
|
67 | + if (!isset($params['var']) || $params['var'] === '') { |
|
68 | 68 | return ''; |
69 | 69 | } |
70 | 70 | |
71 | 71 | global $locale; |
72 | - if(empty($params['currency_id'])){ |
|
72 | + if (empty($params['currency_id'])) { |
|
73 | 73 | $params['currency_id'] = $locale->getPrecedentPreference('currency'); |
74 | - if(!isset($params['convert'])) { |
|
74 | + if (!isset($params['convert'])) { |
|
75 | 75 | $params['convert'] = true; |
76 | 76 | } |
77 | - if(!isset($params['currency_symbol'])) { |
|
77 | + if (!isset($params['currency_symbol'])) { |
|
78 | 78 | $params['currency_symbol'] = $locale->getPrecedentPreference('default_currency_symbol'); |
79 | 79 | } |
80 | 80 | } |
@@ -66,10 +66,10 @@ |
||
66 | 66 | function smarty_function_multienum_to_array($params, &$smarty) |
67 | 67 | { |
68 | 68 | $ret = ""; |
69 | - if(empty($params['string'])) { |
|
69 | + if (empty($params['string'])) { |
|
70 | 70 | if (empty($params['default'])) |
71 | 71 | $ret = array(); |
72 | - else if(is_array($params['default'])) |
|
72 | + else if (is_array($params['default'])) |
|
73 | 73 | $ret = $params['default']; |
74 | 74 | else |
75 | 75 | $ret = unencodeMultienum($params['default']); |
@@ -16,14 +16,14 @@ |
||
16 | 16 | */ |
17 | 17 | function smarty_make_timestamp($string) |
18 | 18 | { |
19 | - if(empty($string)) { |
|
19 | + if (empty($string)) { |
|
20 | 20 | // use "now": |
21 | 21 | $time = time(); |
22 | 22 | |
23 | 23 | } elseif (preg_match('/^\d{14}$/', $string)) { |
24 | 24 | // it is mysql timestamp format of YYYYMMDDHHMMSS? |
25 | - $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2), |
|
26 | - substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4)); |
|
25 | + $time = mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), |
|
26 | + substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4)); |
|
27 | 27 | |
28 | 28 | } elseif (is_numeric($string)) { |
29 | 29 | // it is a numeric string, we handle it as timestamp |
@@ -45,7 +45,7 @@ |
||
45 | 45 | function smarty_modifier_in_array($needle = null, $haystack = null) |
46 | 46 | { |
47 | 47 | //Smarty barfs if Array is empty |
48 | - if($haystack == null || empty($haystack)) { |
|
48 | + if ($haystack == null || empty($haystack)) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | return in_array($needle, $haystack); |
@@ -53,9 +53,9 @@ |
||
53 | 53 | $pdfButtons = ''; |
54 | 54 | $client = $current_user->getPreference('email_link_type'); |
55 | 55 | if ($client != 'sugar') { |
56 | - $pdfButtons = '<input title="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" onclick="location.href=\'mailto:\';return false;"> '; |
|
56 | + $pdfButtons = '<input title="'.$app_strings["LBL_EMAIL_COMPOSE"].'" class="button" type="submit" name="button" value="'.$app_strings["LBL_EMAIL_COMPOSE"].'" onclick="location.href=\'mailto:\';return false;"> '; |
|
57 | 57 | } else { |
58 | - $pdfButtons = '<input id="email_as_pdf_button" title="'. $app_strings["LBL_EMAIL_PDF_BUTTON_TITLE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_PDF_BUTTON_LABEL"] . '" onclick="this.form.email_action.value=\'EmailLayout\';"> '; |
|
58 | + $pdfButtons = '<input id="email_as_pdf_button" title="'.$app_strings["LBL_EMAIL_PDF_BUTTON_TITLE"].'" class="button" type="submit" name="button" value="'.$app_strings["LBL_EMAIL_PDF_BUTTON_LABEL"].'" onclick="this.form.email_action.value=\'EmailLayout\';"> '; |
|
59 | 59 | } |
60 | 60 | return $pdfButtons; |
61 | 61 | } |