Changeset 3413565
- Timestamp:
- 12/07/2025 03:45:30 PM (3 months ago)
- Location:
- disable-ai/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (2 diffs)
-
admin/partials/admin-options-display.php (modified) (8 diffs)
-
disable-ai.php (modified) (3 diffs)
-
includes/class-disableai.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
disable-ai/trunk/README.txt
r3388453 r3413565 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8 6 Stable tag: 0.4. 06 Stable tag: 0.4.1 7 7 License: GPL-2.0+ 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 42 42 Because AI can have negative impacts on people and the planet. And because AI should not be forced on anyone. 43 43 44 = How can I configure plugin settings from my wp-config.php file? = 45 46 There is a Settings page for the plugin in your wp-admin. But you can also disable AI in specific plugins by setting their related constants to true in your wp-config.php file. Ex: DISAI_PLUGIN_AIOSEO, DISAI_PLUGIN_ELEMENTOR, DISAI_PLUGIN_RANKMATH 47 48 If you also want to make a few less database queries and only configure plugin settings from wp-config.php, you can set the DISAI_ENABLE_WPCONFIG_MODE constant to true in your wp-config.php file. 49 44 50 == Changelog == 45 51 52 = 0.4.1 = 53 * New: Support wp-config.php constant DISAI_ENABLE_WPCONFIG_MODE for enabling/disabling plugin settings from wp-config.php. 54 * Updated: Convert wp-config.php string constants to booleans so 'false' evaluates to false. 55 * Updated: Compatibility with WordPress 6.9. 56 46 57 = 0.4.0 = 47 * Add support for Rank Math SEO - Disable Content AI module and features, and hide the module from the Rank Math admin Dashboard.48 * Change: Add AIOSEO editor styles to fewer admin pages, and disable the AI features on custom post type edit screens.49 * Change: Load utilities earlier in the WP sequence so Rank Math SEO's options can be overridden.50 * Fix : Correctly update Yoast SEO settings when disabling AI.58 * New: Add support for Rank Math SEO - Disable Content AI module and features, and hide the module from the Rank Math admin Dashboard. 59 * Updated: Add AIOSEO editor styles to fewer admin pages, and disable the AI features on custom post type edit screens. 60 * Updated: Load utilities earlier in the WP sequence so Rank Math SEO's options can be overridden. 61 * Fixed: Correctly update Yoast SEO settings when disabling AI. 51 62 52 63 = 0.3.0 = 53 * Rename plugin option and add sanitization.54 * Update PHP file structure and comments.55 * Move css to enqueued files.56 * Hide AIOSEO AI tab in AIOSEO's General Settings, and load style in Elementor editor too.64 * Updated: Rename plugin option and add sanitization. 65 * Updated: Update PHP file structure and comments. 66 * Updated: Move css to enqueued files. 67 * Updated: Hide AIOSEO AI tab in AIOSEO's General Settings, and load style in Elementor editor too. 57 68 58 69 = 0.2.0 = 59 * Add support for All in One SEO. Hide AI menu items and tabs, hide AI buttons, and remove the Writing Assistant metabox in the post editor.60 * Remove WP from more instances of the plugin's name to comply with WordPress plugin repository rules.70 * New: Add support for All in One SEO. Hide AI menu items and tabs, hide AI buttons, and remove the Writing Assistant metabox in the post editor. 71 * Updated: Remove WP from more instances of the plugin's name to comply with WordPress plugin repository rules. 61 72 62 73 = 0.1.0 = -
disable-ai/trunk/admin/partials/admin-options-display.php
r3385999 r3413565 16 16 if ( ! defined( 'ABSPATH' ) ) exit; 17 17 18 19 $disai_wpconfig_mode = false; 20 if( defined( 'DISAI_ENABLE_WPCONFIG_MODE' ) ) { 21 if ( rest_sanitize_boolean( constant( 'DISAI_ENABLE_WPCONFIG_MODE' ) ) ) { 22 $disai_wpconfig_mode = true; 23 } 24 } 18 25 $disai_settings = (array) get_option( 'disai_settings', array() ); 19 26 ?> … … 38 45 'description' => 'Disable All in One SEO\'s AI features. Removes the Writing Assistant and AI-related buttons, menu items and tabs from the WordPress Editor.' 39 46 ); 40 disai_output_admin_option( $args, $disai_settings );47 disai_output_admin_option( $args, $disai_settings, $disai_wpconfig_mode ); 41 48 42 49 $args = array( … … 46 53 'description' => 'Disable Elementor\'s AI features.' 47 54 ); 48 disai_output_admin_option( $args, $disai_settings );55 disai_output_admin_option( $args, $disai_settings, $disai_wpconfig_mode ); 49 56 50 57 $args = array( … … 54 61 'description' => 'Disable Rank Math SEO\'s AI features.' 55 62 ); 56 disai_output_admin_option( $args, $disai_settings );63 disai_output_admin_option( $args, $disai_settings, $disai_wpconfig_mode ); 57 64 58 65 $args = array( … … 62 69 'description' => 'Disable WPForms\' AI features.' 63 70 ); 64 disai_output_admin_option( $args, $disai_settings );71 disai_output_admin_option( $args, $disai_settings, $disai_wpconfig_mode ); 65 72 66 73 $args = array( … … 70 77 'description' => 'Disable Yoast SEO\'s AI features.' 71 78 ); 72 disai_output_admin_option( $args, $disai_settings );79 disai_output_admin_option( $args, $disai_settings, $disai_wpconfig_mode ); 73 80 ?> 74 81 </table> … … 86 93 <?php 87 94 88 function disai_output_admin_option( $args , $settings ) {95 function disai_output_admin_option( $args , $settings, $wpconfig_mode = false ) { 89 96 $type = $args['type'] ?? ''; 90 97 $name = $args['name'] ?? ''; … … 96 103 $placeholder = ''; 97 104 $after_label_msg = ''; 105 98 106 if( defined( $utility_constant ) ) { 99 $utility_value = constant( $utility_constant);100 $after_label_msg = "<span class='tooltip'><span class='dashicons dashicons-warning'></span><span class='tooltip-text'>This setting is currently configured in your wp-config.php file and can only be enabled or disabled there.<br/><br/> Remove $utility_constant from wp-config.php in order to configure this setting here.</span></span>";101 } else if ( array_key_exists( $type, $settings ) && array_key_exists( $name, $settings[$type] ) ) {107 $utility_value = rest_sanitize_boolean( constant( $utility_constant ) ); 108 $after_label_msg = "<span class='tooltip'><span class='dashicons dashicons-warning'></span><span class='tooltip-text'>This setting is currently configured in your wp-config.php file and can only be enabled or disabled there.<br/><br/>" . ( $wpconfig_mode ? "WP-Config Mode is enabled as well. Remove DISAI_ENABLE_WPCONFIG_MODE and $utility_constant from wp-config.php in order to enable/disable this setting here." : "Remove $utility_constant from wp-config.php in order to enable/disable this setting here." ) . "</span></span>"; 109 } else if ( ! $wpconfig_mode && array_key_exists( $type, $settings ) && array_key_exists( $name, $settings[$type] ) ) { 102 110 $utility_value = absint( $settings[$type][$name] ); 103 111 } 104 112 105 $input_output = "<input type='checkbox' name='disai_settings[$type][$name]' value='1' " . ( $utility_value ? "checked='checked'" : '' ) . ( defined( $utility_constant ) ? " disabled='' title='Remove $utility_constant from wp-config.php in order to configure this setting here.'" : "" ) . "/>" . $description . "$after_label_msg"; 113 $disabled_title = "Remove $utility_constant from wp-config.php in order to configure this setting here."; 114 if ( $wpconfig_mode ) { 115 $disabled_title = "This setting is managed by the $utility_constant constant in wp-config.php because WP-Config Mode is enabled. Remove DISAI_ENABLE_WPCONFIG_MODE " . ( defined( $utility_constant ) ? "and $utility_constant " : "" ) . "from wp-config.php in order to configure this setting here."; 116 } 117 118 $input_output = "<input type='checkbox' name='disai_settings[$type][$name]' value='1' " . ( $utility_value ? "checked='checked'" : '' ) . ( $wpconfig_mode || defined( $utility_constant ) ? " disabled='' title='$disabled_title'" : "" ) . "/>" . $description . "$after_label_msg"; 106 119 107 120 $allowed_html = array( -
disable-ai/trunk/disable-ai.php
r3385999 r3413565 2 2 3 3 /** 4 *5 * @link https://github.com/jruns6 * @since 0.1.07 4 * @package DisableAI 8 5 * … … 11 8 * Plugin URI: https://github.com/jruns/wp-disable-ai 12 9 * Description: Turn off unwanted AI features and notifications in plugins, themes, and WordPress Core. 13 * Version: 0.4. 010 * Version: 0.4.1 14 11 * Author: jruns 15 12 * Author URI: https://github.com/jruns … … 24 21 if ( ! defined( 'ABSPATH' ) ) exit; 25 22 26 define( 'DISAI_VERSION', '0.4. 0' );23 define( 'DISAI_VERSION', '0.4.1' ); 27 24 define( 'DISAI_BASE_NAME', plugin_basename( __FILE__ ) ); 28 25 -
disable-ai/trunk/includes/class-disableai.php
r3385999 r3413565 58 58 */ 59 59 protected $settings; 60 61 /** 62 * If we should only check wp-config.php constants for active plugins. 63 * 64 * @since 0.4.1 65 * @access protected 66 * @var array $wpconfig_mode The wp-config mode setting. 67 */ 68 protected $wpconfig_mode; 60 69 61 70 /** … … 72 81 $this->version = DISAI_VERSION; 73 82 } else { 74 $this->version = '0.4. 0';83 $this->version = '0.4.1'; 75 84 } 76 85 $this->plugin_name = 'disable-ai'; … … 135 144 ); 136 145 $this->settings = wp_parse_args( get_option( 'disai_settings' ), $defaults ); 146 147 $this->wpconfig_mode = false; 148 if( defined( 'DISAI_ENABLE_WPCONFIG_MODE' ) && rest_sanitize_boolean( constant( 'DISAI_ENABLE_WPCONFIG_MODE' ) ) ) { 149 $this->wpconfig_mode = true; 150 } 137 151 } 138 152 … … 147 161 148 162 if( defined( $constant_name ) ) { 149 if ( constant( $constant_name) ) {163 if ( rest_sanitize_boolean( constant( $constant_name ) ) ) { 150 164 return true; 151 165 } 152 } else if ( array_key_exists( $utility_name, $this->settings[$utility_type] ) && $this->settings[$utility_type][$utility_name] ) { 153 return true; 166 } else if ( ! $this->wpconfig_mode ) { 167 if ( array_key_exists( $utility_name, $this->settings[$utility_type] ) && $this->settings[$utility_type][$utility_name] ) { 168 return true; 169 } 154 170 } 155 171
Note: See TracChangeset
for help on using the changeset viewer.