| @@ -41,9 +41,8 @@ | ||
| 41 | 41 | if ( array_key_exists( 'disable_admin_bar', $options ) ) { |
| 42 | 42 | add_filter( 'show_admin_bar', [ $this, 'disable_admin_bar' ] ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - | |
| 46 | 45 | if ( array_key_exists( 'disable_automatic_updates', $options ) ) { |
| 47 | 46 | // Disable core auto-updates |
| 48 | 47 | add_filter( 'auto_update_core', '__return_false' ); |
| 49 | 48 | // Disable auto-updates for plugins. |
| @@ -165,17 +164,17 @@ | ||
| 165 | 164 | add_filter( 'comment_form_default_fields', [ $this, 'comment_from_website' ], 150 ); |
| 166 | 165 | } |
| 167 | 166 | |
| 168 | 167 | if ( array_key_exists( 'disable_self_pingbacks', $options ) ) { |
| 169 | - add_action( 'pre_ping', [$this, 'self_pingbacks']); | |
| 168 | + add_action( 'pre_ping', [ $this, 'self_pingbacks' ] ); | |
| 170 | 169 | } |
| 171 | 170 | |
| 172 | 171 | if ( array_key_exists( 'disable_wlwmanifest_link', $options ) ) { |
| 173 | - remove_action('wp_head', 'wlwmanifest_link'); | |
| 172 | + remove_action( 'wp_head', 'wlwmanifest_link' ); | |
| 174 | 173 | } |
| 175 | 174 | |
| 176 | 175 | if ( array_key_exists( 'disable_embeds', $options ) ) { |
| 177 | - add_action( 'init', [$this, 'disable_embeds'], 9999); | |
| 176 | + add_action( 'init', [ $this, 'disable_embeds' ], 9999 ); | |
| 178 | 177 | } |
| 179 | 178 | |
| 180 | 179 | if ( array_key_exists( 'disable_lazy_load', $options ) ) { |
| 181 | 180 | add_filter( 'wp_lazy_loading_enabled', '__return_false' ); |
| @@ -181,9 +180,9 @@ | ||
| 181 | 180 | add_filter( 'wp_lazy_loading_enabled', '__return_false' ); |
| 182 | 181 | } |
| 183 | 182 | |
| 184 | 183 | if ( array_key_exists( 'disable_wp_shortlink', $options ) ) { |
| 185 | - remove_action('wp_head', 'wp_shortlink_wp_head' ); | |
| 184 | + remove_action( 'wp_head', 'wp_shortlink_wp_head' ); | |
| 186 | 185 | } |
| 187 | 186 | |
| 188 | 187 | if ( array_key_exists( 'disable_admin_pass_reset_email', $options ) ) { |
| 189 | 188 | remove_action( 'after_password_reset', 'wp_password_change_notification' ); |
| @@ -188,9 +187,20 @@ | ||
| 188 | 187 | if ( array_key_exists( 'disable_admin_pass_reset_email', $options ) ) { |
| 189 | 188 | remove_action( 'after_password_reset', 'wp_password_change_notification' ); |
| 190 | 189 | } |
| 191 | 190 | |
| 191 | + if ( array_key_exists( 'disable_trackbacks_pingbacks', $options ) ) { | |
| 192 | + add_filter('xmlrpc_methods', static function($methods) { | |
| 193 | + unset($methods['pingback.ping']); | |
| 194 | + return $methods; | |
| 195 | + }); | |
| 196 | + } | |
| 192 | 197 | |
| 198 | + if ( array_key_exists( 'disable_comments_html', $options ) ) { | |
| 199 | + remove_filter('comment_text', 'make_clickable', 9); | |
| 200 | + add_filter('pre_comment_content', 'wp_strip_all_tags'); | |
| 201 | + } | |
| 202 | + | |
| 193 | 203 | } |
| 194 | 204 | |
| 195 | 205 | public function disable_embeds(): void { |
| 196 | 206 | // Remove the REST API endpoint. |
| @@ -212,8 +222,9 @@ | ||
| 212 | 222 | if ( false !== strpos( $rewrite, 'embed=true' ) ) { |
| 213 | 223 | unset( $rules[ $rule ] ); |
| 214 | 224 | } |
| 215 | 225 | } |
| 226 | + | |
| 216 | 227 | return $rules; |
| 217 | 228 | } ); |
| 218 | 229 | // Remove filter of the oEmbed result before any HTTP requests are made. |
| 219 | 230 | remove_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10 ); |
| @@ -218,9 +229,9 @@ | ||
| 218 | 229 | // Remove filter of the oEmbed result before any HTTP requests are made. |
| 219 | 230 | remove_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10 ); |
| 220 | 231 | } |
| 221 | 232 | |
| 222 | - public function self_pingbacks(&$links): void { | |
| 233 | + public function self_pingbacks( &$links ): void { | |
| 223 | 234 | |
| 224 | 235 | $home = get_option( 'home' ); |
| 225 | 236 | foreach ( $links as $l => $link ) { |
| 226 | 237 | if ( 0 === strpos( $link, $home ) ) { |
| @@ -240,9 +251,9 @@ | ||
| 240 | 251 | public function disable_feed(): void { |
| 241 | 252 | wp_die( |
| 242 | 253 | sprintf( |
| 243 | 254 | // Translators: Placeholders for the homepage link. |
| 244 | - esc_html__( 'No feed available, please visit our %1$shomepage%2$s!', 'wpcoder' ), | |
| 255 | + esc_html__( 'No feed available, please visit our %1$shomepage%2$s!', 'wp-coder' ), | |
| 245 | 256 | ' <a href="' . esc_url( home_url( '/' ) ) . '">', |
| 246 | 257 | '</a>' |
| 247 | 258 | ) |
| 248 | 259 | ); |
| @@ -345,5 +356,5 @@ | ||
| 345 | 356 | |
| 346 | 357 | |
| 347 | 358 | } |
| 348 | 359 | |
| 349 | -new WPCoder_Lite_Disabled_Snippets; | |
| 360 | +new WPCoder_Lite_Disabled_Snippets; | |