@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param string $file Filename containing the task object |
| 81 | 81 | * @param TaskProviderInterface $provider Provider for tasks |
| 82 | 82 | */ |
| 83 | - public function __construct($file, TaskProviderInterface $provider = null){ |
|
| 83 | + public function __construct($file, TaskProviderInterface $provider = null) { |
|
| 84 | 84 | $this->name = trim(basename($file, '.php')); |
| 85 | 85 | $this->provider = $provider; |
| 86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return TaskProviderInterface |
| 92 | 92 | */ |
| 93 | - public function getProvider(){ |
|
| 93 | + public function getProvider() { |
|
| 94 | 94 | return $this->provider; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param TaskProviderInterface $provider |
| 101 | 101 | * @return self Enable method-chaining |
| 102 | 102 | */ |
| 103 | - public function setProvider(TaskProviderInterface $provider){ |
|
| 103 | + public function setProvider(TaskProviderInterface $provider) { |
|
| 104 | 104 | $this->provider = $provider; |
| 105 | 105 | return $this; |
| 106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
| 116 | 116 | * @param bool $is_running Indicates if the task is currently running |
| 117 | 117 | */ |
| 118 | - public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){ |
|
| 118 | + public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running) { |
|
| 119 | 119 | $this->is_enabled = $is_enabled; |
| 120 | 120 | $this->last_updated = $last_updated; |
| 121 | 121 | $this->last_result = $last_result; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return string |
| 131 | 131 | */ |
| 132 | - public function getName(){ |
|
| 132 | + public function getName() { |
|
| 133 | 133 | return $this->name; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return boolean True if enabled |
| 141 | 141 | */ |
| 142 | - public function isEnabled(){ |
|
| 142 | + public function isEnabled() { |
|
| 143 | 143 | return $this->is_enabled; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @return \DateTime |
| 150 | 150 | */ |
| 151 | - public function getLastUpdated(){ |
|
| 151 | + public function getLastUpdated() { |
|
| 152 | 152 | return $this->last_updated; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @return bool |
| 159 | 159 | */ |
| 160 | - public function isLastRunSuccess(){ |
|
| 160 | + public function isLastRunSuccess() { |
|
| 161 | 161 | return $this->last_result; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * |
| 167 | 167 | * @return int |
| 168 | 168 | */ |
| 169 | - public function getFrequency(){ |
|
| 169 | + public function getFrequency() { |
|
| 170 | 170 | return $this->frequency; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param int $frequency |
| 177 | 177 | * @return self Enable method-chaining |
| 178 | 178 | */ |
| 179 | - public function setFrequency($frequency){ |
|
| 179 | + public function setFrequency($frequency) { |
|
| 180 | 180 | $this->frequency = $frequency; |
| 181 | 181 | return $this; |
| 182 | 182 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @return int |
| 188 | 188 | */ |
| 189 | - public function getRemainingOccurrences(){ |
|
| 189 | + public function getRemainingOccurrences() { |
|
| 190 | 190 | return $this->nb_occurrences; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param int $nb_occur |
| 197 | 197 | * @return self Enable method-chaining |
| 198 | 198 | */ |
| 199 | - public function setRemainingOccurrences($nb_occur){ |
|
| 199 | + public function setRemainingOccurrences($nb_occur) { |
|
| 200 | 200 | $this->nb_occurrences = $nb_occur; |
| 201 | 201 | return $this; |
| 202 | 202 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return bool |
| 208 | 208 | */ |
| 209 | - public function isRunning(){ |
|
| 209 | + public function isRunning() { |
|
| 210 | 210 | return $this->is_running; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @return bool |
| 236 | 236 | */ |
| 237 | 237 | public function save() { |
| 238 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 238 | + if (!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 239 | 239 | return $this->provider->updateTask($this); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -243,23 +243,23 @@ discard block |
||
| 243 | 243 | * Execute the task, default skeleton |
| 244 | 244 | * |
| 245 | 245 | */ |
| 246 | - public function execute(){ |
|
| 246 | + public function execute() { |
|
| 247 | 247 | |
| 248 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 248 | + if ($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 249 | 249 | $this->is_running = false; |
| 250 | 250 | |
| 251 | - if(!$this->is_running){ |
|
| 251 | + if (!$this->is_running) { |
|
| 252 | 252 | $this->last_result = false; |
| 253 | 253 | $this->is_running = true; |
| 254 | 254 | $this->save(); |
| 255 | 255 | |
| 256 | 256 | Log::addDebugLog('Start execution of Admin task: '.$this->getTitle()); |
| 257 | 257 | $this->last_result = $this->executeSteps(); |
| 258 | - if($this->last_result){ |
|
| 258 | + if ($this->last_result) { |
|
| 259 | 259 | $this->last_updated = new \DateTime(); |
| 260 | - if($this->nb_occurrences > 0){ |
|
| 260 | + if ($this->nb_occurrences > 0) { |
|
| 261 | 261 | $this->nb_occurrences--; |
| 262 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 262 | + if ($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | $this->is_running = false; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param \Fisharebest\Webtrees\Controller\IndividualController $ctrl_individual_in The Individual Controller to extend |
| 34 | 34 | */ |
| 35 | - public function __construct(fw\Controller\IndividualController $ctrl_individual_in){ |
|
| 35 | + public function __construct(fw\Controller\IndividualController $ctrl_individual_in) { |
|
| 36 | 36 | $this->ctrl_individual = $ctrl_individual_in; |
| 37 | 37 | $this->dindi = new mw\Individual($this->ctrl_individual->getSignificantIndividual()); |
| 38 | 38 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @uses \MyArtJaub\Webtrees\Hook\Hook |
| 45 | 45 | */ |
| 46 | - public function printHeaderExtensions(){ |
|
| 46 | + public function printHeaderExtensions() { |
|
| 47 | 47 | $hook_extend_indi_header_left = new mw\Hook\Hook('hExtendIndiHeaderLeft'); |
| 48 | 48 | $hook_extend_indi_header_right = new mw\Hook\Hook('hExtendIndiHeaderRight'); |
| 49 | 49 | $hook_extend_indi_header_left = $hook_extend_indi_header_left->execute($this->ctrl_individual); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | echo '<div id="indi_perso_header">', |
| 53 | 53 | '<div id="indi_perso_header_left">'; |
| 54 | 54 | foreach ($hook_extend_indi_header_left as $div) { |
| 55 | - if(count($div)==2){ |
|
| 55 | + if (count($div) == 2) { |
|
| 56 | 56 | echo '<div id="', $div[0], '" class="indi_perso_header_left_div">', |
| 57 | 57 | $div[1], '</div>'; |
| 58 | 58 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | echo '</div>', |
| 61 | 61 | '<div id="indi_perso_header_right">'; |
| 62 | 62 | foreach ($hook_extend_indi_header_right as $div) { |
| 63 | - if(count($div)==2){ |
|
| 63 | + if (count($div) == 2) { |
|
| 64 | 64 | echo '<div id="', $div[0], '" class="indi_perso_header_right_div">', |
| 65 | 65 | $div[1], '</div>'; |
| 66 | 66 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @uses \MyArtJaub\Webtrees\Hook\Hook |
| 77 | 77 | */ |
| 78 | - public function printHeaderExtraIcons(){ |
|
| 78 | + public function printHeaderExtraIcons() { |
|
| 79 | 79 | $hook_extend_indi_header_icons = new Hook('hExtendIndiHeaderIcons'); |
| 80 | 80 | $hook_extend_indi_header_icons = $hook_extend_indi_header_icons->execute($this->ctrl_individual); |
| 81 | 81 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getDefaultFrequency() |
| 43 | 43 | */ |
| 44 | 44 | public function getDefaultFrequency() { |
| 45 | - return 10080; // = 1 week = 7 * 24 * 60 min |
|
| 45 | + return 10080; // = 1 week = 7 * 24 * 60 min |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | // Get the number of days to take into account, either last 7 days or since last check |
| 57 | 57 | $interval_sincelast = 0; |
| 58 | - if($this->last_updated){ |
|
| 58 | + if ($this->last_updated) { |
|
| 59 | 59 | $tmpInt = $this->last_updated->diff(new \DateTime('now'), true); |
| 60 | - $interval_sincelast = ( $tmpInt->days * 24 + $tmpInt->h ) * 60 + $tmpInt->i; |
|
| 60 | + $interval_sincelast = ($tmpInt->days * 24 + $tmpInt->h) * 60 + $tmpInt->i; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $interval = max($this->frequency, $interval_sincelast); |
@@ -66,17 +66,17 @@ discard block |
||
| 66 | 66 | // Check for updates |
| 67 | 67 | $latest_version_txt = Functions::fetchLatestVersion(); |
| 68 | 68 | if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) { |
| 69 | - list($latest_version, , $download_url) = explode('|', $latest_version_txt); |
|
| 69 | + list($latest_version,, $download_url) = explode('|', $latest_version_txt); |
|
| 70 | 70 | } else { |
| 71 | 71 | // Cannot determine the latest version |
| 72 | - list($latest_version, , $download_url) = explode('|', '||'); |
|
| 72 | + list($latest_version,, $download_url) = explode('|', '||'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // Users statistics |
| 76 | 76 | $warnusers = 0; |
| 77 | 77 | $nverusers = 0; |
| 78 | 78 | $applusers = 0; |
| 79 | - foreach(User::all() as $user) { |
|
| 79 | + foreach (User::all() as $user) { |
|
| 80 | 80 | if (((date("U") - (int)$user->getPreference('reg_timestamp')) > 604800) && !$user->getPreference('verified')) { |
| 81 | 81 | $warnusers++; |
| 82 | 82 | } |
@@ -90,20 +90,20 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | // Tree specifics checks |
| 92 | 92 | $one_tree_done = false; |
| 93 | - foreach(Tree::getAll() as $tree){ |
|
| 93 | + foreach (Tree::getAll() as $tree) { |
|
| 94 | 94 | $isTreeEnabled = $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED'); |
| 95 | - if((is_null($isTreeEnabled) || $isTreeEnabled) && $webmaster = User::find($tree->getPreference('WEBMASTER_USER_ID'))){ |
|
| 95 | + if ((is_null($isTreeEnabled) || $isTreeEnabled) && $webmaster = User::find($tree->getPreference('WEBMASTER_USER_ID'))) { |
|
| 96 | 96 | I18N::init($webmaster->getPreference('language')); |
| 97 | 97 | |
| 98 | 98 | $subject = I18N::translate('Health Check Report').' - '.I18N::translate('Tree %s', $tree->getTitle()); |
| 99 | 99 | $message = |
| 100 | - I18N::translate('Health Check Report for the last %d days', $nbdays). Mail::EOL. Mail::EOL. |
|
| 100 | + I18N::translate('Health Check Report for the last %d days', $nbdays).Mail::EOL.Mail::EOL. |
|
| 101 | 101 | I18N::translate('Tree %s', $tree->getTitle()).Mail::EOL. |
| 102 | 102 | '=========================================='.Mail::EOL.Mail::EOL; |
| 103 | 103 | |
| 104 | 104 | // News |
| 105 | 105 | $message_version = ''; |
| 106 | - if($latest_version && version_compare(WT_VERSION, $latest_version)<0){ |
|
| 106 | + if ($latest_version && version_compare(WT_VERSION, $latest_version) < 0) { |
|
| 107 | 107 | $message_version = I18N::translate('News').Mail::EOL. |
| 108 | 108 | '-------------'.Mail::EOL. |
| 109 | 109 | I18N::translate('A new version of *webtrees* is available: %s. Upgrade as soon as possible.', $latest_version).Mail::EOL. |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | I18N::translate('Not verified by the user')."\t\t".$applusers.Mail::EOL. |
| 120 | 120 | I18N::translate('Not approved by an administrator')."\t".$nverusers.Mail::EOL. |
| 121 | 121 | Mail::EOL; |
| 122 | - $message .= $message_users; |
|
| 122 | + $message .= $message_users; |
|
| 123 | 123 | |
| 124 | 124 | // Statistics tree: |
| 125 | 125 | $stats = new Stats($tree); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | ' AND log_time >= DATE_ADD( NOW(), INTERVAL - :nb_days DAY)'. |
| 160 | 160 | ' GROUP BY log_message, gedcom_id'. |
| 161 | 161 | ' ORDER BY lastoccurred DESC'; |
| 162 | - $errors=Database::prepare($sql)->execute(array( |
|
| 162 | + $errors = Database::prepare($sql)->execute(array( |
|
| 163 | 163 | 'log_type' => Log::TYPE_ERROR, |
| 164 | 164 | 'gedcom_id' => $tree->getTreeId(), |
| 165 | 165 | 'nb_days' => $nbdays |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $tmp_message .= str_replace("\n", "\n\t\t\t\t\t\t", $error->log_message).Mail::EOL; |
| 176 | 176 | $nb_errors += $error->nblogs; |
| 177 | 177 | } |
| 178 | - if($nb_errors > 0){ |
|
| 178 | + if ($nb_errors > 0) { |
|
| 179 | 179 | $message .= I18N::translate('Errors [%d]', $nb_errors).Mail::EOL. |
| 180 | 180 | '-------------'.Mail::EOL. |
| 181 | 181 | WT_BASE_URL.'admin_site_logs.php'.Mail::EOL. |
@@ -186,12 +186,12 @@ discard block |
||
| 186 | 186 | str_repeat('-', $nb_char_count_title)."\t".str_repeat('-', $nb_char_type)."\t".str_repeat('-', 20)."\t".str_repeat('-', strlen(I18N::translate('Error'))).Mail::EOL. |
| 187 | 187 | $tmp_message.Mail::EOL; |
| 188 | 188 | } |
| 189 | - else{ |
|
| 189 | + else { |
|
| 190 | 190 | $message .= I18N::translate('No errors', $nb_errors).Mail::EOL.Mail::EOL; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $tmpres = true; |
| 194 | - if($webmaster->getPreference('contactmethod') !== 'messaging' |
|
| 194 | + if ($webmaster->getPreference('contactmethod') !== 'messaging' |
|
| 195 | 195 | && $webmaster->getPreference('contactmethod') !== 'none') { |
| 196 | 196 | $tmpres = Mail::systemMessage($tree, $webmaster, $subject, $message); |
| 197 | 197 | } |
@@ -213,24 +213,24 @@ discard block |
||
| 213 | 213 | $html = ' |
| 214 | 214 | <div class="form-group"> |
| 215 | 215 | <label class="control-label col-sm-3"> '. |
| 216 | - I18N::translate('Enable healthcheck emails for') . |
|
| 216 | + I18N::translate('Enable healthcheck emails for'). |
|
| 217 | 217 | '</label> |
| 218 | 218 | <div class="col-sm-9">'; |
| 219 | 219 | |
| 220 | - foreach(Tree::getAll() as $tree){ |
|
| 221 | - if(Auth::isManager($tree)){ |
|
| 220 | + foreach (Tree::getAll() as $tree) { |
|
| 221 | + if (Auth::isManager($tree)) { |
|
| 222 | 222 | $html .= '<div class="form-group row"> |
| 223 | 223 | <span class="col-sm-3 control-label">' . |
| 224 | - $tree->getTitle() . |
|
| 224 | + $tree->getTitle(). |
|
| 225 | 225 | '</span> |
| 226 | 226 | <div class="col-sm-2">'; |
| 227 | - $html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"'); |
|
| 227 | + $html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_'.$tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"'); |
|
| 228 | 228 | $html .= '</div></div>'; |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $html .= ' <p class="small text-muted">'. |
| 233 | - I18N::translate('Enable the health check emails for each of the selected trees.') . |
|
| 233 | + I18N::translate('Enable the health check emails for each of the selected trees.'). |
|
| 234 | 234 | '</p> |
| 235 | 235 | </div> |
| 236 | 236 | </div>'; |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function saveConfig() { |
| 246 | 246 | try { |
| 247 | - foreach(Tree::getAll() as $tree){ |
|
| 248 | - if(Auth::isManager($tree)){ |
|
| 249 | - $tree_enabled = Filter::postInteger('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), 0, 1); |
|
| 247 | + foreach (Tree::getAll() as $tree) { |
|
| 248 | + if (Auth::isManager($tree)) { |
|
| 249 | + $tree_enabled = Filter::postInteger('HEALTHCHECK_ENABLED_'.$tree->getTreeId(), 0, 1); |
|
| 250 | 250 | $tree->setPreference('MAJ_AT_'.$this->getName().'_ENABLED', $tree_enabled); |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | ' majat_name VARCHAR(32) NOT NULL,'. |
| 29 | 29 | ' majat_status ENUM(\'enabled\',\'disabled\') NOT NULL DEFAULT \'disabled\','. |
| 30 | 30 | ' majat_last_run DATETIME NOT NULL DEFAULT \'2000-01-01 00:00:00\','. |
| 31 | - ' majat_last_result TINYINT(1) NOT NULL DEFAULT 1,'. // 0 means error, 1 is success |
|
| 32 | - ' majat_frequency INTEGER NOT NULL DEFAULT 10080,'. // In min, Default every week |
|
| 31 | + ' majat_last_result TINYINT(1) NOT NULL DEFAULT 1,'.// 0 means error, 1 is success |
|
| 32 | + ' majat_frequency INTEGER NOT NULL DEFAULT 10080,'.// In min, Default every week |
|
| 33 | 33 | ' majat_nb_occur SMALLINT NOT NULL DEFAULT 0,'. |
| 34 | 34 | ' majat_running TINYINT(1) NOT NULL DEFAULT 0,'. |
| 35 | 35 | ' PRIMARY KEY (majat_name)'. |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | public function handle(fw\Module\AbstractModule $module, $request) { |
| 50 | 50 | |
| 51 | 51 | $fq_modclass_name = get_class($module); |
| 52 | - $ctrl_namespace = substr($fq_modclass_name, 0, - strlen('Module')) . '\\'; |
|
| 52 | + $ctrl_namespace = substr($fq_modclass_name, 0, - strlen('Module')).'\\'; |
|
| 53 | 53 | |
| 54 | - $args = explode( '@', $request, 2); |
|
| 55 | - switch(count($args)) { |
|
| 54 | + $args = explode('@', $request, 2); |
|
| 55 | + switch (count($args)) { |
|
| 56 | 56 | case 1: |
| 57 | 57 | $ctrl_name = $args[0]; |
| 58 | 58 | $method = 'index'; |
@@ -64,16 +64,16 @@ discard block |
||
| 64 | 64 | break; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $ctrl_class = $ctrl_namespace . $ctrl_name . 'Controller'; |
|
| 68 | - if(class_exists($ctrl_class) |
|
| 67 | + $ctrl_class = $ctrl_namespace.$ctrl_name.'Controller'; |
|
| 68 | + if (class_exists($ctrl_class) |
|
| 69 | 69 | && is_subclass_of($ctrl_class, '\\MyArtJaub\\Webtrees\\Mvc\\Controller\\MvcController') |
| 70 | - && $ctrl = new $ctrl_class($module) ) { |
|
| 71 | - if(method_exists($ctrl, $method)) { |
|
| 70 | + && $ctrl = new $ctrl_class($module)) { |
|
| 71 | + if (method_exists($ctrl, $method)) { |
|
| 72 | 72 | try { |
| 73 | 73 | call_user_func_array(array($ctrl, $method), array()); |
| 74 | 74 | } |
| 75 | 75 | catch (MvcException $ex) { |
| 76 | - if(!headers_sent()) { |
|
| 76 | + if (!headers_sent()) { |
|
| 77 | 77 | http_response_code($ex->getHttpCode()); |
| 78 | 78 | } |
| 79 | 79 | echo $ex->getMessage(); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | class MvcException extends \Exception { |
| 18 | 18 | |
| 19 | 19 | /** @var int[] $VALID_HTTP List of valid HTTP codes */ |
| 20 | - protected static $VALID_HTTP = array( |
|
| 20 | + protected static $VALID_HTTP = array( |
|
| 21 | 21 | 100, 101, |
| 22 | 22 | 200, 201, 202, 203, 204, 205, 206, |
| 23 | 23 | 300, 301, 302, 303, 304, 305, 306, 307, |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * @throws InvalidArgumentException Thrown if not valid Http code |
| 59 | 59 | */ |
| 60 | 60 | public function setHttpCode($http_code) { |
| 61 | - if(!in_array($http_code, self::$VALID_HTTP)) |
|
| 61 | + if (!in_array($http_code, self::$VALID_HTTP)) |
|
| 62 | 62 | throw new \InvalidArgumentException('Invalid HTTP code'); |
| 63 | - $this->http_code= $http_code; |
|
| 63 | + $this->http_code = $http_code; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | } |
@@ -47,13 +47,13 @@ |
||
| 47 | 47 | <div class="value"> |
| 48 | 48 | <?php |
| 49 | 49 | $users = $this->data->get('users_settings'); |
| 50 | - if(count($users) == 1) { |
|
| 51 | - $root_indi = $users[0]['rootid']; ?> |
|
| 50 | + if (count($users) == 1) { |
|
| 51 | + $root_indi = $users[0]['rootid']; ?> |
|
| 52 | 52 | <label> |
| 53 | 53 | <input id="maj_sosa_input_userid" type="hidden" name="userid" value="<?php echo $users[0]['user']->getUserId(); ?>" /> |
| 54 | 54 | <?php echo $users[0]['user']->getRealNameHtml() ?> |
| 55 | 55 | </label> |
| 56 | - <?php } else if(count($users) > 1) { ?> |
|
| 56 | + <?php } else if (count($users) > 1) { ?> |
|
| 57 | 57 | <select id='maj-sosa-config-select' name="userid"> |
| 58 | 58 | <?php |
| 59 | 59 | $root_indi = $users[0]['rootid']; |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Cache component to speed up some potential data retrievals |
| 22 | 22 | */ |
| 23 | -class Cache{ |
|
| 23 | +class Cache { |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Underlying Cache object |
| 27 | 27 | * @var CacheItemPoolInterface $cache |
| 28 | 28 | */ |
| 29 | - protected $cache=null; |
|
| 29 | + protected $cache = null; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Defines whether the cache has been initialised |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | */ |
| 61 | 61 | protected function init() { |
| 62 | - if(Apc::isAvailable()) { |
|
| 62 | + if (Apc::isAvailable()) { |
|
| 63 | 63 | $driver = new Apc(); |
| 64 | 64 | } else { |
| 65 | 65 | if (!is_dir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')) { |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | * Initiliase the Cache if not done. |
| 84 | 84 | * |
| 85 | 85 | */ |
| 86 | - protected function checkInit(){ |
|
| 87 | - if(!$this->is_init) $this->init(); |
|
| 86 | + protected function checkInit() { |
|
| 87 | + if (!$this->is_init) $this->init(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | * @param AbstractModule $mod Calling module |
| 95 | 95 | * @return string Cached key name |
| 96 | 96 | */ |
| 97 | - protected function getKeyName($value, AbstractModule $mod = null){ |
|
| 97 | + protected function getKeyName($value, AbstractModule $mod = null) { |
|
| 98 | 98 | $this->checkInit(); |
| 99 | 99 | $mod_name = 'myartjaub'; |
| 100 | - if($mod !== null) $mod_name = $mod->getName(); |
|
| 100 | + if ($mod !== null) $mod_name = $mod->getName(); |
|
| 101 | 101 | return $mod_name.'_'.$value; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param AbstractModule $mod Calling module |
| 109 | 109 | * @return \Psr\Cache\CacheItemInterface |
| 110 | 110 | */ |
| 111 | - public function getI($value, AbstractModule $mod = null){ |
|
| 111 | + public function getI($value, AbstractModule $mod = null) { |
|
| 112 | 112 | $this->checkInit(); |
| 113 | 113 | return $this->cache->getItem($this->getKeyName($value, $mod)); |
| 114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @param AbstractModule $mod Calling module |
| 121 | 121 | * @return \Psr\Cache\CacheItemInterface |
| 122 | 122 | */ |
| 123 | - public static function get($value, AbstractModule $mod = null){ |
|
| 123 | + public static function get($value, AbstractModule $mod = null) { |
|
| 124 | 124 | return self::getInstance()->getI($value, $mod); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | * @param mixed $data Value |
| 132 | 132 | * @param AbstractModule $mod Calling module |
| 133 | 133 | */ |
| 134 | - public function saveI($value, $data, AbstractModule $mod = null){ |
|
| 134 | + public function saveI($value, $data, AbstractModule $mod = null) { |
|
| 135 | 135 | $this->checkInit(); |
| 136 | 136 | |
| 137 | 137 | $item = $value; |
| 138 | - if(!($value instanceof CacheItemInterface)) { |
|
| 138 | + if (!($value instanceof CacheItemInterface)) { |
|
| 139 | 139 | $item = new \Stash\Item(); |
| 140 | 140 | $item->setKey($this->getKeyName($value, $mod)); |
| 141 | 141 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param mixed $data Value |
| 151 | 151 | * @param AbstractModule $mod Calling module |
| 152 | 152 | */ |
| 153 | - public static function save($value, $data, AbstractModule $mod = null){ |
|
| 153 | + public static function save($value, $data, AbstractModule $mod = null) { |
|
| 154 | 154 | self::getInstance()->saveI($value, $data, $mod); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param AbstractModule $mod Calling module |
| 162 | 162 | * @return bool Deletion successful? |
| 163 | 163 | */ |
| 164 | - public function deleteI($value, AbstractModule $mod = null){ |
|
| 164 | + public function deleteI($value, AbstractModule $mod = null) { |
|
| 165 | 165 | $this->checkInit(); |
| 166 | 166 | return $this->cache->deleteItem($this->getKeyName($value, $mod)); |
| 167 | 167 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @param AbstractModule $mod Calling module |
| 174 | 174 | * @return bool Deletion successful? |
| 175 | 175 | */ |
| 176 | - public static function delete($value, AbstractModule $mod = null){ |
|
| 176 | + public static function delete($value, AbstractModule $mod = null) { |
|
| 177 | 177 | return self::getInstance()->deleteI($value, $mod); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * Clean the cache |
| 182 | 182 | * |
| 183 | 183 | */ |
| 184 | - public function cleanI(){ |
|
| 184 | + public function cleanI() { |
|
| 185 | 185 | $this->checkInit(); |
| 186 | 186 | $this->cache->clear(); |
| 187 | 187 | } |
@@ -35,8 +35,8 @@ |
||
| 35 | 35 | $surn = str_replace('@N.N.', 'AAAA', $surn); |
| 36 | 36 | |
| 37 | 37 | return array( |
| 38 | - $surn . 'AAAA' . $givn, |
|
| 39 | - $givn . 'AAAA' . $surn, |
|
| 38 | + $surn.'AAAA'.$givn, |
|
| 39 | + $givn.'AAAA'.$surn, |
|
| 40 | 40 | ); |
| 41 | 41 | } |
| 42 | 42 | |