200, // file entries returned per tool 'max_files' => 20000, // files traversed before bailing 'max_depth' => 12, 'max_read_bytes' => 1024, // sniffing only; contents are NEVER returned ); $filtered = apply_filters( 'miintg_limits', $limits ); // Filters may lower a limit, never raise it. foreach ( $limits as $key => $default ) { if ( ! isset( $filtered[ $key ] ) ) { $filtered[ $key ] = $default; continue; } $filtered[ $key ] = min( (int) $filtered[ $key ], $default ); $filtered[ $key ] = max( 1, $filtered[ $key ] ); } return $filtered; } /** * Response envelope shared by every tool in this plugin. * * @param string $tool Tool name. * @param array $payload Tool-specific fields. * @param bool $ok Whether the check completed. * @param string|null $error Error message when $ok is false. * @return array */ function miintg_envelope( $tool, $payload, $ok = true, $error = null ) { return array_merge( array( 'tool' => $tool, 'plugin_ver' => MIINTG_VERSION, 'site' => wp_parse_url( home_url(), PHP_URL_HOST ), 'generated_at' => gmdate( 'c' ), 'ok' => (bool) $ok, 'error' => $error, ), $payload ); } /** * Whether the site owner has confirmed that scan results may be sent to a * third-party AI assistant. Off by default. Every remote access path (the * token-authenticated REST/MCP endpoints and the AI Copilot hooks) is gated * on this, so nothing leaves the site until the owner opts in. * * @return bool */ function miintg_ai_consent() { return (bool) get_option( 'miintg_ai_consent', false ); } /** * @return bool True when WP-Cron is switched off in wp-config.php, so queued * scans will not start on their own. */ function miintg_cron_disabled() { return defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON; }