@@ -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; |
@@ -32,7 +32,9 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function build() |
| 34 | 34 | { |
| 35 | - if( !$this->field['is_valid'] )return; |
|
| 35 | + if( !$this->field['is_valid'] ) { |
|
| 36 | + return; |
|
| 37 | + } |
|
| 36 | 38 | if( $this->field['is_multi'] ) { |
| 37 | 39 | return $this->buildMultiField(); |
| 38 | 40 | } |
@@ -128,7 +130,9 @@ discard block |
||
| 128 | 130 | 'label', 'name', 'type', |
| 129 | 131 | ]; |
| 130 | 132 | foreach( $requiredValues as $value ) { |
| 131 | - if( isset( $this->field[$value] ))continue; |
|
| 133 | + if( isset( $this->field[$value] )) { |
|
| 134 | + continue; |
|
| 135 | + } |
|
| 132 | 136 | $missingValues[] = $value; |
| 133 | 137 | $isValid = $this->field['is_valid'] = false; |
| 134 | 138 | } |
@@ -145,11 +149,15 @@ discard block |
||
| 145 | 149 | */ |
| 146 | 150 | protected function normalize() |
| 147 | 151 | { |
| 148 | - if( !$this->isFieldValid() )return; |
|
| 152 | + if( !$this->isFieldValid() ) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 149 | 155 | $field = $this->field; |
| 150 | 156 | foreach( $field as $key => $value ) { |
| 151 | 157 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 152 | - if( !method_exists( $this, $methodName ))continue; |
|
| 158 | + if( !method_exists( $this, $methodName )) { |
|
| 159 | + continue; |
|
| 160 | + } |
|
| 153 | 161 | $this->$methodName(); |
| 154 | 162 | } |
| 155 | 163 | $this->normalizeFieldId(); |
@@ -162,7 +170,9 @@ discard block |
||
| 162 | 170 | */ |
| 163 | 171 | protected function normalizeDependsOn() |
| 164 | 172 | { |
| 165 | - if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] ))return; |
|
| 173 | + if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] )) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 166 | 176 | $path = key( $this->field['depends_on'] ); |
| 167 | 177 | $value = $this->field['depends_on'][$path]; |
| 168 | 178 | $this->field['depends_on'] = json_encode([ |
@@ -177,7 +187,9 @@ discard block |
||
| 177 | 187 | */ |
| 178 | 188 | protected function normalizeFieldId() |
| 179 | 189 | { |
| 180 | - if( isset( $this->field['id'] ))return; |
|
| 190 | + if( isset( $this->field['id'] )) { |
|
| 191 | + return; |
|
| 192 | + } |
|
| 181 | 193 | $this->field['id'] = glsr( Helper::class )->convertNameToId( $this->field['name'] ); |
| 182 | 194 | } |
| 183 | 195 | |
@@ -200,7 +212,9 @@ discard block |
||
| 200 | 212 | */ |
| 201 | 213 | protected function normalizeFieldValue() |
| 202 | 214 | { |
| 203 | - if( isset( $this->field['value'] ))return; |
|
| 215 | + if( isset( $this->field['value'] )) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 204 | 218 | $this->field['value'] = glsr( OptionManager::class )->get( |
| 205 | 219 | $this->field['path'], |
| 206 | 220 | $this->getFieldDefault() |
@@ -91,7 +91,9 @@ discard block |
||
| 91 | 91 | get_mu_plugins(), |
| 92 | 92 | get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
| 93 | 93 | ); |
| 94 | - if( empty( $plugins ))return; |
|
| 94 | + if( empty( $plugins )) { |
|
| 95 | + return; |
|
| 96 | + } |
|
| 95 | 97 | return $this->normalizePluginList( $plugins ); |
| 96 | 98 | } |
| 97 | 99 | |
@@ -100,7 +102,9 @@ discard block |
||
| 100 | 102 | */ |
| 101 | 103 | public function getMultisitePluginDetails() |
| 102 | 104 | { |
| 103 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
| 105 | + if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] ))) { |
|
| 106 | + return; |
|
| 107 | + } |
|
| 104 | 108 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
| 105 | 109 | } |
| 106 | 110 | |
@@ -154,12 +158,16 @@ discard block |
||
| 154 | 158 | $settings = glsr( OptionManager::class )->get( 'settings', [] ); |
| 155 | 159 | $settings = $helper->flattenArray( $settings ); |
| 156 | 160 | foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) { |
| 157 | - if( empty( $settings[$key] ))continue; |
|
| 161 | + if( empty( $settings[$key] )) { |
|
| 162 | + continue; |
|
| 163 | + } |
|
| 158 | 164 | $settings[$key] = str_repeat( '*', 10 ); |
| 159 | 165 | } |
| 160 | 166 | $details = []; |
| 161 | 167 | foreach( $settings as $key => $value ) { |
| 162 | - if( $helper->startsWith( 'translations', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
| 168 | + if( $helper->startsWith( 'translations', $key ) && $helper->endsWith( 'id', $key )) { |
|
| 169 | + continue; |
|
| 170 | + } |
|
| 163 | 171 | $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
| 164 | 172 | $details[$key] = $value; |
| 165 | 173 | } |