@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $this->args = $args; |
| 36 | 36 | $this->reviews = glsr( Database::class )->getReviews( $args )->results; |
| 37 | - if( empty( $this->reviews ) && $this->isHidden( 'if_empty' ))return; |
|
| 37 | + if( empty($this->reviews) && $this->isHidden( 'if_empty' ) )return; |
|
| 38 | 38 | $this->rating = glsr( Rating::class )->getAverage( $this->reviews ); |
| 39 | 39 | $this->generateSchema(); |
| 40 | 40 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | 'stars' => $this->buildStars(), |
| 47 | 47 | 'text' => $this->buildText(), |
| 48 | 48 | ], |
| 49 | - ]); |
|
| 49 | + ] ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -54,16 +54,16 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | protected function buildPercentage() |
| 56 | 56 | { |
| 57 | - if( $this->isHidden( 'bars' ))return; |
|
| 57 | + if( $this->isHidden( 'bars' ) )return; |
|
| 58 | 58 | $range = range( Rating::MAX_RATING, 1 ); |
| 59 | - $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews )); |
|
| 60 | - $bars = array_reduce( $range, function( $carry, $level ) use( $percentages ) { |
|
| 59 | + $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews ) ); |
|
| 60 | + $bars = array_reduce( $range, function( $carry, $level ) use($percentages) { |
|
| 61 | 61 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
| 62 | 62 | $background = $this->buildPercentageBackground( $percentages[$level] ); |
| 63 | 63 | $percent = $this->buildPercentagePercent( $percentages[$level] ); |
| 64 | 64 | return $carry.glsr( Builder::class )->div( $label.$background.$percent, [ |
| 65 | 65 | 'class' => 'glsr-bar', |
| 66 | - ]); |
|
| 66 | + ] ); |
|
| 67 | 67 | }); |
| 68 | 68 | return $this->wrap( 'percentage', $bars ); |
| 69 | 69 | } |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | protected function buildPercentageBackground( $percent ) |
| 76 | 76 | { |
| 77 | - $backgroundPercent = glsr( Builder::class )->span([ |
|
| 77 | + $backgroundPercent = glsr( Builder::class )->span( [ |
|
| 78 | 78 | 'class' => 'glsr-bar-background-percent', |
| 79 | 79 | 'style' => 'width:'.$percent, |
| 80 | - ]); |
|
| 80 | + ] ); |
|
| 81 | 81 | return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>'; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | protected function buildRating() |
| 106 | 106 | { |
| 107 | - if( $this->isHidden( 'rating' ))return; |
|
| 107 | + if( $this->isHidden( 'rating' ) )return; |
|
| 108 | 108 | return $this->wrap( 'rating', '<span>'.$this->rating.'</span>' ); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | protected function buildStars() |
| 115 | 115 | { |
| 116 | - if( $this->isHidden( 'stars' ))return; |
|
| 116 | + if( $this->isHidden( 'stars' ) )return; |
|
| 117 | 117 | $stars = glsr( Partial::class )->build( 'star-rating', [ |
| 118 | 118 | 'rating' => $this->rating, |
| 119 | - ]); |
|
| 119 | + ] ); |
|
| 120 | 120 | return $this->wrap( 'stars', $stars ); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | protected function buildText() |
| 127 | 127 | { |
| 128 | - if( $this->isHidden( 'summary' ))return; |
|
| 128 | + if( $this->isHidden( 'summary' ) )return; |
|
| 129 | 129 | $count = count( $this->reviews ); |
| 130 | - if( empty( $this->args['text'] )) { |
|
| 130 | + if( empty($this->args['text']) ) { |
|
| 131 | 131 | $this->args['text'] = _nx( |
| 132 | 132 | '{rating} out of {max} stars (based on %d review)', |
| 133 | 133 | '{rating} out of {max} stars (based on %d reviews)', |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | 'site-reviews' |
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | - $summary = str_replace( ['{rating}','{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] ); |
|
| 140 | - $summary = str_replace( ['%s','%d'], $count, $summary ); |
|
| 139 | + $summary = str_replace( ['{rating}', '{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] ); |
|
| 140 | + $summary = str_replace( ['%s', '%d'], $count, $summary ); |
|
| 141 | 141 | return $this->wrap( 'text', '<span>'.$summary.'</span>' ); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | protected function generateSchema() |
| 148 | 148 | { |
| 149 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 149 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
| 150 | 150 | glsr( Schema::class )->store( |
| 151 | 151 | glsr( Schema::class )->buildSummary( $this->args ) |
| 152 | 152 | ); |
@@ -179,6 +179,6 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | return glsr( Builder::class )->div( $value, [ |
| 181 | 181 | 'class' => 'glsr-summary-'.$key, |
| 182 | - ]); |
|
| 182 | + ] ); |
|
| 183 | 183 | } |
| 184 | 184 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'navigation' => $navigation, |
| 56 | 56 | ], |
| 57 | 57 | 'reviews' => $this->buildReviews(), |
| 58 | - ]); |
|
| 58 | + ] ); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $generatedReview = []; |
| 84 | 84 | foreach( $review as $key => $value ) { |
| 85 | 85 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
| 86 | - if( !method_exists( $this, $method ))continue; |
|
| 86 | + if( !method_exists( $this, $method ) )continue; |
|
| 87 | 87 | $generatedReview[$key] = $this->$method( $key, $value ); |
| 88 | 88 | } |
| 89 | 89 | return (object)$generatedReview; |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | protected function buildOptionAssignedTo( $key, $value ) |
| 98 | 98 | { |
| 99 | - if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return; |
|
| 100 | - $post = get_post( intval( $value )); |
|
| 101 | - if( !( $post instanceof WP_Post ))return; |
|
| 99 | + if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ) )return; |
|
| 100 | + $post = get_post( intval( $value ) ); |
|
| 101 | + if( !($post instanceof WP_Post) )return; |
|
| 102 | 102 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
| 103 | 103 | 'href' => get_the_permalink( $post->ID ), |
| 104 | - ]); |
|
| 104 | + ] ); |
|
| 105 | 105 | $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink ); |
| 106 | 106 | return $this->wrap( $key, '<span>'.$assignedTo.'</span>' ); |
| 107 | 107 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | protected function buildOptionAuthor( $key, $value ) |
| 115 | 115 | { |
| 116 | - if( $this->isHidden( $key ))return; |
|
| 116 | + if( $this->isHidden( $key ) )return; |
|
| 117 | 117 | $prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' ) |
| 118 | 118 | ? apply_filters( 'site-reviews/review/author/prefix', '—' ) |
| 119 | 119 | : ''; |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | protected function buildOptionAvatar( $key, $value ) |
| 129 | 129 | { |
| 130 | - if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return; |
|
| 130 | + if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ) )return; |
|
| 131 | 131 | $size = $this->getOption( 'settings.reviews.avatars.size', 40 ); |
| 132 | - return $this->wrap( $key, glsr( Builder::class )->img([ |
|
| 132 | + return $this->wrap( $key, glsr( Builder::class )->img( [ |
|
| 133 | 133 | 'src' => $this->generateAvatar( $value ), |
| 134 | 134 | 'height' => $size, |
| 135 | 135 | 'width' => $size, |
| 136 | - ])); |
|
| 136 | + ] ) ); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | protected function buildOptionContent( $key, $value ) |
| 145 | 145 | { |
| 146 | 146 | $text = $this->normalizeText( $value ); |
| 147 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
| 147 | + if( $this->isHiddenOrEmpty( $key, $text ) )return; |
|
| 148 | 148 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | protected function buildOptionDate( $key, $value ) |
| 157 | 157 | { |
| 158 | - if( $this->isHidden( $key ))return; |
|
| 158 | + if( $this->isHidden( $key ) )return; |
|
| 159 | 159 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
| 160 | 160 | if( $dateFormat == 'relative' ) { |
| 161 | 161 | $date = glsr( Date::class )->relative( $value ); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $format = $dateFormat == 'custom' |
| 165 | 165 | ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' ) |
| 166 | 166 | : (string)get_option( 'date_format' ); |
| 167 | - $date = date_i18n( $format, strtotime( $value )); |
|
| 167 | + $date = date_i18n( $format, strtotime( $value ) ); |
|
| 168 | 168 | } |
| 169 | 169 | return $this->wrap( $key, '<span>'.$date.'</span>' ); |
| 170 | 170 | } |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | protected function buildOptionRating( $key, $value ) |
| 178 | 178 | { |
| 179 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 179 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
| 180 | 180 | $rating = glsr( Html::class )->buildPartial( 'star-rating', [ |
| 181 | 181 | 'rating' => $value, |
| 182 | - ]); |
|
| 182 | + ] ); |
|
| 183 | 183 | return $this->wrap( $key, $rating ); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | protected function buildOptionResponse( $key, $value ) |
| 192 | 192 | { |
| 193 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 194 | - $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
|
| 193 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
| 194 | + $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) ); |
|
| 195 | 195 | $text = $this->normalizeText( $value ); |
| 196 | 196 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
| 197 | 197 | return $this->wrap( $key, |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | protected function buildOptionTitle( $key, $value ) |
| 209 | 209 | { |
| 210 | - if( $this->isHidden( $key ))return; |
|
| 211 | - if( empty( $value )) { |
|
| 210 | + if( $this->isHidden( $key ) )return; |
|
| 211 | + if( empty($value) ) { |
|
| 212 | 212 | $value = __( 'No Title', 'site-reviews' ); |
| 213 | 213 | } |
| 214 | 214 | return $this->wrap( $key, '<h3>'.$value.'</h3>' ); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | return $avatarUrl; |
| 227 | 227 | } |
| 228 | 228 | $authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id ); |
| 229 | - if( empty( $authorIdOrEmail )) { |
|
| 229 | + if( empty($authorIdOrEmail) ) { |
|
| 230 | 230 | $authorIdOrEmail = $review->email; |
| 231 | 231 | } |
| 232 | 232 | return get_avatar_url( $authorIdOrEmail ); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | protected function generateSchema() |
| 239 | 239 | { |
| 240 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 240 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
| 241 | 241 | glsr( Schema::class )->store( |
| 242 | 242 | glsr( Schema::class )->build( $this->args ) |
| 243 | 243 | ); |
@@ -263,14 +263,14 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | $limit = $this->getOption( 'settings.reviews.excerpt.length', 55 ); |
| 265 | 265 | if( str_word_count( $text, 0 ) > $limit ) { |
| 266 | - $words = array_keys( str_word_count( $text, 2 )); |
|
| 267 | - $excerpt = ltrim( substr( $text, 0, $words[$limit] )); |
|
| 268 | - $hiddenText = substr( $text, strlen( $excerpt )); |
|
| 266 | + $words = array_keys( str_word_count( $text, 2 ) ); |
|
| 267 | + $excerpt = ltrim( substr( $text, 0, $words[$limit] ) ); |
|
| 268 | + $hiddenText = substr( $text, strlen( $excerpt ) ); |
|
| 269 | 269 | $showMore = glsr( Builder::class )->span( $hiddenText, [ |
| 270 | 270 | 'class' => 'glsr-hidden glsr-hidden-text', |
| 271 | 271 | 'data-show-less' => __( 'Show less', 'site-reviews' ), |
| 272 | 272 | 'data-show-more' => __( 'Show more', 'site-reviews' ), |
| 273 | - ]); |
|
| 273 | + ] ); |
|
| 274 | 274 | $text = $excerpt.$showMore; |
| 275 | 275 | } |
| 276 | 276 | return nl2br( $text ); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | protected function getOption( $path, $fallback = '' ) |
| 285 | 285 | { |
| 286 | - if( array_key_exists( $path, $this->options )) { |
|
| 286 | + if( array_key_exists( $path, $this->options ) ) { |
|
| 287 | 287 | return $this->options[$path]; |
| 288 | 288 | } |
| 289 | 289 | return $fallback; |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | protected function isHidden( $key, $path = '' ) |
| 298 | 298 | { |
| 299 | - $isOptionEnabled = !empty( $path ) |
|
| 299 | + $isOptionEnabled = !empty($path) |
|
| 300 | 300 | ? $this->isOptionEnabled( $path ) |
| 301 | 301 | : true; |
| 302 | 302 | return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | protected function isHiddenOrEmpty( $key, $value ) |
| 311 | 311 | { |
| 312 | - return $this->isHidden( $key ) || empty( $value ); |
|
| 312 | + return $this->isHidden( $key ) || empty($value); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | protected function normalizeText( $text ) |
| 329 | 329 | { |
| 330 | 330 | $text = wp_kses( $text, wp_kses_allowed_html() ); |
| 331 | - $text = convert_smilies( wptexturize( strip_shortcodes( $text ))); |
|
| 331 | + $text = convert_smilies( wptexturize( strip_shortcodes( $text ) ) ); |
|
| 332 | 332 | $text = str_replace( ']]>', ']]>', $text ); |
| 333 | 333 | $text = preg_replace( '/(\R){2,}/', '$1', $text ); |
| 334 | 334 | return $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' ) |
@@ -345,6 +345,6 @@ discard block |
||
| 345 | 345 | { |
| 346 | 346 | return glsr( Builder::class )->div( $value, [ |
| 347 | 347 | 'class' => 'glsr-review-'.$key, |
| 348 | - ]); |
|
| 348 | + ] ); |
|
| 349 | 349 | } |
| 350 | 350 | } |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | global $menu, $typenow; |
| 23 | 23 | foreach( $menu as $key => $value ) { |
| 24 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 24 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | 25 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 26 | 26 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 27 | 27 | 'class' => 'pending-count', |
| 28 | - ]); |
|
| 28 | + ] ); |
|
| 29 | 29 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
| 30 | 30 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
| 31 | - ]); |
|
| 31 | + ] ); |
|
| 32 | 32 | $menu[$key][0] .= ' '.$awaitingModeration; |
| 33 | 33 | if( $typenow === Application::POST_TYPE ) { |
| 34 | - $menu[$key][4].= ' current'; |
|
| 34 | + $menu[$key][4] .= ' current'; |
|
| 35 | 35 | } |
| 36 | 36 | break; |
| 37 | 37 | } |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | 'tools' => __( 'Tools', 'site-reviews' ), |
| 49 | 49 | 'addons' => __( 'Add-Ons', 'site-reviews' ), |
| 50 | 50 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
| 51 | - ]); |
|
| 51 | + ] ); |
|
| 52 | 52 | foreach( $pages as $slug => $title ) { |
| 53 | 53 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 54 | 54 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 55 | - if( !is_callable( $callback ))continue; |
|
| 55 | + if( !is_callable( $callback ) )continue; |
|
| 56 | 56 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $this->renderPage( 'addons', [ |
| 68 | 68 | 'template' => glsr( Template::class ), |
| 69 | - ]); |
|
| 69 | + ] ); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
| 83 | 83 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
| 84 | 84 | 'functions' => __( 'Functions', 'site-reviews' ), |
| 85 | - ]); |
|
| 85 | + ] ); |
|
| 86 | 86 | $this->renderPage( 'documentation', [ |
| 87 | 87 | 'tabs' => $tabs, |
| 88 | - ]); |
|
| 88 | + ] ); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | 'schema' => __( 'Schema', 'site-reviews' ), |
| 103 | 103 | 'translations' => __( 'Translations', 'site-reviews' ), |
| 104 | 104 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
| 105 | - ]); |
|
| 106 | - if( !apply_filters( 'site-reviews/addon/licenses', false )) { |
|
| 107 | - unset( $tabs['licenses'] ); |
|
| 105 | + ] ); |
|
| 106 | + if( !apply_filters( 'site-reviews/addon/licenses', false ) ) { |
|
| 107 | + unset($tabs['licenses']); |
|
| 108 | 108 | } |
| 109 | 109 | $this->renderPage( 'settings', [ |
| 110 | 110 | 'html' => glsr( Html::class ), |
| 111 | 111 | 'tabs' => $tabs, |
| 112 | - ]); |
|
| 112 | + ] ); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | 'import-export' => __( 'Import/Export', 'site-reviews' ), |
| 124 | 124 | 'logging' => __( 'Logging', 'site-reviews' ), |
| 125 | 125 | 'system-info' => __( 'System Info', 'site-reviews' ), |
| 126 | - ]); |
|
| 126 | + ] ); |
|
| 127 | 127 | $this->renderPage( 'tools', [ |
| 128 | 128 | 'data' => [ |
| 129 | 129 | 'context' => [ |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | ], |
| 135 | 135 | 'html' => glsr( Html::class ), |
| 136 | 136 | 'tabs' => $tabs, |
| 137 | - ]); |
|
| 137 | + ] ); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | 'submit_button' => $this->buildSubmitButton(), |
| 31 | 31 | ], |
| 32 | 32 | 'fields' => $this->getFields(), |
| 33 | - ]); |
|
| 33 | + ] ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | return glsr( Builder::class )->button( '<span></span>'.__( 'Submit your review', 'site-reviews' ), [ |
| 50 | 50 | 'type' => 'submit', |
| 51 | - ]); |
|
| 51 | + ] ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -82,25 +82,25 @@ discard block |
||
| 82 | 82 | $fields = [[ |
| 83 | 83 | 'name' => 'assign_to', |
| 84 | 84 | 'value' => $this->args['assign_to'], |
| 85 | - ],[ |
|
| 85 | + ], [ |
|
| 86 | 86 | 'name' => 'category', |
| 87 | 87 | 'value' => $this->args['category'], |
| 88 | - ],[ |
|
| 88 | + ], [ |
|
| 89 | 89 | 'name' => 'excluded', |
| 90 | 90 | 'value' => $this->args['excluded'], |
| 91 | - ],[ |
|
| 91 | + ], [ |
|
| 92 | 92 | 'name' => 'id', |
| 93 | 93 | 'value' => $this->args['id'], |
| 94 | - ],[ |
|
| 94 | + ], [ |
|
| 95 | 95 | 'name' => '_wp_http_referer', |
| 96 | 96 | 'value' => wp_get_referer(), |
| 97 | - ],[ |
|
| 97 | + ], [ |
|
| 98 | 98 | 'name' => '_wpnonce', |
| 99 | 99 | 'value' => wp_create_nonce( 'post-review' ), |
| 100 | 100 | ]]; |
| 101 | 101 | return array_values( array_map( function( $field ) { |
| 102 | - return new Field( wp_parse_args( $field, ['type' => 'hidden'] )); |
|
| 103 | - }, $fields )); |
|
| 102 | + return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) ); |
|
| 103 | + }, $fields ) ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | protected function getHoneypotField() |
| 110 | 110 | { |
| 111 | - return new Field([ |
|
| 111 | + return new Field( [ |
|
| 112 | 112 | 'name' => 'gotcha', |
| 113 | 113 | 'type' => 'honeypot', |
| 114 | - ]); |
|
| 114 | + ] ); |
|
| 115 | 115 | } |
| 116 | 116 | } |
@@ -27,13 +27,13 @@ |
||
| 27 | 27 | public function getFields( $id ) |
| 28 | 28 | { |
| 29 | 29 | $fields = []; |
| 30 | - $configPath = glsr()->path( 'config/'.$id.'.php' );; |
|
| 30 | + $configPath = glsr()->path( 'config/'.$id.'.php' ); ; |
|
| 31 | 31 | $values = file_exists( $configPath ) |
| 32 | 32 | ? include $configPath |
| 33 | 33 | : []; |
| 34 | 34 | $values = apply_filters( 'site-reviews/form/fields', $values ); |
| 35 | 35 | foreach( $values as $name => $field ) { |
| 36 | - $fields[] = new Field( wp_parse_args( $field, ['name' => $name] )); |
|
| 36 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
| 37 | 37 | } |
| 38 | 38 | return $fields; |
| 39 | 39 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | : $this->$method( $id ); |
| 24 | 24 | return glsr( Template::class )->build( 'pages/settings/'.$id, [ |
| 25 | 25 | 'context' => $context, |
| 26 | - ]); |
|
| 26 | + ] ); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | protected function getSettingFields( $path ) |
| 42 | 42 | { |
| 43 | 43 | $settings = glsr( DefaultsManager::class )->settings(); |
| 44 | - return array_filter( $settings, function( $key ) use( $path ) { |
|
| 44 | + return array_filter( $settings, function( $key ) use($path) { |
|
| 45 | 45 | return glsr( Helper::class )->startsWith( $path, $key ); |
| 46 | 46 | }, ARRAY_FILTER_USE_KEY ); |
| 47 | 47 | } |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | protected function getTemplateContext( $id ) |
| 54 | 54 | { |
| 55 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
| 55 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
| 56 | 56 | $rows = ''; |
| 57 | 57 | foreach( $fields as $name => $field ) { |
| 58 | 58 | $field = wp_parse_args( $field, [ |
| 59 | 59 | 'is_setting' => true, |
| 60 | 60 | 'name' => $name, |
| 61 | - ]); |
|
| 62 | - $rows.= new Field( $field ); |
|
| 61 | + ] ); |
|
| 62 | + $rows .= new Field( $field ); |
|
| 63 | 63 | } |
| 64 | 64 | return [ |
| 65 | 65 | 'rows' => $rows, |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | protected function getTemplateContextForTranslations() |
| 73 | 73 | { |
| 74 | 74 | $translations = glsr( Translator::class )->renderAll(); |
| 75 | - $class = empty( $translations ) |
|
| 75 | + $class = empty($translations) |
|
| 76 | 76 | ? 'glsr-hidden' |
| 77 | 77 | : ''; |
| 78 | 78 | return [ |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | { |
| 14 | 14 | $this->builder->args = wp_parse_args( $this->builder->args, [ |
| 15 | 15 | 'name' => $this->builder->args['text'], |
| 16 | - ]); |
|
| 16 | + ] ); |
|
| 17 | 17 | $this->mergeFieldArgs(); |
| 18 | 18 | $this->builder->tag = 'input'; |
| 19 | 19 | return $this->builder->getOpeningTag(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | 'is_setting' => false, |
| 26 | 26 | 'is_valid' => true, |
| 27 | 27 | 'path' => '', |
| 28 | - ]); |
|
| 28 | + ] ); |
|
| 29 | 29 | $this->normalize(); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | return glsr( Template::class )->build( 'partials/form/field', [ |
| 72 | 72 | 'context' => [ |
| 73 | 73 | 'class' => $this->getFieldClass(), |
| 74 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
| 74 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
| 75 | 75 | ], |
| 76 | - ]); |
|
| 76 | + ] ); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | return glsr( Template::class )->build( 'partials/form/table-row', [ |
| 86 | 86 | 'context' => [ |
| 87 | 87 | 'class' => $this->getFieldClass(), |
| 88 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
| 88 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
| 89 | 89 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
| 90 | 90 | ], |
| 91 | - ]); |
|
| 91 | + ] ); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | 'context' => [ |
| 101 | 101 | 'class' => $this->getFieldClass(), |
| 102 | 102 | 'depends_on' => $this->getFieldDependsOn(), |
| 103 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
| 103 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
| 104 | 104 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
| 105 | 105 | 'legend' => $this->field['legend'], |
| 106 | 106 | ], |
| 107 | - ]); |
|
| 107 | + ] ); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if( $this->field['is_hidden'] ) { |
| 117 | 117 | $classes[] = 'hidden'; |
| 118 | 118 | } |
| 119 | - if( !empty( $this->field['required'] )) { |
|
| 119 | + if( !empty($this->field['required']) ) { |
|
| 120 | 120 | $classes[] = 'glsr-required'; |
| 121 | 121 | } |
| 122 | 122 | return implode( ' ', $classes ); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | protected function getFieldDefault() |
| 129 | 129 | { |
| 130 | - return isset( $this->field['default'] ) |
|
| 130 | + return isset($this->field['default']) |
|
| 131 | 131 | ? $this->field['default'] |
| 132 | 132 | : ''; |
| 133 | 133 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | protected function getFieldDependsOn() |
| 139 | 139 | { |
| 140 | - return !empty( $this->field['depends_on'] ) |
|
| 140 | + return !empty($this->field['depends_on']) |
|
| 141 | 141 | ? $this->field['depends_on'] |
| 142 | 142 | : ''; |
| 143 | 143 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $path, |
| 164 | 164 | glsr( Helper::class )->getPathValue( $path, glsr()->defaults ) |
| 165 | 165 | ); |
| 166 | - if( is_array( $expectedValue )) { |
|
| 166 | + if( is_array( $expectedValue ) ) { |
|
| 167 | 167 | return !in_array( $optionValue, $expectedValue ); |
| 168 | 168 | } |
| 169 | 169 | return $optionValue != $expectedValue; |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | 'name', 'type', |
| 182 | 182 | ]; |
| 183 | 183 | foreach( $requiredValues as $value ) { |
| 184 | - if( isset( $this->field[$value] ))continue; |
|
| 184 | + if( isset($this->field[$value]) )continue; |
|
| 185 | 185 | $missingValues[] = $value; |
| 186 | 186 | $isValid = $this->field['is_valid'] = false; |
| 187 | 187 | } |
| 188 | - if( !empty( $missingValues )) { |
|
| 188 | + if( !empty($missingValues) ) { |
|
| 189 | 189 | glsr_log() |
| 190 | - ->warning( 'Field is missing: '.implode( ', ', $missingValues )) |
|
| 190 | + ->warning( 'Field is missing: '.implode( ', ', $missingValues ) ) |
|
| 191 | 191 | ->info( $this->field ); |
| 192 | 192 | } |
| 193 | 193 | return $isValid; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $field = $this->field; |
| 203 | 203 | foreach( $field as $key => $value ) { |
| 204 | 204 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 205 | - if( !method_exists( $this, $methodName ))continue; |
|
| 205 | + if( !method_exists( $this, $methodName ) )continue; |
|
| 206 | 206 | $this->$methodName(); |
| 207 | 207 | } |
| 208 | 208 | $this->normalizeFieldId(); |
@@ -215,13 +215,13 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | protected function normalizeDependsOn() |
| 217 | 217 | { |
| 218 | - if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] ))return; |
|
| 218 | + if( empty($this->field['depends_on']) || !is_array( $this->field['depends_on'] ) )return; |
|
| 219 | 219 | $path = key( $this->field['depends_on'] ); |
| 220 | 220 | $value = $this->field['depends_on'][$path]; |
| 221 | - $this->field['depends_on'] = json_encode([ |
|
| 221 | + $this->field['depends_on'] = json_encode( [ |
|
| 222 | 222 | 'name' => glsr( Helper::class )->convertPathToName( $path, OptionManager::databaseKey() ), |
| 223 | 223 | 'value' => $value, |
| 224 | - ], JSON_HEX_APOS|JSON_HEX_QUOT ); |
|
| 224 | + ], JSON_HEX_APOS | JSON_HEX_QUOT ); |
|
| 225 | 225 | $this->field['is_hidden'] = $this->isFieldHidden( $path, $value ); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | protected function normalizeFieldId() |
| 232 | 232 | { |
| 233 | - if( isset( $this->field['id'] ) || empty( $this->field['label'] ))return; |
|
| 233 | + if( isset($this->field['id']) || empty($this->field['label']) )return; |
|
| 234 | 234 | $this->field['id'] = glsr( Helper::class )->convertNameToId( $this->field['name'] ); |
| 235 | 235 | } |
| 236 | 236 | |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | protected function normalizeFieldType() |
| 241 | 241 | { |
| 242 | 242 | $className = glsr( Helper::class )->buildClassName( $this->field['type'], __NAMESPACE__.'\Fields' ); |
| 243 | - if( class_exists( $className )) { |
|
| 243 | + if( class_exists( $className ) ) { |
|
| 244 | 244 | $this->field = array_merge( |
| 245 | 245 | wp_parse_args( $this->field, $className::defaults() ), |
| 246 | 246 | $className::required() |
| 247 | 247 | ); |
| 248 | 248 | } |
| 249 | - if( in_array( $this->field['type'], static::MULTI_FIELD_TYPES )) { |
|
| 249 | + if( in_array( $this->field['type'], static::MULTI_FIELD_TYPES ) ) { |
|
| 250 | 250 | $this->field['is_multi'] = true; |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | protected function normalizeFieldValue() |
| 258 | 258 | { |
| 259 | - if( isset( $this->field['value'] ))return; |
|
| 259 | + if( isset($this->field['value']) )return; |
|
| 260 | 260 | $this->field['value'] = glsr( OptionManager::class )->get( |
| 261 | 261 | $this->field['path'], |
| 262 | 262 | $this->getFieldDefault() |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | { |
| 271 | 271 | if( !$this->field['is_setting'] )return; |
| 272 | 272 | $this->field['legend'] = $this->field['label']; |
| 273 | - unset( $this->field['label'] ); |
|
| 273 | + unset($this->field['label']); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function __call( $method, $args ) |
| 65 | 65 | { |
| 66 | - $instance = new static( $this->globals ); |
|
| 66 | + $instance = new static($this->globals); |
|
| 67 | 67 | $instance->setTagFromMethod( $method ); |
| 68 | - call_user_func_array( [$instance, 'normalize'], $args += ['',''] ); |
|
| 68 | + call_user_func_array( [$instance, 'normalize'], $args += ['', ''] ); |
|
| 69 | 69 | $tags = array_merge( static::TAGS_FORM, static::TAGS_SINGLE, static::TAGS_STRUCTURE, static::TAGS_TEXT ); |
| 70 | 70 | $generatedTag = in_array( $instance->tag, $tags ) |
| 71 | 71 | ? $instance->buildTag() |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | 'render' => 'is_bool', |
| 90 | 90 | 'tag' => 'is_string', |
| 91 | 91 | ]; |
| 92 | - if( !isset( $properties[$property] ) |
|
| 93 | - || empty( array_filter( [$value], $properties[$property] )) |
|
| 92 | + if( !isset($properties[$property]) |
|
| 93 | + || empty(array_filter( [$value], $properties[$property] )) |
|
| 94 | 94 | )return; |
| 95 | 95 | $this->$property = $value; |
| 96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getOpeningTag() |
| 110 | 110 | { |
| 111 | - $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
|
| 111 | + $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString(); |
|
| 112 | 112 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | protected function buildCustomField() |
| 119 | 119 | { |
| 120 | 120 | $className = $this->getCustomFieldClassName(); |
| 121 | - if( class_exists( $className )) { |
|
| 121 | + if( class_exists( $className ) ) { |
|
| 122 | 122 | return (new $className( $this ))->build(); |
| 123 | 123 | } |
| 124 | 124 | glsr_log()->error( 'Field missing: '.$className ); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | protected function buildDefaultTag( $text = '' ) |
| 131 | 131 | { |
| 132 | - if( empty( $text )) { |
|
| 132 | + if( empty($text) ) { |
|
| 133 | 133 | $text = $this->args['text']; |
| 134 | 134 | } |
| 135 | 135 | return $this->getOpeningTag().$text.$this->getClosingTag(); |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | protected function buildFieldDescription() |
| 142 | 142 | { |
| 143 | - if( empty( $this->args['description'] ))return; |
|
| 144 | - if( !empty( $this->globals['is_widget'] )) { |
|
| 143 | + if( empty($this->args['description']) )return; |
|
| 144 | + if( !empty($this->globals['is_widget']) ) { |
|
| 145 | 145 | return $this->small( $this->args['description'] ); |
| 146 | 146 | } |
| 147 | 147 | return $this->p( $this->args['description'], ['class' => 'description'] ); |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | protected function buildFormInput() |
| 154 | 154 | { |
| 155 | - if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) { |
|
| 155 | + if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) { |
|
| 156 | 156 | return $this->buildFormLabel().$this->getOpeningTag(); |
| 157 | 157 | } |
| 158 | - return empty( $this->args['options'] ) |
|
| 158 | + return empty($this->args['options']) |
|
| 159 | 159 | ? $this->buildFormInputChoice() |
| 160 | 160 | : $this->buildFormInputMultiChoice(); |
| 161 | 161 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | protected function buildFormInputMultiChoice() |
| 175 | 175 | { |
| 176 | 176 | if( $this->args['type'] == 'checkbox' ) { |
| 177 | - $this->args['name'].= '[]'; |
|
| 177 | + $this->args['name'] .= '[]'; |
|
| 178 | 178 | } |
| 179 | 179 | $options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
| 180 | 180 | return $carry.$this->li( $this->{$this->args['type']}([ |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | 'name' => $this->args['name'], |
| 183 | 183 | 'text' => $this->args['options'][$key], |
| 184 | 184 | 'value' => $key, |
| 185 | - ])); |
|
| 185 | + ]) ); |
|
| 186 | 186 | }); |
| 187 | 187 | return $this->ul( $options, [ |
| 188 | 188 | 'class' => $this->args['class'], |
| 189 | 189 | 'id' => $this->args['id'], |
| 190 | - ]); |
|
| 190 | + ] ); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | protected function buildFormLabel() |
| 197 | 197 | { |
| 198 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 199 | - return $this->label([ |
|
| 198 | + if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return; |
|
| 199 | + return $this->label( [ |
|
| 200 | 200 | 'for' => $this->args['id'], |
| 201 | 201 | 'text' => $this->args['label'], |
| 202 | - ]); |
|
| 202 | + ] ); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -216,11 +216,11 @@ discard block |
||
| 216 | 216 | protected function buildFormSelectOptions() |
| 217 | 217 | { |
| 218 | 218 | return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
| 219 | - return $carry.$this->option([ |
|
| 219 | + return $carry.$this->option( [ |
|
| 220 | 220 | 'selected' => $this->args['value'] == $key, |
| 221 | 221 | 'text' => $this->args['options'][$key], |
| 222 | 222 | 'value' => $key, |
| 223 | - ]); |
|
| 223 | + ] ); |
|
| 224 | 224 | }); |
| 225 | 225 | } |
| 226 | 226 | |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | protected function buildTag() |
| 239 | 239 | { |
| 240 | - if( in_array( $this->tag, static::TAGS_SINGLE )) { |
|
| 240 | + if( in_array( $this->tag, static::TAGS_SINGLE ) ) { |
|
| 241 | 241 | return $this->getOpeningTag(); |
| 242 | 242 | } |
| 243 | - if( !in_array( $this->tag, static::TAGS_FORM )) { |
|
| 243 | + if( !in_array( $this->tag, static::TAGS_FORM ) ) { |
|
| 244 | 244 | return $this->buildDefaultTag(); |
| 245 | 245 | } |
| 246 | 246 | return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription(); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | { |
| 262 | 262 | $args = glsr( BuilderDefaults::class )->merge( $this->args ); |
| 263 | 263 | $className = $this->getCustomFieldClassName(); |
| 264 | - if( class_exists( $className )) { |
|
| 264 | + if( class_exists( $className ) ) { |
|
| 265 | 265 | $args = array_merge( $args, $className::defaults() ); |
| 266 | 266 | } |
| 267 | 267 | $this->args = $args; |
@@ -273,13 +273,13 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | protected function normalize( ...$params ) |
| 275 | 275 | { |
| 276 | - if( is_string( $params[0] ) || is_numeric( $params[0] )) { |
|
| 276 | + if( is_string( $params[0] ) || is_numeric( $params[0] ) ) { |
|
| 277 | 277 | $this->setNameOrTextAttributeForTag( $params[0] ); |
| 278 | 278 | } |
| 279 | - if( is_array( $params[0] )) { |
|
| 279 | + if( is_array( $params[0] ) ) { |
|
| 280 | 280 | $this->args += $params[0]; |
| 281 | 281 | } |
| 282 | - else if( is_array( $params[1] )) { |
|
| 282 | + else if( is_array( $params[1] ) ) { |
|
| 283 | 283 | $this->args += $params[1]; |
| 284 | 284 | } |
| 285 | 285 | $this->mergeArgsWithRequiredDefaults(); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | protected function setTagFromMethod( $method ) |
| 305 | 305 | { |
| 306 | 306 | $this->tag = strtolower( $method ); |
| 307 | - if( in_array( $this->tag, static::INPUT_TYPES )) { |
|
| 307 | + if( in_array( $this->tag, static::INPUT_TYPES ) ) { |
|
| 308 | 308 | $this->args['type'] = $this->tag; |
| 309 | 309 | $this->tag = 'input'; |
| 310 | 310 | } |