@@ -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. |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 52 | 52 | */ |
| 53 | - function SugarWidgetFieldparent_type(&$layout_manager){ |
|
| 53 | + function SugarWidgetFieldparent_type(&$layout_manager) { |
|
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | - if(isset($GLOBALS['log'])) { |
|
| 55 | + if (isset($GLOBALS['log'])) { |
|
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | 57 | } |
| 58 | 58 | else { |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | function displayListPlain($layout_def) { |
| 66 | - $value= $this->_get_list_value($layout_def); |
|
| 67 | - if (isset($layout_def['widget_type']) && $layout_def['widget_type'] =='checkbox') { |
|
| 68 | - if ($value != '' && ($value == 'on' || intval($value) == 1 || $value == 'yes')) |
|
| 66 | + $value = $this->_get_list_value($layout_def); |
|
| 67 | + if (isset($layout_def['widget_type']) && $layout_def['widget_type'] == 'checkbox') { |
|
| 68 | + if ($value != '' && ($value == 'on' || intval($value) == 1 || $value == 'yes')) |
|
| 69 | 69 | { |
| 70 | 70 | return "<input name='checkbox_display' class='checkbox' type='checkbox' disabled='true' checked>"; |
| 71 | 71 | } |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -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. |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | class SugarWidgetSubPanelTopSelectButton extends SugarWidgetSubPanelTopButton |
| 47 | 47 | { |
| 48 | 48 | //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
| 49 | - function __construct($button_properties=array()) |
|
| 49 | + function __construct($button_properties = array()) |
|
| 50 | 50 | { |
| 51 | - $this->button_properties=$button_properties; |
|
| 51 | + $this->button_properties = $button_properties; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 56 | 56 | */ |
| 57 | - function SugarWidgetSubPanelTopSelectButton($button_properties=array()){ |
|
| 57 | + function SugarWidgetSubPanelTopSelectButton($button_properties = array()) { |
|
| 58 | 58 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 59 | - if(isset($GLOBALS['log'])) { |
|
| 59 | + if (isset($GLOBALS['log'])) { |
|
| 60 | 60 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 61 | 61 | } |
| 62 | 62 | else { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public function getWidgetId($buttonSuffix = true) |
| 70 | 70 | { |
| 71 | - return parent::getWidgetId(false) . 'select_button'; |
|
| 71 | + return parent::getWidgetId(false).'select_button'; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function getDisplayName() |
@@ -81,38 +81,38 @@ discard block |
||
| 81 | 81 | global $app_strings; |
| 82 | 82 | $initial_filter = ''; |
| 83 | 83 | |
| 84 | - $this->title = $this->getTitle(); |
|
| 84 | + $this->title = $this->getTitle(); |
|
| 85 | 85 | $this->accesskey = $this->getAccesskey(); |
| 86 | 86 | $this->value = $this->getDisplayName(); |
| 87 | 87 | |
| 88 | 88 | if (is_array($this->button_properties)) { |
| 89 | - if( isset($this->button_properties['title'])) { |
|
| 89 | + if (isset($this->button_properties['title'])) { |
|
| 90 | 90 | $this->title = $app_strings[$this->button_properties['title']]; |
| 91 | 91 | } |
| 92 | - if( isset($this->button_properties['accesskey'])) { |
|
| 92 | + if (isset($this->button_properties['accesskey'])) { |
|
| 93 | 93 | $this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
| 94 | 94 | } |
| 95 | - if( isset($this->button_properties['form_value'])) { |
|
| 95 | + if (isset($this->button_properties['form_value'])) { |
|
| 96 | 96 | $this->value = $app_strings[$this->button_properties['form_value']]; |
| 97 | 97 | } |
| 98 | - if( isset($this->button_properties['module'])) { |
|
| 98 | + if (isset($this->button_properties['module'])) { |
|
| 99 | 99 | $this->module_name = $this->button_properties['module']; |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | $focus = $widget_data['focus']; |
| 105 | - if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 106 | - $button = ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
| 107 | - . ' title="' . $this->title . '"' |
|
| 108 | - . ' value="' . $this->value . "\"\n" |
|
| 105 | + if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)) { |
|
| 106 | + $button = ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\n" |
|
| 107 | + . ' title="'.$this->title.'"' |
|
| 108 | + . ' value="'.$this->value."\"\n" |
|
| 109 | 109 | .' disabled />'; |
| 110 | 110 | return $button; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | //refresh the whole page after end of action? |
| 114 | 114 | $refresh_page = 0; |
| 115 | - if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 115 | + if (!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])) { |
|
| 116 | 116 | $refresh_page = 1; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -124,31 +124,31 @@ discard block |
||
| 124 | 124 | $this->module_name = $subpanel_definition->get_module_name(); |
| 125 | 125 | } |
| 126 | 126 | $link_field_name = $subpanel_definition->get_data_source_name(true); |
| 127 | - $popup_mode='Single'; |
|
| 128 | - if(isset($widget_data['mode'])){ |
|
| 129 | - $popup_mode=$widget_data['mode']; |
|
| 127 | + $popup_mode = 'Single'; |
|
| 128 | + if (isset($widget_data['mode'])) { |
|
| 129 | + $popup_mode = $widget_data['mode']; |
|
| 130 | 130 | } |
| 131 | - if(isset($widget_data['initial_filter_fields'])){ |
|
| 131 | + if (isset($widget_data['initial_filter_fields'])) { |
|
| 132 | 132 | if (is_array($widget_data['initial_filter_fields'])) { |
| 133 | 133 | foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
| 134 | 134 | if (isset($focus->$value) and !empty($focus->$value)) { |
| 135 | - $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 135 | + $initial_filter .= "&".$alias.'='.urlencode($focus->$value); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | - $create="true"; |
|
| 141 | - if(isset($widget_data['create'])){ |
|
| 142 | - $create=$widget_data['create']; |
|
| 140 | + $create = "true"; |
|
| 141 | + if (isset($widget_data['create'])) { |
|
| 142 | + $create = $widget_data['create']; |
|
| 143 | 143 | } |
| 144 | 144 | $return_module = $_REQUEST['module']; |
| 145 | 145 | $return_action = 'SubPanelViewer'; |
| 146 | 146 | $return_id = $_REQUEST['record']; |
| 147 | 147 | |
| 148 | 148 | //field_to_name_array |
| 149 | - $fton_array= array('id' => 'subpanel_id'); |
|
| 150 | - if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 151 | - $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 149 | + $fton_array = array('id' => 'subpanel_id'); |
|
| 150 | + if (isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])) { |
|
| 151 | + $fton_array = array_merge($fton_array, $widget_data['field_to_name_array']); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
@@ -174,21 +174,21 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) |
| 176 | 176 | { |
| 177 | - $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
|
| 177 | + $popup_request_data['passthru_data'] = array_merge($popup_request_data['passthru_data'], $this->button_properties['add_to_passthru_data']); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
| 181 | 181 | |
| 182 | - if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 183 | - $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 182 | + if ($this->button_properties['add_to_passthru_data']['return_type'] == 'report') { |
|
| 183 | + $initial_filter = "&module_name=".urlencode($widget_data['module']); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | //acl_roles_users_selectuser_button |
| 187 | 187 | |
| 188 | 188 | $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
| 189 | - return ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
| 190 | - . ' title="' . $this->title . '"' |
|
| 191 | - . ' value="' . $this->value . "\"\n" |
|
| 189 | + return ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\n" |
|
| 190 | + . ' title="'.$this->title.'"' |
|
| 191 | + . ' value="'.$this->value."\"\n" |
|
| 192 | 192 | . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' />\n"; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -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. |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 51 | 51 | */ |
| 52 | - function SugarWidgetFieldDouble(&$layout_manager){ |
|
| 52 | + function SugarWidgetFieldDouble(&$layout_manager) { |
|
| 53 | 53 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 54 | - if(isset($GLOBALS['log'])) { |
|
| 54 | + if (isset($GLOBALS['log'])) { |
|
| 55 | 55 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 56 | 56 | } |
| 57 | 57 | else { |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -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. |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 57 | 57 | */ |
| 58 | - function SugarWidgetFieldName(&$layout_manager){ |
|
| 58 | + function SugarWidgetFieldName(&$layout_manager) { |
|
| 59 | 59 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 60 | - if(isset($GLOBALS['log'])) { |
|
| 60 | + if (isset($GLOBALS['log'])) { |
|
| 61 | 61 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 62 | 62 | } |
| 63 | 63 | else { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | function displayList(&$layout_def) |
| 71 | 71 | { |
| 72 | - if(empty($layout_def['column_key'])) |
|
| 72 | + if (empty($layout_def['column_key'])) |
|
| 73 | 73 | { |
| 74 | 74 | return $this->displayListPlain($layout_def); |
| 75 | 75 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $key = $this->_get_column_alias($layout_def); |
| 81 | 81 | $key = strtoupper($key); |
| 82 | 82 | |
| 83 | - if(empty($layout_def['fields'][$key])) |
|
| 83 | + if (empty($layout_def['fields'][$key])) |
|
| 84 | 84 | { |
| 85 | 85 | $layout_def['name'] = $name; |
| 86 | 86 | return $this->displayListPlain($layout_def); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $field_type = $field_def['type']; |
| 107 | 107 | $str .= "</a>"; |
| 108 | 108 | if ($field_name == 'name') |
| 109 | - $str .= " " .SugarThemeRegistry::current()->getImage("edit_inline","border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(\"$div_id\",\"$value\",\"$module\",\"$record\",\"$field_name\",\"$field_type\");'"); |
|
| 109 | + $str .= " ".SugarThemeRegistry::current()->getImage("edit_inline", "border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(\"$div_id\",\"$value\",\"$module\",\"$record\",\"$field_name\",\"$field_type\");'"); |
|
| 110 | 110 | $str .= "</div>"; |
| 111 | 111 | } |
| 112 | 112 | return $str; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | function _get_normal_column_select($layout_def) |
| 116 | 116 | { |
| 117 | - if ( isset($this->reporter->all_fields) ) { |
|
| 117 | + if (isset($this->reporter->all_fields)) { |
|
| 118 | 118 | $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
| 119 | 119 | } else { |
| 120 | 120 | $field_def = array(); |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // 'fields' are the two fields to concatenate to create the name. |
| 129 | - if ( ! empty($layout_def['table_alias'])) { |
|
| 129 | + if (!empty($layout_def['table_alias'])) { |
|
| 130 | 130 | $alias = $this->reporter->db->concat($layout_def['table_alias'], $field_def['fields']); |
| 131 | - } elseif (! empty($layout_def['name'])) { |
|
| 131 | + } elseif (!empty($layout_def['name'])) { |
|
| 132 | 132 | $alias = $layout_def['name']; |
| 133 | 133 | } else { |
| 134 | 134 | $alias = "*"; |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | global $locale, $current_user; |
| 143 | 143 | |
| 144 | - if ( isset($this->reporter->all_fields) ) { |
|
| 144 | + if (isset($this->reporter->all_fields)) { |
|
| 145 | 145 | $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
| 146 | 146 | } else { |
| 147 | 147 | $field_def = array(); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // 'fields' are the two fields to concatenate to create the name |
| 151 | - if(!isset($field_def['fields'])) |
|
| 151 | + if (!isset($field_def['fields'])) |
|
| 152 | 152 | { |
| 153 | 153 | return $this->_get_normal_column_select($layout_def); |
| 154 | 154 | } |
@@ -159,22 +159,22 @@ discard block |
||
| 159 | 159 | return parent::_get_column_select($layout_def); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if ( ! empty($layout_def['table_alias'])) { |
|
| 162 | + if (!empty($layout_def['table_alias'])) { |
|
| 163 | 163 | $comps = preg_split("/([fl])/", $localeNameFormat, null, PREG_SPLIT_DELIM_CAPTURE); |
| 164 | 164 | $name = array(); |
| 165 | - foreach($comps as $val) { |
|
| 166 | - if($val == 'f') { |
|
| 165 | + foreach ($comps as $val) { |
|
| 166 | + if ($val == 'f') { |
|
| 167 | 167 | $name[] = $this->reporter->db->convert($layout_def['table_alias'].".".$field_def['fields'][0], 'IFNULL', array("''")); |
| 168 | - } elseif($val == 'l') { |
|
| 168 | + } elseif ($val == 'l') { |
|
| 169 | 169 | $name[] = $this->reporter->db->convert($layout_def['table_alias'].".".$field_def['fields'][1], 'IFNULL', array("''")); |
| 170 | 170 | } else { |
| 171 | - if(!empty($val)) { |
|
| 171 | + if (!empty($val)) { |
|
| 172 | 172 | $name[] = $this->reporter->db->quoted($val); |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | $alias = $this->reporter->db->convert($name, "CONCAT"); |
| 177 | - } elseif (! empty($layout_def['name'])) { |
|
| 177 | + } elseif (!empty($layout_def['name'])) { |
|
| 178 | 178 | $alias = $layout_def['name']; |
| 179 | 179 | } else { |
| 180 | 180 | $alias = "*"; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $layout_def['type'] = 'id'; |
| 191 | 191 | $input_name0 = $layout_def['input_name0']; |
| 192 | 192 | |
| 193 | - if ( is_array($layout_def['input_name0'])) |
|
| 193 | + if (is_array($layout_def['input_name0'])) |
|
| 194 | 194 | { |
| 195 | 195 | $input_name0 = $layout_def['input_name0'][0]; |
| 196 | 196 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $layout_def['type'] = 'id'; |
| 211 | 211 | $input_name0 = $layout_def['input_name0']; |
| 212 | 212 | |
| 213 | - if ( is_array($layout_def['input_name0'])) |
|
| 213 | + if (is_array($layout_def['input_name0'])) |
|
| 214 | 214 | { |
| 215 | 215 | $input_name0 = $layout_def['input_name0'][0]; |
| 216 | 216 | } |
@@ -227,23 +227,23 @@ discard block |
||
| 227 | 227 | function queryFilterone_of($layout_def, $rename_columns = true) |
| 228 | 228 | { |
| 229 | 229 | |
| 230 | - if($rename_columns) { // this was a hack to get reports working, sugarwidgets should not be renaming $name! |
|
| 230 | + if ($rename_columns) { // this was a hack to get reports working, sugarwidgets should not be renaming $name! |
|
| 231 | 231 | $layout_def['name'] = 'id'; |
| 232 | 232 | $layout_def['type'] = 'id'; |
| 233 | 233 | } |
| 234 | 234 | $arr = array(); |
| 235 | 235 | |
| 236 | - foreach($layout_def['input_name0'] as $value) |
|
| 236 | + foreach ($layout_def['input_name0'] as $value) |
|
| 237 | 237 | { |
| 238 | 238 | if ($value == 'Current User') { |
| 239 | 239 | global $current_user; |
| 240 | - array_push($arr,$this->reporter->db->quoted($current_user->id)); |
|
| 240 | + array_push($arr, $this->reporter->db->quoted($current_user->id)); |
|
| 241 | 241 | } |
| 242 | 242 | else |
| 243 | - array_push($arr,$this->reporter->db->quoted($value)); |
|
| 243 | + array_push($arr, $this->reporter->db->quoted($value)); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $str = implode(",",$arr); |
|
| 246 | + $str = implode(",", $arr); |
|
| 247 | 247 | |
| 248 | 248 | return SugarWidgetFieldid::_get_column_select($layout_def)." IN (".$str.")\n"; |
| 249 | 249 | } |
@@ -251,34 +251,34 @@ discard block |
||
| 251 | 251 | function queryFilternot_one_of($layout_def, $rename_columns = true) |
| 252 | 252 | { |
| 253 | 253 | |
| 254 | - if($rename_columns) { // this was a hack to get reports working, sugarwidgets should not be renaming $name! |
|
| 254 | + if ($rename_columns) { // this was a hack to get reports working, sugarwidgets should not be renaming $name! |
|
| 255 | 255 | $layout_def['name'] = 'id'; |
| 256 | 256 | $layout_def['type'] = 'id'; |
| 257 | 257 | } |
| 258 | 258 | $arr = array(); |
| 259 | 259 | |
| 260 | - foreach($layout_def['input_name0'] as $value) |
|
| 260 | + foreach ($layout_def['input_name0'] as $value) |
|
| 261 | 261 | { |
| 262 | 262 | if ($value == 'Current User') { |
| 263 | 263 | global $current_user; |
| 264 | - array_push($arr,$this->reporter->db->quoted($current_user->id)); |
|
| 264 | + array_push($arr, $this->reporter->db->quoted($current_user->id)); |
|
| 265 | 265 | } |
| 266 | 266 | else |
| 267 | - array_push($arr,$this->reporter->db->quoted($value)); |
|
| 267 | + array_push($arr, $this->reporter->db->quoted($value)); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $str = implode(",",$arr); |
|
| 270 | + $str = implode(",", $arr); |
|
| 271 | 271 | |
| 272 | 272 | return SugarWidgetFieldid::_get_column_select($layout_def)." NOT IN (".$str.")\n"; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | function &queryGroupBy($layout_def) |
| 276 | 276 | { |
| 277 | - if($layout_def['name'] == 'full_name') { |
|
| 277 | + if ($layout_def['name'] == 'full_name') { |
|
| 278 | 278 | $layout_def['name'] = 'id'; |
| 279 | 279 | $layout_def['type'] = 'id'; |
| 280 | 280 | |
| 281 | - $group_by = SugarWidgetFieldid::_get_column_select($layout_def)."\n"; |
|
| 281 | + $group_by = SugarWidgetFieldid::_get_column_select($layout_def)."\n"; |
|
| 282 | 282 | } else { |
| 283 | 283 | // group by clause for user name passes through here. |
| 284 | 284 | $group_by = $this->_get_column_select($layout_def)."\n"; |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -59,8 +61,7 @@ discard block |
||
| 59 | 61 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 60 | 62 | if(isset($GLOBALS['log'])) { |
| 61 | 63 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 62 | - } |
|
| 63 | - else { |
|
| 64 | + } else { |
|
| 64 | 65 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 65 | 66 | } |
| 66 | 67 | self::__construct($layout_manager); |
@@ -89,8 +90,9 @@ discard block |
||
| 89 | 90 | $record = $layout_def['fields'][$key]; |
| 90 | 91 | $layout_def['name'] = $name; |
| 91 | 92 | global $current_user; |
| 92 | - if ($module == 'Users' && !is_admin($current_user)) |
|
| 93 | - $module = 'Employees'; |
|
| 93 | + if ($module == 'Users' && !is_admin($current_user)) { |
|
| 94 | + $module = 'Employees'; |
|
| 95 | + } |
|
| 94 | 96 | $str = "<a target='_blank' href=\"index.php?action=DetailView&module=$module&record=$record\">"; |
| 95 | 97 | $str .= $this->displayListPlain($layout_def); |
| 96 | 98 | $str .= "</a>"; |
@@ -105,8 +107,9 @@ discard block |
||
| 105 | 107 | $field_name = $layout_def['name']; |
| 106 | 108 | $field_type = $field_def['type']; |
| 107 | 109 | $str .= "</a>"; |
| 108 | - if ($field_name == 'name') |
|
| 109 | - $str .= " " .SugarThemeRegistry::current()->getImage("edit_inline","border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(\"$div_id\",\"$value\",\"$module\",\"$record\",\"$field_name\",\"$field_type\");'"); |
|
| 110 | + if ($field_name == 'name') { |
|
| 111 | + $str .= " " .SugarThemeRegistry::current()->getImage("edit_inline","border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(\"$div_id\",\"$value\",\"$module\",\"$record\",\"$field_name\",\"$field_type\");'"); |
|
| 112 | + } |
|
| 110 | 113 | $str .= "</div>"; |
| 111 | 114 | } |
| 112 | 115 | return $str; |
@@ -238,9 +241,9 @@ discard block |
||
| 238 | 241 | if ($value == 'Current User') { |
| 239 | 242 | global $current_user; |
| 240 | 243 | array_push($arr,$this->reporter->db->quoted($current_user->id)); |
| 244 | + } else { |
|
| 245 | + array_push($arr,$this->reporter->db->quoted($value)); |
|
| 241 | 246 | } |
| 242 | - else |
|
| 243 | - array_push($arr,$this->reporter->db->quoted($value)); |
|
| 244 | 247 | } |
| 245 | 248 | |
| 246 | 249 | $str = implode(",",$arr); |
@@ -262,9 +265,9 @@ discard block |
||
| 262 | 265 | if ($value == 'Current User') { |
| 263 | 266 | global $current_user; |
| 264 | 267 | array_push($arr,$this->reporter->db->quoted($current_user->id)); |
| 268 | + } else { |
|
| 269 | + array_push($arr,$this->reporter->db->quoted($value)); |
|
| 265 | 270 | } |
| 266 | - else |
|
| 267 | - array_push($arr,$this->reporter->db->quoted($value)); |
|
| 268 | 271 | } |
| 269 | 272 | |
| 270 | 273 | $str = implode(",",$arr); |
@@ -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. |
@@ -56,27 +56,27 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | /** Take the keys for the strings and look them up. Module is literal, the rest are label keys |
| 58 | 58 | */ |
| 59 | - function __construct($module='', $title='', $access_key='', $form_value='') |
|
| 59 | + function __construct($module = '', $title = '', $access_key = '', $form_value = '') |
|
| 60 | 60 | { |
| 61 | 61 | global $app_strings; |
| 62 | 62 | |
| 63 | - if(is_array($module)) |
|
| 63 | + if (is_array($module)) |
|
| 64 | 64 | { |
| 65 | 65 | // it is really the class details from the mapping |
| 66 | 66 | $class_details = $module; |
| 67 | 67 | |
| 68 | 68 | // If keys were passed into the constructor, translate them from keys to values. |
| 69 | - if(!empty($class_details['module'])) |
|
| 69 | + if (!empty($class_details['module'])) |
|
| 70 | 70 | $this->module = $class_details['module']; |
| 71 | - if(!empty($class_details['title'])) |
|
| 71 | + if (!empty($class_details['title'])) |
|
| 72 | 72 | $this->title = $app_strings[$class_details['title']]; |
| 73 | - if(!empty($class_details['access_key'])) |
|
| 73 | + if (!empty($class_details['access_key'])) |
|
| 74 | 74 | $this->access_key = $app_strings[$class_details['access_key']]; |
| 75 | - if(!empty($class_details['form_value'])) |
|
| 75 | + if (!empty($class_details['form_value'])) |
|
| 76 | 76 | $this->form_value = translate($class_details['form_value'], $this->module); |
| 77 | - if(!empty($class_details['additional_form_fields'])) |
|
| 77 | + if (!empty($class_details['additional_form_fields'])) |
|
| 78 | 78 | $this->additional_form_fields = $class_details['additional_form_fields']; |
| 79 | - if(!empty($class_details['ACL'])){ |
|
| 79 | + if (!empty($class_details['ACL'])) { |
|
| 80 | 80 | $this->acl = $class_details['ACL']; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | $this->module = $module; |
| 86 | 86 | |
| 87 | 87 | // If keys were passed into the constructor, translate them from keys to values. |
| 88 | - if(!empty($title)) |
|
| 88 | + if (!empty($title)) |
|
| 89 | 89 | $this->title = $app_strings[$title]; |
| 90 | - if(!empty($access_key)) |
|
| 90 | + if (!empty($access_key)) |
|
| 91 | 91 | $this->access_key = $app_strings[$access_key]; |
| 92 | - if(!empty($form_value)) |
|
| 92 | + if (!empty($form_value)) |
|
| 93 | 93 | $this->form_value = translate($form_value, $module); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | /** |
| 98 | 98 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 99 | 99 | */ |
| 100 | - function SugarWidgetSubPanelTopButton($module='', $title='', $access_key='', $form_value=''){ |
|
| 100 | + function SugarWidgetSubPanelTopButton($module = '', $title = '', $access_key = '', $form_value = '') { |
|
| 101 | 101 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 102 | - if(isset($GLOBALS['log'])) { |
|
| 102 | + if (isset($GLOBALS['log'])) { |
|
| 103 | 103 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 104 | 104 | } |
| 105 | 105 | else { |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function getWidgetId($buttonSuffix = true) |
| 112 | 112 | { |
| 113 | - $widgetID = parent::getWidgetId() . '_'.preg_replace('[ ]', '', mb_strtolower($this->form_value, 'UTF-8')); |
|
| 114 | - if($buttonSuffix){ |
|
| 113 | + $widgetID = parent::getWidgetId().'_'.preg_replace('[ ]', '', mb_strtolower($this->form_value, 'UTF-8')); |
|
| 114 | + if ($buttonSuffix) { |
|
| 115 | 115 | $widgetID .= '_button'; |
| 116 | 116 | } |
| 117 | 117 | return $widgetID; |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | global $currentModule; |
| 124 | 124 | |
| 125 | 125 | // Create the additional form fields with real values if they were not passed in |
| 126 | - if(empty($additionalFormFields) && $this->additional_form_fields) |
|
| 126 | + if (empty($additionalFormFields) && $this->additional_form_fields) |
|
| 127 | 127 | { |
| 128 | - foreach($this->additional_form_fields as $key=>$value) |
|
| 128 | + foreach ($this->additional_form_fields as $key=>$value) |
|
| 129 | 129 | { |
| 130 | - if(!empty($defines['focus']->$value)) |
|
| 130 | + if (!empty($defines['focus']->$value)) |
|
| 131 | 131 | { |
| 132 | 132 | $additionalFormFields[$key] = $defines['focus']->$value; |
| 133 | 133 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
| 142 | - if(!empty($this->module)) |
|
| 142 | + if (!empty($this->module)) |
|
| 143 | 143 | { |
| 144 | 144 | $defines['child_module_name'] = $this->module; |
| 145 | 145 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $defines['child_module_name'] = $defines['module']; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $defines['parent_bean_name'] = get_class( $defines['focus']); |
|
| 151 | + $defines['parent_bean_name'] = get_class($defines['focus']); |
|
| 152 | 152 | $relationship_name = $this->get_subpanel_relationship_name($defines); |
| 153 | 153 | |
| 154 | 154 | |
@@ -158,65 +158,65 @@ discard block |
||
| 158 | 158 | $formValues['module'] = $defines['child_module_name']; |
| 159 | 159 | $formValues[strtolower($defines['parent_bean_name'])."_id"] = $defines['focus']->id; |
| 160 | 160 | |
| 161 | - if(isset($defines['focus']->name)) |
|
| 161 | + if (isset($defines['focus']->name)) |
|
| 162 | 162 | { |
| 163 | 163 | $formValues[strtolower($defines['parent_bean_name'])."_name"] = $defines['focus']->name; |
| 164 | 164 | // #26451,add these fields for custom one-to-many relate field. |
| 165 | - if(!empty($defines['child_module_name'])){ |
|
| 165 | + if (!empty($defines['child_module_name'])) { |
|
| 166 | 166 | $formValues[$relationship_name."_name"] = $defines['focus']->name; |
| 167 | 167 | $childFocusName = !empty($GLOBALS['beanList'][$defines['child_module_name']]) ? $GLOBALS['beanList'][$defines['child_module_name']] : ""; |
| 168 | - if(!empty($GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'])){ |
|
| 169 | - $formValues[$GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name']] = $defines['focus']->id; |
|
| 168 | + if (!empty($GLOBALS['dictionary'][$childFocusName]["fields"][$relationship_name.'_name']['id_name'])) { |
|
| 169 | + $formValues[$GLOBALS['dictionary'][$childFocusName]["fields"][$relationship_name.'_name']['id_name']] = $defines['focus']->id; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | $formValues['return_module'] = $currentModule; |
| 175 | 175 | |
| 176 | - if($currentModule == 'Campaigns'){ |
|
| 176 | + if ($currentModule == 'Campaigns') { |
|
| 177 | 177 | $formValues['return_action'] = "DetailView"; |
| 178 | - }else{ |
|
| 178 | + } else { |
|
| 179 | 179 | $formValues['return_action'] = $defines['action']; |
| 180 | - if ( $formValues['return_action'] == 'SubPanelViewer' ) { |
|
| 180 | + if ($formValues['return_action'] == 'SubPanelViewer') { |
|
| 181 | 181 | $formValues['return_action'] = 'DetailView'; |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | $formValues['return_id'] = $defines['focus']->id; |
| 186 | 186 | $formValues['return_relationship'] = $relationship_name; |
| 187 | - switch ( strtolower( $currentModule ) ) |
|
| 187 | + switch (strtolower($currentModule)) |
|
| 188 | 188 | { |
| 189 | 189 | case 'prospects' : |
| 190 | - $name = $defines['focus']->account_name ; |
|
| 191 | - break ; |
|
| 190 | + $name = $defines['focus']->account_name; |
|
| 191 | + break; |
|
| 192 | 192 | case 'documents' : |
| 193 | - $name = $defines['focus']->document_name ; |
|
| 194 | - break ; |
|
| 193 | + $name = $defines['focus']->document_name; |
|
| 194 | + break; |
|
| 195 | 195 | case 'kbdocuments' : |
| 196 | - $name = $defines['focus']->kbdocument_name ; |
|
| 197 | - break ; |
|
| 196 | + $name = $defines['focus']->kbdocument_name; |
|
| 197 | + break; |
|
| 198 | 198 | case 'leads' : |
| 199 | 199 | case 'contacts' : |
| 200 | - $name = $defines['focus']->first_name . " " .$defines['focus']->last_name ; |
|
| 201 | - break ; |
|
| 200 | + $name = $defines['focus']->first_name." ".$defines['focus']->last_name; |
|
| 201 | + break; |
|
| 202 | 202 | default : |
| 203 | 203 | $name = (isset($defines['focus']->name)) ? $defines['focus']->name : ""; |
| 204 | 204 | } |
| 205 | 205 | $formValues['return_name'] = $name; |
| 206 | 206 | |
| 207 | 207 | // TODO: move this out and get $additionalFormFields working properly |
| 208 | - if(empty($additionalFormFields['parent_type'])) |
|
| 208 | + if (empty($additionalFormFields['parent_type'])) |
|
| 209 | 209 | { |
| 210 | - if($defines['focus']->object_name=='Contact') { |
|
| 210 | + if ($defines['focus']->object_name == 'Contact') { |
|
| 211 | 211 | $additionalFormFields['parent_type'] = 'Accounts'; |
| 212 | 212 | } |
| 213 | 213 | else { |
| 214 | 214 | $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | - if(empty($additionalFormFields['parent_name'])) |
|
| 217 | + if (empty($additionalFormFields['parent_name'])) |
|
| 218 | 218 | { |
| 219 | - if($defines['focus']->object_name=='Contact') { |
|
| 219 | + if ($defines['focus']->object_name == 'Contact') { |
|
| 220 | 220 | $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
| 221 | 221 | $additionalFormFields['account_name'] = $defines['focus']->account_name; |
| 222 | 222 | } |
@@ -224,54 +224,54 @@ discard block |
||
| 224 | 224 | $additionalFormFields['parent_name'] = $defines['focus']->name; |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | - if(empty($additionalFormFields['parent_id'])) |
|
| 227 | + if (empty($additionalFormFields['parent_id'])) |
|
| 228 | 228 | { |
| 229 | - if($defines['focus']->object_name=='Contact') { |
|
| 229 | + if ($defines['focus']->object_name == 'Contact') { |
|
| 230 | 230 | $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
| 231 | 231 | $additionalFormFields['account_id'] = $defines['focus']->account_id; |
| 232 | - } else if($defines['focus']->object_name=='Contract') { |
|
| 232 | + } else if ($defines['focus']->object_name == 'Contract') { |
|
| 233 | 233 | $additionalFormFields['contract_id'] = $defines['focus']->id; |
| 234 | 234 | } else { |
| 235 | 235 | $additionalFormFields['parent_id'] = $defines['focus']->id; |
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - if ($defines['focus']->object_name=='Opportunity') { |
|
| 239 | + if ($defines['focus']->object_name == 'Opportunity') { |
|
| 240 | 240 | $additionalFormFields['account_id'] = $defines['focus']->account_id; |
| 241 | 241 | $additionalFormFields['account_name'] = $defines['focus']->account_name; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - if (!empty($defines['child_module_name']) and $defines['child_module_name']=='Contacts' and !empty($defines['parent_bean_name']) and $defines['parent_bean_name']=='contact' ) { |
|
| 245 | - if (!empty($defines['focus']->id ) and !empty($defines['focus']->name)) { |
|
| 244 | + if (!empty($defines['child_module_name']) and $defines['child_module_name'] == 'Contacts' and !empty($defines['parent_bean_name']) and $defines['parent_bean_name'] == 'contact') { |
|
| 245 | + if (!empty($defines['focus']->id) and !empty($defines['focus']->name)) { |
|
| 246 | 246 | $formValues['reports_to_id'] = $defines['focus']->id; |
| 247 | 247 | $formValues['reports_to_name'] = $defines['focus']->name; |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | $formValues['action'] = "EditView"; |
| 251 | 251 | |
| 252 | - if ( $asUrl ) { |
|
| 252 | + if ($asUrl) { |
|
| 253 | 253 | $returnLink = ''; |
| 254 | - foreach($formValues as $key => $value ) { |
|
| 254 | + foreach ($formValues as $key => $value) { |
|
| 255 | 255 | $returnLink .= $key.'='.$value.'&'; |
| 256 | 256 | } |
| 257 | - foreach($additionalFormFields as $key => $value ) { |
|
| 257 | + foreach ($additionalFormFields as $key => $value) { |
|
| 258 | 258 | $returnLink .= $key.'='.$value.'&'; |
| 259 | 259 | } |
| 260 | - $returnLink = rtrim($returnLink,'&'); |
|
| 260 | + $returnLink = rtrim($returnLink, '&'); |
|
| 261 | 261 | |
| 262 | 262 | return $returnLink; |
| 263 | 263 | } else { |
| 264 | 264 | |
| 265 | - $form = 'form' . $relationship_name; |
|
| 266 | - $button = '<form action="index.php" method="post" name="form" id="' . $form . "\">\n"; |
|
| 267 | - foreach($formValues as $key => $value) { |
|
| 268 | - $button .= "<input type='hidden' name='" . $key . "' value='" . $value . "' />\n"; |
|
| 265 | + $form = 'form'.$relationship_name; |
|
| 266 | + $button = '<form action="index.php" method="post" name="form" id="'.$form."\">\n"; |
|
| 267 | + foreach ($formValues as $key => $value) { |
|
| 268 | + $button .= "<input type='hidden' name='".$key."' value='".$value."' />\n"; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // fill in additional form fields for all but action |
| 272 | - foreach($additionalFormFields as $key => $value) { |
|
| 273 | - if($key != 'action') { |
|
| 274 | - $button .= "<input type='hidden' name='" . $key . "' value='" . $value . "' />\n"; |
|
| 272 | + foreach ($additionalFormFields as $key => $value) { |
|
| 273 | + if ($key != 'action') { |
|
| 274 | + $button .= "<input type='hidden' name='".$key."' value='".$value."' />\n"; |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
@@ -283,18 +283,18 @@ discard block |
||
| 283 | 283 | /** This default function is used to create the HTML for a simple button */ |
| 284 | 284 | function display($defines, $additionalFormFields = null, $nonbutton = false) |
| 285 | 285 | { |
| 286 | - $temp=''; |
|
| 286 | + $temp = ''; |
|
| 287 | 287 | $inputID = $this->getWidgetId(); |
| 288 | 288 | |
| 289 | - if(!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)){ |
|
| 289 | + if (!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)) { |
|
| 290 | 290 | return $temp; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | global $app_strings; |
| 294 | 294 | |
| 295 | - if ( isset($_REQUEST['layout_def_key']) && $_REQUEST['layout_def_key'] == 'UserEAPM' ) { |
|
| 295 | + if (isset($_REQUEST['layout_def_key']) && $_REQUEST['layout_def_key'] == 'UserEAPM') { |
|
| 296 | 296 | // Subpanels generally don't go on the editview, so we have to handle this special |
| 297 | - $megaLink = $this->_get_form($defines, $additionalFormFields,true); |
|
| 297 | + $megaLink = $this->_get_form($defines, $additionalFormFields, true); |
|
| 298 | 298 | $button = "<input title='$this->title' accesskey='$this->access_key' class='button' type='submit' name='$inputID' id='$inputID' value='$this->form_value' onclick='javascript:document.location=\"index.php?".$megaLink."\"; return false;'/>"; |
| 299 | 299 | } else { |
| 300 | 300 | $button = $this->_get_form($defines, $additionalFormFields); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | function get_subpanel_relationship_name($defines) { |
| 325 | 325 | $relationship_name = ''; |
| 326 | - if(!empty($defines)) { |
|
| 326 | + if (!empty($defines)) { |
|
| 327 | 327 | $relationship_name = isset($defines['module']) ? $defines['module'] : ''; |
| 328 | 328 | $dataSource = $defines['subpanel_definition']->get_data_source_name(true); |
| 329 | 329 | if (!empty($dataSource)) { |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -66,31 +68,38 @@ discard block |
||
| 66 | 68 | $class_details = $module; |
| 67 | 69 | |
| 68 | 70 | // If keys were passed into the constructor, translate them from keys to values. |
| 69 | - if(!empty($class_details['module'])) |
|
| 70 | - $this->module = $class_details['module']; |
|
| 71 | - if(!empty($class_details['title'])) |
|
| 72 | - $this->title = $app_strings[$class_details['title']]; |
|
| 73 | - if(!empty($class_details['access_key'])) |
|
| 74 | - $this->access_key = $app_strings[$class_details['access_key']]; |
|
| 75 | - if(!empty($class_details['form_value'])) |
|
| 76 | - $this->form_value = translate($class_details['form_value'], $this->module); |
|
| 77 | - if(!empty($class_details['additional_form_fields'])) |
|
| 78 | - $this->additional_form_fields = $class_details['additional_form_fields']; |
|
| 71 | + if(!empty($class_details['module'])) { |
|
| 72 | + $this->module = $class_details['module']; |
|
| 73 | + } |
|
| 74 | + if(!empty($class_details['title'])) { |
|
| 75 | + $this->title = $app_strings[$class_details['title']]; |
|
| 76 | + } |
|
| 77 | + if(!empty($class_details['access_key'])) { |
|
| 78 | + $this->access_key = $app_strings[$class_details['access_key']]; |
|
| 79 | + } |
|
| 80 | + if(!empty($class_details['form_value'])) { |
|
| 81 | + $this->form_value = translate($class_details['form_value'], $this->module); |
|
| 82 | + } |
|
| 83 | + if(!empty($class_details['additional_form_fields'])) { |
|
| 84 | + $this->additional_form_fields = $class_details['additional_form_fields']; |
|
| 85 | + } |
|
| 79 | 86 | if(!empty($class_details['ACL'])){ |
| 80 | 87 | $this->acl = $class_details['ACL']; |
| 81 | 88 | } |
| 82 | - } |
|
| 83 | - else |
|
| 89 | + } else |
|
| 84 | 90 | { |
| 85 | 91 | $this->module = $module; |
| 86 | 92 | |
| 87 | 93 | // If keys were passed into the constructor, translate them from keys to values. |
| 88 | - if(!empty($title)) |
|
| 89 | - $this->title = $app_strings[$title]; |
|
| 90 | - if(!empty($access_key)) |
|
| 91 | - $this->access_key = $app_strings[$access_key]; |
|
| 92 | - if(!empty($form_value)) |
|
| 93 | - $this->form_value = translate($form_value, $module); |
|
| 94 | + if(!empty($title)) { |
|
| 95 | + $this->title = $app_strings[$title]; |
|
| 96 | + } |
|
| 97 | + if(!empty($access_key)) { |
|
| 98 | + $this->access_key = $app_strings[$access_key]; |
|
| 99 | + } |
|
| 100 | + if(!empty($form_value)) { |
|
| 101 | + $this->form_value = translate($form_value, $module); |
|
| 102 | + } |
|
| 94 | 103 | } |
| 95 | 104 | } |
| 96 | 105 | |
@@ -101,8 +110,7 @@ discard block |
||
| 101 | 110 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 102 | 111 | if(isset($GLOBALS['log'])) { |
| 103 | 112 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 104 | - } |
|
| 105 | - else { |
|
| 113 | + } else { |
|
| 106 | 114 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 107 | 115 | } |
| 108 | 116 | self::__construct($module, $title, $access_key, $form_value); |
@@ -130,8 +138,7 @@ discard block |
||
| 130 | 138 | if(!empty($defines['focus']->$value)) |
| 131 | 139 | { |
| 132 | 140 | $additionalFormFields[$key] = $defines['focus']->$value; |
| 133 | - } |
|
| 134 | - else |
|
| 141 | + } else |
|
| 135 | 142 | { |
| 136 | 143 | $additionalFormFields[$key] = ''; |
| 137 | 144 | } |
@@ -142,8 +149,7 @@ discard block |
||
| 142 | 149 | if(!empty($this->module)) |
| 143 | 150 | { |
| 144 | 151 | $defines['child_module_name'] = $this->module; |
| 145 | - } |
|
| 146 | - else |
|
| 152 | + } else |
|
| 147 | 153 | { |
| 148 | 154 | $defines['child_module_name'] = $defines['module']; |
| 149 | 155 | } |
@@ -175,7 +181,7 @@ discard block |
||
| 175 | 181 | |
| 176 | 182 | if($currentModule == 'Campaigns'){ |
| 177 | 183 | $formValues['return_action'] = "DetailView"; |
| 178 | - }else{ |
|
| 184 | + } else{ |
|
| 179 | 185 | $formValues['return_action'] = $defines['action']; |
| 180 | 186 | if ( $formValues['return_action'] == 'SubPanelViewer' ) { |
| 181 | 187 | $formValues['return_action'] = 'DetailView'; |
@@ -209,8 +215,7 @@ discard block |
||
| 209 | 215 | { |
| 210 | 216 | if($defines['focus']->object_name=='Contact') { |
| 211 | 217 | $additionalFormFields['parent_type'] = 'Accounts'; |
| 212 | - } |
|
| 213 | - else { |
|
| 218 | + } else { |
|
| 214 | 219 | $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
| 215 | 220 | } |
| 216 | 221 | } |
@@ -219,8 +224,7 @@ discard block |
||
| 219 | 224 | if($defines['focus']->object_name=='Contact') { |
| 220 | 225 | $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
| 221 | 226 | $additionalFormFields['account_name'] = $defines['focus']->account_name; |
| 222 | - } |
|
| 223 | - else { |
|
| 227 | + } else { |
|
| 224 | 228 | $additionalFormFields['parent_name'] = $defines['focus']->name; |
| 225 | 229 | } |
| 226 | 230 | } |
@@ -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. |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 52 | 52 | */ |
| 53 | - function SugarWidgetFieldText(&$layout_manager){ |
|
| 53 | + function SugarWidgetFieldText(&$layout_manager) { |
|
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | - if(isset($GLOBALS['log'])) { |
|
| 55 | + if (isset($GLOBALS['log'])) { |
|
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | 57 | } |
| 58 | 58 | else { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | function queryFilterNot_Equals_Str($layout_def) |
| 72 | 72 | { |
| 73 | 73 | $column = $this->_get_column_select($layout_def); |
| 74 | - return "($column IS NULL OR ". $this->reporter->db->convert($column, "text2char")." != ". |
|
| 74 | + return "($column IS NULL OR ".$this->reporter->db->convert($column, "text2char")." != ". |
|
| 75 | 75 | $this->reporter->db->quoted($layout_def['input_name0']).")"; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -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. |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 48 | 48 | */ |
| 49 | - public function SugarWidgetFielddynamicenum($layout_manager){ |
|
| 49 | + public function SugarWidgetFielddynamicenum($layout_manager) { |
|
| 50 | 50 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 51 | - if(isset($GLOBALS['log'])) { |
|
| 51 | + if (isset($GLOBALS['log'])) { |
|
| 52 | 52 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 53 | 53 | } |
| 54 | 54 | else { |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -112,6 +112,8 @@ discard block |
||
| 112 | 112 | * @param object handler object being decorated |
| 113 | 113 | * @param string original open handler method |
| 114 | 114 | * @param string original close handler method |
| 115 | + * @param string $orig_open_method |
|
| 116 | + * @param string $orig_close_method |
|
| 115 | 117 | * @access protected |
| 116 | 118 | */ |
| 117 | 119 | function __construct(&$orig_obj, $orig_open_method, $orig_close_method) { |
@@ -162,6 +164,7 @@ discard block |
||
| 162 | 164 | * Constructs XML_HTMLSax3_LineFeed |
| 163 | 165 | * @param object handler object being decorated |
| 164 | 166 | * @param string original handler method |
| 167 | + * @param string $orig_method |
|
| 165 | 168 | * @access protected |
| 166 | 169 | */ |
| 167 | 170 | function XML_HTMLSax3_LineFeed(&$orig_obj, $orig_method) { |
@@ -204,6 +207,7 @@ discard block |
||
| 204 | 207 | * Constructs XML_HTMLSax3_Tab |
| 205 | 208 | * @param object handler object being decorated |
| 206 | 209 | * @param string original handler method |
| 210 | + * @param string $orig_method |
|
| 207 | 211 | * @access protected |
| 208 | 212 | */ |
| 209 | 213 | function __construct(&$orig_obj, $orig_method) { |
@@ -247,6 +251,7 @@ discard block |
||
| 247 | 251 | * Constructs XML_HTMLSax3_Entities_Parsed |
| 248 | 252 | * @param object handler object being decorated |
| 249 | 253 | * @param string original handler method |
| 254 | + * @param string $orig_method |
|
| 250 | 255 | * @access protected |
| 251 | 256 | */ |
| 252 | 257 | function __construct(&$orig_obj, $orig_method) { |
@@ -271,6 +276,10 @@ discard block |
||
| 271 | 276 | * Compatibility with older PHP versions |
| 272 | 277 | */ |
| 273 | 278 | if (version_compare(phpversion(), '4.3', '<') && !function_exists('html_entity_decode') ) { |
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * @param integer $style |
|
| 282 | + */ |
|
| 274 | 283 | function html_entity_decode($str, $style=ENT_NOQUOTES) { |
| 275 | 284 | return strtr($str, |
| 276 | 285 | array_flip(get_html_translation_table(HTML_ENTITIES,$style))); |
@@ -299,6 +308,7 @@ discard block |
||
| 299 | 308 | * Constructs XML_HTMLSax3_Entities_Unparsed |
| 300 | 309 | * @param object handler object being decorated |
| 301 | 310 | * @param string original handler method |
| 311 | + * @param string $orig_method |
|
| 302 | 312 | * @access protected |
| 303 | 313 | */ |
| 304 | 314 | function __construct(&$orig_obj, $orig_method) { |
@@ -342,6 +352,7 @@ discard block |
||
| 342 | 352 | * Constructs XML_HTMLSax3_Entities_Unparsed |
| 343 | 353 | * @param object handler object being decorated |
| 344 | 354 | * @param string original handler method |
| 355 | + * @param string $orig_method |
|
| 345 | 356 | * @access protected |
| 346 | 357 | */ |
| 347 | 358 | function __construct(&$orig_obj, $orig_method) { |
@@ -52,16 +52,16 @@ discard block |
||
| 52 | 52 | * @access protected |
| 53 | 53 | */ |
| 54 | 54 | function __construct(&$orig_obj, $orig_method) { |
| 55 | - $this->orig_obj =& $orig_obj; |
|
| 55 | + $this->orig_obj = & $orig_obj; |
|
| 56 | 56 | $this->orig_method = $orig_method; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 61 | 61 | */ |
| 62 | - function XML_HTMLSax3_Trim(&$orig_obj, $orig_method){ |
|
| 62 | + function XML_HTMLSax3_Trim(&$orig_obj, $orig_method) { |
|
| 63 | 63 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 64 | - if(isset($GLOBALS['log'])) { |
|
| 64 | + if (isset($GLOBALS['log'])) { |
|
| 65 | 65 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 66 | 66 | } |
| 67 | 67 | else { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @access protected |
| 116 | 116 | */ |
| 117 | 117 | function __construct(&$orig_obj, $orig_open_method, $orig_close_method) { |
| 118 | - $this->orig_obj =& $orig_obj; |
|
| 118 | + $this->orig_obj = & $orig_obj; |
|
| 119 | 119 | $this->orig_open_method = $orig_open_method; |
| 120 | 120 | $this->orig_close_method = $orig_close_method; |
| 121 | 121 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param array tag attributes |
| 127 | 127 | * @access protected |
| 128 | 128 | */ |
| 129 | - function foldOpen(&$parser, $tag, $attrs=array(), $empty = FALSE) { |
|
| 129 | + function foldOpen(&$parser, $tag, $attrs = array(), $empty = FALSE) { |
|
| 130 | 130 | $this->orig_obj->{$this->orig_open_method}($parser, strtoupper($tag), $attrs, $empty); |
| 131 | 131 | } |
| 132 | 132 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @access protected |
| 166 | 166 | */ |
| 167 | 167 | function XML_HTMLSax3_LineFeed(&$orig_obj, $orig_method) { |
| 168 | - $this->orig_obj =& $orig_obj; |
|
| 168 | + $this->orig_obj = & $orig_obj; |
|
| 169 | 169 | $this->orig_method = $orig_method; |
| 170 | 170 | } |
| 171 | 171 | /** |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | * @access protected |
| 176 | 176 | */ |
| 177 | 177 | function breakData(&$parser, $data) { |
| 178 | - $data = explode("\n",$data); |
|
| 179 | - foreach ( $data as $chunk ) { |
|
| 178 | + $data = explode("\n", $data); |
|
| 179 | + foreach ($data as $chunk) { |
|
| 180 | 180 | $this->orig_obj->{$this->orig_method}($parser, $chunk); |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @access protected |
| 208 | 208 | */ |
| 209 | 209 | function __construct(&$orig_obj, $orig_method) { |
| 210 | - $this->orig_obj =& $orig_obj; |
|
| 210 | + $this->orig_obj = & $orig_obj; |
|
| 211 | 211 | $this->orig_method = $orig_method; |
| 212 | 212 | } |
| 213 | 213 | /** |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | * @access protected |
| 218 | 218 | */ |
| 219 | 219 | function breakData(&$parser, $data) { |
| 220 | - $data = explode("\t",$data); |
|
| 221 | - foreach ( $data as $chunk ) { |
|
| 220 | + $data = explode("\t", $data); |
|
| 221 | + foreach ($data as $chunk) { |
|
| 222 | 222 | $this->orig_obj->{$this->orig_method}($this, $chunk); |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @access protected |
| 251 | 251 | */ |
| 252 | 252 | function __construct(&$orig_obj, $orig_method) { |
| 253 | - $this->orig_obj =& $orig_obj; |
|
| 253 | + $this->orig_obj = & $orig_obj; |
|
| 254 | 254 | $this->orig_method = $orig_method; |
| 255 | 255 | } |
| 256 | 256 | /** |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | * @access protected |
| 261 | 261 | */ |
| 262 | 262 | function breakData(&$parser, $data) { |
| 263 | - $data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 264 | - foreach ( $data as $chunk ) { |
|
| 265 | - $chunk = html_entity_decode($chunk,ENT_NOQUOTES); |
|
| 263 | + $data = preg_split('/(&.+?;)/', $data, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 264 | + foreach ($data as $chunk) { |
|
| 265 | + $chunk = html_entity_decode($chunk, ENT_NOQUOTES); |
|
| 266 | 266 | $this->orig_obj->{$this->orig_method}($this, $chunk); |
| 267 | 267 | } |
| 268 | 268 | } |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | /** |
| 271 | 271 | * Compatibility with older PHP versions |
| 272 | 272 | */ |
| 273 | -if (version_compare(phpversion(), '4.3', '<') && !function_exists('html_entity_decode') ) { |
|
| 274 | - function html_entity_decode($str, $style=ENT_NOQUOTES) { |
|
| 273 | +if (version_compare(phpversion(), '4.3', '<') && !function_exists('html_entity_decode')) { |
|
| 274 | + function html_entity_decode($str, $style = ENT_NOQUOTES) { |
|
| 275 | 275 | return strtr($str, |
| 276 | - array_flip(get_html_translation_table(HTML_ENTITIES,$style))); |
|
| 276 | + array_flip(get_html_translation_table(HTML_ENTITIES, $style))); |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | /** |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * @access protected |
| 303 | 303 | */ |
| 304 | 304 | function __construct(&$orig_obj, $orig_method) { |
| 305 | - $this->orig_obj =& $orig_obj; |
|
| 305 | + $this->orig_obj = & $orig_obj; |
|
| 306 | 306 | $this->orig_method = $orig_method; |
| 307 | 307 | } |
| 308 | 308 | /** |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | * @access protected |
| 313 | 313 | */ |
| 314 | 314 | function breakData(&$parser, $data) { |
| 315 | - $data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 316 | - foreach ( $data as $chunk ) { |
|
| 315 | + $data = preg_split('/(&.+?;)/', $data, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 316 | + foreach ($data as $chunk) { |
|
| 317 | 317 | $this->orig_obj->{$this->orig_method}($this, $chunk); |
| 318 | 318 | } |
| 319 | 319 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | * @access protected |
| 346 | 346 | */ |
| 347 | 347 | function __construct(&$orig_obj, $orig_method) { |
| 348 | - $this->orig_obj =& $orig_obj; |
|
| 348 | + $this->orig_obj = & $orig_obj; |
|
| 349 | 349 | $this->orig_method = $orig_method; |
| 350 | 350 | } |
| 351 | 351 | /** |
@@ -356,20 +356,20 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | function strip(&$parser, $data) { |
| 358 | 358 | // Check for HTML comments first |
| 359 | - if ( substr($data,0,2) == '--' ) { |
|
| 359 | + if (substr($data, 0, 2) == '--') { |
|
| 360 | 360 | $patterns = array( |
| 361 | - '/^\-\-/', // Opening comment: -- |
|
| 362 | - '/\-\-$/', // Closing comment: -- |
|
| 361 | + '/^\-\-/', // Opening comment: -- |
|
| 362 | + '/\-\-$/', // Closing comment: -- |
|
| 363 | 363 | ); |
| 364 | - $data = preg_replace($patterns,'',$data); |
|
| 364 | + $data = preg_replace($patterns, '', $data); |
|
| 365 | 365 | |
| 366 | 366 | // Check for XML CDATA sections (note: don't do both!) |
| 367 | - } else if ( substr($data,0,1) == '[' ) { |
|
| 367 | + } else if (substr($data, 0, 1) == '[') { |
|
| 368 | 368 | $patterns = array( |
| 369 | 369 | '/^\[.*CDATA.*\[/s', // Opening CDATA |
| 370 | - '/\].*\]$/s', // Closing CDATA |
|
| 370 | + '/\].*\]$/s', // Closing CDATA |
|
| 371 | 371 | ); |
| 372 | - $data = preg_replace($patterns,'',$data); |
|
| 372 | + $data = preg_replace($patterns, '', $data); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | $this->orig_obj->{$this->orig_method}($this, $data); |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -67,6 +67,9 @@ discard block |
||
| 67 | 67 | $this->generateAppStrings(); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | + /** |
|
| 71 | + * @param string $file |
|
| 72 | + */ |
|
| 70 | 73 | function loadStrings($file) |
| 71 | 74 | { |
| 72 | 75 | $module = strtoupper($this->name); |
@@ -90,6 +93,9 @@ discard block |
||
| 90 | 93 | } |
| 91 | 94 | } |
| 92 | 95 | |
| 96 | + /** |
|
| 97 | + * @param string $file |
|
| 98 | + */ |
|
| 93 | 99 | function loadAppListStrings($file){ |
| 94 | 100 | if(!file_exists($file))return; |
| 95 | 101 | //we may not need this when loading in the app strings, but there is no harm |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | 40 | class MBLanguage{ |
| 41 | - var $iTemplates = array(); |
|
| 42 | - var $templates = array(); |
|
| 43 | - function __construct( $name, $path, $label, $key_name){ |
|
| 44 | - $this->path = $path; |
|
| 45 | - $this->name = $name; |
|
| 46 | - $this->key_name = $key_name; |
|
| 47 | - $this->label = $label; |
|
| 48 | - } |
|
| 41 | + var $iTemplates = array(); |
|
| 42 | + var $templates = array(); |
|
| 43 | + function __construct( $name, $path, $label, $key_name){ |
|
| 44 | + $this->path = $path; |
|
| 45 | + $this->name = $name; |
|
| 46 | + $this->key_name = $key_name; |
|
| 47 | + $this->label = $label; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -62,116 +62,116 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | - function load(){ |
|
| 66 | - $this->generateModStrings(); |
|
| 67 | - $this->generateAppStrings(); |
|
| 68 | - } |
|
| 65 | + function load(){ |
|
| 66 | + $this->generateModStrings(); |
|
| 67 | + $this->generateAppStrings(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - function loadStrings($file) |
|
| 70 | + function loadStrings($file) |
|
| 71 | 71 | { |
| 72 | 72 | $module = strtoupper($this->name); |
| 73 | 73 | $object_name = strtoupper($this->key_name); |
| 74 | 74 | $_object_name = strtolower($this->name); |
| 75 | - if(!file_exists($file))return; |
|
| 75 | + if(!file_exists($file))return; |
|
| 76 | 76 | |
| 77 | - $d = dir($file); |
|
| 78 | - while($e = $d->read()){ |
|
| 79 | - if(substr($e, 0, 1) != '.' && is_file($file . '/' . $e)){ |
|
| 80 | - include($file.'/'. $e); |
|
| 81 | - if(empty($this->strings[$e])){ |
|
| 77 | + $d = dir($file); |
|
| 78 | + while($e = $d->read()){ |
|
| 79 | + if(substr($e, 0, 1) != '.' && is_file($file . '/' . $e)){ |
|
| 80 | + include($file.'/'. $e); |
|
| 81 | + if(empty($this->strings[$e])){ |
|
| 82 | 82 | |
| 83 | - $this->strings[$e] = $mod_strings; |
|
| 84 | - }else{ |
|
| 85 | - $this->strings[$e] = array_merge($this->strings[$e], $mod_strings); |
|
| 86 | - } |
|
| 83 | + $this->strings[$e] = $mod_strings; |
|
| 84 | + }else{ |
|
| 85 | + $this->strings[$e] = array_merge($this->strings[$e], $mod_strings); |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | |
| 89 | - } |
|
| 90 | - } |
|
| 91 | - } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - function loadAppListStrings($file){ |
|
| 93 | + function loadAppListStrings($file){ |
|
| 94 | 94 | if(!file_exists($file))return; |
| 95 | - //we may not need this when loading in the app strings, but there is no harm |
|
| 96 | - //in setting it. |
|
| 97 | - $object_name = strtolower($this->key_name); |
|
| 98 | - |
|
| 99 | - $d = dir($file); |
|
| 100 | - while($e = $d->read()){ |
|
| 101 | - if(substr($e, 0, 1) != '.' && is_file($file . '/' . $e)){ |
|
| 102 | - include($file.'/'. $e); |
|
| 103 | - if(empty($this->appListStrings[$e])){ |
|
| 104 | - |
|
| 105 | - $this->appListStrings[$e] = $app_list_strings; |
|
| 106 | - }else{ |
|
| 107 | - $this->appListStrings[$e] = array_merge($this->appListStrings[$e], $app_list_strings); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - function generateModStrings(){ |
|
| 116 | - $this->strings = array(); |
|
| 117 | - $this->loadTemplates(); |
|
| 118 | - |
|
| 119 | - foreach($this->iTemplates as $template=>$val){ |
|
| 120 | - $file = MB_IMPLEMENTS . '/' . $template . '/language'; |
|
| 121 | - $this->loadStrings($file); |
|
| 122 | - } |
|
| 123 | - foreach($this->templates as $template=>$val){ |
|
| 124 | - $file = MB_TEMPLATES . '/' . $template . '/language'; |
|
| 125 | - $this->loadStrings($file); |
|
| 126 | - } |
|
| 127 | - $this->loadStrings($this->path . '/language'); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - function getModStrings($language='en_us'){ |
|
| 131 | - $language .= '.lang.php'; |
|
| 132 | - if(!empty($this->strings[$language]) && $language != 'en_us.lang.php'){ |
|
| 133 | - return sugarLangArrayMerge($this->strings['en_us.lang.php'], $this->strings[$language]); |
|
| 134 | - } |
|
| 135 | - if(!empty($this->strings['en_us.lang.php']))return $this->strings['en_us.lang.php']; |
|
| 136 | - $empty = array(); |
|
| 137 | - return $empty; |
|
| 138 | - } |
|
| 139 | - function getAppListStrings($language='en_us'){ |
|
| 140 | - $language .= '.lang.php'; |
|
| 141 | - if(!empty($this->appListStrings[$language]) && $language != 'en_us.lang.php'){ |
|
| 142 | - return sugarLangArrayMerge($this->appListStrings['en_us.lang.php'], $this->appListStrings[$language]); |
|
| 143 | - } |
|
| 144 | - if(!empty($this->appListStrings['en_us.lang.php']))return $this->appListStrings['en_us.lang.php']; |
|
| 145 | - $empty = array(); |
|
| 146 | - return $empty; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - function generateAppStrings($buildFromTemplate = true){ |
|
| 150 | - $this->appListStrings = array('en_us.lang.php'=>array()); |
|
| 151 | - //By default, generate app strings for the current language as well. |
|
| 152 | - $this->appListStrings[$GLOBALS [ 'current_language' ] . ".lang.php"] = array(); |
|
| 153 | - $this->loadAppListStrings($this->path . '/../../language/application'); |
|
| 154 | - |
|
| 155 | - if($buildFromTemplate){ |
|
| 156 | - //go through the templates application strings and load anything that is needed |
|
| 157 | - foreach($this->iTemplates as $template=>$val){ |
|
| 158 | - $file = MB_IMPLEMENTS . '/' . $template . '/language/application'; |
|
| 159 | - $this->loadAppListStrings($file); |
|
| 160 | - } |
|
| 161 | - foreach($this->templates as $template=>$val){ |
|
| 162 | - $file = MB_TEMPLATES . '/' . $template . '/language/application'; |
|
| 163 | - $this->loadAppListStrings($file); |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - function save($key_name, $duplicate=false, $rename=false){ |
|
| 168 | - $header = file_get_contents('modules/ModuleBuilder/MB/header.php'); |
|
| 169 | - $save_path = $this->path . '/language'; |
|
| 170 | - mkdir_recursive($save_path); |
|
| 171 | - foreach($this->strings as $lang=>$values){ |
|
| 172 | - //Check if the module Label has changed. |
|
| 173 | - $renameLang = $rename || empty($values) || (isset($values['LBL_MODULE_NAME']) && $this->label != $values['LBL_MODULE_NAME']); |
|
| 174 | - $mod_strings = return_module_language(str_replace('.lang.php','',$lang), 'ModuleBuilder'); |
|
| 95 | + //we may not need this when loading in the app strings, but there is no harm |
|
| 96 | + //in setting it. |
|
| 97 | + $object_name = strtolower($this->key_name); |
|
| 98 | + |
|
| 99 | + $d = dir($file); |
|
| 100 | + while($e = $d->read()){ |
|
| 101 | + if(substr($e, 0, 1) != '.' && is_file($file . '/' . $e)){ |
|
| 102 | + include($file.'/'. $e); |
|
| 103 | + if(empty($this->appListStrings[$e])){ |
|
| 104 | + |
|
| 105 | + $this->appListStrings[$e] = $app_list_strings; |
|
| 106 | + }else{ |
|
| 107 | + $this->appListStrings[$e] = array_merge($this->appListStrings[$e], $app_list_strings); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + function generateModStrings(){ |
|
| 116 | + $this->strings = array(); |
|
| 117 | + $this->loadTemplates(); |
|
| 118 | + |
|
| 119 | + foreach($this->iTemplates as $template=>$val){ |
|
| 120 | + $file = MB_IMPLEMENTS . '/' . $template . '/language'; |
|
| 121 | + $this->loadStrings($file); |
|
| 122 | + } |
|
| 123 | + foreach($this->templates as $template=>$val){ |
|
| 124 | + $file = MB_TEMPLATES . '/' . $template . '/language'; |
|
| 125 | + $this->loadStrings($file); |
|
| 126 | + } |
|
| 127 | + $this->loadStrings($this->path . '/language'); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + function getModStrings($language='en_us'){ |
|
| 131 | + $language .= '.lang.php'; |
|
| 132 | + if(!empty($this->strings[$language]) && $language != 'en_us.lang.php'){ |
|
| 133 | + return sugarLangArrayMerge($this->strings['en_us.lang.php'], $this->strings[$language]); |
|
| 134 | + } |
|
| 135 | + if(!empty($this->strings['en_us.lang.php']))return $this->strings['en_us.lang.php']; |
|
| 136 | + $empty = array(); |
|
| 137 | + return $empty; |
|
| 138 | + } |
|
| 139 | + function getAppListStrings($language='en_us'){ |
|
| 140 | + $language .= '.lang.php'; |
|
| 141 | + if(!empty($this->appListStrings[$language]) && $language != 'en_us.lang.php'){ |
|
| 142 | + return sugarLangArrayMerge($this->appListStrings['en_us.lang.php'], $this->appListStrings[$language]); |
|
| 143 | + } |
|
| 144 | + if(!empty($this->appListStrings['en_us.lang.php']))return $this->appListStrings['en_us.lang.php']; |
|
| 145 | + $empty = array(); |
|
| 146 | + return $empty; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + function generateAppStrings($buildFromTemplate = true){ |
|
| 150 | + $this->appListStrings = array('en_us.lang.php'=>array()); |
|
| 151 | + //By default, generate app strings for the current language as well. |
|
| 152 | + $this->appListStrings[$GLOBALS [ 'current_language' ] . ".lang.php"] = array(); |
|
| 153 | + $this->loadAppListStrings($this->path . '/../../language/application'); |
|
| 154 | + |
|
| 155 | + if($buildFromTemplate){ |
|
| 156 | + //go through the templates application strings and load anything that is needed |
|
| 157 | + foreach($this->iTemplates as $template=>$val){ |
|
| 158 | + $file = MB_IMPLEMENTS . '/' . $template . '/language/application'; |
|
| 159 | + $this->loadAppListStrings($file); |
|
| 160 | + } |
|
| 161 | + foreach($this->templates as $template=>$val){ |
|
| 162 | + $file = MB_TEMPLATES . '/' . $template . '/language/application'; |
|
| 163 | + $this->loadAppListStrings($file); |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + function save($key_name, $duplicate=false, $rename=false){ |
|
| 168 | + $header = file_get_contents('modules/ModuleBuilder/MB/header.php'); |
|
| 169 | + $save_path = $this->path . '/language'; |
|
| 170 | + mkdir_recursive($save_path); |
|
| 171 | + foreach($this->strings as $lang=>$values){ |
|
| 172 | + //Check if the module Label has changed. |
|
| 173 | + $renameLang = $rename || empty($values) || (isset($values['LBL_MODULE_NAME']) && $this->label != $values['LBL_MODULE_NAME']); |
|
| 174 | + $mod_strings = return_module_language(str_replace('.lang.php','',$lang), 'ModuleBuilder'); |
|
| 175 | 175 | $required = array( |
| 176 | 176 | 'LBL_LIST_FORM_TITLE'=>$this->label . " " . $mod_strings['LBL_LIST'], |
| 177 | 177 | 'LBL_MODULE_NAME'=>$this->label, |
@@ -187,98 +187,98 @@ discard block |
||
| 187 | 187 | 'LBL_'.strtoupper($this->key_name).'_SUBPANEL_TITLE'=>$this->label, |
| 188 | 188 | 'LBL_NEW_FORM_TITLE' => $mod_strings['LBL_NEW'] ." ". $this->label, |
| 189 | 189 | ); |
| 190 | - foreach($required as $k=>$v){ |
|
| 191 | - if(empty($values[$k]) || $renameLang){ |
|
| 192 | - $values[$k] = $v; |
|
| 193 | - } |
|
| 194 | - } |
|
| 195 | - write_array_to_file('mod_strings', $values, $save_path .'/'.$lang,'w', $header); |
|
| 196 | - } |
|
| 197 | - $app_save_path = $this->path . '/../../language/application'; |
|
| 198 | - mkdir_recursive($app_save_path); |
|
| 199 | - $key_changed = ($this->key_name != $key_name); |
|
| 200 | - |
|
| 201 | - foreach($this->appListStrings as $lang=>$values){ |
|
| 202 | - // Load previously created modules data |
|
| 203 | - // $app_list_strings = array (); --- fix for issue #305 |
|
| 204 | - $neededFile = $app_save_path . '/'. $lang; |
|
| 205 | - if (file_exists($neededFile)) { |
|
| 206 | - include $neededFile; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - |
|
| 210 | - if(!$duplicate){ |
|
| 211 | - unset($values['moduleList'][$this->key_name]); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - |
|
| 215 | - // $values = sugarLangArrayMerge($values, $app_list_strings); --- fix for issue #305 |
|
| 216 | - $values['moduleList'][$key_name]= $this->label; |
|
| 217 | - |
|
| 218 | - |
|
| 219 | - $appFile = $header. "\n"; |
|
| 220 | - require_once('include/utils/array_utils.php'); |
|
| 221 | - $this->getGlobalAppListStringsForMB($values); |
|
| 222 | - foreach($values as $key=>$array){ |
|
| 223 | - if($duplicate){ |
|
| 224 | - //keep the original when duplicating |
|
| 225 | - $appFile .= override_value_to_string_recursive2 ('app_list_strings', $key, $array); |
|
| 226 | - } |
|
| 227 | - $okey = $key; |
|
| 228 | - if($key_changed)$key = str_replace($this->key_name, $key_name, $key); |
|
| 229 | - if($key_changed)$key = str_replace(strtolower($this->key_name), strtolower($key_name), $key); |
|
| 230 | - // if we aren't duplicating or the key has changed let's add it |
|
| 231 | - if(!$duplicate || $okey != $key){ |
|
| 232 | - $appFile .= override_value_to_string_recursive2 ('app_list_strings', $key, $array); |
|
| 233 | - } |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - $fp = sugar_fopen($app_save_path . '/'. $lang, 'w'); |
|
| 237 | - fwrite($fp, $appFile); |
|
| 238 | - fclose($fp); |
|
| 239 | - } |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * If there is no this dropdown list in custom\modulebuilder\packages\$package\language\application\$lang.lang.php , |
|
| 244 | - * we will include it from global app_list_string array into custom\modulebuilder\packages\$package\language\application\$lang.lang.php |
|
| 245 | - * when we create a dropdown filed and the value is created in MB.(#20728 ) |
|
| 246 | - **/ |
|
| 247 | - function getGlobalAppListStringsForMB(&$values){ |
|
| 248 | - //Ensure it comes from MB |
|
| 249 | - if(!empty($_REQUEST['view_package']) && !empty($_REQUEST['type']) && $_REQUEST['type'] == 'enum' && !empty($_REQUEST['options'])){ |
|
| 250 | - if(!isset($values[$_REQUEST['options']])){ |
|
| 251 | - global $app_list_strings; |
|
| 252 | - if(!empty($app_list_strings[$_REQUEST['options']])){ |
|
| 253 | - $values[$_REQUEST['options']] = $app_list_strings[$_REQUEST['options']]; |
|
| 254 | - } |
|
| 255 | - } |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - function build($path){ |
|
| 260 | - if(file_exists($this->path.'/language/')) |
|
| 261 | - copy_recursive($this->path.'/language/', $path . '/language/'); |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - function loadTemplates() { |
|
| 265 | - if(empty($this->templates)){ |
|
| 266 | - if (file_exists("$this->path/config.php")) { |
|
| 267 | - include "$this->path/config.php"; |
|
| 268 | - $this->templates = $config['templates']; |
|
| 269 | - $this->iTemplates = array(); |
|
| 270 | - } |
|
| 271 | - } |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * Reset the templates and load the language files again. This is called from |
|
| 276 | - * MBModule->save() once the config file has been written. |
|
| 277 | - */ |
|
| 278 | - function reload(){ |
|
| 279 | - $this->templates = null; |
|
| 280 | - $this->load(); |
|
| 281 | - } |
|
| 190 | + foreach($required as $k=>$v){ |
|
| 191 | + if(empty($values[$k]) || $renameLang){ |
|
| 192 | + $values[$k] = $v; |
|
| 193 | + } |
|
| 194 | + } |
|
| 195 | + write_array_to_file('mod_strings', $values, $save_path .'/'.$lang,'w', $header); |
|
| 196 | + } |
|
| 197 | + $app_save_path = $this->path . '/../../language/application'; |
|
| 198 | + mkdir_recursive($app_save_path); |
|
| 199 | + $key_changed = ($this->key_name != $key_name); |
|
| 200 | + |
|
| 201 | + foreach($this->appListStrings as $lang=>$values){ |
|
| 202 | + // Load previously created modules data |
|
| 203 | + // $app_list_strings = array (); --- fix for issue #305 |
|
| 204 | + $neededFile = $app_save_path . '/'. $lang; |
|
| 205 | + if (file_exists($neededFile)) { |
|
| 206 | + include $neededFile; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + |
|
| 210 | + if(!$duplicate){ |
|
| 211 | + unset($values['moduleList'][$this->key_name]); |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + |
|
| 215 | + // $values = sugarLangArrayMerge($values, $app_list_strings); --- fix for issue #305 |
|
| 216 | + $values['moduleList'][$key_name]= $this->label; |
|
| 217 | + |
|
| 218 | + |
|
| 219 | + $appFile = $header. "\n"; |
|
| 220 | + require_once('include/utils/array_utils.php'); |
|
| 221 | + $this->getGlobalAppListStringsForMB($values); |
|
| 222 | + foreach($values as $key=>$array){ |
|
| 223 | + if($duplicate){ |
|
| 224 | + //keep the original when duplicating |
|
| 225 | + $appFile .= override_value_to_string_recursive2 ('app_list_strings', $key, $array); |
|
| 226 | + } |
|
| 227 | + $okey = $key; |
|
| 228 | + if($key_changed)$key = str_replace($this->key_name, $key_name, $key); |
|
| 229 | + if($key_changed)$key = str_replace(strtolower($this->key_name), strtolower($key_name), $key); |
|
| 230 | + // if we aren't duplicating or the key has changed let's add it |
|
| 231 | + if(!$duplicate || $okey != $key){ |
|
| 232 | + $appFile .= override_value_to_string_recursive2 ('app_list_strings', $key, $array); |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + $fp = sugar_fopen($app_save_path . '/'. $lang, 'w'); |
|
| 237 | + fwrite($fp, $appFile); |
|
| 238 | + fclose($fp); |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * If there is no this dropdown list in custom\modulebuilder\packages\$package\language\application\$lang.lang.php , |
|
| 244 | + * we will include it from global app_list_string array into custom\modulebuilder\packages\$package\language\application\$lang.lang.php |
|
| 245 | + * when we create a dropdown filed and the value is created in MB.(#20728 ) |
|
| 246 | + **/ |
|
| 247 | + function getGlobalAppListStringsForMB(&$values){ |
|
| 248 | + //Ensure it comes from MB |
|
| 249 | + if(!empty($_REQUEST['view_package']) && !empty($_REQUEST['type']) && $_REQUEST['type'] == 'enum' && !empty($_REQUEST['options'])){ |
|
| 250 | + if(!isset($values[$_REQUEST['options']])){ |
|
| 251 | + global $app_list_strings; |
|
| 252 | + if(!empty($app_list_strings[$_REQUEST['options']])){ |
|
| 253 | + $values[$_REQUEST['options']] = $app_list_strings[$_REQUEST['options']]; |
|
| 254 | + } |
|
| 255 | + } |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + function build($path){ |
|
| 260 | + if(file_exists($this->path.'/language/')) |
|
| 261 | + copy_recursive($this->path.'/language/', $path . '/language/'); |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + function loadTemplates() { |
|
| 265 | + if(empty($this->templates)){ |
|
| 266 | + if (file_exists("$this->path/config.php")) { |
|
| 267 | + include "$this->path/config.php"; |
|
| 268 | + $this->templates = $config['templates']; |
|
| 269 | + $this->iTemplates = array(); |
|
| 270 | + } |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * Reset the templates and load the language files again. This is called from |
|
| 276 | + * MBModule->save() once the config file has been written. |
|
| 277 | + */ |
|
| 278 | + function reload(){ |
|
| 279 | + $this->templates = null; |
|
| 280 | + $this->load(); |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | 283 | /** |
| 284 | 284 | * Attempts to translate the given label if it is contained in this |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | -class MBLanguage{ |
|
| 40 | +class MBLanguage { |
|
| 41 | 41 | var $iTemplates = array(); |
| 42 | 42 | var $templates = array(); |
| 43 | - function __construct( $name, $path, $label, $key_name){ |
|
| 43 | + function __construct($name, $path, $label, $key_name) { |
|
| 44 | 44 | $this->path = $path; |
| 45 | 45 | $this->name = $name; |
| 46 | 46 | $this->key_name = $key_name; |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 52 | 52 | */ |
| 53 | - function MBLanguage($name, $path, $label, $key_name){ |
|
| 53 | + function MBLanguage($name, $path, $label, $key_name) { |
|
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | - if(isset($GLOBALS['log'])) { |
|
| 55 | + if (isset($GLOBALS['log'])) { |
|
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | 57 | } |
| 58 | 58 | else { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | - function load(){ |
|
| 65 | + function load() { |
|
| 66 | 66 | $this->generateModStrings(); |
| 67 | 67 | $this->generateAppStrings(); |
| 68 | 68 | } |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | $module = strtoupper($this->name); |
| 73 | 73 | $object_name = strtoupper($this->key_name); |
| 74 | 74 | $_object_name = strtolower($this->name); |
| 75 | - if(!file_exists($file))return; |
|
| 75 | + if (!file_exists($file))return; |
|
| 76 | 76 | |
| 77 | 77 | $d = dir($file); |
| 78 | - while($e = $d->read()){ |
|
| 79 | - if(substr($e, 0, 1) != '.' && is_file($file . '/' . $e)){ |
|
| 80 | - include($file.'/'. $e); |
|
| 81 | - if(empty($this->strings[$e])){ |
|
| 78 | + while ($e = $d->read()) { |
|
| 79 | + if (substr($e, 0, 1) != '.' && is_file($file.'/'.$e)) { |
|
| 80 | + include($file.'/'.$e); |
|
| 81 | + if (empty($this->strings[$e])) { |
|
| 82 | 82 | |
| 83 | 83 | $this->strings[$e] = $mod_strings; |
| 84 | - }else{ |
|
| 84 | + } else { |
|
| 85 | 85 | $this->strings[$e] = array_merge($this->strings[$e], $mod_strings); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -90,20 +90,20 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - function loadAppListStrings($file){ |
|
| 94 | - if(!file_exists($file))return; |
|
| 93 | + function loadAppListStrings($file) { |
|
| 94 | + if (!file_exists($file))return; |
|
| 95 | 95 | //we may not need this when loading in the app strings, but there is no harm |
| 96 | 96 | //in setting it. |
| 97 | 97 | $object_name = strtolower($this->key_name); |
| 98 | 98 | |
| 99 | 99 | $d = dir($file); |
| 100 | - while($e = $d->read()){ |
|
| 101 | - if(substr($e, 0, 1) != '.' && is_file($file . '/' . $e)){ |
|
| 102 | - include($file.'/'. $e); |
|
| 103 | - if(empty($this->appListStrings[$e])){ |
|
| 100 | + while ($e = $d->read()) { |
|
| 101 | + if (substr($e, 0, 1) != '.' && is_file($file.'/'.$e)) { |
|
| 102 | + include($file.'/'.$e); |
|
| 103 | + if (empty($this->appListStrings[$e])) { |
|
| 104 | 104 | |
| 105 | 105 | $this->appListStrings[$e] = $app_list_strings; |
| 106 | - }else{ |
|
| 106 | + } else { |
|
| 107 | 107 | $this->appListStrings[$e] = array_merge($this->appListStrings[$e], $app_list_strings); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -112,128 +112,128 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - function generateModStrings(){ |
|
| 115 | + function generateModStrings() { |
|
| 116 | 116 | $this->strings = array(); |
| 117 | 117 | $this->loadTemplates(); |
| 118 | 118 | |
| 119 | - foreach($this->iTemplates as $template=>$val){ |
|
| 120 | - $file = MB_IMPLEMENTS . '/' . $template . '/language'; |
|
| 119 | + foreach ($this->iTemplates as $template=>$val) { |
|
| 120 | + $file = MB_IMPLEMENTS.'/'.$template.'/language'; |
|
| 121 | 121 | $this->loadStrings($file); |
| 122 | 122 | } |
| 123 | - foreach($this->templates as $template=>$val){ |
|
| 124 | - $file = MB_TEMPLATES . '/' . $template . '/language'; |
|
| 123 | + foreach ($this->templates as $template=>$val) { |
|
| 124 | + $file = MB_TEMPLATES.'/'.$template.'/language'; |
|
| 125 | 125 | $this->loadStrings($file); |
| 126 | 126 | } |
| 127 | - $this->loadStrings($this->path . '/language'); |
|
| 127 | + $this->loadStrings($this->path.'/language'); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - function getModStrings($language='en_us'){ |
|
| 130 | + function getModStrings($language = 'en_us') { |
|
| 131 | 131 | $language .= '.lang.php'; |
| 132 | - if(!empty($this->strings[$language]) && $language != 'en_us.lang.php'){ |
|
| 132 | + if (!empty($this->strings[$language]) && $language != 'en_us.lang.php') { |
|
| 133 | 133 | return sugarLangArrayMerge($this->strings['en_us.lang.php'], $this->strings[$language]); |
| 134 | 134 | } |
| 135 | - if(!empty($this->strings['en_us.lang.php']))return $this->strings['en_us.lang.php']; |
|
| 135 | + if (!empty($this->strings['en_us.lang.php']))return $this->strings['en_us.lang.php']; |
|
| 136 | 136 | $empty = array(); |
| 137 | 137 | return $empty; |
| 138 | 138 | } |
| 139 | - function getAppListStrings($language='en_us'){ |
|
| 139 | + function getAppListStrings($language = 'en_us') { |
|
| 140 | 140 | $language .= '.lang.php'; |
| 141 | - if(!empty($this->appListStrings[$language]) && $language != 'en_us.lang.php'){ |
|
| 141 | + if (!empty($this->appListStrings[$language]) && $language != 'en_us.lang.php') { |
|
| 142 | 142 | return sugarLangArrayMerge($this->appListStrings['en_us.lang.php'], $this->appListStrings[$language]); |
| 143 | 143 | } |
| 144 | - if(!empty($this->appListStrings['en_us.lang.php']))return $this->appListStrings['en_us.lang.php']; |
|
| 144 | + if (!empty($this->appListStrings['en_us.lang.php']))return $this->appListStrings['en_us.lang.php']; |
|
| 145 | 145 | $empty = array(); |
| 146 | 146 | return $empty; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - function generateAppStrings($buildFromTemplate = true){ |
|
| 149 | + function generateAppStrings($buildFromTemplate = true) { |
|
| 150 | 150 | $this->appListStrings = array('en_us.lang.php'=>array()); |
| 151 | 151 | //By default, generate app strings for the current language as well. |
| 152 | - $this->appListStrings[$GLOBALS [ 'current_language' ] . ".lang.php"] = array(); |
|
| 153 | - $this->loadAppListStrings($this->path . '/../../language/application'); |
|
| 152 | + $this->appListStrings[$GLOBALS ['current_language'].".lang.php"] = array(); |
|
| 153 | + $this->loadAppListStrings($this->path.'/../../language/application'); |
|
| 154 | 154 | |
| 155 | - if($buildFromTemplate){ |
|
| 155 | + if ($buildFromTemplate) { |
|
| 156 | 156 | //go through the templates application strings and load anything that is needed |
| 157 | - foreach($this->iTemplates as $template=>$val){ |
|
| 158 | - $file = MB_IMPLEMENTS . '/' . $template . '/language/application'; |
|
| 157 | + foreach ($this->iTemplates as $template=>$val) { |
|
| 158 | + $file = MB_IMPLEMENTS.'/'.$template.'/language/application'; |
|
| 159 | 159 | $this->loadAppListStrings($file); |
| 160 | 160 | } |
| 161 | - foreach($this->templates as $template=>$val){ |
|
| 162 | - $file = MB_TEMPLATES . '/' . $template . '/language/application'; |
|
| 161 | + foreach ($this->templates as $template=>$val) { |
|
| 162 | + $file = MB_TEMPLATES.'/'.$template.'/language/application'; |
|
| 163 | 163 | $this->loadAppListStrings($file); |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | - function save($key_name, $duplicate=false, $rename=false){ |
|
| 167 | + function save($key_name, $duplicate = false, $rename = false) { |
|
| 168 | 168 | $header = file_get_contents('modules/ModuleBuilder/MB/header.php'); |
| 169 | - $save_path = $this->path . '/language'; |
|
| 169 | + $save_path = $this->path.'/language'; |
|
| 170 | 170 | mkdir_recursive($save_path); |
| 171 | - foreach($this->strings as $lang=>$values){ |
|
| 171 | + foreach ($this->strings as $lang=>$values) { |
|
| 172 | 172 | //Check if the module Label has changed. |
| 173 | 173 | $renameLang = $rename || empty($values) || (isset($values['LBL_MODULE_NAME']) && $this->label != $values['LBL_MODULE_NAME']); |
| 174 | - $mod_strings = return_module_language(str_replace('.lang.php','',$lang), 'ModuleBuilder'); |
|
| 174 | + $mod_strings = return_module_language(str_replace('.lang.php', '', $lang), 'ModuleBuilder'); |
|
| 175 | 175 | $required = array( |
| 176 | - 'LBL_LIST_FORM_TITLE'=>$this->label . " " . $mod_strings['LBL_LIST'], |
|
| 176 | + 'LBL_LIST_FORM_TITLE'=>$this->label." ".$mod_strings['LBL_LIST'], |
|
| 177 | 177 | 'LBL_MODULE_NAME'=>$this->label, |
| 178 | 178 | 'LBL_MODULE_TITLE'=>$this->label, |
| 179 | - 'LBL_HOMEPAGE_TITLE'=>$mod_strings['LBL_HOMEPAGE_PREFIX'] . " " . $this->label, |
|
| 179 | + 'LBL_HOMEPAGE_TITLE'=>$mod_strings['LBL_HOMEPAGE_PREFIX']." ".$this->label, |
|
| 180 | 180 | //FOR GENERIC MENU |
| 181 | - 'LNK_NEW_RECORD'=>$mod_strings['LBL_CREATE'] ." ". $this->label, |
|
| 182 | - 'LNK_LIST'=>$mod_strings['LBL_VIEW'] ." ". $this->label, |
|
| 183 | - 'LNK_IMPORT_'.strtoupper($this->key_name)=>translate('LBL_IMPORT') ." ". $this->label, |
|
| 184 | - 'LBL_SEARCH_FORM_TITLE'=>$mod_strings['LBL_SEARCH'] ." ". $this->label, |
|
| 181 | + 'LNK_NEW_RECORD'=>$mod_strings['LBL_CREATE']." ".$this->label, |
|
| 182 | + 'LNK_LIST'=>$mod_strings['LBL_VIEW']." ".$this->label, |
|
| 183 | + 'LNK_IMPORT_'.strtoupper($this->key_name)=>translate('LBL_IMPORT')." ".$this->label, |
|
| 184 | + 'LBL_SEARCH_FORM_TITLE'=>$mod_strings['LBL_SEARCH']." ".$this->label, |
|
| 185 | 185 | 'LBL_HISTORY_SUBPANEL_TITLE'=>$mod_strings['LBL_HISTORY'], |
| 186 | 186 | 'LBL_ACTIVITIES_SUBPANEL_TITLE'=>$mod_strings['LBL_ACTIVITIES'], |
| 187 | 187 | 'LBL_'.strtoupper($this->key_name).'_SUBPANEL_TITLE'=>$this->label, |
| 188 | - 'LBL_NEW_FORM_TITLE' => $mod_strings['LBL_NEW'] ." ". $this->label, |
|
| 188 | + 'LBL_NEW_FORM_TITLE' => $mod_strings['LBL_NEW']." ".$this->label, |
|
| 189 | 189 | ); |
| 190 | - foreach($required as $k=>$v){ |
|
| 191 | - if(empty($values[$k]) || $renameLang){ |
|
| 190 | + foreach ($required as $k=>$v) { |
|
| 191 | + if (empty($values[$k]) || $renameLang) { |
|
| 192 | 192 | $values[$k] = $v; |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | - write_array_to_file('mod_strings', $values, $save_path .'/'.$lang,'w', $header); |
|
| 195 | + write_array_to_file('mod_strings', $values, $save_path.'/'.$lang, 'w', $header); |
|
| 196 | 196 | } |
| 197 | - $app_save_path = $this->path . '/../../language/application'; |
|
| 197 | + $app_save_path = $this->path.'/../../language/application'; |
|
| 198 | 198 | mkdir_recursive($app_save_path); |
| 199 | 199 | $key_changed = ($this->key_name != $key_name); |
| 200 | 200 | |
| 201 | - foreach($this->appListStrings as $lang=>$values){ |
|
| 201 | + foreach ($this->appListStrings as $lang=>$values) { |
|
| 202 | 202 | // Load previously created modules data |
| 203 | 203 | // $app_list_strings = array (); --- fix for issue #305 |
| 204 | - $neededFile = $app_save_path . '/'. $lang; |
|
| 204 | + $neededFile = $app_save_path.'/'.$lang; |
|
| 205 | 205 | if (file_exists($neededFile)) { |
| 206 | 206 | include $neededFile; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | |
| 210 | - if(!$duplicate){ |
|
| 210 | + if (!$duplicate) { |
|
| 211 | 211 | unset($values['moduleList'][$this->key_name]); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | // $values = sugarLangArrayMerge($values, $app_list_strings); --- fix for issue #305 |
| 216 | - $values['moduleList'][$key_name]= $this->label; |
|
| 216 | + $values['moduleList'][$key_name] = $this->label; |
|
| 217 | 217 | |
| 218 | 218 | |
| 219 | - $appFile = $header. "\n"; |
|
| 219 | + $appFile = $header."\n"; |
|
| 220 | 220 | require_once('include/utils/array_utils.php'); |
| 221 | 221 | $this->getGlobalAppListStringsForMB($values); |
| 222 | - foreach($values as $key=>$array){ |
|
| 223 | - if($duplicate){ |
|
| 222 | + foreach ($values as $key=>$array) { |
|
| 223 | + if ($duplicate) { |
|
| 224 | 224 | //keep the original when duplicating |
| 225 | - $appFile .= override_value_to_string_recursive2 ('app_list_strings', $key, $array); |
|
| 225 | + $appFile .= override_value_to_string_recursive2('app_list_strings', $key, $array); |
|
| 226 | 226 | } |
| 227 | 227 | $okey = $key; |
| 228 | - if($key_changed)$key = str_replace($this->key_name, $key_name, $key); |
|
| 229 | - if($key_changed)$key = str_replace(strtolower($this->key_name), strtolower($key_name), $key); |
|
| 228 | + if ($key_changed)$key = str_replace($this->key_name, $key_name, $key); |
|
| 229 | + if ($key_changed)$key = str_replace(strtolower($this->key_name), strtolower($key_name), $key); |
|
| 230 | 230 | // if we aren't duplicating or the key has changed let's add it |
| 231 | - if(!$duplicate || $okey != $key){ |
|
| 232 | - $appFile .= override_value_to_string_recursive2 ('app_list_strings', $key, $array); |
|
| 231 | + if (!$duplicate || $okey != $key) { |
|
| 232 | + $appFile .= override_value_to_string_recursive2('app_list_strings', $key, $array); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - $fp = sugar_fopen($app_save_path . '/'. $lang, 'w'); |
|
| 236 | + $fp = sugar_fopen($app_save_path.'/'.$lang, 'w'); |
|
| 237 | 237 | fwrite($fp, $appFile); |
| 238 | 238 | fclose($fp); |
| 239 | 239 | } |
@@ -244,25 +244,25 @@ discard block |
||
| 244 | 244 | * we will include it from global app_list_string array into custom\modulebuilder\packages\$package\language\application\$lang.lang.php |
| 245 | 245 | * when we create a dropdown filed and the value is created in MB.(#20728 ) |
| 246 | 246 | **/ |
| 247 | - function getGlobalAppListStringsForMB(&$values){ |
|
| 247 | + function getGlobalAppListStringsForMB(&$values) { |
|
| 248 | 248 | //Ensure it comes from MB |
| 249 | - if(!empty($_REQUEST['view_package']) && !empty($_REQUEST['type']) && $_REQUEST['type'] == 'enum' && !empty($_REQUEST['options'])){ |
|
| 250 | - if(!isset($values[$_REQUEST['options']])){ |
|
| 249 | + if (!empty($_REQUEST['view_package']) && !empty($_REQUEST['type']) && $_REQUEST['type'] == 'enum' && !empty($_REQUEST['options'])) { |
|
| 250 | + if (!isset($values[$_REQUEST['options']])) { |
|
| 251 | 251 | global $app_list_strings; |
| 252 | - if(!empty($app_list_strings[$_REQUEST['options']])){ |
|
| 253 | - $values[$_REQUEST['options']] = $app_list_strings[$_REQUEST['options']]; |
|
| 252 | + if (!empty($app_list_strings[$_REQUEST['options']])) { |
|
| 253 | + $values[$_REQUEST['options']] = $app_list_strings[$_REQUEST['options']]; |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - function build($path){ |
|
| 260 | - if(file_exists($this->path.'/language/')) |
|
| 261 | - copy_recursive($this->path.'/language/', $path . '/language/'); |
|
| 259 | + function build($path) { |
|
| 260 | + if (file_exists($this->path.'/language/')) |
|
| 261 | + copy_recursive($this->path.'/language/', $path.'/language/'); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | function loadTemplates() { |
| 265 | - if(empty($this->templates)){ |
|
| 265 | + if (empty($this->templates)) { |
|
| 266 | 266 | if (file_exists("$this->path/config.php")) { |
| 267 | 267 | include "$this->path/config.php"; |
| 268 | 268 | $this->templates = $config['templates']; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * Reset the templates and load the language files again. This is called from |
| 276 | 276 | * MBModule->save() once the config file has been written. |
| 277 | 277 | */ |
| 278 | - function reload(){ |
|
| 278 | + function reload() { |
|
| 279 | 279 | $this->templates = null; |
| 280 | 280 | $this->load(); |
| 281 | 281 | } |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | * @param string $language Language to use to translate the label |
| 289 | 289 | * @return string |
| 290 | 290 | */ |
| 291 | - public function translate($label, $language = "en_us"){ |
|
| 292 | - $language = $language . ".lang.php"; |
|
| 291 | + public function translate($label, $language = "en_us") { |
|
| 292 | + $language = $language.".lang.php"; |
|
| 293 | 293 | if (isset($this->strings[$language][$label])) |
| 294 | 294 | return $this->strings[$language][$label]; |
| 295 | 295 | |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | 55 | if(isset($GLOBALS['log'])) { |
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | - } |
|
| 58 | - else { |
|
| 57 | + } else { |
|
| 59 | 58 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 60 | 59 | } |
| 61 | 60 | self::__construct($name, $path, $label, $key_name); |
@@ -72,7 +71,9 @@ discard block |
||
| 72 | 71 | $module = strtoupper($this->name); |
| 73 | 72 | $object_name = strtoupper($this->key_name); |
| 74 | 73 | $_object_name = strtolower($this->name); |
| 75 | - if(!file_exists($file))return; |
|
| 74 | + if(!file_exists($file)) { |
|
| 75 | + return; |
|
| 76 | + } |
|
| 76 | 77 | |
| 77 | 78 | $d = dir($file); |
| 78 | 79 | while($e = $d->read()){ |
@@ -81,7 +82,7 @@ discard block |
||
| 81 | 82 | if(empty($this->strings[$e])){ |
| 82 | 83 | |
| 83 | 84 | $this->strings[$e] = $mod_strings; |
| 84 | - }else{ |
|
| 85 | + } else{ |
|
| 85 | 86 | $this->strings[$e] = array_merge($this->strings[$e], $mod_strings); |
| 86 | 87 | } |
| 87 | 88 | |
@@ -91,7 +92,9 @@ discard block |
||
| 91 | 92 | } |
| 92 | 93 | |
| 93 | 94 | function loadAppListStrings($file){ |
| 94 | - if(!file_exists($file))return; |
|
| 95 | + if(!file_exists($file)) { |
|
| 96 | + return; |
|
| 97 | + } |
|
| 95 | 98 | //we may not need this when loading in the app strings, but there is no harm |
| 96 | 99 | //in setting it. |
| 97 | 100 | $object_name = strtolower($this->key_name); |
@@ -103,7 +106,7 @@ discard block |
||
| 103 | 106 | if(empty($this->appListStrings[$e])){ |
| 104 | 107 | |
| 105 | 108 | $this->appListStrings[$e] = $app_list_strings; |
| 106 | - }else{ |
|
| 109 | + } else{ |
|
| 107 | 110 | $this->appListStrings[$e] = array_merge($this->appListStrings[$e], $app_list_strings); |
| 108 | 111 | } |
| 109 | 112 | |
@@ -132,7 +135,9 @@ discard block |
||
| 132 | 135 | if(!empty($this->strings[$language]) && $language != 'en_us.lang.php'){ |
| 133 | 136 | return sugarLangArrayMerge($this->strings['en_us.lang.php'], $this->strings[$language]); |
| 134 | 137 | } |
| 135 | - if(!empty($this->strings['en_us.lang.php']))return $this->strings['en_us.lang.php']; |
|
| 138 | + if(!empty($this->strings['en_us.lang.php'])) { |
|
| 139 | + return $this->strings['en_us.lang.php']; |
|
| 140 | + } |
|
| 136 | 141 | $empty = array(); |
| 137 | 142 | return $empty; |
| 138 | 143 | } |
@@ -141,7 +146,9 @@ discard block |
||
| 141 | 146 | if(!empty($this->appListStrings[$language]) && $language != 'en_us.lang.php'){ |
| 142 | 147 | return sugarLangArrayMerge($this->appListStrings['en_us.lang.php'], $this->appListStrings[$language]); |
| 143 | 148 | } |
| 144 | - if(!empty($this->appListStrings['en_us.lang.php']))return $this->appListStrings['en_us.lang.php']; |
|
| 149 | + if(!empty($this->appListStrings['en_us.lang.php'])) { |
|
| 150 | + return $this->appListStrings['en_us.lang.php']; |
|
| 151 | + } |
|
| 145 | 152 | $empty = array(); |
| 146 | 153 | return $empty; |
| 147 | 154 | } |
@@ -225,8 +232,12 @@ discard block |
||
| 225 | 232 | $appFile .= override_value_to_string_recursive2 ('app_list_strings', $key, $array); |
| 226 | 233 | } |
| 227 | 234 | $okey = $key; |
| 228 | - if($key_changed)$key = str_replace($this->key_name, $key_name, $key); |
|
| 229 | - if($key_changed)$key = str_replace(strtolower($this->key_name), strtolower($key_name), $key); |
|
| 235 | + if($key_changed) { |
|
| 236 | + $key = str_replace($this->key_name, $key_name, $key); |
|
| 237 | + } |
|
| 238 | + if($key_changed) { |
|
| 239 | + $key = str_replace(strtolower($this->key_name), strtolower($key_name), $key); |
|
| 240 | + } |
|
| 230 | 241 | // if we aren't duplicating or the key has changed let's add it |
| 231 | 242 | if(!$duplicate || $okey != $key){ |
| 232 | 243 | $appFile .= override_value_to_string_recursive2 ('app_list_strings', $key, $array); |
@@ -257,8 +268,9 @@ discard block |
||
| 257 | 268 | } |
| 258 | 269 | |
| 259 | 270 | function build($path){ |
| 260 | - if(file_exists($this->path.'/language/')) |
|
| 261 | - copy_recursive($this->path.'/language/', $path . '/language/'); |
|
| 271 | + if(file_exists($this->path.'/language/')) { |
|
| 272 | + copy_recursive($this->path.'/language/', $path . '/language/'); |
|
| 273 | + } |
|
| 262 | 274 | } |
| 263 | 275 | |
| 264 | 276 | function loadTemplates() { |
@@ -290,11 +302,13 @@ discard block |
||
| 290 | 302 | */ |
| 291 | 303 | public function translate($label, $language = "en_us"){ |
| 292 | 304 | $language = $language . ".lang.php"; |
| 293 | - if (isset($this->strings[$language][$label])) |
|
| 294 | - return $this->strings[$language][$label]; |
|
| 305 | + if (isset($this->strings[$language][$label])) { |
|
| 306 | + return $this->strings[$language][$label]; |
|
| 307 | + } |
|
| 295 | 308 | |
| 296 | - if (isset($this->appListStrings[$language][$label])) |
|
| 297 | - return $this->appListStrings[$language][$label]; |
|
| 309 | + if (isset($this->appListStrings[$language][$label])) { |
|
| 310 | + return $this->appListStrings[$language][$label]; |
|
| 311 | + } |
|
| 298 | 312 | |
| 299 | 313 | return $label; |
| 300 | 314 | } |