<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://-domain-name-/wp-includes/wlwmanifest.xml" />",
'option_documentation_url' => 'https://www.wp-hide.com/documentation/general-html-meta/'
),
'input_type' => 'radio',
'options' => array(
'no' => __('No', 'wp-hide-security-enhancer'),
'yes' => __('Yes', 'wp-hide-security-enhancer'),
),
'default_value' => 'no',
'sanitize_type' => array('sanitize_title', 'strtolower')
);
$this->module_settings[] = array(
'id' => 'disable_json_rest_wphead_link',
'label' => __('Disable output the REST API link tag into page header', 'wp-hide-security-enhancer'),
'description' => __('By default a REST API link tag is being append to HTML.', 'wp-hide-security-enhancer'),
'help' => array(
'title' => __('Help', 'wp-hide-security-enhancer') . ' - ' . __('Disable output the REST API link tag into page header', 'wp-hide-security-enhancer'),
'description' => __("This option disable the tag output with the JSON API url.", 'wp-hide-security-enhancer') .
"<link rel='https://api.w.org/' href='https://-domain-name-/wp-json/' />",
'option_documentation_url' => 'https://www.wp-hide.com/documentation/general-html-meta/'
),
'input_type' => 'radio',
'options' => array(
'no' => __('No', 'wp-hide-security-enhancer'),
'yes' => __('Yes', 'wp-hide-security-enhancer'),
),
'default_value' => 'no',
'sanitize_type' => array('sanitize_title', 'strtolower'),
'processing_order' => 58
);
$this->module_settings[] = array(
'id' => 'remove_rsd_link',
'label' => __('Remove rsd_link Meta', 'wp-hide-security-enhancer'),
'description' => __('Remove the rsd_link tag within head.', 'wp-hide-security-enhancer'),
'help' => array(
'title' => __('Help', 'wp-hide-security-enhancer') . ' - ' . __('Remove rsd_link Meta', 'wp-hide-security-enhancer'),
'description' => __("This helps to hide the link to the Really Simple Discovery service endpoint.", 'wp-hide-security-enhancer') .
"<link rel='EditURI' type='application/rsd+xml' title='RSD' href='https://-domain-name-/xmlrpc.php?rsd' />",
'option_documentation_url' => 'https://www.wp-hide.com/documentation/general-html-meta/'
),
'input_type' => 'radio',
'options' => array(
'no' => __('No', 'wp-hide-security-enhancer'),
'yes' => __('Yes', 'wp-hide-security-enhancer'),
),
'default_value' => 'no',
'sanitize_type' => array('sanitize_title', 'strtolower')
);
$this->module_settings[] = array(
'id' => 'remove_adjacent_posts_rel',
'label' => __('Remove adjacent_posts_rel Meta', 'wp-hide-security-enhancer'),
'description' => __('Remove the adjacent_posts_rel tag within head.', 'wp-hide-security-enhancer'),
'help' => array(
'title' => __('Help', 'wp-hide-security-enhancer') . ' - ' . __('Remove adjacent_posts_rel Meta', 'wp-hide-security-enhancer'),
'description' => __("This helps to hide the post adjacent tags.", 'wp-hide-security-enhancer') .
"<link rel='next' title='Dummy Post' href='http://-domain-name-/dummy-post/' />",
'option_documentation_url' => 'https://www.wp-hide.com/documentation/general-html-meta/'
),
'input_type' => 'radio',
'options' => array(
'no' => __('No', 'wp-hide-security-enhancer'),
'yes' => __('Yes', 'wp-hide-security-enhancer'),
),
'default_value' => 'no',
'sanitize_type' => array('sanitize_title', 'strtolower')
);
$this->module_settings[] = array(
'id' => 'remove_profile',
'label' => __('Remove profile link', 'wp-hide-security-enhancer'),
'description' => __('Remove profile link meta tag within head.', 'wp-hide-security-enhancer'),
'help' => array(
'title' => __('Help', 'wp-hide-security-enhancer') . ' - ' . __('Remove adjacent_posts_rel Meta', 'wp-hide-security-enhancer'),
'description' => __("This helps to hide the profile tags.", 'wp-hide-security-enhancer') .
"<link rel='profile' href='http://-domain-name-/profile/' />",
'option_documentation_url' => 'https://www.wp-hide.com/documentation/general-html-meta/'
),
'input_type' => 'radio',
'options' => array(
'no' => __('No', 'wp-hide-security-enhancer'),
'yes' => __('Yes', 'wp-hide-security-enhancer'),
),
'default_value' => 'no',
'sanitize_type' => array('sanitize_title', 'strtolower')
);
$this->module_settings[] = array(
'id' => 'remove_canonical',
'label' => __('Remove canonical link', 'wp-hide-security-enhancer'),
'description' => __('Remove canonical link meta tag within head.', 'wp-hide-security-enhancer'),
'help' => array(
'title' => __('Help', 'wp-hide-security-enhancer') . ' - ' . __('Remove adjacent_posts_rel Meta', 'wp-hide-security-enhancer'),
'description' => __("The rel=canonical element, often called the 'canonical link', is an HTML element that helps webmasters prevent duplicate content issues. It does this by specifying the 'canonical URL', the 'preferred' version of a web page - the original source, even.", 'wp-hide-security-enhancer') .
"<link rel="canonical" href="http://-domain-name-/dummy-post/" />",
'option_documentation_url' => 'https://www.wp-hide.com/documentation/general-html-meta/'
),
'input_type' => 'radio',
'options' => array(
'no' => __('No', 'wp-hide-security-enhancer'),
'yes' => __('Yes', 'wp-hide-security-enhancer'),
),
'default_value' => 'no',
'sanitize_type' => array('sanitize_title', 'strtolower')
);
return $this->module_settings;
}
function _init_remove_generator_meta($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
add_filter('the_generator', array( $this, 'the_generator' ));
remove_action( 'wp_head', 'wp_generator' );
//make sure it's being replaced
add_filter( 'wp-hide/ob_start_callback', array(&$this, 'ob_start_callback_remove_generator_meta'));
}
function the_generator()
{
return '';
}
function ob_start_callback_remove_generator_meta( $buffer )
{
$buffer = preg_replace_callback('/(]+)name=("|\')generator("|\')([^>]+)?\/?>)/im', array($this, "remove_generator_meta_preg_replace_callback"), $buffer);
return $buffer;
}
function remove_generator_meta_preg_replace_callback( $matches )
{
$found = isset($matches[0]) ? $matches[0] : '';
if(empty($found))
return '';
//check if content starts with WordPress
if(stripos($found, 'content="WordPress ') !== FALSE)
return "";
return $found;
}
function _init_remove_other_generator_meta($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
//remove other generator links
add_filter( 'wp-hide/ob_start_callback', array(&$this, 'ob_start_callback_remove_other_generator_meta'));
}
function ob_start_callback_remove_other_generator_meta( $buffer )
{
$buffer = preg_replace_callback('/(]+)name=("|\')generator("|\')([^>]+)?\/?>)/im', array($this, "remove_other_generator_meta_preg_replace_callback"), $buffer);
return $buffer;
}
function remove_other_generator_meta_preg_replace_callback( $matches )
{
$found = isset($matches[0]) ? $matches[0] : '';
if(empty($found))
return '';
//check if content starts with WordPress
if(stripos($found, 'content="WordPress ') === FALSE)
return "";
return $found;
}
function _init_remove_shortlink_meta($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
//remove other generator links
add_filter( 'wp-hide/ob_start_callback', array(&$this, 'ob_start_callback_remove_shortlink_meta'));
}
function ob_start_callback_remove_shortlink_meta( $buffer )
{
$result = preg_match_all('/(]+)rel=("|\')shortlink("|\')([^>]+)?\/?>)/im', $buffer, $founds);
if(!isset($founds[0]) || count($founds[0]) < 1)
return $buffer;
if(count($founds[0]) > 0)
{
foreach ($founds[0] as $found)
{
if(empty($found))
continue;
$buffer = str_replace($found, "", $buffer);
}
}
return $buffer;
}
function _init_remove_dns_prefetch( $saved_field_data )
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
add_filter( 'wp-hide/ob_start_callback', array(&$this, 'ob_start_callback_remove_dns_prefetch'));
}
function ob_start_callback_remove_dns_prefetch( $buffer )
{
if(is_admin())
return $buffer;
$result = preg_match_all('/(]+)rel=("|\')dns-prefetch("|\')([^>]+)?\/?>)/im', $buffer, $founds);
if(!isset($founds[0]) || count($founds[0]) < 1)
return $buffer;
if(count($founds[0]) > 0)
{
foreach ($founds[0] as $found)
{
if(empty($found))
continue;
$buffer = str_replace($found, "", $buffer);
}
}
return $buffer;
}
function _init_remove_resource_hints($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
remove_action( 'wp_head', 'wp_resource_hints', 2 );
}
function _init_remove_wlwmanifest($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
remove_action( 'wp_head', 'wlwmanifest_link' );
}
function _init_disable_json_rest_wphead_link($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
}
function _init_remove_rsd_link($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
remove_action('wp_head', 'rsd_link');
}
function _init_remove_adjacent_posts_rel($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
}
function _init_remove_profile($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
add_filter('wp-hide/ob_start_callback', array($this, 'remove_profile_tag'));
}
function remove_profile_tag( $buffer )
{
if(is_admin())
return $buffer;
$result = preg_match_all('/(]+)rel=("|\')profile("|\')([^>]+)?\/?>)/im', $buffer, $founds);
if(!isset($founds[0]) || count($founds[0]) < 1)
return $buffer;
if(count($founds[0]) > 0)
{
foreach ($founds[0] as $found)
{
if(empty($found))
continue;
$buffer = str_replace($found, "", $buffer);
}
}
return $buffer;
}
function _init_remove_canonical($saved_field_data)
{
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
remove_action( 'wp_head', 'rel_canonical');
//use the earlier possible action to remove the admin canonical url
add_action( 'auth_redirect', array(&$this, 'remove_wp_admin_canonical_url'));
//make sure is removed if placed by other plugins
add_filter('wp-hide/ob_start_callback', array($this, 'remove_canonical_tag'));
}
function remove_wp_admin_canonical_url()
{
remove_action( 'admin_head', 'wp_admin_canonical_url' );
}
function remove_canonical_tag( $buffer )
{
if(is_admin())
return $buffer;
$result = preg_match_all('/(]+)rel=("|\')canonical("|\')([^>]+)?\/?>)/im', $buffer, $founds);
if(!isset($founds[0]) || count($founds[0]) < 1)
return $buffer;
if(count($founds[0]) > 0)
{
foreach ($founds[0] as $found)
{
if(empty($found))
continue;
$buffer = str_replace($found, "", $buffer);
}
}
return $buffer;
}
}
?>