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