@@ -68,46 +68,46 @@ |
||
68 | 68 | |
69 | 69 | function smarty_function_sugarvar($params, &$smarty) |
70 | 70 | { |
71 | - if(empty($params['key'])) { |
|
72 | - $smarty->trigger_error("sugarvar: missing 'key' parameter"); |
|
73 | - return; |
|
74 | - } |
|
75 | - |
|
76 | - $object = (empty($params['objectName']))?$smarty->get_template_vars('parentFieldArray'): $params['objectName']; |
|
77 | - $displayParams = $smarty->get_template_vars('displayParams'); |
|
78 | - |
|
79 | - |
|
80 | - if(empty($params['memberName'])){ |
|
81 | - $member = $smarty->get_template_vars('vardef'); |
|
82 | - $member = $member['name']; |
|
83 | - }else{ |
|
84 | - $members = explode('.', $params['memberName']); |
|
85 | - $member = $smarty->get_template_vars($members[0]); |
|
86 | - for($i = 1; $i < count($members); $i++){ |
|
87 | - $member = $member[$members[$i]]; |
|
88 | - } |
|
89 | - } |
|
71 | + if(empty($params['key'])) { |
|
72 | + $smarty->trigger_error("sugarvar: missing 'key' parameter"); |
|
73 | + return; |
|
74 | + } |
|
75 | + |
|
76 | + $object = (empty($params['objectName']))?$smarty->get_template_vars('parentFieldArray'): $params['objectName']; |
|
77 | + $displayParams = $smarty->get_template_vars('displayParams'); |
|
78 | + |
|
79 | + |
|
80 | + if(empty($params['memberName'])){ |
|
81 | + $member = $smarty->get_template_vars('vardef'); |
|
82 | + $member = $member['name']; |
|
83 | + }else{ |
|
84 | + $members = explode('.', $params['memberName']); |
|
85 | + $member = $smarty->get_template_vars($members[0]); |
|
86 | + for($i = 1; $i < count($members); $i++){ |
|
87 | + $member = $member[$members[$i]]; |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | $_contents = '$'. $object . '.' . $member . '.' . $params['key']; |
92 | - if(empty($params['stringFormat']) && empty($params['string'])) { |
|
93 | - $_contents = '{' . $_contents; |
|
94 | - if(!empty($displayParams['htmlescape'])){ |
|
95 | - $_contents .= '|escape:\'html\''; |
|
96 | - } |
|
97 | - if(!empty($params['htmlentitydecode'])){ |
|
98 | - $_contents .= '|escape:\'html_entity_decode\''; |
|
99 | - } |
|
100 | - if(!empty($displayParams['strip_tags'])){ |
|
101 | - $_contents .= '|strip_tags'; |
|
102 | - } |
|
103 | - if(!empty($displayParams['url2html'])){ |
|
104 | - $_contents .= '|url2html'; |
|
105 | - } |
|
106 | - if(!empty($displayParams['nl2br'])){ |
|
107 | - $_contents .= '|nl2br'; |
|
108 | - } |
|
109 | - |
|
110 | - $_contents .= '}'; |
|
92 | + if(empty($params['stringFormat']) && empty($params['string'])) { |
|
93 | + $_contents = '{' . $_contents; |
|
94 | + if(!empty($displayParams['htmlescape'])){ |
|
95 | + $_contents .= '|escape:\'html\''; |
|
96 | + } |
|
97 | + if(!empty($params['htmlentitydecode'])){ |
|
98 | + $_contents .= '|escape:\'html_entity_decode\''; |
|
99 | + } |
|
100 | + if(!empty($displayParams['strip_tags'])){ |
|
101 | + $_contents .= '|strip_tags'; |
|
102 | + } |
|
103 | + if(!empty($displayParams['url2html'])){ |
|
104 | + $_contents .= '|url2html'; |
|
105 | + } |
|
106 | + if(!empty($displayParams['nl2br'])){ |
|
107 | + $_contents .= '|nl2br'; |
|
108 | + } |
|
109 | + |
|
110 | + $_contents .= '}'; |
|
111 | 111 | } |
112 | 112 | return $_contents; |
113 | 113 | } |
@@ -68,42 +68,42 @@ |
||
68 | 68 | |
69 | 69 | function smarty_function_sugarvar($params, &$smarty) |
70 | 70 | { |
71 | - if(empty($params['key'])) { |
|
71 | + if (empty($params['key'])) { |
|
72 | 72 | $smarty->trigger_error("sugarvar: missing 'key' parameter"); |
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | - $object = (empty($params['objectName']))?$smarty->get_template_vars('parentFieldArray'): $params['objectName']; |
|
76 | + $object = (empty($params['objectName'])) ? $smarty->get_template_vars('parentFieldArray') : $params['objectName']; |
|
77 | 77 | $displayParams = $smarty->get_template_vars('displayParams'); |
78 | 78 | |
79 | 79 | |
80 | - if(empty($params['memberName'])){ |
|
80 | + if (empty($params['memberName'])) { |
|
81 | 81 | $member = $smarty->get_template_vars('vardef'); |
82 | 82 | $member = $member['name']; |
83 | - }else{ |
|
83 | + } else { |
|
84 | 84 | $members = explode('.', $params['memberName']); |
85 | - $member = $smarty->get_template_vars($members[0]); |
|
86 | - for($i = 1; $i < count($members); $i++){ |
|
85 | + $member = $smarty->get_template_vars($members[0]); |
|
86 | + for ($i = 1; $i < count($members); $i++) { |
|
87 | 87 | $member = $member[$members[$i]]; |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - $_contents = '$'. $object . '.' . $member . '.' . $params['key']; |
|
92 | - if(empty($params['stringFormat']) && empty($params['string'])) { |
|
93 | - $_contents = '{' . $_contents; |
|
94 | - if(!empty($displayParams['htmlescape'])){ |
|
91 | + $_contents = '$'.$object.'.'.$member.'.'.$params['key']; |
|
92 | + if (empty($params['stringFormat']) && empty($params['string'])) { |
|
93 | + $_contents = '{'.$_contents; |
|
94 | + if (!empty($displayParams['htmlescape'])) { |
|
95 | 95 | $_contents .= '|escape:\'html\''; |
96 | 96 | } |
97 | - if(!empty($params['htmlentitydecode'])){ |
|
97 | + if (!empty($params['htmlentitydecode'])) { |
|
98 | 98 | $_contents .= '|escape:\'html_entity_decode\''; |
99 | 99 | } |
100 | - if(!empty($displayParams['strip_tags'])){ |
|
100 | + if (!empty($displayParams['strip_tags'])) { |
|
101 | 101 | $_contents .= '|strip_tags'; |
102 | 102 | } |
103 | - if(!empty($displayParams['url2html'])){ |
|
103 | + if (!empty($displayParams['url2html'])) { |
|
104 | 104 | $_contents .= '|url2html'; |
105 | 105 | } |
106 | - if(!empty($displayParams['nl2br'])){ |
|
106 | + if (!empty($displayParams['nl2br'])) { |
|
107 | 107 | $_contents .= '|nl2br'; |
108 | 108 | } |
109 | 109 |
@@ -80,7 +80,7 @@ |
||
80 | 80 | if(empty($params['memberName'])){ |
81 | 81 | $member = $smarty->get_template_vars('vardef'); |
82 | 82 | $member = $member['name']; |
83 | - }else{ |
|
83 | + } else{ |
|
84 | 84 | $members = explode('.', $params['memberName']); |
85 | 85 | $member = $smarty->get_template_vars($members[0]); |
86 | 86 | for($i = 1; $i < count($members); $i++){ |
@@ -27,44 +27,44 @@ |
||
27 | 27 | */ |
28 | 28 | function smarty_function_sugar_button_slider($params, &$smarty) |
29 | 29 | { |
30 | - if(empty($params['module'])) { |
|
31 | - $smarty->trigger_error("sugar_button_slider: missing required param (module)"); |
|
32 | - } else if(empty($params['buttons'])) { |
|
33 | - $smarty->trigger_error("sugar_button_slider: missing required param (buttons)"); |
|
34 | - } else if(empty($params['view'])) { |
|
35 | - $smarty->trigger_error("sugar_button_slider: missing required param (view)"); |
|
36 | - } |
|
37 | - $module = $params['module']; |
|
38 | - $view = $params['view']; |
|
39 | - $buttons = $params['buttons']; |
|
40 | - $str = ''; |
|
41 | - if(is_array($buttons)) { |
|
42 | - if(count($buttons) <= 2){ |
|
43 | - foreach($buttons as $val => $button){ |
|
44 | - $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
45 | - } |
|
46 | - }else{ |
|
47 | - $str = '<div id="buttonSlide" class="yui-module">'; |
|
48 | - $str .= '<table border="0">'; |
|
49 | - $str .='<tr><td>'; |
|
50 | - $str .='<div class="yui-hd">'; |
|
51 | - for($i = 0; $i < 2; $i++){ |
|
52 | - $button = $buttons[$i]; |
|
53 | - $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
54 | - $str .= ' '; |
|
55 | - } |
|
56 | - $str .= '</div></td>'; |
|
57 | - $str .='<td align="right"> <div class="yui-bd">'; |
|
58 | - for($i = 2; $i < count($buttons); $i++){ |
|
59 | - $button = $buttons[$i]; |
|
60 | - $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
61 | - $str .= ' '; |
|
62 | - } |
|
63 | - $str .='</div></td>'; |
|
64 | - $str .='</tr></table>'; |
|
65 | - } |
|
66 | - } |
|
67 | - return $str; |
|
30 | + if(empty($params['module'])) { |
|
31 | + $smarty->trigger_error("sugar_button_slider: missing required param (module)"); |
|
32 | + } else if(empty($params['buttons'])) { |
|
33 | + $smarty->trigger_error("sugar_button_slider: missing required param (buttons)"); |
|
34 | + } else if(empty($params['view'])) { |
|
35 | + $smarty->trigger_error("sugar_button_slider: missing required param (view)"); |
|
36 | + } |
|
37 | + $module = $params['module']; |
|
38 | + $view = $params['view']; |
|
39 | + $buttons = $params['buttons']; |
|
40 | + $str = ''; |
|
41 | + if(is_array($buttons)) { |
|
42 | + if(count($buttons) <= 2){ |
|
43 | + foreach($buttons as $val => $button){ |
|
44 | + $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
45 | + } |
|
46 | + }else{ |
|
47 | + $str = '<div id="buttonSlide" class="yui-module">'; |
|
48 | + $str .= '<table border="0">'; |
|
49 | + $str .='<tr><td>'; |
|
50 | + $str .='<div class="yui-hd">'; |
|
51 | + for($i = 0; $i < 2; $i++){ |
|
52 | + $button = $buttons[$i]; |
|
53 | + $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
54 | + $str .= ' '; |
|
55 | + } |
|
56 | + $str .= '</div></td>'; |
|
57 | + $str .='<td align="right"> <div class="yui-bd">'; |
|
58 | + for($i = 2; $i < count($buttons); $i++){ |
|
59 | + $button = $buttons[$i]; |
|
60 | + $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
61 | + $str .= ' '; |
|
62 | + } |
|
63 | + $str .='</div></td>'; |
|
64 | + $str .='</tr></table>'; |
|
65 | + } |
|
66 | + } |
|
67 | + return $str; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | ?> |
@@ -27,41 +27,41 @@ |
||
27 | 27 | */ |
28 | 28 | function smarty_function_sugar_button_slider($params, &$smarty) |
29 | 29 | { |
30 | - if(empty($params['module'])) { |
|
30 | + if (empty($params['module'])) { |
|
31 | 31 | $smarty->trigger_error("sugar_button_slider: missing required param (module)"); |
32 | - } else if(empty($params['buttons'])) { |
|
32 | + } else if (empty($params['buttons'])) { |
|
33 | 33 | $smarty->trigger_error("sugar_button_slider: missing required param (buttons)"); |
34 | - } else if(empty($params['view'])) { |
|
34 | + } else if (empty($params['view'])) { |
|
35 | 35 | $smarty->trigger_error("sugar_button_slider: missing required param (view)"); |
36 | 36 | } |
37 | 37 | $module = $params['module']; |
38 | 38 | $view = $params['view']; |
39 | 39 | $buttons = $params['buttons']; |
40 | 40 | $str = ''; |
41 | - if(is_array($buttons)) { |
|
42 | - if(count($buttons) <= 2){ |
|
43 | - foreach($buttons as $val => $button){ |
|
41 | + if (is_array($buttons)) { |
|
42 | + if (count($buttons) <= 2) { |
|
43 | + foreach ($buttons as $val => $button) { |
|
44 | 44 | $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
45 | 45 | } |
46 | - }else{ |
|
46 | + } else { |
|
47 | 47 | $str = '<div id="buttonSlide" class="yui-module">'; |
48 | 48 | $str .= '<table border="0">'; |
49 | - $str .='<tr><td>'; |
|
50 | - $str .='<div class="yui-hd">'; |
|
51 | - for($i = 0; $i < 2; $i++){ |
|
49 | + $str .= '<tr><td>'; |
|
50 | + $str .= '<div class="yui-hd">'; |
|
51 | + for ($i = 0; $i < 2; $i++) { |
|
52 | 52 | $button = $buttons[$i]; |
53 | 53 | $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
54 | 54 | $str .= ' '; |
55 | 55 | } |
56 | 56 | $str .= '</div></td>'; |
57 | - $str .='<td align="right"> <div class="yui-bd">'; |
|
58 | - for($i = 2; $i < count($buttons); $i++){ |
|
57 | + $str .= '<td align="right"> <div class="yui-bd">'; |
|
58 | + for ($i = 2; $i < count($buttons); $i++) { |
|
59 | 59 | $button = $buttons[$i]; |
60 | 60 | $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
61 | 61 | $str .= ' '; |
62 | 62 | } |
63 | - $str .='</div></td>'; |
|
64 | - $str .='</tr></table>'; |
|
63 | + $str .= '</div></td>'; |
|
64 | + $str .= '</tr></table>'; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | return $str; |
@@ -43,7 +43,7 @@ |
||
43 | 43 | foreach($buttons as $val => $button){ |
44 | 44 | $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
45 | 45 | } |
46 | - }else{ |
|
46 | + } else{ |
|
47 | 47 | $str = '<div id="buttonSlide" class="yui-module">'; |
48 | 48 | $str .= '<table border="0">'; |
49 | 49 | $str .='<tr><td>'; |
@@ -37,13 +37,13 @@ |
||
37 | 37 | |
38 | 38 | function smarty_function_sugar_fetch($params, &$smarty) |
39 | 39 | { |
40 | - if(empty($params['key'])) { |
|
41 | - $smarty->trigger_error("sugar_fetch: missing 'key' parameter"); |
|
42 | - return; |
|
43 | - } |
|
40 | + if(empty($params['key'])) { |
|
41 | + $smarty->trigger_error("sugar_fetch: missing 'key' parameter"); |
|
42 | + return; |
|
43 | + } |
|
44 | 44 | if(empty($params['object'])) { |
45 | - $smarty->trigger_error("sugar_fetch: missing 'object' parameter"); |
|
46 | - return; |
|
45 | + $smarty->trigger_error("sugar_fetch: missing 'object' parameter"); |
|
46 | + return; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $theKey = $params['key']; |
@@ -37,24 +37,24 @@ |
||
37 | 37 | |
38 | 38 | function smarty_function_sugar_fetch($params, &$smarty) |
39 | 39 | { |
40 | - if(empty($params['key'])) { |
|
40 | + if (empty($params['key'])) { |
|
41 | 41 | $smarty->trigger_error("sugar_fetch: missing 'key' parameter"); |
42 | 42 | return; |
43 | 43 | } |
44 | - if(empty($params['object'])) { |
|
44 | + if (empty($params['object'])) { |
|
45 | 45 | $smarty->trigger_error("sugar_fetch: missing 'object' parameter"); |
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | 49 | $theKey = $params['key']; |
50 | - if(is_object($params['object'])) { |
|
50 | + if (is_object($params['object'])) { |
|
51 | 51 | $theData = $params['object']->$theKey; |
52 | 52 | } else { |
53 | 53 | $theData = $params['object'][$theKey]; |
54 | 54 | } |
55 | 55 | |
56 | - if(!empty($params['assign'])) { |
|
57 | - $smarty->assign($params['assign'],$theData); |
|
56 | + if (!empty($params['assign'])) { |
|
57 | + $smarty->assign($params['assign'], $theData); |
|
58 | 58 | } else { |
59 | 59 | return $theData; |
60 | 60 | } |
@@ -40,14 +40,14 @@ |
||
40 | 40 | function smarty_function_sugar_image($params, &$smarty) |
41 | 41 | { |
42 | 42 | |
43 | - if(!isset($params['name'])){ |
|
44 | - $smarty->trigger_error("sugar_field: missing 'name' parameter"); |
|
45 | - return; |
|
46 | - } |
|
47 | - $height = (!empty($params['height']))?$params['height']:'48'; |
|
48 | - $width = (!empty($params['width']))?$params['width']:'48'; |
|
49 | - $image = (!empty($params['image']))?$params['image']:$params['name']; |
|
50 | - $altimage = (!empty($params['altimage']))?$params['altimage']:$params['name']; |
|
51 | - return getStudioIcon($image, $altimage, $height, $width); |
|
43 | + if(!isset($params['name'])){ |
|
44 | + $smarty->trigger_error("sugar_field: missing 'name' parameter"); |
|
45 | + return; |
|
46 | + } |
|
47 | + $height = (!empty($params['height']))?$params['height']:'48'; |
|
48 | + $width = (!empty($params['width']))?$params['width']:'48'; |
|
49 | + $image = (!empty($params['image']))?$params['image']:$params['name']; |
|
50 | + $altimage = (!empty($params['altimage']))?$params['altimage']:$params['name']; |
|
51 | + return getStudioIcon($image, $altimage, $height, $width); |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -40,14 +40,14 @@ |
||
40 | 40 | function smarty_function_sugar_image($params, &$smarty) |
41 | 41 | { |
42 | 42 | |
43 | - if(!isset($params['name'])){ |
|
43 | + if (!isset($params['name'])) { |
|
44 | 44 | $smarty->trigger_error("sugar_field: missing 'name' parameter"); |
45 | 45 | return; |
46 | 46 | } |
47 | - $height = (!empty($params['height']))?$params['height']:'48'; |
|
48 | - $width = (!empty($params['width']))?$params['width']:'48'; |
|
49 | - $image = (!empty($params['image']))?$params['image']:$params['name']; |
|
50 | - $altimage = (!empty($params['altimage']))?$params['altimage']:$params['name']; |
|
47 | + $height = (!empty($params['height'])) ? $params['height'] : '48'; |
|
48 | + $width = (!empty($params['width'])) ? $params['width'] : '48'; |
|
49 | + $image = (!empty($params['image'])) ? $params['image'] : $params['name']; |
|
50 | + $altimage = (!empty($params['altimage'])) ? $params['altimage'] : $params['name']; |
|
51 | 51 | return getStudioIcon($image, $altimage, $height, $width); |
52 | 52 | |
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -21,11 +21,12 @@ |
||
21 | 21 | */ |
22 | 22 | function smarty_modifier_default($string, $default = '') |
23 | 23 | { |
24 | - if (!isset($string) || $string === '') |
|
25 | - return $default; |
|
26 | - else |
|
27 | - return $string; |
|
28 | -} |
|
24 | + if (!isset($string) || $string === '') { |
|
25 | + return $default; |
|
26 | + } else { |
|
27 | + return $string; |
|
28 | + } |
|
29 | + } |
|
29 | 30 | |
30 | 31 | /* vim: set expandtab: */ |
31 | 32 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | if (!empty($params['src'])) { |
31 | 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"; |
|
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 | } |
@@ -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)]; |
@@ -22,7 +22,7 @@ |
||
22 | 22 | function smarty_modifier_count_characters($string, $include_spaces = false) |
23 | 23 | { |
24 | 24 | if ($include_spaces) |
25 | - return(strlen($string)); |
|
25 | + return(strlen($string)); |
|
26 | 26 | |
27 | 27 | return preg_match_all("/[^\s]/",$string, $match); |
28 | 28 | } |
@@ -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: */ |
@@ -21,8 +21,9 @@ |
||
21 | 21 | */ |
22 | 22 | function smarty_modifier_count_characters($string, $include_spaces = false) |
23 | 23 | { |
24 | - if ($include_spaces) |
|
25 | - return(strlen($string)); |
|
24 | + if ($include_spaces) { |
|
25 | + return(strlen($string)); |
|
26 | + } |
|
26 | 27 | |
27 | 28 | return preg_match_all("/[^\s]/",$string, $match); |
28 | 29 | } |
@@ -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 |