@@ -28,7 +28,7 @@ |
||
| 28 | 28 | register_rest_route( $this->namespace, '/types', [ |
| 29 | 29 | 'callback' => [$this, 'get_types'], |
| 30 | 30 | 'methods' => Server::READABLE, |
| 31 | - ]); |
|
| 31 | + ] ); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | 'permission_callback' => [$this, 'get_items_permissions_check'], |
| 34 | 34 | ], |
| 35 | 35 | 'schema' => [$this, 'get_public_item_schema'], |
| 36 | - ]); |
|
| 36 | + ] ); |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | 'title' => 'Images', |
| 18 | 18 | ], |
| 19 | 19 | 'plugin' => 'site-reviews-images/site-reviews-images.php', |
| 20 | - ]); |
|
| 20 | + ] ); |
|
| 21 | 21 | $template->render( 'partials/addons/addon', [ |
| 22 | 22 | 'context' => [ |
| 23 | 23 | 'description' => __( 'Sync your Tripadvisor reviews to your website and manage them with Site Reviews.', 'site-reviews' ), |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'title' => 'Tripadvisor Reviews', |
| 27 | 27 | ], |
| 28 | 28 | 'plugin' => 'site-reviews-tripadvisor/site-reviews-tripadvisor.php', |
| 29 | - ]); |
|
| 29 | + ] ); |
|
| 30 | 30 | ?> |
| 31 | 31 | </div> |
| 32 | 32 | </div> |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function renderTaxonomyFilter() |
| 37 | 37 | { |
| 38 | - if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return; |
|
| 38 | + if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ) )return; |
|
| 39 | 39 | echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [ |
| 40 | 40 | 'class' => 'screen-reader-text', |
| 41 | 41 | 'for' => Application::TAXONOMY, |
| 42 | - ]); |
|
| 43 | - wp_dropdown_categories([ |
|
| 42 | + ] ); |
|
| 43 | + wp_dropdown_categories( [ |
|
| 44 | 44 | 'depth' => 3, |
| 45 | 45 | 'hide_empty' => true, |
| 46 | 46 | 'hide_if_empty' => true, |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'show_option_all' => $this->getShowOptionAll(), |
| 53 | 53 | 'taxonomy' => Application::TAXONOMY, |
| 54 | 54 | 'value_field' => 'slug', |
| 55 | - ]); |
|
| 55 | + ] ); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | protected function getSelected() |
| 62 | 62 | { |
| 63 | 63 | global $wp_query; |
| 64 | - return isset( $wp_query->query[Application::TAXONOMY] ) |
|
| 64 | + return isset($wp_query->query[Application::TAXONOMY]) |
|
| 65 | 65 | ? $wp_query->query[Application::TAXONOMY] |
| 66 | 66 | : ''; |
| 67 | 67 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $taxonomy = get_taxonomy( Application::TAXONOMY ); |
| 75 | 75 | return $taxonomy |
| 76 | - ? ucfirst( strtolower( $taxonomy->labels->all_items )) |
|
| 76 | + ? ucfirst( strtolower( $taxonomy->labels->all_items ) ) |
|
| 77 | 77 | : ''; |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | 'savePending' => __( 'Save as Unapproved', 'site-reviews' ), |
| 18 | 18 | 'published' => __( 'Approved', 'site-reviews' ), |
| 19 | 19 | ]; |
| 20 | - if( $this->canModifyTranslation() && isset( $wp_scripts->registered['post']->extra['data'] )) { |
|
| 20 | + if( $this->canModifyTranslation() && isset($wp_scripts->registered['post']->extra['data']) ) { |
|
| 21 | 21 | $l10n = &$wp_scripts->registered['post']->extra['data']; |
| 22 | 22 | foreach( $strings as $search => $replace ) { |
| 23 | 23 | $l10n = preg_replace( '/("'.$search.'":")([^"]+)/', "$1".$replace, $l10n ); |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function filterPostStatusLabels( $translation, $text, $domain ) |
| 35 | 35 | { |
| 36 | - if( $this->canModifyTranslation( $domain )) { |
|
| 36 | + if( $this->canModifyTranslation( $domain ) ) { |
|
| 37 | 37 | $replacements = $this->getStatusLabels(); |
| 38 | - if( array_key_exists( $text, $replacements )) { |
|
| 38 | + if( array_key_exists( $text, $replacements ) ) { |
|
| 39 | 39 | $translation = $replacements[$text]; |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | public function filterUpdateMessages( array $messages ) |
| 49 | 49 | { |
| 50 | 50 | $post = get_post(); |
| 51 | - if( !( $post instanceof WP_Post ))return; |
|
| 51 | + if( !($post instanceof WP_Post) )return; |
|
| 52 | 52 | $strings = $this->getReviewLabels(); |
| 53 | 53 | $restored = filter_input( INPUT_GET, 'revision' ); |
| 54 | - if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) { |
|
| 54 | + if( $revisionTitle = wp_post_revision_title( intval( $restored ), false ) ) { |
|
| 55 | 55 | $restored = sprintf( $strings['restored'], $revisionTitle ); |
| 56 | 56 | } |
| 57 | - $scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date )); |
|
| 58 | - $messages[ Application::POST_TYPE ] = [ |
|
| 57 | + $scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ) ); |
|
| 58 | + $messages[Application::POST_TYPE] = [ |
|
| 59 | 59 | 1 => $strings['updated'], |
| 60 | 60 | 4 => $strings['updated'], |
| 61 | 61 | 5 => $restored, |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function canModifyTranslation( $domain = 'default' ) |
| 79 | 79 | { |
| 80 | - if( $domain != 'default' || empty( glsr_current_screen()->base )) { |
|
| 80 | + if( $domain != 'default' || empty(glsr_current_screen()->base) ) { |
|
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | return glsr_current_screen()->post_type == Application::POST_TYPE |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | protected function getStatusLabels() |
| 113 | 113 | { |
| 114 | 114 | static $labels; |
| 115 | - if( empty( $labels )) { |
|
| 115 | + if( empty($labels) ) { |
|
| 116 | 116 | $labels = [ |
| 117 | 117 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
| 118 | 118 | 'Pending Review' => __( 'Unapproved', 'site-reviews' ), |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function __get( $key ) |
| 48 | 48 | { |
| 49 | - if( property_exists( $this, $key )) { |
|
| 49 | + if( property_exists( $this, $key ) ) { |
|
| 50 | 50 | return $this->$key; |
| 51 | 51 | } |
| 52 | - if( is_array( $this->custom ) && array_key_exists( $key, $this->custom )) { |
|
| 52 | + if( is_array( $this->custom ) && array_key_exists( $key, $this->custom ) ) { |
|
| 53 | 53 | return $this->custom[$key]; |
| 54 | 54 | } |
| 55 | 55 | return ''; |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | 'review_type' => 'local', |
| 78 | 78 | ]; |
| 79 | 79 | $meta = array_filter( |
| 80 | - array_map( 'array_shift', (array)get_post_meta( $post->ID )), |
|
| 80 | + array_map( 'array_shift', (array)get_post_meta( $post->ID ) ), |
|
| 81 | 81 | 'strlen' |
| 82 | 82 | ); |
| 83 | - $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
|
| 83 | + $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) ); |
|
| 84 | 84 | $this->modified = $this->isModified( $properties ); |
| 85 | 85 | array_walk( $properties, function( $value, $key ) { |
| 86 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
| 86 | + if( !property_exists( $this, $key ) || isset($this->$key) )return; |
|
| 87 | 87 | $this->$key = maybe_unserialize( $value ); |
| 88 | 88 | }); |
| 89 | 89 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | protected function setTermIds( WP_Post $post ) |
| 95 | 95 | { |
| 96 | 96 | $this->term_ids = []; |
| 97 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
| 97 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return; |
|
| 98 | 98 | foreach( $terms as $term ) { |
| 99 | 99 | $this->term_ids[] = $term->term_id; |
| 100 | 100 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $className = $this->camelCase( $name ); |
| 18 | 18 | $path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' ); |
| 19 | - return !empty( $path ) |
|
| 19 | + return !empty($path) |
|
| 20 | 20 | ? __NAMESPACE__.'\\'.$path.'\\'.$className |
| 21 | 21 | : $className; |
| 22 | 22 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function buildMethodName( $name, $prefix = '' ) |
| 30 | 30 | { |
| 31 | - return lcfirst( $prefix.$this->buildClassName( $name )); |
|
| 31 | + return lcfirst( $prefix.$this->buildClassName( $name ) ); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function buildPropertyName( $name ) |
| 39 | 39 | { |
| 40 | - return lcfirst( $this->buildClassName( $name )); |
|
| 40 | + return lcfirst( $this->buildClassName( $name ) ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function camelCase( $string ) |
| 48 | 48 | { |
| 49 | - $string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ))); |
|
| 49 | + $string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) ); |
|
| 50 | 50 | return str_replace( ' ', '', $string ); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function convertPathToId( $path, $prefix = '' ) |
| 80 | 80 | { |
| 81 | - return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix )); |
|
| 81 | + return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) ); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $levels = explode( '.', $path ); |
| 91 | 91 | return array_reduce( $levels, function( $result, $value ) { |
| 92 | - return $result.= '['.$value.']'; |
|
| 92 | + return $result .= '['.$value.']'; |
|
| 93 | 93 | }, $prefix ); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function convertStringToArray( $string, $callback = null ) |
| 102 | 102 | { |
| 103 | - $array = array_map( 'trim', explode( ',', $string )); |
|
| 103 | + $array = array_map( 'trim', explode( ',', $string ) ); |
|
| 104 | 104 | return $callback |
| 105 | 105 | ? array_filter( $array, $callback ) |
| 106 | 106 | : array_filter( $array ); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function dashCase( $string ) |
| 114 | 114 | { |
| 115 | - return str_replace( '_', '-', $this->snakeCase( $string )); |
|
| 115 | + return str_replace( '_', '-', $this->snakeCase( $string ) ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function filterInput( $key, array $request = [] ) |
| 136 | 136 | { |
| 137 | - if( isset( $request[$key] )) { |
|
| 137 | + if( isset($request[$key]) ) { |
|
| 138 | 138 | return $request[$key]; |
| 139 | 139 | } |
| 140 | 140 | $variable = filter_input( INPUT_POST, $key ); |
| 141 | - if( is_null( $variable ) && isset( $_POST[$key] )) { |
|
| 141 | + if( is_null( $variable ) && isset($_POST[$key]) ) { |
|
| 142 | 142 | $variable = $_POST[$key]; |
| 143 | 143 | } |
| 144 | 144 | return $variable; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | public function filterInputArray( $key ) |
| 152 | 152 | { |
| 153 | 153 | $variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
| 154 | - if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) { |
|
| 154 | + if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) { |
|
| 155 | 155 | $variable = $_POST[$key]; |
| 156 | 156 | } |
| 157 | 157 | return (array)$variable; |
@@ -167,13 +167,13 @@ discard block |
||
| 167 | 167 | $result = []; |
| 168 | 168 | foreach( $array as $key => $value ) { |
| 169 | 169 | $newKey = ltrim( $prefix.'.'.$key, '.' ); |
| 170 | - if( $this->isIndexedFlatArray( $value )) { |
|
| 170 | + if( $this->isIndexedFlatArray( $value ) ) { |
|
| 171 | 171 | if( $flattenValue ) { |
| 172 | 172 | $value = '['.implode( ', ', $value ).']'; |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | - else if( is_array( $value )) { |
|
| 176 | - $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey )); |
|
| 175 | + else if( is_array( $value ) ) { |
|
| 176 | + $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) ); |
|
| 177 | 177 | continue; |
| 178 | 178 | } |
| 179 | 179 | $result[$newKey] = $value; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | Whip::IPV4 => $cloudflareIps['v4'], |
| 196 | 196 | Whip::IPV6 => $ipv6, |
| 197 | 197 | ], |
| 198 | - ]))->getValidIpAddress(); |
|
| 198 | + ] ))->getValidIpAddress(); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | $keys = explode( '.', $path ); |
| 210 | 210 | foreach( $keys as $key ) { |
| 211 | - if( !isset( $values[$key] )) { |
|
| 211 | + if( !isset($values[$key]) ) { |
|
| 212 | 212 | return $fallback; |
| 213 | 213 | } |
| 214 | 214 | $values = $values[$key]; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function isIndexedArray( $array ) |
| 224 | 224 | { |
| 225 | - if( !is_array( $array )) { |
|
| 225 | + if( !is_array( $array ) ) { |
|
| 226 | 226 | return false; |
| 227 | 227 | } |
| 228 | 228 | $current = 0; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function isIndexedFlatArray( $array ) |
| 243 | 243 | { |
| 244 | - if( !is_array( $array ) || array_filter( $array, 'is_array' )) { |
|
| 244 | + if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) { |
|
| 245 | 245 | return false; |
| 246 | 246 | } |
| 247 | 247 | return $this->isIndexedArray( $array ); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function prefixString( $string, $prefix = '' ) |
| 256 | 256 | { |
| 257 | - return $prefix.str_replace( $prefix, '', trim( $string )); |
|
| 257 | + return $prefix.str_replace( $prefix, '', trim( $string ) ); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function removePrefix( $prefix, $text ) { |
| 281 | 281 | return 0 === strpos( $text, $prefix ) |
| 282 | - ? substr( $text, strlen( $prefix )) |
|
| 282 | + ? substr( $text, strlen( $prefix ) ) |
|
| 283 | 283 | : $text; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function snakeCase( $string ) |
| 312 | 312 | { |
| 313 | - if( !ctype_lower( $string )) { |
|
| 313 | + if( !ctype_lower( $string ) ) { |
|
| 314 | 314 | $string = preg_replace( '/\s+/u', '', $string ); |
| 315 | 315 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); |
| 316 | 316 | $string = function_exists( 'mb_strtolower' ) |
@@ -327,6 +327,6 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | public function startsWith( $needle, $haystack ) |
| 329 | 329 | { |
| 330 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
| 330 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
| 331 | 331 | } |
| 332 | 332 | } |
@@ -31,25 +31,25 @@ discard block |
||
| 31 | 31 | public function __construct( $input ) |
| 32 | 32 | { |
| 33 | 33 | $this->request = $input; |
| 34 | - $this->ajax_request = isset( $input['_ajax_request'] ); |
|
| 34 | + $this->ajax_request = isset($input['_ajax_request']); |
|
| 35 | 35 | $this->assigned_to = $this->getNumeric( 'assign_to' ); |
| 36 | - $this->author = sanitize_text_field( $this->getUser( 'name' )); |
|
| 36 | + $this->author = sanitize_text_field( $this->getUser( 'name' ) ); |
|
| 37 | 37 | $this->avatar = $this->getAvatar(); |
| 38 | - $this->blacklisted = isset( $input['blacklisted'] ); |
|
| 39 | - $this->category = sanitize_key( $this->get( 'category' )); |
|
| 40 | - $this->content = sanitize_textarea_field( $this->get( 'content' )); |
|
| 38 | + $this->blacklisted = isset($input['blacklisted']); |
|
| 39 | + $this->category = sanitize_key( $this->get( 'category' ) ); |
|
| 40 | + $this->content = sanitize_textarea_field( $this->get( 'content' ) ); |
|
| 41 | 41 | $this->custom = $this->getCustom(); |
| 42 | 42 | $this->date = $this->getDate( 'date' ); |
| 43 | - $this->email = sanitize_email( $this->getUser( 'email' )); |
|
| 44 | - $this->form_id = sanitize_key( $this->get( 'form_id' )); |
|
| 43 | + $this->email = sanitize_email( $this->getUser( 'email' ) ); |
|
| 44 | + $this->form_id = sanitize_key( $this->get( 'form_id' ) ); |
|
| 45 | 45 | $this->ip_address = $this->get( 'ip_address' ); |
| 46 | - $this->post_id = intval( $this->get( '_post_id' )); |
|
| 47 | - $this->rating = intval( $this->get( 'rating' )); |
|
| 46 | + $this->post_id = intval( $this->get( '_post_id' ) ); |
|
| 47 | + $this->rating = intval( $this->get( 'rating' ) ); |
|
| 48 | 48 | $this->referer = $this->get( '_referer' ); |
| 49 | - $this->response = sanitize_textarea_field( $this->get( 'response' )); |
|
| 50 | - $this->terms = !empty( $input['terms'] ); |
|
| 51 | - $this->title = sanitize_text_field( $this->get( 'title' )); |
|
| 52 | - $this->url = esc_url_raw( $this->get( 'url' )); |
|
| 49 | + $this->response = sanitize_textarea_field( $this->get( 'response' ) ); |
|
| 50 | + $this->terms = !empty($input['terms']); |
|
| 51 | + $this->title = sanitize_text_field( $this->get( 'title' ) ); |
|
| 52 | + $this->url = esc_url_raw( $this->get( 'url' ) ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | protected function get( $key ) |
| 60 | 60 | { |
| 61 | - return isset( $this->request[$key] ) |
|
| 61 | + return isset($this->request[$key]) |
|
| 62 | 62 | ? (string)$this->request[$key] |
| 63 | 63 | : ''; |
| 64 | 64 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | $avatar = $this->get( 'avatar' ); |
| 72 | 72 | return !filter_var( $avatar, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED | FILTER_FLAG_PATH_REQUIRED ) |
| 73 | - ? (string)get_avatar_url( $this->get( 'email' )) |
|
| 73 | + ? (string)get_avatar_url( $this->get( 'email' ) ) |
|
| 74 | 74 | : $avatar; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | ]; |
| 87 | 87 | $custom = $this->request; |
| 88 | 88 | foreach( $unset as $value ) { |
| 89 | - unset( $custom[$value] ); |
|
| 89 | + unset($custom[$value]); |
|
| 90 | 90 | } |
| 91 | 91 | return $custom; |
| 92 | 92 | } |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | protected function getDate( $key ) |
| 99 | 99 | { |
| 100 | - $date = strtotime( $this->get( $key )); |
|
| 100 | + $date = strtotime( $this->get( $key ) ); |
|
| 101 | 101 | if( $date === false ) { |
| 102 | 102 | $date = time(); |
| 103 | 103 | } |
| 104 | - return get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $date )); |
|
| 104 | + return get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $date ) ); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -111,13 +111,13 @@ discard block |
||
| 111 | 111 | protected function getUser( $key ) |
| 112 | 112 | { |
| 113 | 113 | $value = $this->get( $key ); |
| 114 | - if( empty( $value )) { |
|
| 114 | + if( empty($value) ) { |
|
| 115 | 115 | $user = wp_get_current_user(); |
| 116 | 116 | $userValues = [ |
| 117 | 117 | 'email' => 'user_email', |
| 118 | 118 | 'name' => 'display_name', |
| 119 | 119 | ]; |
| 120 | - if( $user->exists() && array_key_exists( $key, $userValues )) { |
|
| 120 | + if( $user->exists() && array_key_exists( $key, $userValues ) ) { |
|
| 121 | 121 | return $user->{$userValues[$key]}; |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -22,17 +22,17 @@ 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 | - $menu[$key][4].= ' current'; |
|
| 35 | + $menu[$key][4] .= ' current'; |
|
| 36 | 36 | } |
| 37 | 37 | break; |
| 38 | 38 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | 'tools' => __( 'Tools', 'site-reviews' ), |
| 50 | 50 | 'addons' => __( 'Add-ons', 'site-reviews' ), |
| 51 | 51 | 'documentation' => __( 'Documentation', '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, glsr()->constant( '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 | /** |
@@ -84,16 +84,16 @@ discard block |
||
| 84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
| 85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
| 86 | 86 | 'addons' => __( 'Addons', 'site-reviews' ), |
| 87 | - ]); |
|
| 87 | + ] ); |
|
| 88 | 88 | $addons = apply_filters( 'site-reviews/addon/documentation', [] ); |
| 89 | 89 | ksort( $addons ); |
| 90 | - if( empty( $addons )) { |
|
| 91 | - unset( $tabs['addons'] ); |
|
| 90 | + if( empty($addons) ) { |
|
| 91 | + unset($tabs['addons']); |
|
| 92 | 92 | } |
| 93 | 93 | $this->renderPage( 'documentation', [ |
| 94 | 94 | 'addons' => $addons, |
| 95 | 95 | 'tabs' => $tabs, |
| 96 | - ]); |
|
| 96 | + ] ); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | 'translations' => __( 'Translations', 'site-reviews' ), |
| 112 | 112 | 'addons' => __( 'Addons', 'site-reviews' ), |
| 113 | 113 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
| 114 | - ]); |
|
| 115 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { |
|
| 116 | - unset( $tabs['addons'] ); |
|
| 114 | + ] ); |
|
| 115 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { |
|
| 116 | + unset($tabs['addons']); |
|
| 117 | 117 | } |
| 118 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { |
|
| 119 | - unset( $tabs['licenses'] ); |
|
| 118 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { |
|
| 119 | + unset($tabs['licenses']); |
|
| 120 | 120 | } |
| 121 | 121 | $this->renderPage( 'settings', [ |
| 122 | 122 | 'notices' => $this->getNotices(), |
| 123 | 123 | 'settings' => glsr( Settings::class ), |
| 124 | 124 | 'tabs' => $tabs, |
| 125 | - ]); |
|
| 125 | + ] ); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -137,24 +137,24 @@ discard block |
||
| 137 | 137 | 'sync' => __( 'Sync Reviews', 'site-reviews' ), |
| 138 | 138 | 'console' => __( 'Console', 'site-reviews' ), |
| 139 | 139 | 'system-info' => __( 'System Info', 'site-reviews' ), |
| 140 | - ]); |
|
| 141 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
| 142 | - unset( $tabs['sync'] ); |
|
| 140 | + ] ); |
|
| 141 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
| 142 | + unset($tabs['sync']); |
|
| 143 | 143 | } |
| 144 | 144 | $this->renderPage( 'tools', [ |
| 145 | 145 | 'data' => [ |
| 146 | 146 | 'context' => [ |
| 147 | 147 | 'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ), |
| 148 | - 'console' => strval( glsr( Console::class )), |
|
| 148 | + 'console' => strval( glsr( Console::class ) ), |
|
| 149 | 149 | 'id' => Application::ID, |
| 150 | - 'system' => strval( glsr( System::class )), |
|
| 150 | + 'system' => strval( glsr( System::class ) ), |
|
| 151 | 151 | ], |
| 152 | 152 | 'services' => apply_filters( 'site-reviews/addon/sync/services', [] ), |
| 153 | 153 | ], |
| 154 | 154 | 'notices' => $this->getNotices(), |
| 155 | 155 | 'tabs' => $tabs, |
| 156 | 156 | 'template' => glsr( Template::class ), |
| 157 | - ]); |
|
| 157 | + ] ); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | { |
| 176 | 176 | return glsr( Builder::class )->div( glsr( Notice::class )->get(), [ |
| 177 | 177 | 'id' => 'glsr-notices', |
| 178 | - ]); |
|
| 178 | + ] ); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |