| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettingsModel; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
die; |
| 10 |
} // Cannot access directly. |
| 11 |
|
| 12 |
class Tweaks_HTTP_Response extends AdminSettingsModel { |
| 13 |
|
| 14 |
public function __construct() { |
| 15 |
$this->tweaks_http_response_settings(); |
| 16 |
} |
| 17 |
|
| 18 |
public function get_defaults() { |
| 19 |
return [ |
| 20 |
'self_ping' => false, |
| 21 |
'remove_http_shortlink' => false, |
| 22 |
'remove_pingback' => false, |
| 23 |
'remove_powered' => false, |
| 24 |
]; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
public function tweaks_http_response_fields( &$http_response_fields ) { |
| 29 |
$http_response_fields[] = [ |
| 30 |
'type' => 'subheading', |
| 31 |
'content' => Utils::adminfiy_help_urls( |
| 32 |
__( 'Cleanup your server response HTTP headers.', 'adminify' ), |
| 33 |
'https://wpadminify.com/kb/wp-adminify-tweaks/', |
| 34 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 35 |
'https://www.facebook.com/groups/jeweltheme', |
| 36 |
'https://wpadminify.com/support/' |
| 37 |
), |
| 38 |
]; |
| 39 |
|
| 40 |
$http_response_fields[] = [ |
| 41 |
'id' => 'self_ping', |
| 42 |
'type' => 'switcher', |
| 43 |
'title' => esc_html__( 'Disable Self Ping', 'adminify' ), |
| 44 |
'text_on' => __( 'Yes', 'adminify' ), |
| 45 |
'text_off' => __( 'No', 'adminify' ), |
| 46 |
'text_width' => 80, |
| 47 |
'default' => $this->get_default_field( 'self_ping' ), |
| 48 |
]; |
| 49 |
|
| 50 |
$http_response_fields[] = [ |
| 51 |
'id' => 'remove_http_shortlink', |
| 52 |
'type' => 'switcher', |
| 53 |
'title' => esc_html__( 'Remove Shortlink from HTTP Headers', 'adminify' ), |
| 54 |
'subtitle' => esc_html__( 'Remove "Link:<...>; rel=shortlink" from server response HTTP headers', 'adminify' ), |
| 55 |
'label' => esc_html__( 'This response header contains link to posts short URLs. This information is not used anywhere and you can remove this.', 'adminify' ), |
| 56 |
'text_on' => __( 'Yes', 'adminify' ), |
| 57 |
'text_off' => __( 'No', 'adminify' ), |
| 58 |
'text_width' => 80, |
| 59 |
'default' => $this->get_default_field( 'remove_http_shortlink' ), |
| 60 |
]; |
| 61 |
|
| 62 |
$http_response_fields[] = [ |
| 63 |
'id' => 'remove_pingback', |
| 64 |
'type' => 'switcher', |
| 65 |
'title' => esc_html__( 'Remove X-Pingback from HTTP Headers', 'adminify' ), |
| 66 |
'subtitle' => esc_html__( 'Remove "X-Pingback:..." from server response HTTP headers (works only with PHP 5.3 and up)', 'adminify' ), |
| 67 |
'label' => esc_html__( 'This response header contains link to your pingback file. This information can be used by spammers and you can remove it.', 'adminify' ), |
| 68 |
'text_on' => __( 'Yes', 'adminify' ), |
| 69 |
'text_off' => __( 'No', 'adminify' ), |
| 70 |
'text_width' => 80, |
| 71 |
'default' => $this->get_default_field( 'remove_pingback' ), |
| 72 |
]; |
| 73 |
|
| 74 |
$http_response_fields[] = [ |
| 75 |
'id' => 'remove_powered', |
| 76 |
'type' => 'switcher', |
| 77 |
'title' => esc_html__( 'Remove X-Powered-By from HTTP Headers', 'adminify' ), |
| 78 |
'subtitle' => esc_html__( 'Remove "X-Powered-By:..." from server response HTTP headers (works only with PHP 5.3 and up)', 'adminify' ), |
| 79 |
'label' => esc_html__( 'This response header contains information about PHP version on your server. This information is not used anywhere and you can remove this.', 'adminify' ), |
| 80 |
'text_on' => __( 'Yes', 'adminify' ), |
| 81 |
'text_off' => __( 'No', 'adminify' ), |
| 82 |
'text_width' => 80, |
| 83 |
'default' => $this->get_default_field( 'remove_powered' ), |
| 84 |
]; |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
public function tweaks_http_response_settings() { |
| 89 |
if ( ! class_exists( 'ADMINIFY' ) ) { |
| 90 |
return; |
| 91 |
} |
| 92 |
|
| 93 |
$http_response_fields = []; |
| 94 |
$this->tweaks_http_response_fields( $http_response_fields ); |
| 95 |
|
| 96 |
\ADMINIFY::createSection( |
| 97 |
$this->prefix, |
| 98 |
[ |
| 99 |
'title' => __( 'HTTP Response', 'adminify' ), |
| 100 |
'parent' => 'tweaks_performance', |
| 101 |
'icon' => 'fas fa-shield-virus', |
| 102 |
'fields' => $http_response_fields, |
| 103 |
] |
| 104 |
); |
| 105 |
} |
| 106 |
} |
| 107 |
|