post_type;
}
else {
$post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : '';
}
if ( in_array( $post_type, self::$post_types ) ) { return true; }
if ( in_array( $taxonomy, self::$taxonomies ) ) { return true; }
if ( in_array( $page, self::$additional_pages ) ) { return true; }
return false;
}
public static function get_page_details() {
global $post;
$page_details = array(
'ait-iat-settings-ait-iat-license-tab' => array(
'description' => __( 'The Dashboard page displays your license status, usage limits, and recent activity, with quick actions to manage background image alt text generation and access the media library. This serves as the central hub for monitoring and controlling your plugin’s AI features.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/alt-text/media-library',
'title' => 'Generate Alt Text From the Media Library'
),
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/pro/benefits',
'title' => 'Benefits of Pro'
),
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/pro/purchase',
'title' => 'How to Purchase'
),
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/pro/activate',
'title' => 'Activate Pro'
),
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/alt-text/bulk',
'title' => 'Bulk Generating and Scheduled Regeneration of Alt Text'
),
)
),
'ait-iat-settings-ait-iat-general-tab' => array(
'description' => __( 'The General page lets you configure AI alt text generation settings, including OpenAI API key, model selection, language, generation style, character limits, and upload behavior. This is the central hub for controlling how AI generates and applies alt text to your images.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/openai-key/get-key',
'title' => 'Getting your API key'
),
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/openai-key/adding-key',
'title' => 'Add Key in Plugin'
),
)
),
'ait-iat-settings-ait-iat-bulk-tab' => array(
'description' => __( 'The Bulk page allows you to manage large-scale alt text generation, including folder inclusion/exclusion, batch limits, cron intervals, retries, and skipping images with existing alt text. This serves as the central hub for efficiently processing alt text for multiple images at once.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/alt-text/bulk',
'title' => 'Bulk Generating and Scheduled Regeneration of Alt Text'
),
)
),
'ait-iat-settings-ait-iat-woocommerce-tab' => array(
'description' => __( 'The WooCommerce page lets you configure automatic alt text generation for product and gallery images, including options to include product context, regenerate existing alt text, and control on-save queueing. This serves as the central hub for managing AI-generated alt text within your WooCommerce store.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/alt-text/woocommerce',
'title' => 'WooCommerce Image Alt Text'
),
)
),
'ait-iat-settings-ait-iat-context‑aware-tab' => array(
'description' => __( 'The Context Aware page lets you enable and configure context-aware alt text generation, including the amount of post/page content to include and the template for sending context. This serves as the central hub for creating more accurate, context-rich alt text.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/alt-text/context-aware',
'title' => 'Context-Aware Alt Text'
),
)
),
'ait-iat-settings-ait-iat-seo-score-tab' => array(
'description' => __( 'The SEO Score page lets you enable and configure SEO scoring for generated alt text. It works with supported SEO plugins like Yoast to evaluate images based on page content and keywords. Here you can require keywords, adjust duplicate handling, show scores in post lists, or hide the score metabox.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/settings/seo-score',
'title' => 'SEO Score'
),
)
),
'ait-iat-settings-ait-iat-analytics-tab' => array(
'description' => __( 'The Analytics page lets you enable logging for alt text generation, tracking details like source, status, duration, and tokens used. You can choose what information to capture and how long to retain it, then view analytics from the plugin’s main menu.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/settings/analytics',
'title' => 'Analytics'
),
)
),
'ait-iat-settings-ait-iat-advanced-tab' => array(
'description' => __( 'The Advanced page gives you access to debug and test features. You can enable debug logging for errors, configure log retention, blocklist keywords, force model overrides, and use test mode to generate alt text without saving it. These settings help troubleshoot issues and fine-tune plugin behavior.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/settings/logs#debug-logging',
'title' => 'Debug Logging'
),
)
),
'ait-iat-settings-ait-iat-logs-tab' => array(
'description' => __( 'The Logs page shows a history of all alt text generation jobs run by the plugin. Use it to review past activity and troubleshoot issues. For log retention or to disable logging, adjust the settings on the Advanced page.', 'ai-image-alt-text' ),
'tutorials' => array(
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/settings/logs',
'title' => 'Logs'
),
array(
'url' => 'https://doc.wpaiplugins.dev/plugins/ai-image-alt-text/user/settings/logs#debug-logging',
'title' => 'Debug Logging'
),
)
),
);
$page_details['ait-iat-settings'] = $page_details['ait-iat-settings-ait-iat-license-tab'];
$tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
$page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
$taxonomy = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : '';
if ( isset( $_GET['post'] ) ) {
$post = get_post( intval( $_GET['post'] ) );
$post_type = $post->post_type;
}
else {
$post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : '';
}
if ( in_array( $page . '-' . $tab, array_keys( $page_details ) ) ) { return $page_details[ $page . '-' . $tab ]; }
if ( in_array( $page, array_keys( $page_details ) ) ) { return $page_details[ $page ]; }
if ( in_array( $taxonomy, array_keys( $page_details ) ) ) { return $page_details[ $taxonomy ]; }
if ( in_array( $post_type, array_keys( $page_details ) ) ) { return $page_details[ $post_type ]; }
return array( 'description', 'tutorials' => array() );
}
}