@@ -23,6 +23,9 @@ |
||
| 23 | 23 | protected $user; |
| 24 | 24 | protected $module; |
| 25 | 25 | |
| 26 | + /** |
|
| 27 | + * @param Link $link |
|
| 28 | + */ |
|
| 26 | 29 | public function __construct($link, $user, $input = null) |
| 27 | 30 | { |
| 28 | 31 | $this->link = $link; |
@@ -89,6 +89,7 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * Initialize this instance using mail template |
| 91 | 91 | * @access private |
| 92 | + * @param boolean $emailtemplate |
|
| 92 | 93 | */ |
| 93 | 94 | public function initFromTemplate($emailtemplate) |
| 94 | 95 | { |
@@ -187,6 +188,7 @@ discard block |
||
| 187 | 188 | |
| 188 | 189 | /** |
| 189 | 190 | * Add this mail to queue |
| 191 | + * @param boolean $linktoid |
|
| 190 | 192 | */ |
| 191 | 193 | public function __AddToQueue($linktoid) |
| 192 | 194 | { |
@@ -225,7 +227,7 @@ discard block |
||
| 225 | 227 | |
| 226 | 228 | /** |
| 227 | 229 | * Function to prepares email as string |
| 228 | - * @return type |
|
| 230 | + * @return string |
|
| 229 | 231 | */ |
| 230 | 232 | public function getMailString() |
| 231 | 233 | { |
@@ -63,8 +63,9 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | // End |
| 65 | 65 | |
| 66 | - if (empty($this->SMTPAuth)) |
|
| 67 | - $this->SMTPAuth = false; |
|
| 66 | + if (empty($this->SMTPAuth)) { |
|
| 67 | + $this->SMTPAuth = false; |
|
| 68 | + } |
|
| 68 | 69 | |
| 69 | 70 | $this->ConfigSenderInfo($adb->query_result($result, 0, 'from_email_field')); |
| 70 | 71 | |
@@ -121,8 +122,9 @@ discard block |
||
| 121 | 122 | */ |
| 122 | 123 | public function ConfigSenderInfo($fromemail, $fromname = '', $replyto = '') |
| 123 | 124 | { |
| 124 | - if (empty($fromname)) |
|
| 125 | - $fromname = $fromemail; |
|
| 125 | + if (empty($fromname)) { |
|
| 126 | + $fromname = $fromemail; |
|
| 127 | + } |
|
| 126 | 128 | |
| 127 | 129 | $this->From = $fromemail; |
| 128 | 130 | //fix for (http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8001) |
@@ -135,11 +137,13 @@ discard block |
||
| 135 | 137 | */ |
| 136 | 138 | public function Send($sync = false, $linktoid = false) |
| 137 | 139 | { |
| 138 | - if (!$this->_serverConfigured) |
|
| 139 | - return; |
|
| 140 | + if (!$this->_serverConfigured) { |
|
| 141 | + return; |
|
| 142 | + } |
|
| 140 | 143 | |
| 141 | - if ($sync) |
|
| 142 | - return parent::Send(); |
|
| 144 | + if ($sync) { |
|
| 145 | + return parent::Send(); |
|
| 146 | + } |
|
| 143 | 147 | |
| 144 | 148 | $this->__AddToQueue($linktoid); |
| 145 | 149 | return true; |
@@ -153,11 +157,13 @@ discard block |
||
| 153 | 157 | */ |
| 154 | 158 | public function SendTo($toemail, $toname = '', $emailtemplate = false, $linktoid = false, $sync = false) |
| 155 | 159 | { |
| 156 | - if (empty($toname)) |
|
| 157 | - $toname = $toemail; |
|
| 160 | + if (empty($toname)) { |
|
| 161 | + $toname = $toemail; |
|
| 162 | + } |
|
| 158 | 163 | $this->AddAddress($toemail, $toname); |
| 159 | - if ($emailtemplate) |
|
| 160 | - $this->initFromTemplate($emailtemplate); |
|
| 164 | + if ($emailtemplate) { |
|
| 165 | + $this->initFromTemplate($emailtemplate); |
|
| 166 | + } |
|
| 161 | 167 | return $this->Send($sync, $linktoid); |
| 162 | 168 | } |
| 163 | 169 | |
@@ -196,28 +202,33 @@ discard block |
||
| 196 | 202 | $adb->pquery('INSERT INTO vtiger_mailer_queue(id,fromname,fromemail,content_type,subject,body,mailer,relcrmid) VALUES(?,?,?,?,?,?,?,?)', Array($uniqueid, $this->FromName, $this->From, $this->ContentType, $this->Subject, $this->Body, $this->Mailer, $linktoid)); |
| 197 | 203 | $queueid = $adb->database->Insert_ID(); |
| 198 | 204 | foreach ($this->to as $toinfo) { |
| 199 | - if (empty($toinfo[0])) |
|
| 200 | - continue; |
|
| 205 | + if (empty($toinfo[0])) { |
|
| 206 | + continue; |
|
| 207 | + } |
|
| 201 | 208 | $adb->pquery('INSERT INTO vtiger_mailer_queueinfo(id, name, email, type) VALUES(?,?,?,?)', Array($queueid, $toinfo[1], $toinfo[0], 'TO')); |
| 202 | 209 | } |
| 203 | 210 | foreach ($this->cc as $ccinfo) { |
| 204 | - if (empty($ccinfo[0])) |
|
| 205 | - continue; |
|
| 211 | + if (empty($ccinfo[0])) { |
|
| 212 | + continue; |
|
| 213 | + } |
|
| 206 | 214 | $adb->pquery('INSERT INTO vtiger_mailer_queueinfo(id, name, email, type) VALUES(?,?,?,?)', Array($queueid, $ccinfo[1], $ccinfo[0], 'CC')); |
| 207 | 215 | } |
| 208 | 216 | foreach ($this->bcc as $bccinfo) { |
| 209 | - if (empty($bccinfo[0])) |
|
| 210 | - continue; |
|
| 217 | + if (empty($bccinfo[0])) { |
|
| 218 | + continue; |
|
| 219 | + } |
|
| 211 | 220 | $adb->pquery('INSERT INTO vtiger_mailer_queueinfo(id, name, email, type) VALUES(?,?,?,?)', Array($queueid, $bccinfo[1], $bccinfo[0], 'BCC')); |
| 212 | 221 | } |
| 213 | 222 | foreach ($this->ReplyTo as $rtoinfo) { |
| 214 | - if (empty($rtoinfo[0])) |
|
| 215 | - continue; |
|
| 223 | + if (empty($rtoinfo[0])) { |
|
| 224 | + continue; |
|
| 225 | + } |
|
| 216 | 226 | $adb->pquery('INSERT INTO vtiger_mailer_queueinfo(id, name, email, type) VALUES(?,?,?,?)', Array($queueid, $rtoinfo[1], $rtoinfo[0], 'RPLYTO')); |
| 217 | 227 | } |
| 218 | 228 | foreach ($this->attachment as $attachmentinfo) { |
| 219 | - if (empty($attachmentinfo[0])) |
|
| 220 | - continue; |
|
| 229 | + if (empty($attachmentinfo[0])) { |
|
| 230 | + continue; |
|
| 231 | + } |
|
| 221 | 232 | $adb->pquery('INSERT INTO vtiger_mailer_queueattachments(id, path, name, encoding, type) VALUES(?,?,?,?,?)', Array($queueid, $attachmentinfo[0], $attachmentinfo[2], $attachmentinfo[3], $attachmentinfo[4])); |
| 222 | 233 | } |
| 223 | 234 | } |
@@ -238,8 +249,9 @@ discard block |
||
| 238 | 249 | static function dispatchQueue(Vtiger_Mailer_Listener $listener = null) |
| 239 | 250 | { |
| 240 | 251 | $adb = \PearDatabase::getInstance(); |
| 241 | - if (!Utils::CheckTable('vtiger_mailer_queue')) |
|
| 242 | - return; |
|
| 252 | + if (!Utils::CheckTable('vtiger_mailer_queue')) { |
|
| 253 | + return; |
|
| 254 | + } |
|
| 243 | 255 | |
| 244 | 256 | $mailer = new self(); |
| 245 | 257 | $queue = $adb->pquery('SELECT * FROM vtiger_mailer_queue WHERE failed != ?', array(1)); |
@@ -261,14 +273,15 @@ discard block |
||
| 261 | 273 | $emails = $adb->pquery('SELECT * FROM vtiger_mailer_queueinfo WHERE id=?', Array($queueid)); |
| 262 | 274 | for ($eidx = 0; $eidx < $adb->num_rows($emails); ++$eidx) { |
| 263 | 275 | $email_record = $adb->fetch_array($emails, $eidx); |
| 264 | - if ($email_record[type] == 'TO') |
|
| 265 | - $mailer->AddAddress($email_record[email], $email_record[name]); |
|
| 266 | - else if ($email_record[type] == 'CC') |
|
| 267 | - $mailer->AddCC($email_record[email], $email_record[name]); |
|
| 268 | - else if ($email_record[type] == 'BCC') |
|
| 269 | - $mailer->AddBCC($email_record[email], $email_record[name]); |
|
| 270 | - else if ($email_record[type] == 'RPLYTO') |
|
| 271 | - $mailer->AddReplyTo($email_record[email], $email_record[name]); |
|
| 276 | + if ($email_record[type] == 'TO') { |
|
| 277 | + $mailer->AddAddress($email_record[email], $email_record[name]); |
|
| 278 | + } else if ($email_record[type] == 'CC') { |
|
| 279 | + $mailer->AddCC($email_record[email], $email_record[name]); |
|
| 280 | + } else if ($email_record[type] == 'BCC') { |
|
| 281 | + $mailer->AddBCC($email_record[email], $email_record[name]); |
|
| 282 | + } else if ($email_record[type] == 'RPLYTO') { |
|
| 283 | + $mailer->AddReplyTo($email_record[email], $email_record[name]); |
|
| 284 | + } |
|
| 272 | 285 | } |
| 273 | 286 | |
| 274 | 287 | $attachments = $adb->pquery('SELECT * FROM vtiger_mailer_queueattachments WHERE id=?', Array($queueid)); |
@@ -321,6 +321,7 @@ discard block |
||
| 321 | 321 | /** |
| 322 | 322 | * Set entity identifier field for this module |
| 323 | 323 | * @param Field Instance of field to use |
| 324 | + * @param Field $fieldInstance |
|
| 324 | 325 | */ |
| 325 | 326 | public function setEntityIdentifier($fieldInstance) |
| 326 | 327 | { |
@@ -397,6 +398,7 @@ discard block |
||
| 397 | 398 | /** |
| 398 | 399 | * Disable tools for this module |
| 399 | 400 | * @param mixed String or Array with value ['Import', 'Export', 'Merge'] |
| 401 | + * @param string $tools |
|
| 400 | 402 | */ |
| 401 | 403 | public function disableTools($tools) |
| 402 | 404 | { |
@@ -411,6 +413,7 @@ discard block |
||
| 411 | 413 | /** |
| 412 | 414 | * Add block to this module |
| 413 | 415 | * @param vtlib\Block Instance of block to add |
| 416 | + * @param Block $blockInstance |
|
| 414 | 417 | */ |
| 415 | 418 | public function addBlock($blockInstance) |
| 416 | 419 | { |
@@ -421,6 +424,7 @@ discard block |
||
| 421 | 424 | /** |
| 422 | 425 | * Add filter to this module |
| 423 | 426 | * @param vtlib\Filter Instance of filter to add |
| 427 | + * @param Filter $filterInstance |
|
| 424 | 428 | */ |
| 425 | 429 | public function addFilter($filterInstance) |
| 426 | 430 | { |
@@ -552,7 +556,6 @@ discard block |
||
| 552 | 556 | |
| 553 | 557 | /** |
| 554 | 558 | * Function to remove files related to a module |
| 555 | - * @param string $path - dir path |
|
| 556 | 559 | */ |
| 557 | 560 | public function deleteDir($moduleInstance) |
| 558 | 561 | { |
@@ -131,10 +131,12 @@ discard block |
||
| 131 | 131 | self::log("Creating Module $this->name ... STARTED"); |
| 132 | 132 | |
| 133 | 133 | $this->id = $this->__getUniqueId(); |
| 134 | - if (!$this->tabsequence) |
|
| 135 | - $this->tabsequence = $this->__getNextSequence(); |
|
| 136 | - if (!$this->label) |
|
| 137 | - $this->label = $this->name; |
|
| 134 | + if (!$this->tabsequence) { |
|
| 135 | + $this->tabsequence = $this->__getNextSequence(); |
|
| 136 | + } |
|
| 137 | + if (!$this->label) { |
|
| 138 | + $this->label = $this->name; |
|
| 139 | + } |
|
| 138 | 140 | |
| 139 | 141 | $customized = 1; // To indicate this is a Custom Module |
| 140 | 142 | |
@@ -237,10 +239,11 @@ discard block |
||
| 237 | 239 | */ |
| 238 | 240 | public function save() |
| 239 | 241 | { |
| 240 | - if ($this->id) |
|
| 241 | - $this->__update(); |
|
| 242 | - else |
|
| 243 | - $this->__create(); |
|
| 242 | + if ($this->id) { |
|
| 243 | + $this->__update(); |
|
| 244 | + } else { |
|
| 245 | + $this->__create(); |
|
| 246 | + } |
|
| 244 | 247 | return $this->id; |
| 245 | 248 | } |
| 246 | 249 | |
@@ -300,13 +303,16 @@ discard block |
||
| 300 | 303 | |
| 301 | 304 | // Initialize tablename and index column names |
| 302 | 305 | $lcasemodname = strtolower($this->name); |
| 303 | - if (!$this->basetable) |
|
| 304 | - $this->basetable = "vtiger_$lcasemodname"; |
|
| 305 | - if (!$this->basetableid) |
|
| 306 | - $this->basetableid = $lcasemodname . 'id'; |
|
| 306 | + if (!$this->basetable) { |
|
| 307 | + $this->basetable = "vtiger_$lcasemodname"; |
|
| 308 | + } |
|
| 309 | + if (!$this->basetableid) { |
|
| 310 | + $this->basetableid = $lcasemodname . 'id'; |
|
| 311 | + } |
|
| 307 | 312 | |
| 308 | - if (!$this->customtable) |
|
| 309 | - $this->customtable = $this->basetable . 'cf'; |
|
| 313 | + if (!$this->customtable) { |
|
| 314 | + $this->customtable = $this->basetable . 'cf'; |
|
| 315 | + } |
|
| 310 | 316 | |
| 311 | 317 | Utils::CreateTable($this->basetable, "($this->basetableid int(19) PRIMARY KEY, CONSTRAINT `fk_1_$this->basetable` FOREIGN KEY (`$this->basetableid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE)", true); |
| 312 | 318 | Utils::CreateTable($this->customtable, "($this->basetableid int(19) PRIMARY KEY, CONSTRAINT `fk_1_$this->customtable` FOREIGN KEY (`$this->basetableid`) REFERENCES `$this->basetable` (`$this->basetableid`) ON DELETE CASCADE)", true); |
@@ -327,10 +333,12 @@ discard block |
||
| 327 | 333 | $adb = \PearDatabase::getInstance(); |
| 328 | 334 | |
| 329 | 335 | if ($this->basetableid) { |
| 330 | - if (!$this->entityidfield) |
|
| 331 | - $this->entityidfield = $this->basetableid; |
|
| 332 | - if (!$this->entityidcolumn) |
|
| 333 | - $this->entityidcolumn = $this->basetableid; |
|
| 336 | + if (!$this->entityidfield) { |
|
| 337 | + $this->entityidfield = $this->basetableid; |
|
| 338 | + } |
|
| 339 | + if (!$this->entityidcolumn) { |
|
| 340 | + $this->entityidcolumn = $this->basetableid; |
|
| 341 | + } |
|
| 334 | 342 | } |
| 335 | 343 | if ($this->entityidfield && $this->entityidcolumn) { |
| 336 | 344 | $result = $adb->pquery('SELECT tabid FROM vtiger_entityname WHERE tablename=? && tabid=?', array($fieldInstance->table, $this->id)); |
@@ -435,10 +443,11 @@ discard block |
||
| 435 | 443 | public function getFields($blockInstance = false) |
| 436 | 444 | { |
| 437 | 445 | $fields = false; |
| 438 | - if ($blockInstance) |
|
| 439 | - $fields = Field::getAllForBlock($blockInstance, $this); |
|
| 440 | - else |
|
| 441 | - $fields = Field::getAllForModule($this); |
|
| 446 | + if ($blockInstance) { |
|
| 447 | + $fields = Field::getAllForBlock($blockInstance, $this); |
|
| 448 | + } else { |
|
| 449 | + $fields = Field::getAllForModule($this); |
|
| 450 | + } |
|
| 442 | 451 | return $fields; |
| 443 | 452 | } |
| 444 | 453 | |
@@ -25,6 +25,7 @@ |
||
| 25 | 25 | * @param String URL of the site |
| 26 | 26 | * Example: |
| 27 | 27 | * $client = new Vtiger_New_Client('http://www.vtiger.com'); |
| 28 | + * @param string|false $url |
|
| 28 | 29 | */ |
| 29 | 30 | public function __construct($url) |
| 30 | 31 | { |
@@ -77,14 +77,16 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function doGet($params = false, $timeout = null) |
| 79 | 79 | { |
| 80 | - if ($timeout) |
|
| 81 | - $this->client->_timeout = $timeout; |
|
| 80 | + if ($timeout) { |
|
| 81 | + $this->client->_timeout = $timeout; |
|
| 82 | + } |
|
| 82 | 83 | $this->client->setURL($this->url); |
| 83 | 84 | $this->client->setMethod(HTTP_REQUEST_METHOD_GET); |
| 84 | 85 | |
| 85 | 86 | if ($params) { |
| 86 | - foreach ($params as $key => $value) |
|
| 87 | - $this->client->addQueryString($key, $value); |
|
| 87 | + foreach ($params as $key => $value) { |
|
| 88 | + $this->client->addQueryString($key, $value); |
|
| 89 | + } |
|
| 88 | 90 | } |
| 89 | 91 | $this->response = $this->client->sendRequest(); |
| 90 | 92 | |
@@ -103,17 +105,19 @@ discard block |
||
| 103 | 105 | */ |
| 104 | 106 | public function doPost($params = false, $timeout = null) |
| 105 | 107 | { |
| 106 | - if ($timeout) |
|
| 107 | - $this->client->_timeout = $timeout; |
|
| 108 | + if ($timeout) { |
|
| 109 | + $this->client->_timeout = $timeout; |
|
| 110 | + } |
|
| 108 | 111 | $this->client->setURL($this->url); |
| 109 | 112 | $this->client->setMethod(HTTP_REQUEST_METHOD_POST); |
| 110 | 113 | |
| 111 | 114 | if ($params) { |
| 112 | - if (is_string($params)) |
|
| 113 | - $this->client->addRawPostData($params); |
|
| 114 | - else { |
|
| 115 | - foreach ($params as $key => $value) |
|
| 116 | - $this->client->addPostData($key, $value); |
|
| 115 | + if (is_string($params)) { |
|
| 116 | + $this->client->addRawPostData($params); |
|
| 117 | + } else { |
|
| 118 | + foreach ($params as $key => $value) { |
|
| 119 | + $this->client->addPostData($key, $value); |
|
| 120 | + } |
|
| 117 | 121 | } |
| 118 | 122 | } |
| 119 | 123 | $this->response = $this->client->sendRequest(); |
@@ -53,6 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * Get type of package (as specified in manifest) |
| 56 | + * @return string |
|
| 56 | 57 | */ |
| 57 | 58 | public function type() |
| 58 | 59 | { |
@@ -393,6 +394,7 @@ discard block |
||
| 393 | 394 | /** |
| 394 | 395 | * Cache the field instance for re-use |
| 395 | 396 | * @access private |
| 397 | + * @param Field $fieldInstance |
|
| 396 | 398 | */ |
| 397 | 399 | public function __AddModuleFieldToCache($moduleInstance, $fieldname, $fieldInstance) |
| 398 | 400 | { |
@@ -674,6 +676,8 @@ discard block |
||
| 674 | 676 | /** |
| 675 | 677 | * Import Blocks of the module |
| 676 | 678 | * @access private |
| 679 | + * @param \SimpleXMLElement $modulenode |
|
| 680 | + * @param Module $moduleInstance |
|
| 677 | 681 | */ |
| 678 | 682 | public function import_Blocks($modulenode, $moduleInstance) |
| 679 | 683 | { |
@@ -717,6 +721,7 @@ discard block |
||
| 717 | 721 | /** |
| 718 | 722 | * Import Fields of the module |
| 719 | 723 | * @access private |
| 724 | + * @param Block $blockInstance |
|
| 720 | 725 | */ |
| 721 | 726 | public function import_Fields($blocknode, $blockInstance, $moduleInstance) |
| 722 | 727 | { |
@@ -807,6 +812,8 @@ discard block |
||
| 807 | 812 | /** |
| 808 | 813 | * Import Custom views of the module |
| 809 | 814 | * @access private |
| 815 | + * @param \SimpleXMLElement $modulenode |
|
| 816 | + * @param Module $moduleInstance |
|
| 810 | 817 | */ |
| 811 | 818 | public function import_CustomViews($modulenode, $moduleInstance) |
| 812 | 819 | { |
@@ -851,6 +858,8 @@ discard block |
||
| 851 | 858 | /** |
| 852 | 859 | * Import Sharing Access of the module |
| 853 | 860 | * @access private |
| 861 | + * @param \SimpleXMLElement $modulenode |
|
| 862 | + * @param Module $moduleInstance |
|
| 854 | 863 | */ |
| 855 | 864 | public function import_SharingAccess($modulenode, $moduleInstance) |
| 856 | 865 | { |
@@ -867,6 +876,8 @@ discard block |
||
| 867 | 876 | /** |
| 868 | 877 | * Import Events of the module |
| 869 | 878 | * @access private |
| 879 | + * @param \SimpleXMLElement $modulenode |
|
| 880 | + * @param Module $moduleInstance |
|
| 870 | 881 | */ |
| 871 | 882 | public function import_Events($modulenode, $moduleInstance) |
| 872 | 883 | { |
@@ -899,6 +910,8 @@ discard block |
||
| 899 | 910 | /** |
| 900 | 911 | * Import actions of the module |
| 901 | 912 | * @access private |
| 913 | + * @param \SimpleXMLElement $modulenode |
|
| 914 | + * @param Module $moduleInstance |
|
| 902 | 915 | */ |
| 903 | 916 | public function import_Actions($modulenode, $moduleInstance) |
| 904 | 917 | { |
@@ -925,6 +938,8 @@ discard block |
||
| 925 | 938 | /** |
| 926 | 939 | * Import related lists of the module |
| 927 | 940 | * @access private |
| 941 | + * @param \SimpleXMLElement $modulenode |
|
| 942 | + * @param Module $moduleInstance |
|
| 928 | 943 | */ |
| 929 | 944 | public function import_RelatedLists($modulenode, $moduleInstance) |
| 930 | 945 | { |
@@ -1004,6 +1019,7 @@ discard block |
||
| 1004 | 1019 | /** |
| 1005 | 1020 | * Import cron jobs of the module. |
| 1006 | 1021 | * @access private |
| 1022 | + * @param \SimpleXMLElement $modulenode |
|
| 1007 | 1023 | */ |
| 1008 | 1024 | public function import_CronTasks($modulenode) |
| 1009 | 1025 | { |
@@ -1022,6 +1038,9 @@ discard block |
||
| 1022 | 1038 | } |
| 1023 | 1039 | } |
| 1024 | 1040 | |
| 1041 | + /** |
|
| 1042 | + * @param \SimpleXMLElement $modulenode |
|
| 1043 | + */ |
|
| 1025 | 1044 | public function import_update($modulenode) |
| 1026 | 1045 | { |
| 1027 | 1046 | $dirName = 'cache/updates'; |
@@ -101,8 +101,9 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $xpathres = $this->xpath($path); |
| 103 | 103 | foreach ($xpathres as $pathkey => $pathvalue) { |
| 104 | - if ($pathkey == $path) |
|
| 105 | - return $pathvalue; |
|
| 104 | + if ($pathkey == $path) { |
|
| 105 | + return $pathvalue; |
|
| 106 | + } |
|
| 106 | 107 | } |
| 107 | 108 | return false; |
| 108 | 109 | } |
@@ -121,13 +122,15 @@ discard block |
||
| 121 | 122 | |
| 122 | 123 | if ($packagetype) { |
| 123 | 124 | $lcasetype = strtolower($packagetype); |
| 124 | - if ($lcasetype == 'language') |
|
| 125 | - return true; |
|
| 125 | + if ($lcasetype == 'language') { |
|
| 126 | + return true; |
|
| 127 | + } |
|
| 126 | 128 | } |
| 127 | 129 | if ($packagetype) { |
| 128 | 130 | $lcasetype = strtolower($packagetype); |
| 129 | - if ($lcasetype == 'layout') |
|
| 130 | - return true; |
|
| 131 | + if ($lcasetype == 'layout') { |
|
| 132 | + return true; |
|
| 133 | + } |
|
| 131 | 134 | } |
| 132 | 135 | return false; |
| 133 | 136 | } |
@@ -146,8 +149,9 @@ discard block |
||
| 146 | 149 | |
| 147 | 150 | if ($packagetype) { |
| 148 | 151 | $lcasetype = strtolower($packagetype); |
| 149 | - if ($lcasetype == 'extension') |
|
| 150 | - return true; |
|
| 152 | + if ($lcasetype == 'extension') { |
|
| 153 | + return true; |
|
| 154 | + } |
|
| 151 | 155 | } |
| 152 | 156 | return false; |
| 153 | 157 | } |
@@ -163,8 +167,9 @@ discard block |
||
| 163 | 167 | |
| 164 | 168 | if ($packagetype) { |
| 165 | 169 | $lcasetype = strtolower($packagetype); |
| 166 | - if ($lcasetype == 'update') |
|
| 167 | - return true; |
|
| 170 | + if ($lcasetype == 'update') { |
|
| 171 | + return true; |
|
| 172 | + } |
|
| 168 | 173 | } |
| 169 | 174 | return false; |
| 170 | 175 | } |
@@ -183,8 +188,9 @@ discard block |
||
| 183 | 188 | |
| 184 | 189 | if ($packagetype) { |
| 185 | 190 | $lcasetype = strtolower($packagetype); |
| 186 | - if ($lcasetype == 'layout') |
|
| 187 | - return true; |
|
| 191 | + if ($lcasetype == 'layout') { |
|
| 192 | + return true; |
|
| 193 | + } |
|
| 188 | 194 | } |
| 189 | 195 | return false; |
| 190 | 196 | } |
@@ -227,8 +233,9 @@ discard block |
||
| 227 | 233 | public function getParameters() |
| 228 | 234 | { |
| 229 | 235 | $parameters = []; |
| 230 | - if (empty($this->_modulexml->parameters)) |
|
| 231 | - return $parameters; |
|
| 236 | + if (empty($this->_modulexml->parameters)) { |
|
| 237 | + return $parameters; |
|
| 238 | + } |
|
| 232 | 239 | foreach ($this->_modulexml->parameters->parameter as $parameter) { |
| 233 | 240 | $parameters[] = $parameter; |
| 234 | 241 | } |
@@ -338,17 +345,21 @@ discard block |
||
| 338 | 345 | } |
| 339 | 346 | |
| 340 | 347 | $validzip = false; |
| 341 | - if ($manifestxml_found && $languagefile_found && $moduleVersionFound) |
|
| 342 | - $validzip = true; |
|
| 348 | + if ($manifestxml_found && $languagefile_found && $moduleVersionFound) { |
|
| 349 | + $validzip = true; |
|
| 350 | + } |
|
| 343 | 351 | |
| 344 | - if ($manifestxml_found && $layoutfile_found && $moduleVersionFound) |
|
| 345 | - $validzip = true; |
|
| 352 | + if ($manifestxml_found && $layoutfile_found && $moduleVersionFound) { |
|
| 353 | + $validzip = true; |
|
| 354 | + } |
|
| 346 | 355 | |
| 347 | - if ($manifestxml_found && $languagefile_found && $extensionfile_found && $moduleVersionFound) |
|
| 348 | - $validzip = true; |
|
| 356 | + if ($manifestxml_found && $languagefile_found && $extensionfile_found && $moduleVersionFound) { |
|
| 357 | + $validzip = true; |
|
| 358 | + } |
|
| 349 | 359 | |
| 350 | - if ($manifestxml_found && $updatefile_found && $moduleVersionFound) |
|
| 351 | - $validzip = true; |
|
| 360 | + if ($manifestxml_found && $updatefile_found && $moduleVersionFound) { |
|
| 361 | + $validzip = true; |
|
| 362 | + } |
|
| 352 | 363 | |
| 353 | 364 | if ($validzip) { |
| 354 | 365 | if (!empty($this->_modulexml->license)) { |
@@ -365,8 +376,9 @@ discard block |
||
| 365 | 376 | } |
| 366 | 377 | } |
| 367 | 378 | } |
| 368 | - if ($unzip) |
|
| 369 | - $unzip->close(); |
|
| 379 | + if ($unzip) { |
|
| 380 | + $unzip->close(); |
|
| 381 | + } |
|
| 370 | 382 | return $validzip; |
| 371 | 383 | } |
| 372 | 384 | |
@@ -376,8 +388,9 @@ discard block |
||
| 376 | 388 | */ |
| 377 | 389 | public function getModuleNameFromZip($zipfile) |
| 378 | 390 | { |
| 379 | - if (!$this->checkZip($zipfile)) |
|
| 380 | - return null; |
|
| 391 | + if (!$this->checkZip($zipfile)) { |
|
| 392 | + return null; |
|
| 393 | + } |
|
| 381 | 394 | return (string) $this->_modulexml->name; |
| 382 | 395 | } |
| 383 | 396 | |
@@ -453,8 +466,9 @@ discard block |
||
| 453 | 466 | $unzip->unzip("$module.png", 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png"); |
| 454 | 467 | } |
| 455 | 468 | |
| 456 | - if ($unzip) |
|
| 457 | - $unzip->close(); |
|
| 469 | + if ($unzip) { |
|
| 470 | + $unzip->close(); |
|
| 471 | + } |
|
| 458 | 472 | } |
| 459 | 473 | return $module; |
| 460 | 474 | } |
@@ -642,8 +656,9 @@ discard block |
||
| 642 | 656 | */ |
| 643 | 657 | public function import_Tables($modulenode) |
| 644 | 658 | { |
| 645 | - if (empty($modulenode->tables) || empty($modulenode->tables->table)) |
|
| 646 | - return; |
|
| 659 | + if (empty($modulenode->tables) || empty($modulenode->tables->table)) { |
|
| 660 | + return; |
|
| 661 | + } |
|
| 647 | 662 | $adb = \PearDatabase::getInstance(); |
| 648 | 663 | $adb->query('SET FOREIGN_KEY_CHECKS = 0;'); |
| 649 | 664 | |
@@ -677,8 +692,9 @@ discard block |
||
| 677 | 692 | */ |
| 678 | 693 | public function import_Blocks($modulenode, $moduleInstance) |
| 679 | 694 | { |
| 680 | - if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) |
|
| 681 | - return; |
|
| 695 | + if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) { |
|
| 696 | + return; |
|
| 697 | + } |
|
| 682 | 698 | foreach ($modulenode->blocks->block as $blocknode) { |
| 683 | 699 | $blockInstance = $this->import_Block($modulenode, $moduleInstance, $blocknode); |
| 684 | 700 | $this->import_Fields($blocknode, $blockInstance, $moduleInstance); |
@@ -697,8 +713,9 @@ discard block |
||
| 697 | 713 | $blockInstance->label = $blocklabel; |
| 698 | 714 | if (isset($blocknode->sequence) && isset($blocknode->display_status)) { |
| 699 | 715 | $blockInstance->sequence = strval($blocknode->sequence); |
| 700 | - if ($blockInstance->sequence = "") |
|
| 701 | - $blockInstance->sequence = NULL; |
|
| 716 | + if ($blockInstance->sequence = "") { |
|
| 717 | + $blockInstance->sequence = NULL; |
|
| 718 | + } |
|
| 702 | 719 | $blockInstance->showtitle = strval($blocknode->show_title); |
| 703 | 720 | $blockInstance->visible = strval($blocknode->visible); |
| 704 | 721 | $blockInstance->increateview = strval($blocknode->create_view); |
@@ -720,8 +737,9 @@ discard block |
||
| 720 | 737 | */ |
| 721 | 738 | public function import_Fields($blocknode, $blockInstance, $moduleInstance) |
| 722 | 739 | { |
| 723 | - if (empty($blocknode->fields) || empty($blocknode->fields->field)) |
|
| 724 | - return; |
|
| 740 | + if (empty($blocknode->fields) || empty($blocknode->fields->field)) { |
|
| 741 | + return; |
|
| 742 | + } |
|
| 725 | 743 | |
| 726 | 744 | foreach ($blocknode->fields->field as $fieldnode) { |
| 727 | 745 | $fieldInstance = $this->import_Field($blocknode, $blockInstance, $moduleInstance, $fieldnode); |
@@ -752,17 +770,21 @@ discard block |
||
| 752 | 770 | $fieldInstance->displaytype = $fieldnode->displaytype; |
| 753 | 771 | $fieldInstance->info_type = $fieldnode->info_type; |
| 754 | 772 | |
| 755 | - if (!empty($fieldnode->fieldparams)) |
|
| 756 | - $fieldInstance->fieldparams = $fieldnode->fieldparams; |
|
| 773 | + if (!empty($fieldnode->fieldparams)) { |
|
| 774 | + $fieldInstance->fieldparams = $fieldnode->fieldparams; |
|
| 775 | + } |
|
| 757 | 776 | |
| 758 | - if (!empty($fieldnode->helpinfo)) |
|
| 759 | - $fieldInstance->helpinfo = $fieldnode->helpinfo; |
|
| 777 | + if (!empty($fieldnode->helpinfo)) { |
|
| 778 | + $fieldInstance->helpinfo = $fieldnode->helpinfo; |
|
| 779 | + } |
|
| 760 | 780 | |
| 761 | - if (isset($fieldnode->masseditable)) |
|
| 762 | - $fieldInstance->masseditable = $fieldnode->masseditable; |
|
| 781 | + if (isset($fieldnode->masseditable)) { |
|
| 782 | + $fieldInstance->masseditable = $fieldnode->masseditable; |
|
| 783 | + } |
|
| 763 | 784 | |
| 764 | - if (isset($fieldnode->columntype) && !empty($fieldnode->columntype)) |
|
| 765 | - $fieldInstance->columntype = strval($fieldnode->columntype); |
|
| 785 | + if (isset($fieldnode->columntype) && !empty($fieldnode->columntype)) { |
|
| 786 | + $fieldInstance->columntype = strval($fieldnode->columntype); |
|
| 787 | + } |
|
| 766 | 788 | |
| 767 | 789 | if (!empty($fieldnode->tree_template)) { |
| 768 | 790 | $templateid = $fieldInstance->setTreeTemplate($fieldnode->tree_template, $moduleInstance); |
@@ -810,8 +832,9 @@ discard block |
||
| 810 | 832 | */ |
| 811 | 833 | public function import_CustomViews($modulenode, $moduleInstance) |
| 812 | 834 | { |
| 813 | - if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) |
|
| 814 | - return; |
|
| 835 | + if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) { |
|
| 836 | + return; |
|
| 837 | + } |
|
| 815 | 838 | foreach ($modulenode->customviews->customview as $customviewnode) { |
| 816 | 839 | $this->import_CustomView($modulenode, $moduleInstance, $customviewnode); |
| 817 | 840 | } |
@@ -854,8 +877,9 @@ discard block |
||
| 854 | 877 | */ |
| 855 | 878 | public function import_SharingAccess($modulenode, $moduleInstance) |
| 856 | 879 | { |
| 857 | - if (empty($modulenode->sharingaccess)) |
|
| 858 | - return; |
|
| 880 | + if (empty($modulenode->sharingaccess)) { |
|
| 881 | + return; |
|
| 882 | + } |
|
| 859 | 883 | |
| 860 | 884 | if (!empty($modulenode->sharingaccess->default)) { |
| 861 | 885 | foreach ($modulenode->sharingaccess->default as $defaultnode) { |
@@ -870,8 +894,9 @@ discard block |
||
| 870 | 894 | */ |
| 871 | 895 | public function import_Events($modulenode, $moduleInstance) |
| 872 | 896 | { |
| 873 | - if (empty($modulenode->events) || empty($modulenode->events->event)) |
|
| 874 | - return; |
|
| 897 | + if (empty($modulenode->events) || empty($modulenode->events->event)) { |
|
| 898 | + return; |
|
| 899 | + } |
|
| 875 | 900 | |
| 876 | 901 | if (Event::hasSupport()) { |
| 877 | 902 | foreach ($modulenode->events->event as $eventnode) { |
@@ -888,10 +913,12 @@ discard block |
||
| 888 | 913 | { |
| 889 | 914 | $event_condition = ''; |
| 890 | 915 | $event_dependent = '[]'; |
| 891 | - if (!empty($eventnode->condition)) |
|
| 892 | - $event_condition = "$eventnode->condition"; |
|
| 893 | - if (!empty($eventnode->dependent)) |
|
| 894 | - $event_dependent = "$eventnode->dependent"; |
|
| 916 | + if (!empty($eventnode->condition)) { |
|
| 917 | + $event_condition = "$eventnode->condition"; |
|
| 918 | + } |
|
| 919 | + if (!empty($eventnode->dependent)) { |
|
| 920 | + $event_dependent = "$eventnode->dependent"; |
|
| 921 | + } |
|
| 895 | 922 | Event::register($moduleInstance, (string) $eventnode->eventname, (string) $eventnode->classname, (string) $eventnode->filename, (string) $event_condition, (string) $event_dependent |
| 896 | 923 | ); |
| 897 | 924 | } |
@@ -902,8 +929,9 @@ discard block |
||
| 902 | 929 | */ |
| 903 | 930 | public function import_Actions($modulenode, $moduleInstance) |
| 904 | 931 | { |
| 905 | - if (empty($modulenode->actions) || empty($modulenode->actions->action)) |
|
| 906 | - return; |
|
| 932 | + if (empty($modulenode->actions) || empty($modulenode->actions->action)) { |
|
| 933 | + return; |
|
| 934 | + } |
|
| 907 | 935 | foreach ($modulenode->actions->action as $actionnode) { |
| 908 | 936 | $this->import_Action($modulenode, $moduleInstance, $actionnode); |
| 909 | 937 | } |
@@ -916,10 +944,11 @@ discard block |
||
| 916 | 944 | public function import_Action($modulenode, $moduleInstance, $actionnode) |
| 917 | 945 | { |
| 918 | 946 | $actionstatus = $actionnode->status; |
| 919 | - if ($actionstatus == 'enabled') |
|
| 920 | - $moduleInstance->enableTools($actionnode->name); |
|
| 921 | - else |
|
| 922 | - $moduleInstance->disableTools($actionnode->name); |
|
| 947 | + if ($actionstatus == 'enabled') { |
|
| 948 | + $moduleInstance->enableTools($actionnode->name); |
|
| 949 | + } else { |
|
| 950 | + $moduleInstance->disableTools($actionnode->name); |
|
| 951 | + } |
|
| 923 | 952 | } |
| 924 | 953 | |
| 925 | 954 | /** |
@@ -984,8 +1013,9 @@ discard block |
||
| 984 | 1013 | */ |
| 985 | 1014 | public function import_CustomLinks($modulenode, $moduleInstance) |
| 986 | 1015 | { |
| 987 | - if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) |
|
| 988 | - return; |
|
| 1016 | + if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) { |
|
| 1017 | + return; |
|
| 1018 | + } |
|
| 989 | 1019 | |
| 990 | 1020 | foreach ($modulenode->customlinks->customlink as $customlinknode) { |
| 991 | 1021 | $handlerInfo = null; |
@@ -1007,8 +1037,9 @@ discard block |
||
| 1007 | 1037 | */ |
| 1008 | 1038 | public function import_CronTasks($modulenode) |
| 1009 | 1039 | { |
| 1010 | - if (empty($modulenode->crons) || empty($modulenode->crons->cron)) |
|
| 1011 | - return; |
|
| 1040 | + if (empty($modulenode->crons) || empty($modulenode->crons->cron)) { |
|
| 1041 | + return; |
|
| 1042 | + } |
|
| 1012 | 1043 | foreach ($modulenode->crons->cron as $cronTask) { |
| 1013 | 1044 | if (empty($cronTask->status)) { |
| 1014 | 1045 | $cronTask->status = Cron::$STATUS_DISABLED; |
@@ -1069,8 +1100,9 @@ discard block |
||
| 1069 | 1100 | */ |
| 1070 | 1101 | public function importInventory() |
| 1071 | 1102 | { |
| 1072 | - if (empty($this->_modulexml->inventory) || empty($this->_modulexml->inventory->fields->field)) |
|
| 1073 | - return false; |
|
| 1103 | + if (empty($this->_modulexml->inventory) || empty($this->_modulexml->inventory->fields->field)) { |
|
| 1104 | + return false; |
|
| 1105 | + } |
|
| 1074 | 1106 | $module = (string) $this->moduleInstance->name; |
| 1075 | 1107 | |
| 1076 | 1108 | $inventoryInstance = \Vtiger_Inventory_Model::getInstance($module); |
@@ -23,6 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Initialize Update |
| 25 | 25 | * @access private |
| 26 | + * @param boolean $overwrite |
|
| 26 | 27 | */ |
| 27 | 28 | public function initUpdate($moduleInstance, $zipfile, $overwrite) |
| 28 | 29 | { |
@@ -185,6 +186,7 @@ discard block |
||
| 185 | 186 | /** |
| 186 | 187 | * Handle migration of the module |
| 187 | 188 | * @access private |
| 189 | + * @param \SimpleXMLElement $modulenode |
|
| 188 | 190 | */ |
| 189 | 191 | public function handle_Migration($modulenode, $moduleInstance) |
| 190 | 192 | { |
@@ -218,6 +220,7 @@ discard block |
||
| 218 | 220 | /** |
| 219 | 221 | * Update Tables of the module |
| 220 | 222 | * @access private |
| 223 | + * @param \SimpleXMLElement $modulenode |
|
| 221 | 224 | */ |
| 222 | 225 | public function update_Tables($modulenode) |
| 223 | 226 | { |
@@ -227,6 +230,7 @@ discard block |
||
| 227 | 230 | /** |
| 228 | 231 | * Update Blocks of the module |
| 229 | 232 | * @access private |
| 233 | + * @param \SimpleXMLElement $modulenode |
|
| 230 | 234 | */ |
| 231 | 235 | public function update_Blocks($modulenode, $moduleInstance) |
| 232 | 236 | { |
@@ -308,6 +312,7 @@ discard block |
||
| 308 | 312 | /** |
| 309 | 313 | * Update Field of the module |
| 310 | 314 | * @access private |
| 315 | + * @param Field $fieldInstance |
|
| 311 | 316 | */ |
| 312 | 317 | public function update_Field($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance) |
| 313 | 318 | { |
@@ -387,6 +392,7 @@ discard block |
||
| 387 | 392 | /** |
| 388 | 393 | * Import Custom views of the module |
| 389 | 394 | * @access private |
| 395 | + * @param \SimpleXMLElement $modulenode |
|
| 390 | 396 | */ |
| 391 | 397 | public function update_CustomViews($modulenode, $moduleInstance) |
| 392 | 398 | { |
@@ -405,6 +411,7 @@ discard block |
||
| 405 | 411 | /** |
| 406 | 412 | * Update Custom View of the module |
| 407 | 413 | * @access private |
| 414 | + * @param Filter $filterInstance |
|
| 408 | 415 | */ |
| 409 | 416 | public function update_CustomView($modulenode, $moduleInstance, $customviewnode, $filterInstance) |
| 410 | 417 | { |
@@ -416,6 +423,7 @@ discard block |
||
| 416 | 423 | /** |
| 417 | 424 | * Update Sharing Access of the module |
| 418 | 425 | * @access private |
| 426 | + * @param \SimpleXMLElement $modulenode |
|
| 419 | 427 | */ |
| 420 | 428 | public function update_SharingAccess($modulenode, $moduleInstance) |
| 421 | 429 | { |
@@ -428,6 +436,7 @@ discard block |
||
| 428 | 436 | /** |
| 429 | 437 | * Update Events of the module |
| 430 | 438 | * @access private |
| 439 | + * @param \SimpleXMLElement $modulenode |
|
| 431 | 440 | */ |
| 432 | 441 | public function update_Events($modulenode, $moduleInstance) |
| 433 | 442 | { |
@@ -460,6 +469,7 @@ discard block |
||
| 460 | 469 | /** |
| 461 | 470 | * Update actions of the module |
| 462 | 471 | * @access private |
| 472 | + * @param \SimpleXMLElement $modulenode |
|
| 463 | 473 | */ |
| 464 | 474 | public function update_Actions($modulenode, $moduleInstance) |
| 465 | 475 | { |
@@ -482,6 +492,7 @@ discard block |
||
| 482 | 492 | /** |
| 483 | 493 | * Update related lists of the module |
| 484 | 494 | * @access private |
| 495 | + * @param \SimpleXMLElement $modulenode |
|
| 485 | 496 | */ |
| 486 | 497 | public function update_RelatedLists($modulenode, $moduleInstance) |
| 487 | 498 | { |
@@ -538,6 +549,9 @@ discard block |
||
| 538 | 549 | return $inRelModuleInstance; |
| 539 | 550 | } |
| 540 | 551 | |
| 552 | + /** |
|
| 553 | + * @param \SimpleXMLElement $modulenode |
|
| 554 | + */ |
|
| 541 | 555 | public function update_CustomLinks($modulenode, $moduleInstance) |
| 542 | 556 | { |
| 543 | 557 | if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) |
@@ -546,6 +560,9 @@ discard block |
||
| 546 | 560 | $this->import_CustomLinks($modulenode, $moduleInstance); |
| 547 | 561 | } |
| 548 | 562 | |
| 563 | + /** |
|
| 564 | + * @param \SimpleXMLElement $modulenode |
|
| 565 | + */ |
|
| 549 | 566 | public function update_CronTasks($modulenode) |
| 550 | 567 | { |
| 551 | 568 | if (empty($modulenode->crons) || empty($modulenode->crons->cron)) |
@@ -65,8 +65,9 @@ discard block |
||
| 65 | 65 | $this->__parseManifestFile($unzip); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if ($unzip) |
|
| 69 | - $unzip->close(); |
|
| 68 | + if ($unzip) { |
|
| 69 | + $unzip->close(); |
|
| 70 | + } |
|
| 70 | 71 | } |
| 71 | 72 | return $module; |
| 72 | 73 | } |
@@ -136,8 +137,9 @@ discard block |
||
| 136 | 137 | $isextension = false; |
| 137 | 138 | if (!empty($this->_modulexml->type)) { |
| 138 | 139 | $type = strtolower($this->_modulexml->type); |
| 139 | - if ($type == 'extension' || $type == 'language') |
|
| 140 | - $isextension = true; |
|
| 140 | + if ($type == 'extension' || $type == 'language') { |
|
| 141 | + $isextension = true; |
|
| 142 | + } |
|
| 141 | 143 | } |
| 142 | 144 | |
| 143 | 145 | Module::fireEvent($moduleInstance->name, Module::EVENT_MODULE_PREUPDATE); |
@@ -230,8 +232,9 @@ discard block |
||
| 230 | 232 | */ |
| 231 | 233 | public function update_Blocks($modulenode, $moduleInstance) |
| 232 | 234 | { |
| 233 | - if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) |
|
| 234 | - return; |
|
| 235 | + if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) { |
|
| 236 | + return; |
|
| 237 | + } |
|
| 235 | 238 | |
| 236 | 239 | foreach ($modulenode->blocks->block as $blocknode) { |
| 237 | 240 | $this->listBlocks[] = strval($blocknode->label); |
@@ -283,8 +286,9 @@ discard block |
||
| 283 | 286 | */ |
| 284 | 287 | public function update_Fields($blocknode, $blockInstance, $moduleInstance) |
| 285 | 288 | { |
| 286 | - if (empty($blocknode->fields) || empty($blocknode->fields->field)) |
|
| 287 | - return; |
|
| 289 | + if (empty($blocknode->fields) || empty($blocknode->fields->field)) { |
|
| 290 | + return; |
|
| 291 | + } |
|
| 288 | 292 | |
| 289 | 293 | foreach ($blocknode->fields->field as $fieldnode) { |
| 290 | 294 | $this->listFields[] = strval($fieldnode->fieldname); |
@@ -331,8 +335,9 @@ discard block |
||
| 331 | 335 | $fieldInstance->info_type = strval($fieldnode->info_type); |
| 332 | 336 | $fieldInstance->fieldparams = strval($fieldnode->fieldparams); |
| 333 | 337 | |
| 334 | - if (!empty($fieldnode->fieldparams)) |
|
| 335 | - $fieldInstance->fieldparams = strval($fieldnode->fieldparams); |
|
| 338 | + if (!empty($fieldnode->fieldparams)) { |
|
| 339 | + $fieldInstance->fieldparams = strval($fieldnode->fieldparams); |
|
| 340 | + } |
|
| 336 | 341 | |
| 337 | 342 | // Check if new parameters are defined |
| 338 | 343 | if (isset($fieldnode->columntype)) { |
@@ -341,12 +346,15 @@ discard block |
||
| 341 | 346 | $fieldInstance->columntype = NULL; |
| 342 | 347 | } |
| 343 | 348 | |
| 344 | - if (!empty($fieldnode->helpinfo)) |
|
| 345 | - $fieldInstance->setHelpInfo($fieldnode->helpinfo); |
|
| 346 | - if (!empty($fieldnode->masseditable)) |
|
| 347 | - $fieldInstance->setMassEditable($fieldnode->masseditable); |
|
| 348 | - if (!empty($fieldnode->summaryfield)) |
|
| 349 | - $fieldInstance->setSummaryField($fieldnode->summaryfield); |
|
| 349 | + if (!empty($fieldnode->helpinfo)) { |
|
| 350 | + $fieldInstance->setHelpInfo($fieldnode->helpinfo); |
|
| 351 | + } |
|
| 352 | + if (!empty($fieldnode->masseditable)) { |
|
| 353 | + $fieldInstance->setMassEditable($fieldnode->masseditable); |
|
| 354 | + } |
|
| 355 | + if (!empty($fieldnode->summaryfield)) { |
|
| 356 | + $fieldInstance->setSummaryField($fieldnode->summaryfield); |
|
| 357 | + } |
|
| 350 | 358 | |
| 351 | 359 | $fieldInstance->block = $blockInstance; |
| 352 | 360 | $fieldInstance->save(); |
@@ -390,8 +398,9 @@ discard block |
||
| 390 | 398 | */ |
| 391 | 399 | public function update_CustomViews($modulenode, $moduleInstance) |
| 392 | 400 | { |
| 393 | - if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) |
|
| 394 | - return; |
|
| 401 | + if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) { |
|
| 402 | + return; |
|
| 403 | + } |
|
| 395 | 404 | foreach ($modulenode->customviews->customview as $customviewnode) { |
| 396 | 405 | $filterInstance = Filter::getInstance($customviewnode->viewname, $moduleInstance); |
| 397 | 406 | if (!$filterInstance) { |
@@ -419,8 +428,9 @@ discard block |
||
| 419 | 428 | */ |
| 420 | 429 | public function update_SharingAccess($modulenode, $moduleInstance) |
| 421 | 430 | { |
| 422 | - if (empty($modulenode->sharingaccess)) |
|
| 423 | - return; |
|
| 431 | + if (empty($modulenode->sharingaccess)) { |
|
| 432 | + return; |
|
| 433 | + } |
|
| 424 | 434 | |
| 425 | 435 | // TODO Handle sharing access property update |
| 426 | 436 | } |
@@ -431,8 +441,9 @@ discard block |
||
| 431 | 441 | */ |
| 432 | 442 | public function update_Events($modulenode, $moduleInstance) |
| 433 | 443 | { |
| 434 | - if (empty($modulenode->events) || empty($modulenode->events->event)) |
|
| 435 | - return; |
|
| 444 | + if (empty($modulenode->events) || empty($modulenode->events->event)) { |
|
| 445 | + return; |
|
| 446 | + } |
|
| 436 | 447 | |
| 437 | 448 | $adb = \PearDatabase::getInstance(); |
| 438 | 449 | |
@@ -463,8 +474,9 @@ discard block |
||
| 463 | 474 | */ |
| 464 | 475 | public function update_Actions($modulenode, $moduleInstance) |
| 465 | 476 | { |
| 466 | - if (empty($modulenode->actions) || empty($modulenode->actions->action)) |
|
| 467 | - return; |
|
| 477 | + if (empty($modulenode->actions) || empty($modulenode->actions->action)) { |
|
| 478 | + return; |
|
| 479 | + } |
|
| 468 | 480 | foreach ($modulenode->actions->action as $actionnode) { |
| 469 | 481 | $this->update_Action($modulenode, $moduleInstance, $actionnode); |
| 470 | 482 | } |
@@ -540,16 +552,18 @@ discard block |
||
| 540 | 552 | |
| 541 | 553 | public function update_CustomLinks($modulenode, $moduleInstance) |
| 542 | 554 | { |
| 543 | - if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) |
|
| 544 | - return; |
|
| 555 | + if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) { |
|
| 556 | + return; |
|
| 557 | + } |
|
| 545 | 558 | $moduleInstance->deleteLinks(); |
| 546 | 559 | $this->import_CustomLinks($modulenode, $moduleInstance); |
| 547 | 560 | } |
| 548 | 561 | |
| 549 | 562 | public function update_CronTasks($modulenode) |
| 550 | 563 | { |
| 551 | - if (empty($modulenode->crons) || empty($modulenode->crons->cron)) |
|
| 552 | - return; |
|
| 564 | + if (empty($modulenode->crons) || empty($modulenode->crons->cron)) { |
|
| 565 | + return; |
|
| 566 | + } |
|
| 553 | 567 | $cronTasks = Cron::listAllInstancesByModule($modulenode->name); |
| 554 | 568 | foreach ($modulenode->crons->cron as $importCronTask) { |
| 555 | 569 | foreach ($cronTasks as $cronTask) { |
@@ -66,6 +66,7 @@ discard block |
||
| 66 | 66 | * Helper function to log messages |
| 67 | 67 | * @param String Message to log |
| 68 | 68 | * @param Boolean true appends linebreak, false to avoid it |
| 69 | + * @param string $message |
|
| 69 | 70 | * @access private |
| 70 | 71 | */ |
| 71 | 72 | static function log($message, $delimit = true) |
@@ -76,6 +77,7 @@ discard block |
||
| 76 | 77 | /** |
| 77 | 78 | * Initialize profile setup for Field |
| 78 | 79 | * @param Field Instance of the field |
| 80 | + * @param FieldBasic $fieldInstance |
|
| 79 | 81 | * @access private |
| 80 | 82 | */ |
| 81 | 83 | static function initForField($fieldInstance) |
@@ -94,6 +96,7 @@ discard block |
||
| 94 | 96 | /** |
| 95 | 97 | * Delete profile information related with field. |
| 96 | 98 | * @param Field Instance of the field |
| 99 | + * @param FieldBasic $fieldInstance |
|
| 97 | 100 | * @access private |
| 98 | 101 | */ |
| 99 | 102 | static function deleteForField($fieldInstance) |
@@ -122,6 +125,7 @@ discard block |
||
| 122 | 125 | /** |
| 123 | 126 | * Initialize profile setup for the module |
| 124 | 127 | * @param Module Instance of module |
| 128 | + * @param ModuleBasic $moduleInstance |
|
| 125 | 129 | * @access private |
| 126 | 130 | */ |
| 127 | 131 | static function initForModule($moduleInstance) |
@@ -28,6 +28,7 @@ |
||
| 28 | 28 | /** |
| 29 | 29 | * Initialize Import |
| 30 | 30 | * @access private |
| 31 | + * @param boolean $overwrite |
|
| 31 | 32 | */ |
| 32 | 33 | public function initImport($zipfile, $overwrite) |
| 33 | 34 | { |
@@ -84,8 +84,9 @@ discard block |
||
| 84 | 84 | foreach ($filelist as $filename => $fileinfo) { |
| 85 | 85 | if (!$unzip->isdir($filename)) { |
| 86 | 86 | |
| 87 | - if (strpos($filename, '/') === false) |
|
| 88 | - continue; |
|
| 87 | + if (strpos($filename, '/') === false) { |
|
| 88 | + continue; |
|
| 89 | + } |
|
| 89 | 90 | |
| 90 | 91 | $targetdir = substr($filename, 0, strripos($filename, '/')); |
| 91 | 92 | $targetfile = basename($filename); |
@@ -146,8 +147,9 @@ discard block |
||
| 146 | 147 | } |
| 147 | 148 | } |
| 148 | 149 | } |
| 149 | - if ($unzip) |
|
| 150 | - $unzip->close(); |
|
| 150 | + if ($unzip) { |
|
| 151 | + $unzip->close(); |
|
| 152 | + } |
|
| 151 | 153 | |
| 152 | 154 | self::register($prefix, $label, $name); |
| 153 | 155 | |
@@ -112,6 +112,7 @@ |
||
| 112 | 112 | /** |
| 113 | 113 | * Clean up the input to be used as a regex |
| 114 | 114 | * @access private |
| 115 | + * @param string $value |
|
| 115 | 116 | */ |
| 116 | 117 | public function __formatAsRegex($value) |
| 117 | 118 | { |
@@ -70,8 +70,9 @@ discard block |
||
| 70 | 70 | unset($this->tplvars); |
| 71 | 71 | |
| 72 | 72 | $this->tplvars = []; |
| 73 | - foreach ($restorevars as $key => $val) |
|
| 74 | - $this->assign($key, $val); |
|
| 73 | + foreach ($restorevars as $key => $val) { |
|
| 74 | + $this->assign($key, $val); |
|
| 75 | + } |
|
| 75 | 76 | } |
| 76 | 77 | |
| 77 | 78 | /** |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | */ |
| 83 | 84 | public function merge($instring, $avoidLookup = false) |
| 84 | 85 | { |
| 85 | - if (empty($instring)) |
|
| 86 | - return $instring; |
|
| 86 | + if (empty($instring)) { |
|
| 87 | + return $instring; |
|
| 88 | + } |
|
| 87 | 89 | |
| 88 | 90 | if (!$avoidLookup) { |
| 89 | 91 | |