WP PLUGIN MTEE(Meta Tag etc Extend) RSSと絵文字タグ設定
・RSSと絵文字タグの無効化設定を追加
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ if (!class_exists('MTEE')) {
|
||||
|
||||
public function is_disable($type): bool {
|
||||
if (isset($this->get_options()[$type])
|
||||
&& $this->get_options()['asset_ver_disabled'] == 1) {
|
||||
&& $this->get_options()[$type] == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +1,56 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
if ( ! class_exists( 'mtee_version_setting' ) ) {
|
||||
if (!class_exists('mtee_version_setting')) {
|
||||
|
||||
class mtee_version_setting {
|
||||
private $options;
|
||||
class mtee_version_setting {
|
||||
private $options;
|
||||
|
||||
public function __construct( $options ) {
|
||||
$this->options = $options;
|
||||
$this->change_wp_version_view();
|
||||
$this->change_asset_version_view();
|
||||
}
|
||||
public function __construct($options) {
|
||||
$this->options = $options;
|
||||
$this->disabled_wp_version_view();
|
||||
$this->disabled_asset_version_view();
|
||||
$this->disabled_emoji();
|
||||
$this->disabled_rss_feed();
|
||||
}
|
||||
|
||||
public function change_wp_version_view() {
|
||||
if ( $this->options['wp_ver_disabled'] == 1 ) {
|
||||
remove_action( 'wp_head', 'wp_generator' );
|
||||
}
|
||||
}
|
||||
public function disabled_wp_version_view() {
|
||||
if ($this->options['wp_ver_disabled'] == 1) {
|
||||
remove_action('wp_head', 'wp_generator');
|
||||
}
|
||||
}
|
||||
|
||||
public function change_asset_version_view() {
|
||||
if ( $this->options['asset_ver_disabled'] == 1 ) {
|
||||
add_action( 'wp_default_scripts', array( $this, 'remove_src_wp_ver' ) );
|
||||
add_action( 'wp_default_styles', array( $this, 'remove_src_wp_ver' ) );
|
||||
}
|
||||
}
|
||||
public function disabled_asset_version_view() {
|
||||
if ($this->options['asset_ver_disabled'] == 1) {
|
||||
add_action('wp_default_scripts', array($this, 'remove_src_wp_ver'));
|
||||
add_action('wp_default_styles', array($this, 'remove_src_wp_ver'));
|
||||
}
|
||||
}
|
||||
|
||||
function remove_src_wp_ver( $dep ) {
|
||||
$dep->default_version = '';
|
||||
}
|
||||
public function remove_src_wp_ver($dep) {
|
||||
$dep->default_version = '';
|
||||
}
|
||||
|
||||
public function disabled_emoji() {
|
||||
if ($this->options['emoji_disabled'] == 1) {
|
||||
remove_action('wp_head', 'print_emoji_detection_script', 7);
|
||||
remove_action('wp_print_styles', 'print_emoji_styles');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public function disabled_rss_feed() {
|
||||
if ($this->options['rss_disabled'] == 1) {
|
||||
//RSS Feedを停止
|
||||
remove_action('do_feed_rdf', 'do_feed_rdf');
|
||||
remove_action('do_feed_rss', 'do_feed_rss');
|
||||
remove_action('do_feed_rss2', 'do_feed_rss2');
|
||||
remove_action('do_feed_atom', 'do_feed_atom');
|
||||
//RSSリンクを無効化
|
||||
remove_action('wp_head', 'feed_links', 2);
|
||||
remove_action('wp_head', 'feed_links_extra', 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-4
@@ -62,10 +62,19 @@ if ($mtee->is_enable('noindex_nofollow')) {
|
||||
new mtee_meta_output_noindexnofollow();
|
||||
}
|
||||
|
||||
//disabled WP version, WP JS/CSS version
|
||||
if ($mtee->is_disable('asset_ver_disabled') || $mtee->is_disable('asset_ver_disabled')) {
|
||||
require_once MTEE_CLASS_DIR . 'mtee_version_setting.php';
|
||||
new mtee_version_setting($options);
|
||||
//disabled WP version, WP JS/CSS version, Emoji, RSS Feed
|
||||
$disabled_checks = array(
|
||||
'asset_ver_disabled',
|
||||
'asset_ver_disabled',
|
||||
'emoji_disabled',
|
||||
'rss_disabled'
|
||||
);
|
||||
foreach ($disabled_checks as $disabled_check) {
|
||||
if ($mtee->is_disable($disabled_check)) {
|
||||
require_once MTEE_CLASS_DIR . 'mtee_version_setting.php';
|
||||
new mtee_version_setting($options);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+20
-1
@@ -7,6 +7,8 @@ $ogp_setting = $this->get_key_setting('ogp_setting');
|
||||
$canonical_setting = $this->get_key_setting('canonical_setting');
|
||||
$wp_ver_disabled = $this->get_key_setting('wp_ver_disabled');
|
||||
$asset_ver_disabled = $this->get_key_setting('asset_ver_disabled');
|
||||
$emoji_disabled = $this->get_key_setting('emoji_disabled');
|
||||
$rss_disabled = $this->get_key_setting('rss_disabled');
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2>meta keyword, description / バージョン情報 設定</h2>
|
||||
@@ -143,7 +145,15 @@ $asset_ver_disabled = $this->get_key_setting('asset_ver_disabled');
|
||||
value="1">有効
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="mtee-form-box mtee_box_border">
|
||||
<h3>RSS</h3>
|
||||
<label>
|
||||
<input type="hidden" name="_mtee[rss_disabled]" value="0">
|
||||
<input type="checkbox"
|
||||
name="_mtee[rss_disabled]" <?php checked($rss_disabled, 1); ?>
|
||||
value="1">出力しない
|
||||
</label>
|
||||
</div>
|
||||
<div class="mtee-form-box mtee_box_border">
|
||||
<h3>OGPタグ出力</h3>
|
||||
<label>
|
||||
@@ -180,6 +190,15 @@ $asset_ver_disabled = $this->get_key_setting('asset_ver_disabled');
|
||||
value="1">削除
|
||||
</label>
|
||||
</div>
|
||||
<div class="mtee-form-box mtee_box_border">
|
||||
<h3>絵文字</h3>
|
||||
<label>
|
||||
<input type="hidden" name="_mtee[emoji_disabled]" value="0">
|
||||
<input type="checkbox"
|
||||
name="_mtee[emoji_disabled]" <?php checked($emoji_disabled, 1); ?>
|
||||
value="1">表示しない
|
||||
</label>
|
||||
</div>
|
||||
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
|
||||
</div>
|
||||
<div class="mtee_tab_box">
|
||||
|
||||
Reference in New Issue
Block a user