@@ -30,7 +30,9 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $diff = time() - strtotime( $date ); |
| 32 | 32 | foreach( static::$TIME_PERIODS as $i => $timePeriod ) { |
| 33 | - if( $diff > $timePeriod[0] )continue; |
|
| 33 | + if( $diff > $timePeriod[0] ) { |
|
| 34 | + continue; |
|
| 35 | + } |
|
| 34 | 36 | $unit = intval( floor( $diff / $timePeriod[1] )); |
| 35 | 37 | $relativeDates = [ |
| 36 | 38 | _n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ), |
@@ -161,7 +161,9 @@ discard block |
||
| 161 | 161 | if( !empty( $sessions )) { |
| 162 | 162 | $now = time(); |
| 163 | 163 | foreach( $sessions as $session ) { |
| 164 | - if( $now <= $session->expiration )continue; |
|
| 164 | + if( $now <= $session->expiration ) { |
|
| 165 | + continue; |
|
| 166 | + } |
|
| 165 | 167 | $expiredSessions[] = $session->name; |
| 166 | 168 | $expiredSessions[] = str_replace( '_expires_', '_', $session->name ); |
| 167 | 169 | } |
@@ -204,7 +206,9 @@ discard block |
||
| 204 | 206 | */ |
| 205 | 207 | protected function setCookie() |
| 206 | 208 | { |
| 207 | - if( headers_sent() )return; |
|
| 209 | + if( headers_sent() ) { |
|
| 210 | + return; |
|
| 211 | + } |
|
| 208 | 212 | $cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset; |
| 209 | 213 | $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ))); |
| 210 | 214 | setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath ); |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | natsort( $routines ); |
| 17 | 17 | array_walk( $routines, function( $routine ) { |
| 18 | 18 | $version = str_replace( strtolower( __CLASS__ ).'_', '', $routine ); |
| 19 | - if( version_compare( glsr()->version, $version, '>=' ))return; |
|
| 19 | + if( version_compare( glsr()->version, $version, '>=' )) { |
|
| 20 | + return; |
|
| 21 | + } |
|
| 20 | 22 | call_user_func( [$this, $routine] ); |
| 21 | 23 | }); |
| 22 | 24 | $this->updateVersion(); |
@@ -37,5 +39,6 @@ discard block |
||
| 37 | 39 | } |
| 38 | 40 | |
| 39 | 41 | protected function upgrade_3_0_0() |
| 40 | - {} |
|
| 42 | + { |
|
| 43 | +} |
|
| 41 | 44 | } |
@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function onCreateReview( $postData, $meta, $postId ) |
| 24 | 24 | { |
| 25 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
| 25 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
| 26 | + return; |
|
| 27 | + } |
|
| 26 | 28 | $this->updateAssignedToPost( $review ); |
| 27 | 29 | } |
| 28 | 30 | |
@@ -32,7 +34,9 @@ discard block |
||
| 32 | 34 | */ |
| 33 | 35 | public function onDeleteReview( $postId ) |
| 34 | 36 | { |
| 35 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
| 37 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
| 38 | + return; |
|
| 39 | + } |
|
| 36 | 40 | $review->post_status = 'deleted'; // important to change the post_status here first! |
| 37 | 41 | $this->updateAssignedToPost( $review ); |
| 38 | 42 | } |
@@ -52,7 +56,9 @@ discard block |
||
| 52 | 56 | */ |
| 53 | 57 | public function saveAssignedToMetabox( $postId ) |
| 54 | 58 | { |
| 55 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
| 59 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' )) { |
|
| 60 | + return; |
|
| 61 | + } |
|
| 56 | 62 | $assignedTo = filter_input( INPUT_POST, 'assigned_to' ); |
| 57 | 63 | $assignedTo || $assignedTo = ''; |
| 58 | 64 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
@@ -67,7 +73,9 @@ discard block |
||
| 67 | 73 | */ |
| 68 | 74 | public function saveResponseMetabox( $postId ) |
| 69 | 75 | { |
| 70 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return; |
|
| 76 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' )) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 71 | 79 | $response = filter_input( INPUT_POST, 'response' ); |
| 72 | 80 | $response || $response = ''; |
| 73 | 81 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
@@ -120,9 +128,13 @@ discard block |
||
| 120 | 128 | */ |
| 121 | 129 | protected function updateAssignedToPost( WP_Post $review ) |
| 122 | 130 | { |
| 123 | - if( !( $postId = $this->getAssignedToPostId( $review->ID )))return; |
|
| 131 | + if( !( $postId = $this->getAssignedToPostId( $review->ID ))) { |
|
| 132 | + return; |
|
| 133 | + } |
|
| 124 | 134 | $reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
| 125 | - if( empty( $reviewIds ))return; |
|
| 135 | + if( empty( $reviewIds )) { |
|
| 136 | + return; |
|
| 137 | + } |
|
| 126 | 138 | $this->updateReviewIdOfPost( $postId, $review, $reviewIds ); |
| 127 | 139 | $updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
| 128 | 140 | if( empty( $updatedReviewIds )) { |
@@ -22,7 +22,8 @@ |
||
| 22 | 22 | protected $public; |
| 23 | 23 | protected $translator; |
| 24 | 24 | |
| 25 | - public function __construct( Application $app ) { |
|
| 25 | + public function __construct( Application $app ) |
|
| 26 | + { |
|
| 26 | 27 | $this->app = $app; |
| 27 | 28 | $this->admin = $app->make( AdminController::class ); |
| 28 | 29 | $this->basename = plugin_basename( $app->file ); |
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | protected $router; |
| 26 | 26 | protected $settings; |
| 27 | 27 | |
| 28 | - public function __construct( Application $app ) { |
|
| 28 | + public function __construct( Application $app ) |
|
| 29 | + { |
|
| 29 | 30 | $this->app = $app; |
| 30 | 31 | $this->admin = $app->make( AdminController::class ); |
| 31 | 32 | $this->editor = $app->make( EditorController::class ); |
@@ -3,7 +3,9 @@ |
||
| 3 | 3 | defined( 'WP_UNINSTALL_PLUGIN' ) || die; |
| 4 | 4 | |
| 5 | 5 | require_once __DIR__.'/site-reviews.php'; |
| 6 | -if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return; |
|
| 6 | +if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ))) { |
|
| 7 | + return; |
|
| 8 | +} |
|
| 7 | 9 | |
| 8 | 10 | delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() ); |
| 9 | 11 | delete_option( 'widget_'.glsr()->id.'_site-reviews' ); |
@@ -53,7 +53,9 @@ |
||
| 53 | 53 | protected function normalize( array $settings ) |
| 54 | 54 | { |
| 55 | 55 | array_walk( $settings, function( &$setting ) { |
| 56 | - if( isset( $setting['default'] ))return; |
|
| 56 | + if( isset( $setting['default'] )) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 57 | 59 | $setting['default'] = ''; |
| 58 | 60 | }); |
| 59 | 61 | return $settings; |
@@ -42,7 +42,9 @@ discard block |
||
| 42 | 42 | $options = $this->all(); |
| 43 | 43 | $pointer = &$options; |
| 44 | 44 | foreach( $keys as $key ) { |
| 45 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
| 45 | + if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) { |
|
| 46 | + continue; |
|
| 47 | + } |
|
| 46 | 48 | $pointer = &$pointer[$key]; |
| 47 | 49 | } |
| 48 | 50 | unset( $pointer[$last] ); |
@@ -77,7 +79,9 @@ discard block |
||
| 77 | 79 | glsr( DefaultsManager::class )->defaults() |
| 78 | 80 | ); |
| 79 | 81 | array_walk( $options, function( &$value ) { |
| 80 | - if( !is_string( $value ))return; |
|
| 82 | + if( !is_string( $value )) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 81 | 85 | $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
| 82 | 86 | }); |
| 83 | 87 | return glsr( Helper::class )->convertDotNotationArray( $options ); |