@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | /** |
317 | 317 | * Checks if the comment can be edited. |
318 | 318 | * |
319 | - * @param null|int|Member $member |
|
319 | + * @param DataObject|null $member |
|
320 | 320 | * |
321 | 321 | * @return Boolean |
322 | 322 | */ |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | /** |
347 | 347 | * Checks if the comment can be deleted. |
348 | 348 | * |
349 | - * @param null|int|Member $member |
|
349 | + * @param Member|null $member |
|
350 | 350 | * |
351 | 351 | * @return Boolean |
352 | 352 | */ |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * Resolves Member object. |
370 | 370 | * |
371 | 371 | * @param Member|int|null $member |
372 | - * @return Member|null |
|
372 | + * @return DataObject|null |
|
373 | 373 | */ |
374 | 374 | protected function getMember($member = null) { |
375 | 375 | if(!$member) { |
@@ -570,15 +570,15 @@ discard block |
||
570 | 570 | _t('Comment.ParentComment_Title', 'This comment is a reply to the below') |
571 | 571 | )); |
572 | 572 | // Created date |
573 | - // FIXME - the method setName in DatetimeField is not chainable, hence |
|
574 | - // the lack of chaining here |
|
575 | - $createdField = $parent |
|
576 | - ->obj('Created') |
|
577 | - ->scaffoldFormField($parent->fieldLabel('Created')); |
|
578 | - $createdField->setName('ParentComment_Created'); |
|
579 | - $createdField->setValue($parent->Created); |
|
580 | - $createdField->performReadonlyTransformation(); |
|
581 | - $fields->push($createdField); |
|
573 | + // FIXME - the method setName in DatetimeField is not chainable, hence |
|
574 | + // the lack of chaining here |
|
575 | + $createdField = $parent |
|
576 | + ->obj('Created') |
|
577 | + ->scaffoldFormField($parent->fieldLabel('Created')); |
|
578 | + $createdField->setName('ParentComment_Created'); |
|
579 | + $createdField->setValue($parent->Created); |
|
580 | + $createdField->performReadonlyTransformation(); |
|
581 | + $fields->push($createdField); |
|
582 | 582 | |
583 | 583 | // Name (could be member or string value) |
584 | 584 | $fields->push( |
@@ -620,13 +620,13 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function getHtmlPurifierService() { |
622 | 622 | $config = HTMLPurifier_Config::createDefault(); |
623 | - $allowedElements = $this->getOption('html_allowed_elements'); |
|
624 | - $config->set('HTML.AllowedElements', $allowedElements); |
|
623 | + $allowedElements = $this->getOption('html_allowed_elements'); |
|
624 | + $config->set('HTML.AllowedElements', $allowedElements); |
|
625 | 625 | |
626 | - // This injector cannot be set unless the 'p' element is allowed |
|
627 | - if (in_array('p', $allowedElements)) { |
|
628 | - $config->set('AutoFormat.AutoParagraph', true); |
|
629 | - } |
|
626 | + // This injector cannot be set unless the 'p' element is allowed |
|
627 | + if (in_array('p', $allowedElements)) { |
|
628 | + $config->set('AutoFormat.AutoParagraph', true); |
|
629 | + } |
|
630 | 630 | |
631 | 631 | $config->set('AutoFormat.Linkify', true); |
632 | 632 | $config->set('URI.DisableExternalResources', true); |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | || ($this->getOption('frontend_moderation') && $parent->canModerateComments()) |
717 | 717 | ); |
718 | 718 | if (!$showUnmoderated) { |
719 | - $list = $list->filter('Moderated', 1); |
|
719 | + $list = $list->filter('Moderated', 1); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | $this->extend('updateReplies', $list); |
@@ -135,7 +135,9 @@ discard block |
||
135 | 135 | // set the variables which have changed |
136 | 136 | $comment->BaseClass = 'SiteTree'; |
137 | 137 | $comment->URL = (isset($pageComment['CommenterURL'])) ? $pageComment['CommenterURL'] : ''; |
138 | - if((int) $pageComment['NeedsModeration'] == 0) $comment->Moderated = true; |
|
138 | + if((int) $pageComment['NeedsModeration'] == 0) { |
|
139 | + $comment->Moderated = true; |
|
140 | + } |
|
139 | 141 | |
140 | 142 | $comment->write(); |
141 | 143 | } |
@@ -206,8 +208,7 @@ discard block |
||
206 | 208 | if(!$record && $this->BaseClass) { |
207 | 209 | // Otherwise a singleton of that record |
208 | 210 | $record = singleton($this->BaseClass); |
209 | - } |
|
210 | - else if(!$record) { |
|
211 | + } else if(!$record) { |
|
211 | 212 | // Otherwise just use the default options |
212 | 213 | $record = singleton('CommentsExtension'); |
213 | 214 | } |
@@ -405,8 +406,12 @@ discard block |
||
405 | 406 | * @return string |
406 | 407 | */ |
407 | 408 | protected function actionLink($action, $member = null) { |
408 | - if(!$member) $member = Member::currentUser(); |
|
409 | - if(!$member) return false; |
|
409 | + if(!$member) { |
|
410 | + $member = Member::currentUser(); |
|
411 | + } |
|
412 | + if(!$member) { |
|
413 | + return false; |
|
414 | + } |
|
410 | 415 | |
411 | 416 | $url = Controller::join_links( |
412 | 417 | Director::baseURL(), |
@@ -855,7 +860,9 @@ discard block |
||
855 | 860 | */ |
856 | 861 | public function checkRequest($request) { |
857 | 862 | $member = Member::currentUser(); |
858 | - if(!$member) return false; |
|
863 | + if(!$member) { |
|
864 | + return false; |
|
865 | + } |
|
859 | 866 | |
860 | 867 | $salt = $request->getVar('s'); |
861 | 868 | $memberSalt = $this->memberSalt($salt, $member); |
@@ -876,7 +883,9 @@ discard block |
||
876 | 883 | protected function generate($length = null) { |
877 | 884 | $generator = new RandomGenerator(); |
878 | 885 | $result = $generator->randomToken('sha256'); |
879 | - if($length !== null) return substr($result, 0, $length); |
|
886 | + if($length !== null) { |
|
887 | + return substr($result, 0, $length); |
|
888 | + } |
|
880 | 889 | return $result; |
881 | 890 | } |
882 | 891 | } |