@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | * Connector factory |
43 | 43 | * @api |
44 | 44 | */ |
45 | -class ConnectorFactory{ |
|
45 | +class ConnectorFactory { |
|
46 | 46 | |
47 | 47 | static $source_map = array(); |
48 | 48 | |
49 | - public static function getInstance($source_name){ |
|
50 | - if(empty(self::$source_map[$source_name])) { |
|
49 | + public static function getInstance($source_name) { |
|
50 | + if (empty(self::$source_map[$source_name])) { |
|
51 | 51 | require_once('include/connectors/sources/SourceFactory.php'); |
52 | 52 | require_once('include/connectors/component.php'); |
53 | 53 | $source = SourceFactory::getSource($source_name); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * which represents the inheritance structure to load up all required parents. |
65 | 65 | * @param string $class the root class we want to load. |
66 | 66 | */ |
67 | - public static function load($class, $type){ |
|
67 | + public static function load($class, $type) { |
|
68 | 68 | self::loadClass($class, $type); |
69 | 69 | } |
70 | 70 | |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | * include a source class file. |
73 | 73 | * @param string $class a class file to include. |
74 | 74 | */ |
75 | - public static function loadClass($class, $type){ |
|
76 | - $dir = str_replace('_','/',$class); |
|
75 | + public static function loadClass($class, $type) { |
|
76 | + $dir = str_replace('_', '/', $class); |
|
77 | 77 | $parts = explode("/", $dir); |
78 | - $file = $parts[count($parts)-1] . '.php'; |
|
79 | - if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){ |
|
78 | + $file = $parts[count($parts) - 1].'.php'; |
|
79 | + if (file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
80 | 80 | require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file"); |
81 | - } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
81 | + } else if (file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
82 | 82 | require_once("modules/Connectors/connectors/{$type}/{$dir}/$file"); |
83 | - } else if(file_exists("connectors/{$type}/{$dir}/$file")) { |
|
83 | + } else if (file_exists("connectors/{$type}/{$dir}/$file")) { |
|
84 | 84 | require_once("connectors/{$type}/{$dir}/$file"); |
85 | 85 | } |
86 | 86 | } |
@@ -49,31 +49,31 @@ |
||
49 | 49 | * |
50 | 50 | * @return an instance of SugarController |
51 | 51 | */ |
52 | - static function getController($module){ |
|
52 | + static function getController($module) { |
|
53 | 53 | $class = ucfirst($module).'Controller'; |
54 | - $customClass = 'Custom' . $class; |
|
55 | - if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | - $customClass = 'Custom' . $class; |
|
54 | + $customClass = 'Custom'.$class; |
|
55 | + if (file_exists('custom/modules/'.$module.'/controller.php')) { |
|
56 | + $customClass = 'Custom'.$class; |
|
57 | 57 | require_once('custom/modules/'.$module.'/controller.php'); |
58 | - if(class_exists($customClass)){ |
|
58 | + if (class_exists($customClass)) { |
|
59 | 59 | $controller = new $customClass(); |
60 | - }else if(class_exists($class)){ |
|
60 | + } else if (class_exists($class)) { |
|
61 | 61 | $controller = new $class(); |
62 | 62 | } |
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
63 | + }elseif (file_exists('modules/'.$module.'/controller.php')) { |
|
64 | 64 | require_once('modules/'.$module.'/controller.php'); |
65 | - if(class_exists($customClass)){ |
|
65 | + if (class_exists($customClass)) { |
|
66 | 66 | $controller = new $customClass(); |
67 | - }else if(class_exists($class)){ |
|
67 | + } else if (class_exists($class)) { |
|
68 | 68 | $controller = new $class(); |
69 | 69 | } |
70 | - }else{ |
|
71 | - if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
70 | + } else { |
|
71 | + if (file_exists('custom/include/MVC/Controller/SugarController.php')) { |
|
72 | 72 | require_once('custom/include/MVC/Controller/SugarController.php'); |
73 | 73 | } |
74 | - if(class_exists('CustomSugarController')){ |
|
74 | + if (class_exists('CustomSugarController')) { |
|
75 | 75 | $controller = new CustomSugarController(); |
76 | - }else{ |
|
76 | + } else { |
|
77 | 77 | $controller = new SugarController(); |
78 | 78 | } |
79 | 79 | } |
@@ -44,21 +44,21 @@ |
||
44 | 44 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
45 | 45 | */ |
46 | 46 | //format '<action_name>' => '<view_name>' |
47 | -$action_view_map['multieditview']= 'multiedit'; |
|
48 | -$action_view_map['detailview']= 'detail'; |
|
49 | -$action_view_map['editview']= 'edit'; |
|
50 | -$action_view_map['listview']= 'list'; |
|
51 | -$action_view_map['popup']= 'popup'; |
|
52 | -$action_view_map['vcard']= 'vcard'; |
|
53 | -$action_view_map['importvcard']= 'importvcard'; |
|
54 | -$action_view_map['importvcardsave']= 'importvcardsave'; |
|
55 | -$action_view_map['modulelistmenu']= 'modulelistmenu'; |
|
56 | -$action_view_map['favorites']= 'favorites'; |
|
57 | -$action_view_map['ajaxui']= 'ajaxui'; |
|
58 | -$action_view_map['noaccess']= 'noaccess'; |
|
47 | +$action_view_map['multieditview'] = 'multiedit'; |
|
48 | +$action_view_map['detailview'] = 'detail'; |
|
49 | +$action_view_map['editview'] = 'edit'; |
|
50 | +$action_view_map['listview'] = 'list'; |
|
51 | +$action_view_map['popup'] = 'popup'; |
|
52 | +$action_view_map['vcard'] = 'vcard'; |
|
53 | +$action_view_map['importvcard'] = 'importvcard'; |
|
54 | +$action_view_map['importvcardsave'] = 'importvcardsave'; |
|
55 | +$action_view_map['modulelistmenu'] = 'modulelistmenu'; |
|
56 | +$action_view_map['favorites'] = 'favorites'; |
|
57 | +$action_view_map['ajaxui'] = 'ajaxui'; |
|
58 | +$action_view_map['noaccess'] = 'noaccess'; |
|
59 | 59 | |
60 | 60 | // SugarPDF |
61 | -$action_view_map['sugarpdf']= 'sugarpdf'; |
|
61 | +$action_view_map['sugarpdf'] = 'sugarpdf'; |
|
62 | 62 | $action_view_map['dc'] = 'dc'; |
63 | 63 | $action_view_map['dcajax'] = 'dcajax'; |
64 | 64 | $action_view_map['quick'] = 'quick'; |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $version = $version[0]; |
66 | 66 | if (empty($yui_path[$version])) continue; |
67 | 67 | |
68 | - $path = $yui_path[$version] . substr($param, strlen($version)); |
|
68 | + $path = $yui_path[$version].substr($param, strlen($version)); |
|
69 | 69 | |
70 | 70 | $extension = substr($path, strrpos($path, "_") + 1); |
71 | 71 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $contentType = $types[$extension]; |
79 | 79 | } |
80 | 80 | //Put together the final filepath |
81 | - $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
81 | + $path = substr($path, 0, strrpos($path, "_")).".".$extension; |
|
82 | 82 | $contents = ''; |
83 | 83 | if (is_file($path)) { |
84 | - $out .= "/*" . $path . "*/\n"; |
|
85 | - $contents = file_get_contents($path); |
|
86 | - $out .= $contents . "\n"; |
|
84 | + $out .= "/*".$path."*/\n"; |
|
85 | + $contents = file_get_contents($path); |
|
86 | + $out .= $contents."\n"; |
|
87 | 87 | } |
88 | 88 | $path = empty($contents) ? $path : $contents; |
89 | 89 | $allpath .= md5($path); |
@@ -95,6 +95,6 @@ discard block |
||
95 | 95 | header("Cache-Control: private"); |
96 | 96 | header("Pragma: dummy=bogus"); |
97 | 97 | header("Etag: $etag"); |
98 | -header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000)); |
|
98 | +header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000)); |
|
99 | 99 | header("Content-Type: $contentType"); |
100 | 100 | echo ($out); |
101 | 101 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -64,28 +64,28 @@ discard block |
||
64 | 64 | $cacheDir = create_cache_directory('dashlets/'); |
65 | 65 | $allDashlets = array_merge($dashletFiles, $dashletFilesCustom); |
66 | 66 | $dashletFiles = array(); |
67 | - foreach($allDashlets as $num => $file) { |
|
68 | - if(substr_count($file, '.meta') == 0) { // ignore meta data files |
|
67 | + foreach ($allDashlets as $num => $file) { |
|
68 | + if (substr_count($file, '.meta') == 0) { // ignore meta data files |
|
69 | 69 | $class = substr($file, strrpos($file, '/') + 1, -4); |
70 | 70 | $dashletFiles[$class] = array(); |
71 | 71 | $dashletFiles[$class]['file'] = $file; |
72 | 72 | $dashletFiles[$class]['class'] = $class; |
73 | - if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file? |
|
73 | + if (is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file? |
|
74 | 74 | $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file); |
75 | 75 | require($dashletFiles[$class]['meta']); |
76 | - if ( isset($dashletMeta[$class]['module']) ) |
|
76 | + if (isset($dashletMeta[$class]['module'])) |
|
77 | 77 | $dashletFiles[$class]['module'] = $dashletMeta[$class]['module']; |
78 | 78 | } |
79 | 79 | |
80 | 80 | $filesInDirectory = array(); |
81 | 81 | getFiles($filesInDirectory, substr($file, 0, strrpos($file, '/')), '/^.*\/Dashlets\/[^\.]*\.icon\.(jpg|jpeg|gif|png)$/i'); |
82 | - if(!empty($filesInDirectory)) { |
|
82 | + if (!empty($filesInDirectory)) { |
|
83 | 83 | $dashletFiles[$class]['icon'] = $filesInDirectory[0]; // take the first icon we see |
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir . 'dashlets.php'); |
|
88 | + write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir.'dashlets.php'); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | ?> |
92 | 92 | \ No newline at end of file |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | */ |
93 | 93 | public function getTitle() { |
94 | - $matches = array (); |
|
94 | + $matches = array(); |
|
95 | 95 | preg_match("/<title>.*?<\/title>/i", $this->contents, $matches); |
96 | 96 | if (isset($matches[0])) { |
97 | 97 | $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]); |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | |
101 | 101 | public function cutLength() { |
102 | 102 | if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) { |
103 | - $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith; |
|
103 | + $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding).$this->endWith; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | 107 | private function _identifyXmlEncoding() { |
108 | - $matches = array (); |
|
108 | + $matches = array(); |
|
109 | 109 | preg_match('/encoding\=*\".*?\"/', $this->contents, $matches); |
110 | 110 | if (isset($matches[0])) { |
111 | 111 | $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"'); |
@@ -37,11 +37,11 @@ |
||
37 | 37 | function smarty_function_sugar_number_format($params, &$smarty) { |
38 | 38 | global $locale; |
39 | 39 | |
40 | - if(!isset($params['var']) || $params['var'] === '') { |
|
40 | + if (!isset($params['var']) || $params['var'] === '') { |
|
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 | |
44 | - if ( !isset($params['precision']) ) { |
|
44 | + if (!isset($params['precision'])) { |
|
45 | 45 | $params['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits'); |
46 | 46 | } |
47 | 47 |
@@ -21,9 +21,9 @@ |
||
21 | 21 | * @param boolean |
22 | 22 | * @return string |
23 | 23 | */ |
24 | -function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false) |
|
24 | +function smarty_modifier_wordwrap($string, $length = 80, $break = "\n", $cut = false) |
|
25 | 25 | { |
26 | - return wordwrap($string,$length,$break,$cut); |
|
26 | + return wordwrap($string, $length, $break, $cut); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | ?> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | function smarty_function_html_options($params, &$smarty) |
31 | 31 | { |
32 | - require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); |
|
32 | + require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars'); |
|
33 | 33 | |
34 | 34 | $name = null; |
35 | 35 | $values = null; |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | $extra = ''; |
41 | 41 | |
42 | - foreach($params as $_key => $_val) { |
|
43 | - switch($_key) { |
|
42 | + foreach ($params as $_key => $_val) { |
|
43 | + switch ($_key) { |
|
44 | 44 | case 'name': |
45 | 45 | $$_key = (string)$_val; |
46 | 46 | break; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | break; |
60 | 60 | |
61 | 61 | default: |
62 | - if(!is_array($_val)) { |
|
62 | + if (!is_array($_val)) { |
|
63 | 63 | $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; |
64 | 64 | } else { |
65 | 65 | $smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE); |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | - if(!empty($name)) { |
|
91 | - $_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n"; |
|
90 | + if (!empty($name)) { |
|
91 | + $_html_result = '<select name="'.$name.'"'.$extra.'>'."\n".$_html_result.'</select>'."\n"; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $_html_result; |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | function smarty_function_html_options_optoutput($key, $value, $selected) { |
99 | - if(!is_array($value)) { |
|
100 | - $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' . |
|
101 | - smarty_function_escape_special_chars($key) . '"'; |
|
99 | + if (!is_array($value)) { |
|
100 | + $_html_result = '<option label="'.smarty_function_escape_special_chars($value).'" value="'. |
|
101 | + smarty_function_escape_special_chars($key).'"'; |
|
102 | 102 | if (in_array((string)$key, $selected)) |
103 | 103 | $_html_result .= ' selected="selected"'; |
104 | - $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n"; |
|
104 | + $_html_result .= '>'.smarty_function_escape_special_chars($value).'</option>'."\n"; |
|
105 | 105 | } else { |
106 | 106 | $_html_result = smarty_function_html_options_optgroup($key, $value, $selected); |
107 | 107 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | function smarty_function_html_options_optgroup($key, $values, $selected) { |
112 | - $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n"; |
|
112 | + $optgroup_html = '<optgroup label="'.smarty_function_escape_special_chars($key).'">'."\n"; |
|
113 | 113 | foreach ($values as $key => $value) { |
114 | 114 | $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected); |
115 | 115 | } |