@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | 'name' => 'tripadvisor', |
| 13 | 13 | 'title' => 'Tripadvisor Reviews', |
| 14 | 14 | ], |
| 15 | - ]); |
|
| 15 | + ] ); |
|
| 16 | 16 | $template->render( 'addons/addon', [ |
| 17 | 17 | 'context' => [ |
| 18 | 18 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'name' => 'yelp', |
| 21 | 21 | 'title' => 'Yelp Reviews', |
| 22 | 22 | ], |
| 23 | - ]); |
|
| 23 | + ] ); |
|
| 24 | 24 | ?> |
| 25 | 25 | </div> |
| 26 | 26 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function renderSettingFields( $id ) |
| 53 | 53 | { |
| 54 | 54 | $rows = $this->build( 'pages/settings/'.$id, [ |
| 55 | - ]); |
|
| 55 | + ] ); |
|
| 56 | 56 | glsr_debug( $id ); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function normalize( array $data ) |
| 63 | 63 | { |
| 64 | - $data = wp_parse_args( $data, array_fill_keys( ['context', 'globals'], [] )); |
|
| 64 | + $data = wp_parse_args( $data, array_fill_keys( ['context', 'globals'], [] ) ); |
|
| 65 | 65 | foreach( $data as $key => $value ) { |
| 66 | - if( is_array( $value ))continue; |
|
| 66 | + if( is_array( $value ) )continue; |
|
| 67 | 67 | $data[$key] = []; |
| 68 | 68 | } |
| 69 | 69 | $data['template'] = $this; |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function build( $path, array $fields = [] ) |
| 17 | 17 | { |
| 18 | - if( empty( $fields )) { |
|
| 19 | - $fields = $this->getSettingsFields( $this->normalizeSettingsPath( $path )); |
|
| 18 | + if( empty($fields) ) { |
|
| 19 | + $fields = $this->getSettingsFields( $this->normalizeSettingsPath( $path ) ); |
|
| 20 | 20 | } |
| 21 | 21 | foreach( $fields as $name => &$field ) { |
| 22 | 22 | $field = wp_parse_args( $field, ['name' => $name] ); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | protected function getSettingsFields( $path ) |
| 34 | 34 | { |
| 35 | 35 | $settings = glsr( DefaultsManager::class )->settings(); |
| 36 | - return array_filter( $settings, function( $key ) use( $path ) { |
|
| 36 | + return array_filter( $settings, function( $key ) use($path) { |
|
| 37 | 37 | return glsr( Helper::class )->startsWith( $path, $key ); |
| 38 | 38 | }, ARRAY_FILTER_USE_KEY ); |
| 39 | 39 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | public function get() |
| 14 | 14 | { |
| 15 | 15 | $settings = $this->settings(); |
| 16 | - $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' )); |
|
| 16 | + $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) ); |
|
| 17 | 17 | return glsr( Helper::class )->convertDotNotationArray( $defaults ); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | protected function normalize( array $settings ) |
| 47 | 47 | { |
| 48 | 48 | array_walk( $settings, function( &$setting ) { |
| 49 | - if( isset( $setting['default'] ))return; |
|
| 49 | + if( isset($setting['default']) )return; |
|
| 50 | 50 | $setting['default'] = null; |
| 51 | 51 | }); |
| 52 | 52 | return $settings; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function getDefaults() |
| 68 | 68 | { |
| 69 | - if( empty( $this->defaults )) { |
|
| 69 | + if( empty($this->defaults) ) { |
|
| 70 | 70 | $this->defaults = $this->make( DefaultsManager::class )->get(); |
| 71 | 71 | $this->upgrade(); |
| 72 | 72 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function hasPermission() |
| 80 | 80 | { |
| 81 | - return !$this->isAdmin() || ( $this->isAdmin() && current_user_can( static::CAPABILITY )); |
|
| 81 | + return !$this->isAdmin() || ($this->isAdmin() && current_user_can( static::CAPABILITY )); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $types = apply_filters( 'site-reviews/addon/types', [] ); |
| 134 | 134 | $this->reviewTypes = wp_parse_args( $types, [ |
| 135 | 135 | 'local' => __( 'Local', 'site-reviews' ), |
| 136 | - ]); |
|
| 136 | + ] ); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -143,15 +143,15 @@ discard block |
||
| 143 | 143 | public function render( $view, array $data = [] ) |
| 144 | 144 | { |
| 145 | 145 | $file = ''; |
| 146 | - if( glsr( Helper::class )->startsWith( $view, 'templates/' )) { |
|
| 146 | + if( glsr( Helper::class )->startsWith( $view, 'templates/' ) ) { |
|
| 147 | 147 | $file = str_replace( 'templates/', 'site-reviews/', $view ).'.php'; |
| 148 | 148 | $file = get_stylesheet_directory().'/'.$file; |
| 149 | 149 | } |
| 150 | - if( !file_exists( $file )) { |
|
| 150 | + if( !file_exists( $file ) ) { |
|
| 151 | 151 | $file = $this->path( 'views/'.$view.'.php' ); |
| 152 | 152 | } |
| 153 | 153 | $file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data ); |
| 154 | - if( !file_exists( $file )) { |
|
| 154 | + if( !file_exists( $file ) ) { |
|
| 155 | 155 | glsr_log()->error( 'File not found: '.$file ); |
| 156 | 156 | return; |
| 157 | 157 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function scheduleCronJob() |
| 167 | 167 | { |
| 168 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
| 168 | + if( wp_next_scheduled( static::CRON_EVENT ) )return; |
|
| 169 | 169 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function unscheduleCronJob() |
| 176 | 176 | { |
| 177 | - wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT ); |
|
| 177 | + wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT ); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -206,6 +206,6 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function url( $path = '' ) |
| 208 | 208 | { |
| 209 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
| 209 | + return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); |
|
| 210 | 210 | } |
| 211 | 211 | } |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | global $menu, $typenow; |
| 24 | 24 | foreach( $menu as $key => $value ) { |
| 25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 26 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 27 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 28 | 28 | 'class' => 'pending-count', |
| 29 | - ]); |
|
| 29 | + ] ); |
|
| 30 | 30 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
| 31 | 31 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
| 32 | - ]); |
|
| 32 | + ] ); |
|
| 33 | 33 | $menu[$key][0] .= $awaitingModeration; |
| 34 | 34 | if( $typenow === Application::POST_TYPE ) { |
| 35 | 35 | $menu[$key][4] .= ' current'; |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | 'tools' => __( 'Tools', 'site-reviews' ), |
| 50 | 50 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
| 51 | 51 | 'addons' => __( 'Add-Ons', 'site-reviews' ), |
| 52 | - ]); |
|
| 52 | + ] ); |
|
| 53 | 53 | foreach( $pages as $slug => $title ) { |
| 54 | 54 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 55 | 55 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 56 | - if( !is_callable( $callback ))continue; |
|
| 56 | + if( !is_callable( $callback ) )continue; |
|
| 57 | 57 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $this->renderPage( 'addons', [ |
| 69 | 69 | 'template' => glsr( Template::class ), |
| 70 | - ]); |
|
| 70 | + ] ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
| 84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
| 85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
| 86 | - ]); |
|
| 86 | + ] ); |
|
| 87 | 87 | $this->renderPage( 'documentation', [ |
| 88 | 88 | 'tabs' => $tabs, |
| 89 | - ]); |
|
| 89 | + ] ); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -103,16 +103,16 @@ discard block |
||
| 103 | 103 | 'schema' => __( 'Schema', 'site-reviews' ), |
| 104 | 104 | 'translations' => __( 'Translations', 'site-reviews' ), |
| 105 | 105 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
| 106 | - ]); |
|
| 107 | - if( !apply_filters( 'site-reviews/addon/licenses', false )) { |
|
| 108 | - unset( $tabs['licenses'] ); |
|
| 106 | + ] ); |
|
| 107 | + if( !apply_filters( 'site-reviews/addon/licenses', false ) ) { |
|
| 108 | + unset($tabs['licenses']); |
|
| 109 | 109 | } |
| 110 | 110 | $this->renderPage( 'settings', [ |
| 111 | 111 | // 'database_key' => OptionManager::databaseKey(), |
| 112 | 112 | // 'settings' => glsr()->getDefaults(), |
| 113 | 113 | 'tabs' => $tabs, |
| 114 | 114 | 'template' => glsr( Template::class ), |
| 115 | - ]); |
|
| 115 | + ] ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | 'import-export' => __( 'Import/Export', 'site-reviews' ), |
| 127 | 127 | 'logging' => __( 'Logging', 'site-reviews' ), |
| 128 | 128 | 'system-info' => __( 'System Info', 'site-reviews' ), |
| 129 | - ]); |
|
| 129 | + ] ); |
|
| 130 | 130 | $this->renderPage( 'tools', [ |
| 131 | 131 | 'data' => [ |
| 132 | 132 | 'id' => Application::ID, |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | ], |
| 137 | 137 | 'html' => glsr( Html::class ), |
| 138 | 138 | 'tabs' => $tabs, |
| 139 | - ]); |
|
| 139 | + ] ); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function renderAssignedToMetabox( WP_Post $post ) |
| 149 | 149 | { |
| 150 | - if( !$this->isReviewPostType( $post ))return; |
|
| 151 | - $assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true )); |
|
| 150 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 151 | + $assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ) ); |
|
| 152 | 152 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 153 | 153 | glsr()->render( 'editor/metabox-assigned-to', [ |
| 154 | 154 | 'id' => $assignedTo, |
| 155 | 155 | 'template' => $this->buildAssignedToTemplate( $assignedTo ), |
| 156 | - ]); |
|
| 156 | + ] ); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function renderDetailsMetaBox( WP_Post $post ) |
| 164 | 164 | { |
| 165 | - if( !$this->isReviewPostType( $post ))return; |
|
| 165 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 166 | 166 | $review = glsr( Database::class )->getReview( $post ); |
| 167 | 167 | glsr()->render( 'editor/metabox-details', [ |
| 168 | 168 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
| 169 | 169 | 'metabox' => $this->normalizeDetailsMetaBox( $review ), |
| 170 | - ]); |
|
| 170 | + ] ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function renderPinnedInPublishMetaBox() |
| 178 | 178 | { |
| 179 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 179 | + if( !$this->isReviewPostType( get_post() ) )return; |
|
| 180 | 180 | glsr()->render( 'editor/pinned', [ |
| 181 | - 'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
|
| 182 | - ]); |
|
| 181 | + 'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ), |
|
| 182 | + ] ); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function renderResponseMetaBox( WP_Post $post ) |
| 190 | 190 | { |
| 191 | - if( !$this->isReviewPostType( $post ))return; |
|
| 191 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 192 | 192 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 193 | 193 | glsr()->render( 'editor/metabox-response', [ |
| 194 | 194 | 'response' => glsr( Database::class )->getReview( $post )->response, |
| 195 | - ]); |
|
| 195 | + ] ); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 204 | 204 | { |
| 205 | - if( !$this->isReviewPostType( $post ))return; |
|
| 205 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 206 | 206 | glsr()->render( 'editor/metabox-categories', [ |
| 207 | 207 | 'post' => $post, |
| 208 | 208 | 'tax_name' => Application::TAXONOMY, |
| 209 | 209 | 'taxonomy' => get_taxonomy( Application::TAXONOMY ), |
| 210 | - ]); |
|
| 210 | + ] ); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function revertReview() |
| 219 | 219 | { |
| 220 | - check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
|
| 220 | + check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) ); |
|
| 221 | 221 | glsr( Database::class )->revertReview( $postId ); |
| 222 | 222 | $this->redirect( $postId, 52 ); |
| 223 | 223 | } |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | protected function buildAssignedToTemplate( $assignedTo ) |
| 241 | 241 | { |
| 242 | 242 | $assignedPost = get_post( $assignedTo ); |
| 243 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 243 | + if( !($assignedPost instanceof WP_Post) )return; |
|
| 244 | 244 | return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [ |
| 245 | 245 | 'context' => [ |
| 246 | 246 | 'url' => (string)get_permalink( $assignedPost ), |
| 247 | 247 | 'title' => get_the_title( $assignedPost ), |
| 248 | 248 | ], |
| 249 | - ]); |
|
| 249 | + ] ); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -267,13 +267,13 @@ discard block |
||
| 267 | 267 | 'class' => 'button button-large', |
| 268 | 268 | 'href' => $revertUrl, |
| 269 | 269 | 'id' => 'revert', |
| 270 | - ]); |
|
| 270 | + ] ); |
|
| 271 | 271 | } |
| 272 | 272 | return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [ |
| 273 | 273 | 'class' => 'button button-large', |
| 274 | 274 | 'disabled' => true, |
| 275 | 275 | 'id' => 'revert', |
| 276 | - ]); |
|
| 276 | + ] ); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -283,11 +283,11 @@ discard block |
||
| 283 | 283 | protected function getReviewType( $review ) |
| 284 | 284 | { |
| 285 | 285 | $reviewType = $review->review_type; |
| 286 | - if( !empty( $review->url )) { |
|
| 286 | + if( !empty($review->url) ) { |
|
| 287 | 287 | $reviewType = glsr( Builder::class )->a( $reviewType, [ |
| 288 | 288 | 'href' => $review->url, |
| 289 | 289 | 'target' => '_blank', |
| 290 | - ]); |
|
| 290 | + ] ); |
|
| 291 | 291 | } |
| 292 | 292 | return in_array( $reviewType, glsr()->reviewTypes ) |
| 293 | 293 | ? glsr()->reviewTypes[$reviewType] |
@@ -309,16 +309,16 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | protected function normalizeDetailsMetaBox( $review ) |
| 311 | 311 | { |
| 312 | - $reviewer = empty( $review->user_id ) |
|
| 312 | + $reviewer = empty($review->user_id) |
|
| 313 | 313 | ? __( 'Unregistered user', 'site-reviews' ) |
| 314 | 314 | : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [ |
| 315 | 315 | 'href' => get_author_posts_url( $review->user_id ), |
| 316 | - ]); |
|
| 317 | - $email = empty( $review->email ) |
|
| 316 | + ] ); |
|
| 317 | + $email = empty($review->email) |
|
| 318 | 318 | ? '—' |
| 319 | 319 | : glsr( Builder::class )->a( $review->email, [ |
| 320 | 320 | 'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ), |
| 321 | - ]); |
|
| 321 | + ] ); |
|
| 322 | 322 | $metabox = [ |
| 323 | 323 | __( 'Rating', 'site-reviews' ) => glsr( Html::class )->renderPartial( 'star-rating', ['rating' => $review->rating] ), |
| 324 | 324 | __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ), |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $redirectUri = $hasReferer |
| 347 | 347 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
| 348 | 348 | : get_edit_post_link( $postId ); |
| 349 | - wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri )); |
|
| 349 | + wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) ); |
|
| 350 | 350 | exit; |
| 351 | 351 | } |
| 352 | 352 | } |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | return $input; |
| 22 | 22 | } |
| 23 | 23 | $triggered = true; |
| 24 | - if( !is_array( $input )) { |
|
| 24 | + if( !is_array( $input ) ) { |
|
| 25 | 25 | $input = ['settings' => []]; |
| 26 | 26 | } |
| 27 | 27 | if( key( $input ) == 'settings' ) { |
| 28 | - glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' )); |
|
| 28 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
| 29 | 29 | } |
| 30 | 30 | $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input ); |
| 31 | 31 | $options = $this->sanitizeSubmissions( $input, $options ); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [ |
| 43 | 43 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
| 44 | - ]); |
|
| 44 | + ] ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | protected function sanitizeSubmissions( array $input, array $options ) |
| 51 | 51 | { |
| 52 | - if( isset( $input['settings']['submissions'] )) { |
|
| 52 | + if( isset($input['settings']['submissions']) ) { |
|
| 53 | 53 | $inputForm = $input['settings']['submissions']; |
| 54 | - $options['settings']['submissions']['required'] = isset( $inputForm['required'] ) |
|
| 54 | + $options['settings']['submissions']['required'] = isset($inputForm['required']) |
|
| 55 | 55 | ? $inputForm['required'] |
| 56 | 56 | : []; |
| 57 | 57 | } |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | protected function sanitizeTranslations( array $input, array $options ) |
| 65 | 65 | { |
| 66 | - if( isset( $input['settings']['translations'] )) { |
|
| 67 | - $options['settings']['translations'] = array_values( array_filter( $input['settings']['translations'] )); |
|
| 66 | + if( isset($input['settings']['translations']) ) { |
|
| 67 | + $options['settings']['translations'] = array_values( array_filter( $input['settings']['translations'] ) ); |
|
| 68 | 68 | array_walk( $options['settings']['translations'], function( &$string ) { |
| 69 | - if( isset( $string['s2'] )) { |
|
| 69 | + if( isset($string['s2']) ) { |
|
| 70 | 70 | $string['s2'] = wp_strip_all_tags( $string['s2'] ); |
| 71 | 71 | } |
| 72 | - if( isset( $string['p2'] )) { |
|
| 72 | + if( isset($string['p2']) ) { |
|
| 73 | 73 | $string['p2'] = wp_strip_all_tags( $string['p2'] ); |
| 74 | 74 | } |
| 75 | 75 | }); |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public function buildClassName( $name, $path = '' ) |
| 16 | 16 | { |
| 17 | - $className = array_map( 'strtolower', (array)preg_split( '/[-_]/', $name )); |
|
| 17 | + $className = array_map( 'strtolower', (array)preg_split( '/[-_]/', $name ) ); |
|
| 18 | 18 | $className = array_map( 'ucfirst', $className ); |
| 19 | 19 | $className = implode( '', $className ); |
| 20 | 20 | $path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' ); |
| 21 | - return !empty( $path ) |
|
| 21 | + return !empty($path) |
|
| 22 | 22 | ? __NAMESPACE__.'\\'.$path.'\\'.$className |
| 23 | 23 | : $className; |
| 24 | 24 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function buildMethodName( $name, $prefix = '' ) |
| 32 | 32 | { |
| 33 | - return lcfirst( $prefix.$this->buildClassName( $name )); |
|
| 33 | + return lcfirst( $prefix.$this->buildClassName( $name ) ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function buildPropertyName( $name ) |
| 41 | 41 | { |
| 42 | - return lcfirst( $this->buildClassName( $name )); |
|
| 42 | + return lcfirst( $this->buildClassName( $name ) ); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function dashCase( $string ) |
| 72 | 72 | { |
| 73 | - return str_replace( '_', '-', $this->snakeCase( $string )); |
|
| 73 | + return str_replace( '_', '-', $this->snakeCase( $string ) ); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $result = []; |
| 96 | 96 | foreach( $array as $key => $value ) { |
| 97 | - $newKey = $prefix.( empty( $prefix ) ? '' : '.' ).$key; |
|
| 98 | - if( $this->isIndexedArray( $value )) { |
|
| 97 | + $newKey = $prefix.(empty($prefix) ? '' : '.').$key; |
|
| 98 | + if( $this->isIndexedArray( $value ) ) { |
|
| 99 | 99 | $value = '['.implode( ', ', $value ).']'; |
| 100 | 100 | } |
| 101 | - if( is_array( $value )) { |
|
| 102 | - $result = array_merge( $result, $this->flattenArray( $value, $newKey )); |
|
| 101 | + if( is_array( $value ) ) { |
|
| 102 | + $result = array_merge( $result, $this->flattenArray( $value, $newKey ) ); |
|
| 103 | 103 | continue; |
| 104 | 104 | } |
| 105 | 105 | $result[$newKey] = $value; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | Whip::IPV4 => $cloudflareIps['v4'], |
| 119 | 119 | Whip::IPV6 => $cloudflareIps['v6'], |
| 120 | 120 | ], |
| 121 | - ]))->getValidIpAddress(); |
|
| 121 | + ] ))->getValidIpAddress(); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $keys = explode( '.', $path ); |
| 133 | 133 | foreach( $keys as $key ) { |
| 134 | - if( !isset( $values[$key] )) { |
|
| 134 | + if( !isset($values[$key]) ) { |
|
| 135 | 135 | return $fallback; |
| 136 | 136 | } |
| 137 | 137 | $values = $values[$key]; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function isIndexedArray( $array ) |
| 147 | 147 | { |
| 148 | - if( !is_array( $array ) || array_filter( $array, 'is_array' )) { |
|
| 148 | + if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) { |
|
| 149 | 149 | return false; |
| 150 | 150 | } |
| 151 | 151 | $current = 0; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function prefixString( $string, $prefix = '' ) |
| 167 | 167 | { |
| 168 | - return $prefix.str_replace( $prefix, '', trim( $string )); |
|
| 168 | + return $prefix.str_replace( $prefix, '', trim( $string ) ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function snakeCase( $string ) |
| 213 | 213 | { |
| 214 | - if( !ctype_lower( $string )) { |
|
| 214 | + if( !ctype_lower( $string ) ) { |
|
| 215 | 215 | $string = preg_replace( '/\s+/u', '', $string ); |
| 216 | 216 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); |
| 217 | 217 | $string = mb_strtolower( $string, 'UTF-8' ); |
@@ -226,6 +226,6 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function startsWith( $needle, $haystack ) |
| 228 | 228 | { |
| 229 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
| 229 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
| 230 | 230 | } |
| 231 | 231 | } |