@@ -32,6 +32,9 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param boolean $interactive |
|
| 37 | + */ |
|
| 35 | 38 | public function setArguments($args, $interactive) |
| 36 | 39 | { |
| 37 | 40 | $this->arguments = $args; |
@@ -156,11 +159,18 @@ discard block |
||
| 156 | 159 | } while (true); |
| 157 | 160 | } |
| 158 | 161 | |
| 162 | + /** |
|
| 163 | + * @return string |
|
| 164 | + */ |
|
| 159 | 165 | protected function toAlphaNumeric($value) |
| 160 | 166 | { |
| 161 | 167 | return preg_replace("/[^a-zA-Z0-9_]/", "", $value); |
| 162 | 168 | } |
| 163 | 169 | |
| 170 | + /** |
|
| 171 | + * @param string $dir |
|
| 172 | + * @param string $file_pattern |
|
| 173 | + */ |
|
| 164 | 174 | protected function findFiles($dir, $file_pattern, &$files) |
| 165 | 175 | { |
| 166 | 176 | $items = glob($dir . '/*', GLOB_NOSORT); |
@@ -257,6 +267,9 @@ discard block |
||
| 257 | 267 | echo "DONE.\n"; |
| 258 | 268 | } |
| 259 | 269 | |
| 270 | + /** |
|
| 271 | + * @param string $name |
|
| 272 | + */ |
|
| 260 | 273 | public function find($name) |
| 261 | 274 | { |
| 262 | 275 | return vtlib\Module::getInstance($name); |
@@ -401,7 +401,7 @@ |
||
| 401 | 401 | if (!file_exists($tplpath . $tplname)) { |
| 402 | 402 | $initialContent = "{* License Text *}\n"; |
| 403 | 403 | // Enable debug to make it easy to implement. |
| 404 | - $initialContent.= "{debug}{* REMOVE THIS LINE AFTER IMPLEMENTATION *}\n\n"; |
|
| 404 | + $initialContent .= "{debug}{* REMOVE THIS LINE AFTER IMPLEMENTATION *}\n\n"; |
|
| 405 | 405 | file_put_contents($tplpath . $tplname, $initialContent); |
| 406 | 406 | } |
| 407 | 407 | file_put_contents($tplpath . $tplname, "{* $file *}\n", FILE_APPEND); |
@@ -116,8 +116,9 @@ discard block |
||
| 116 | 116 | protected function prompt($msg = '', $type = self::PROMPT_ANY) |
| 117 | 117 | { |
| 118 | 118 | do { |
| 119 | - if ($msg) |
|
| 120 | - echo $msg; |
|
| 119 | + if ($msg) { |
|
| 120 | + echo $msg; |
|
| 121 | + } |
|
| 121 | 122 | $value = trim(fgets(STDIN)); |
| 122 | 123 | |
| 123 | 124 | if (!$value && $type == self::PROMPT_OPTIONAL) { |
@@ -463,8 +464,9 @@ discard block |
||
| 463 | 464 | $filename = basename($file, true); |
| 464 | 465 | $dir = substr($file, 0, strpos($file, $filename)); |
| 465 | 466 | $dir = str_replace('languages/' . self::BASE_LANG_PREFIX, 'languages/' . $languageInformation['prefix'], $dir); |
| 466 | - if (!file_exists($dir)) |
|
| 467 | - mkdir($dir); |
|
| 467 | + if (!file_exists($dir)) { |
|
| 468 | + mkdir($dir); |
|
| 469 | + } |
|
| 468 | 470 | |
| 469 | 471 | if (isset($languageInformation['prefix_value'])) { |
| 470 | 472 | $contents = file_get_contents($file); |
@@ -146,6 +146,7 @@ |
||
| 146 | 146 | /** |
| 147 | 147 | * Create this field instance |
| 148 | 148 | * @param vtlib\Block Instance of the block to use |
| 149 | + * @param boolean $blockInstance |
|
| 149 | 150 | * @access private |
| 150 | 151 | */ |
| 151 | 152 | public function __create($blockInstance) |
@@ -253,10 +253,11 @@ |
||
| 253 | 253 | */ |
| 254 | 254 | public function save($blockInstance = false) |
| 255 | 255 | { |
| 256 | - if ($this->id) |
|
| 257 | - $this->__update(); |
|
| 258 | - else |
|
| 259 | - $this->__create($blockInstance); |
|
| 256 | + if ($this->id) { |
|
| 257 | + $this->__update(); |
|
| 258 | + } else { |
|
| 259 | + $this->__create($blockInstance); |
|
| 260 | + } |
|
| 260 | 261 | return $this->id; |
| 261 | 262 | } |
| 262 | 263 | |
@@ -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 | { |
@@ -78,8 +78,9 @@ discard block |
||
| 78 | 78 | foreach ($filelist as $filename => $fileinfo) { |
| 79 | 79 | if (!$unzip->isdir($filename)) { |
| 80 | 80 | |
| 81 | - if (strpos($filename, '/') === false) |
|
| 82 | - continue; |
|
| 81 | + if (strpos($filename, '/') === false) { |
|
| 82 | + continue; |
|
| 83 | + } |
|
| 83 | 84 | |
| 84 | 85 | |
| 85 | 86 | $targetdir = substr($filename, 0, strripos($filename, '/')); |
@@ -130,8 +131,9 @@ discard block |
||
| 130 | 131 | } |
| 131 | 132 | } |
| 132 | 133 | } |
| 133 | - if ($unzip) |
|
| 134 | - $unzip->close(); |
|
| 134 | + if ($unzip) { |
|
| 135 | + $unzip->close(); |
|
| 136 | + } |
|
| 135 | 137 | |
| 136 | 138 | self::register($name, $label); |
| 137 | 139 | |
@@ -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; |
@@ -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 | } |
@@ -640,8 +654,9 @@ discard block |
||
| 640 | 654 | */ |
| 641 | 655 | public function import_Tables($modulenode) |
| 642 | 656 | { |
| 643 | - if (empty($modulenode->tables) || empty($modulenode->tables->table)) |
|
| 644 | - return; |
|
| 657 | + if (empty($modulenode->tables) || empty($modulenode->tables->table)) { |
|
| 658 | + return; |
|
| 659 | + } |
|
| 645 | 660 | $adb = \PearDatabase::getInstance(); |
| 646 | 661 | $adb->query('SET FOREIGN_KEY_CHECKS = 0;'); |
| 647 | 662 | |
@@ -675,8 +690,9 @@ discard block |
||
| 675 | 690 | */ |
| 676 | 691 | public function import_Blocks($modulenode, $moduleInstance) |
| 677 | 692 | { |
| 678 | - if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) |
|
| 679 | - return; |
|
| 693 | + if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) { |
|
| 694 | + return; |
|
| 695 | + } |
|
| 680 | 696 | foreach ($modulenode->blocks->block as $blocknode) { |
| 681 | 697 | $blockInstance = $this->import_Block($modulenode, $moduleInstance, $blocknode); |
| 682 | 698 | $this->import_Fields($blocknode, $blockInstance, $moduleInstance); |
@@ -695,8 +711,9 @@ discard block |
||
| 695 | 711 | $blockInstance->label = $blocklabel; |
| 696 | 712 | if (isset($blocknode->sequence) && isset($blocknode->display_status)) { |
| 697 | 713 | $blockInstance->sequence = strval($blocknode->sequence); |
| 698 | - if ($blockInstance->sequence = "") |
|
| 699 | - $blockInstance->sequence = NULL; |
|
| 714 | + if ($blockInstance->sequence = "") { |
|
| 715 | + $blockInstance->sequence = NULL; |
|
| 716 | + } |
|
| 700 | 717 | $blockInstance->showtitle = strval($blocknode->show_title); |
| 701 | 718 | $blockInstance->visible = strval($blocknode->visible); |
| 702 | 719 | $blockInstance->increateview = strval($blocknode->create_view); |
@@ -718,8 +735,9 @@ discard block |
||
| 718 | 735 | */ |
| 719 | 736 | public function import_Fields($blocknode, $blockInstance, $moduleInstance) |
| 720 | 737 | { |
| 721 | - if (empty($blocknode->fields) || empty($blocknode->fields->field)) |
|
| 722 | - return; |
|
| 738 | + if (empty($blocknode->fields) || empty($blocknode->fields->field)) { |
|
| 739 | + return; |
|
| 740 | + } |
|
| 723 | 741 | |
| 724 | 742 | foreach ($blocknode->fields->field as $fieldnode) { |
| 725 | 743 | $fieldInstance = $this->import_Field($blocknode, $blockInstance, $moduleInstance, $fieldnode); |
@@ -750,17 +768,21 @@ discard block |
||
| 750 | 768 | $fieldInstance->displaytype = $fieldnode->displaytype; |
| 751 | 769 | $fieldInstance->info_type = $fieldnode->info_type; |
| 752 | 770 | |
| 753 | - if (!empty($fieldnode->fieldparams)) |
|
| 754 | - $fieldInstance->fieldparams = $fieldnode->fieldparams; |
|
| 771 | + if (!empty($fieldnode->fieldparams)) { |
|
| 772 | + $fieldInstance->fieldparams = $fieldnode->fieldparams; |
|
| 773 | + } |
|
| 755 | 774 | |
| 756 | - if (!empty($fieldnode->helpinfo)) |
|
| 757 | - $fieldInstance->helpinfo = $fieldnode->helpinfo; |
|
| 775 | + if (!empty($fieldnode->helpinfo)) { |
|
| 776 | + $fieldInstance->helpinfo = $fieldnode->helpinfo; |
|
| 777 | + } |
|
| 758 | 778 | |
| 759 | - if (isset($fieldnode->masseditable)) |
|
| 760 | - $fieldInstance->masseditable = $fieldnode->masseditable; |
|
| 779 | + if (isset($fieldnode->masseditable)) { |
|
| 780 | + $fieldInstance->masseditable = $fieldnode->masseditable; |
|
| 781 | + } |
|
| 761 | 782 | |
| 762 | - if (isset($fieldnode->columntype) && !empty($fieldnode->columntype)) |
|
| 763 | - $fieldInstance->columntype = strval($fieldnode->columntype); |
|
| 783 | + if (isset($fieldnode->columntype) && !empty($fieldnode->columntype)) { |
|
| 784 | + $fieldInstance->columntype = strval($fieldnode->columntype); |
|
| 785 | + } |
|
| 764 | 786 | |
| 765 | 787 | if (!empty($fieldnode->tree_template)) { |
| 766 | 788 | $templateid = $fieldInstance->setTreeTemplate($fieldnode->tree_template, $moduleInstance); |
@@ -808,8 +830,9 @@ discard block |
||
| 808 | 830 | */ |
| 809 | 831 | public function import_CustomViews($modulenode, $moduleInstance) |
| 810 | 832 | { |
| 811 | - if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) |
|
| 812 | - return; |
|
| 833 | + if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) { |
|
| 834 | + return; |
|
| 835 | + } |
|
| 813 | 836 | foreach ($modulenode->customviews->customview as $customviewnode) { |
| 814 | 837 | $this->import_CustomView($modulenode, $moduleInstance, $customviewnode); |
| 815 | 838 | } |
@@ -852,8 +875,9 @@ discard block |
||
| 852 | 875 | */ |
| 853 | 876 | public function import_SharingAccess($modulenode, $moduleInstance) |
| 854 | 877 | { |
| 855 | - if (empty($modulenode->sharingaccess)) |
|
| 856 | - return; |
|
| 878 | + if (empty($modulenode->sharingaccess)) { |
|
| 879 | + return; |
|
| 880 | + } |
|
| 857 | 881 | |
| 858 | 882 | if (!empty($modulenode->sharingaccess->default)) { |
| 859 | 883 | foreach ($modulenode->sharingaccess->default as $defaultnode) { |
@@ -883,8 +907,9 @@ discard block |
||
| 883 | 907 | */ |
| 884 | 908 | public function import_Actions($modulenode, $moduleInstance) |
| 885 | 909 | { |
| 886 | - if (empty($modulenode->actions) || empty($modulenode->actions->action)) |
|
| 887 | - return; |
|
| 910 | + if (empty($modulenode->actions) || empty($modulenode->actions->action)) { |
|
| 911 | + return; |
|
| 912 | + } |
|
| 888 | 913 | foreach ($modulenode->actions->action as $actionnode) { |
| 889 | 914 | $this->import_Action($modulenode, $moduleInstance, $actionnode); |
| 890 | 915 | } |
@@ -966,8 +991,9 @@ discard block |
||
| 966 | 991 | */ |
| 967 | 992 | public function import_CustomLinks($modulenode, $moduleInstance) |
| 968 | 993 | { |
| 969 | - if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) |
|
| 970 | - return; |
|
| 994 | + if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) { |
|
| 995 | + return; |
|
| 996 | + } |
|
| 971 | 997 | |
| 972 | 998 | foreach ($modulenode->customlinks->customlink as $customlinknode) { |
| 973 | 999 | $handlerInfo = null; |
@@ -989,8 +1015,9 @@ discard block |
||
| 989 | 1015 | */ |
| 990 | 1016 | public function import_CronTasks($modulenode) |
| 991 | 1017 | { |
| 992 | - if (empty($modulenode->crons) || empty($modulenode->crons->cron)) |
|
| 993 | - return; |
|
| 1018 | + if (empty($modulenode->crons) || empty($modulenode->crons->cron)) { |
|
| 1019 | + return; |
|
| 1020 | + } |
|
| 994 | 1021 | foreach ($modulenode->crons->cron as $cronTask) { |
| 995 | 1022 | if (empty($cronTask->status)) { |
| 996 | 1023 | $cronTask->status = Cron::$STATUS_DISABLED; |
@@ -1051,8 +1078,9 @@ discard block |
||
| 1051 | 1078 | */ |
| 1052 | 1079 | public function importInventory() |
| 1053 | 1080 | { |
| 1054 | - if (empty($this->_modulexml->inventory) || empty($this->_modulexml->inventory->fields->field)) |
|
| 1055 | - return false; |
|
| 1081 | + if (empty($this->_modulexml->inventory) || empty($this->_modulexml->inventory->fields->field)) { |
|
| 1082 | + return false; |
|
| 1083 | + } |
|
| 1056 | 1084 | $module = (string) $this->moduleInstance->name; |
| 1057 | 1085 | |
| 1058 | 1086 | $inventoryInstance = \Vtiger_Inventory_Model::getInstance($module); |
@@ -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 | |
@@ -20,6 +20,7 @@ discard block |
||
| 20 | 20 | * Helper function to log messages |
| 21 | 21 | * @param String Message to log |
| 22 | 22 | * @param Boolean true appends linebreak, false to avoid it |
| 23 | + * @param string $message |
|
| 23 | 24 | * @access private |
| 24 | 25 | */ |
| 25 | 26 | static function log($message, $delim = true) |
@@ -30,6 +31,7 @@ discard block |
||
| 30 | 31 | /** |
| 31 | 32 | * Initialize webservice for the given module |
| 32 | 33 | * @param Module Instance of the module. |
| 34 | + * @param Module $moduleInstance |
|
| 33 | 35 | */ |
| 34 | 36 | static function initialize($moduleInstance) |
| 35 | 37 | { |
@@ -45,6 +47,7 @@ discard block |
||
| 45 | 47 | /** |
| 46 | 48 | * Initialize webservice for the given module |
| 47 | 49 | * @param Module Instance of the module. |
| 50 | + * @param Module $moduleInstance |
|
| 48 | 51 | */ |
| 49 | 52 | static function uninitialize($moduleInstance) |
| 50 | 53 | { |
@@ -69,6 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Normalize the directory path separators. |
| 72 | + * @param string $path |
|
| 72 | 73 | */ |
| 73 | 74 | public function __normalizePath($path) |
| 74 | 75 | { |
@@ -79,6 +80,7 @@ discard block |
||
| 79 | 80 | |
| 80 | 81 | /** |
| 81 | 82 | * Copy the directory on the disk into zip file. |
| 83 | + * @param string $zipdirname |
|
| 82 | 84 | */ |
| 83 | 85 | public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null) |
| 84 | 86 | { |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | if ($search_index === 0) { |
| 51 | 51 | $startindex = strlen($base_realpath) + 1; |
| 52 | 52 | // On windows $base_realpath ends with / and On Linux it will not have / at end! |
| 53 | - if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1) |
|
| 54 | - $startindex -= 1; |
|
| 53 | + if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1) { |
|
| 54 | + $startindex -= 1; |
|
| 55 | + } |
|
| 55 | 56 | $relpath = substr($src_realpath, $startindex); |
| 56 | 57 | } |
| 57 | 58 | return $relpath; |
@@ -62,8 +63,9 @@ discard block |
||
| 62 | 63 | */ |
| 63 | 64 | public function __fixDirSeparator($path) |
| 64 | 65 | { |
| 65 | - if ($path != '' && (strripos($path, '/') != strlen($path) - 1)) |
|
| 66 | - $path .= '/'; |
|
| 66 | + if ($path != '' && (strripos($path, '/') != strlen($path) - 1)) { |
|
| 67 | + $path .= '/'; |
|
| 68 | + } |
|
| 67 | 69 | return $path; |
| 68 | 70 | } |
| 69 | 71 | |
@@ -72,8 +74,9 @@ discard block |
||
| 72 | 74 | */ |
| 73 | 75 | public function __normalizePath($path) |
| 74 | 76 | { |
| 75 | - if ($path && strpos($path, '\\') !== false) |
|
| 76 | - $path = preg_replace("/\\\\/", "/", $path); |
|
| 77 | + if ($path && strpos($path, '\\') !== false) { |
|
| 78 | + $path = preg_replace("/\\\\/", "/", $path); |
|
| 79 | + } |
|
| 77 | 80 | return $path; |
| 78 | 81 | } |
| 79 | 82 | |
@@ -83,18 +86,21 @@ discard block |
||
| 83 | 86 | public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null) |
| 84 | 87 | { |
| 85 | 88 | $dir = opendir($dirname); |
| 86 | - if (strripos($dirname, '/') != strlen($dirname) - 1) |
|
| 87 | - $dirname .= '/'; |
|
| 89 | + if (strripos($dirname, '/') != strlen($dirname) - 1) { |
|
| 90 | + $dirname .= '/'; |
|
| 91 | + } |
|
| 88 | 92 | |
| 89 | - if ($basedirname === null) |
|
| 90 | - $basedirname = realpath($dirname); |
|
| 93 | + if ($basedirname === null) { |
|
| 94 | + $basedirname = realpath($dirname); |
|
| 95 | + } |
|
| 91 | 96 | |
| 92 | 97 | while (false !== ($file = readdir($dir))) { |
| 93 | 98 | if ($file != '.' && $file != '..' && |
| 94 | 99 | $file != '.svn' && $file != 'CVS') { |
| 95 | 100 | // Exclude the file/directory |
| 96 | - if (!empty($excludeList) && in_array("$dirname$file", $excludeList)) |
|
| 97 | - continue; |
|
| 101 | + if (!empty($excludeList) && in_array("$dirname$file", $excludeList)) { |
|
| 102 | + continue; |
|
| 103 | + } |
|
| 98 | 104 | |
| 99 | 105 | if (is_dir("$dirname$file")) { |
| 100 | 106 | $this->copyDirectoryFromDisk("$dirname$file", $zipdirname, $excludeList, $basedirname); |
@@ -124,8 +124,9 @@ |
||
| 124 | 124 | $secondFallBackModuleDir = $secondFallBackModuleClassPath = $actualModule; |
| 125 | 125 | if ($actualModule != 'Users') { |
| 126 | 126 | $baseModule = $moduleHierarchyParts[0]; |
| 127 | - if ($baseModule == 'Settings') |
|
| 128 | - $baseModule = 'Settings:Vtiger'; |
|
| 127 | + if ($baseModule == 'Settings') { |
|
| 128 | + $baseModule = 'Settings:Vtiger'; |
|
| 129 | + } |
|
| 129 | 130 | $firstFallBackDir = str_replace(':', '.', $baseModule); |
| 130 | 131 | $firstFallBackClassPath = str_replace(':', '_', $baseModule); |
| 131 | 132 | } |