@@ -28,8 +28,8 @@ |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | if (!empty($params['src'])) { |
31 | - return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n" |
|
32 | - . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n"; |
|
31 | + return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>'."\n" |
|
32 | + . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>'."\n"; |
|
33 | 33 | } else { |
34 | 34 | $smarty->trigger_error("popup_init: missing src parameter"); |
35 | 35 | } |
@@ -109,26 +109,26 @@ discard block |
||
109 | 109 | $loop_count = count($loop); |
110 | 110 | if (empty($params['rows'])) { |
111 | 111 | /* no rows specified */ |
112 | - $rows = ceil($loop_count/$cols_count); |
|
112 | + $rows = ceil($loop_count / $cols_count); |
|
113 | 113 | } elseif (empty($params['cols'])) { |
114 | 114 | if (!empty($params['rows'])) { |
115 | 115 | /* no cols specified, but rows */ |
116 | - $cols_count = ceil($loop_count/$rows); |
|
116 | + $cols_count = ceil($loop_count / $rows); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | 120 | $output = "<table $table_attr>\n"; |
121 | 121 | |
122 | 122 | if (!empty($caption)) { |
123 | - $output .= '<caption>' . $caption . "</caption>\n"; |
|
123 | + $output .= '<caption>'.$caption."</caption>\n"; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | if (is_array($cols)) { |
127 | 127 | $cols = ($hdir == 'right') ? $cols : array_reverse($cols); |
128 | 128 | $output .= "<thead><tr>\n"; |
129 | 129 | |
130 | - for ($r=0; $r<$cols_count; $r++) { |
|
131 | - $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>'; |
|
130 | + for ($r = 0; $r < $cols_count; $r++) { |
|
131 | + $output .= '<th'.smarty_function_html_table_cycle('th', $th_attr, $r).'>'; |
|
132 | 132 | $output .= $cols[$r]; |
133 | 133 | $output .= "</th>\n"; |
134 | 134 | } |
@@ -136,21 +136,21 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | $output .= "<tbody>\n"; |
139 | - for ($r=0; $r<$rows; $r++) { |
|
140 | - $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n"; |
|
141 | - $rx = ($vdir == 'down') ? $r*$cols_count : ($rows-1-$r)*$cols_count; |
|
139 | + for ($r = 0; $r < $rows; $r++) { |
|
140 | + $output .= "<tr".smarty_function_html_table_cycle('tr', $tr_attr, $r).">\n"; |
|
141 | + $rx = ($vdir == 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count; |
|
142 | 142 | |
143 | - for ($c=0; $c<$cols_count; $c++) { |
|
144 | - $x = ($hdir == 'right') ? $rx+$c : $rx+$cols_count-1-$c; |
|
145 | - if ($inner!='cols') { |
|
143 | + for ($c = 0; $c < $cols_count; $c++) { |
|
144 | + $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count - 1 - $c; |
|
145 | + if ($inner != 'cols') { |
|
146 | 146 | /* shuffle x to loop over rows*/ |
147 | - $x = floor($x/$cols_count) + ($x%$cols_count)*$rows; |
|
147 | + $x = floor($x / $cols_count) + ($x % $cols_count) * $rows; |
|
148 | 148 | } |
149 | 149 | |
150 | - if ($x<$loop_count) { |
|
151 | - $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[$x] . "</td>\n"; |
|
150 | + if ($x < $loop_count) { |
|
151 | + $output .= "<td".smarty_function_html_table_cycle('td', $td_attr, $c).">".$loop[$x]."</td>\n"; |
|
152 | 152 | } else { |
153 | - $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n"; |
|
153 | + $output .= "<td".smarty_function_html_table_cycle('td', $td_attr, $c).">$trailpad</td>\n"; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | $output .= "</tr>\n"; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | function smarty_function_html_table_cycle($name, $var, $no) { |
165 | - if(!is_array($var)) { |
|
165 | + if (!is_array($var)) { |
|
166 | 166 | $ret = $var; |
167 | 167 | } else { |
168 | 168 | $ret = $var[$no % count($var)]; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | if ($include_spaces) |
25 | 25 | return(strlen($string)); |
26 | 26 | |
27 | - return preg_match_all("/[^\s]/",$string, $match); |
|
27 | + return preg_match_all("/[^\s]/", $string, $match); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /* vim: set expandtab: */ |
@@ -72,27 +72,27 @@ |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | // split into paragraphs |
75 | - $_paragraphs = preg_split('![\r\n][\r\n]!',$content); |
|
75 | + $_paragraphs = preg_split('![\r\n][\r\n]!', $content); |
|
76 | 76 | $_output = ''; |
77 | 77 | |
78 | - for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { |
|
78 | + for ($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { |
|
79 | 79 | if ($_paragraphs[$_x] == '') { |
80 | 80 | continue; |
81 | 81 | } |
82 | 82 | // convert mult. spaces & special chars to single space |
83 | - $_paragraphs[$_x] = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]); |
|
83 | + $_paragraphs[$_x] = preg_replace(array('!\s+!', '!(^\s+)|(\s+$)!'), array(' ', ''), $_paragraphs[$_x]); |
|
84 | 84 | // indent first line |
85 | - if($indent_first > 0) { |
|
86 | - $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x]; |
|
85 | + if ($indent_first > 0) { |
|
86 | + $_paragraphs[$_x] = str_repeat($indent_char, $indent_first).$_paragraphs[$_x]; |
|
87 | 87 | } |
88 | 88 | // wordwrap sentences |
89 | 89 | $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut); |
90 | 90 | // indent lines |
91 | - if($indent > 0) { |
|
91 | + if ($indent > 0) { |
|
92 | 92 | $_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]); |
93 | 93 | } |
94 | 94 | } |
95 | - $_output = implode($wrap_char . $wrap_char, $_paragraphs); |
|
95 | + $_output = implode($wrap_char.$wrap_char, $_paragraphs); |
|
96 | 96 | |
97 | 97 | return $assign ? $smarty->assign($assign, $_output) : $_output; |
98 | 98 |
@@ -62,27 +62,27 @@ |
||
62 | 62 | */ |
63 | 63 | function smarty_function_sugar_translate($params, &$smarty) |
64 | 64 | { |
65 | - if (!isset($params['label'])){ |
|
65 | + if (!isset($params['label'])) { |
|
66 | 66 | $smarty->trigger_error("sugar_translate: missing 'label' parameter"); |
67 | 67 | return ''; |
68 | 68 | } |
69 | 69 | |
70 | - $module = (isset($params['module']))? $params['module']: ''; |
|
71 | - if(isset($params['select'])){ |
|
72 | - if(empty($params['select'])) |
|
70 | + $module = (isset($params['module'])) ? $params['module'] : ''; |
|
71 | + if (isset($params['select'])) { |
|
72 | + if (empty($params['select'])) |
|
73 | 73 | $value = ""; |
74 | 74 | else |
75 | - $value = translate($params['label'] , $module, $params['select']); |
|
76 | - }else{ |
|
77 | - $value = translate($params['label'] , $module); |
|
75 | + $value = translate($params['label'], $module, $params['select']); |
|
76 | + } else { |
|
77 | + $value = translate($params['label'], $module); |
|
78 | 78 | } |
79 | 79 | if (!empty($params['for_js']) && $params['for_js']) { |
80 | 80 | $value = addslashes($value); |
81 | 81 | $value = str_replace(array(''', '''), "\'", $value); |
82 | 82 | } |
83 | - if(isset($params['trimColon']) && !$params['trimColon']) { |
|
83 | + if (isset($params['trimColon']) && !$params['trimColon']) { |
|
84 | 84 | return $value; |
85 | - } elseif($params['label'] == '0') { |
|
85 | + } elseif ($params['label'] == '0') { |
|
86 | 86 | return translate("DEFAULT", $module); |
87 | 87 | } else { |
88 | 88 | return preg_replace("/([:]|\xEF\xBC\x9A)[\\s]*$/", "", $value); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | if (isset($params['output'])) { |
27 | 27 | $smarty->assign('_smarty_debug_output', $params['output']); |
28 | 28 | } |
29 | - require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); |
|
29 | + require_once(SMARTY_CORE_DIR.'core.display_debug_console.php'); |
|
30 | 30 | return smarty_core_display_debug_console(null, $smarty); |
31 | 31 | } |
32 | 32 |
@@ -26,14 +26,14 @@ |
||
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | - if($params['var'] == '') { |
|
29 | + if ($params['var'] == '') { |
|
30 | 30 | return; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled); |
34 | 34 | |
35 | 35 | ob_start(); |
36 | - $smarty->_eval('?>' . $_var_compiled); |
|
36 | + $smarty->_eval('?>'.$_var_compiled); |
|
37 | 37 | $_contents = ob_get_contents(); |
38 | 38 | ob_end_clean(); |
39 | 39 |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | |
31 | 31 | switch (gettype($var)) { |
32 | 32 | case 'array' : |
33 | - $results = '<b>Array (' . count($var) . ')</b>'; |
|
33 | + $results = '<b>Array ('.count($var).')</b>'; |
|
34 | 34 | foreach ($var as $curr_key => $curr_val) { |
35 | - $results .= '<br>' . str_repeat(' ', $depth * 2) |
|
36 | - . '<b>' . strtr($curr_key, $_replace) . '</b> => ' |
|
35 | + $results .= '<br>'.str_repeat(' ', $depth * 2) |
|
36 | + . '<b>'.strtr($curr_key, $_replace).'</b> => ' |
|
37 | 37 | . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); |
38 | 38 | $depth--; |
39 | 39 | } |
40 | 40 | break; |
41 | 41 | case 'object' : |
42 | 42 | $object_vars = get_object_vars($var); |
43 | - $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; |
|
43 | + $results = '<b>'.get_class($var).' Object ('.count($object_vars).')</b>'; |
|
44 | 44 | foreach ($object_vars as $curr_key => $curr_val) { |
45 | - $results .= '<br>' . str_repeat(' ', $depth * 2) |
|
46 | - . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' |
|
45 | + $results .= '<br>'.str_repeat(' ', $depth * 2) |
|
46 | + . '<b> ->'.strtr($curr_key, $_replace).'</b> = ' |
|
47 | 47 | . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); |
48 | 48 | $depth--; |
49 | 49 | } |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | } elseif (null === $var) { |
59 | 59 | $results = 'null'; |
60 | 60 | } else { |
61 | - $results = htmlspecialchars((string) $var); |
|
61 | + $results = htmlspecialchars((string)$var); |
|
62 | 62 | } |
63 | - $results = '<i>' . $results . '</i>'; |
|
63 | + $results = '<i>'.$results.'</i>'; |
|
64 | 64 | break; |
65 | 65 | case 'integer' : |
66 | 66 | case 'float' : |
67 | - $results = htmlspecialchars((string) $var); |
|
67 | + $results = htmlspecialchars((string)$var); |
|
68 | 68 | break; |
69 | 69 | case 'string' : |
70 | 70 | $results = strtr($var, $_replace); |
71 | - if (strlen($var) > $length ) { |
|
72 | - $results = substr($var, 0, $length - 3) . '...'; |
|
71 | + if (strlen($var) > $length) { |
|
72 | + $results = substr($var, 0, $length - 3).'...'; |
|
73 | 73 | } |
74 | - $results = htmlspecialchars('"' . $results . '"'); |
|
74 | + $results = htmlspecialchars('"'.$results.'"'); |
|
75 | 75 | break; |
76 | 76 | case 'unknown type' : |
77 | 77 | default : |
78 | - $results = strtr((string) $var, $_replace); |
|
79 | - if (strlen($results) > $length ) { |
|
80 | - $results = substr($results, 0, $length - 3) . '...'; |
|
78 | + $results = strtr((string)$var, $_replace); |
|
79 | + if (strlen($results) > $length) { |
|
80 | + $results = substr($results, 0, $length - 3).'...'; |
|
81 | 81 | } |
82 | 82 | $results = htmlspecialchars($results); |
83 | 83 | } |
@@ -68,48 +68,48 @@ discard block |
||
68 | 68 | */ |
69 | 69 | function smarty_function_sugar_evalcolumn($params, &$smarty) |
70 | 70 | { |
71 | - if (!isset($params['colData']['field']) ) { |
|
72 | - if(empty($params['colData'])) |
|
71 | + if (!isset($params['colData']['field'])) { |
|
72 | + if (empty($params['colData'])) |
|
73 | 73 | $smarty->trigger_error("evalcolumn: missing 'colData' parameter"); |
74 | - if(!isset($params['colData']['field'])) |
|
74 | + if (!isset($params['colData']['field'])) |
|
75 | 75 | $smarty->trigger_error("evalcolumn: missing 'colData.field' parameter"); |
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | - if(empty($params['colData']['field'])) { |
|
79 | + if (empty($params['colData']['field'])) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | $params['var'] = $params['colData']['field']; |
83 | - if(isset($params['toJSON'])) { |
|
83 | + if (isset($params['toJSON'])) { |
|
84 | 84 | $json = getJSONobj(); |
85 | 85 | $params['var'] = $json->encode($params['var']); |
86 | 86 | } |
87 | 87 | |
88 | 88 | if (!empty($params['var']['assign'])) { |
89 | - return '{$' . $params['colData']['field']['name'] . '}'; |
|
89 | + return '{$'.$params['colData']['field']['name'].'}'; |
|
90 | 90 | } else { |
91 | 91 | $code = $params['var']['customCode']; |
92 | - if(isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
92 | + if (isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
93 | 93 | $str_replace = array(); |
94 | - $tabindex = ' tabindex="' . $params['tabindex'] . '" '; |
|
95 | - foreach($matches[3] as $match) { |
|
96 | - $str_replace[$match] = $tabindex . $match; |
|
94 | + $tabindex = ' tabindex="'.$params['tabindex'].'" '; |
|
95 | + foreach ($matches[3] as $match) { |
|
96 | + $str_replace[$match] = $tabindex.$match; |
|
97 | 97 | } |
98 | 98 | $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
99 | 99 | } |
100 | 100 | |
101 | - if(isset($params['accesskey']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
101 | + if (isset($params['accesskey']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
102 | 102 | $str_replace = array(); |
103 | - $accesskey = ' accesskey="' . $params['accesskey'] . '" '; |
|
104 | - foreach($matches[3] as $match) { |
|
105 | - $str_replace[$match] = $accesskey . $match; |
|
103 | + $accesskey = ' accesskey="'.$params['accesskey'].'" '; |
|
104 | + foreach ($matches[3] as $match) { |
|
105 | + $str_replace[$match] = $accesskey.$match; |
|
106 | 106 | } |
107 | 107 | $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Add a string replace to swap out @@FIELD@@ for the actual field, |
111 | 111 | // we can't do this through customCode directly because the sugar_field smarty function returns smarty code to run on the second pass |
112 | - if (!empty($code) && strpos($code,'@@FIELD@@') !== FALSE ) { |
|
112 | + if (!empty($code) && strpos($code, '@@FIELD@@') !== FALSE) { |
|
113 | 113 | // First we need to fetch extra data about the field |
114 | 114 | // sfp == SugarFieldParams |
115 | 115 | $sfp = $params; |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | |
124 | 124 | $fieldText = smarty_function_sugar_field($sfp, $smarty); |
125 | 125 | |
126 | - $code = str_replace('@@FIELD@@',$fieldText,$code); |
|
126 | + $code = str_replace('@@FIELD@@', $fieldText, $code); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | //eggsurplus bug 28321: add support for rendering customCode AND normal field rendering |
130 | - if(!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) { |
|
130 | + if (!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) { |
|
131 | 131 | require_once('include/connectors/utils/ConnectorUtils.php'); |
132 | - $code .= ' ' . ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty); |
|
132 | + $code .= ' '.ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty); |
|
133 | 133 | } |
134 | 134 | return $code; |
135 | 135 | } |