$wpdb->prefix . 'aiwest_goals']; if (class_exists('AIWEST_Goals')) { AIWEST_Goals::ensure_tables(); } $intent = AIWEST_Security::post_key('aiwest_goal_intent'); if (AIWEST_Security::is_post_request() && $intent) { check_admin_referer('aiwest_goal_action'); if ($intent === 'add') { $result = AIWEST_Goals::add( AIWEST_Security::post_text('goal_title'), AIWEST_Security::post_textarea('goal_description'), AIWEST_Security::post_key('priority', 'normal') ); if (is_wp_error($result)) { echo '
' . esc_html(__('The goal was not saved:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '
' . esc_html(__('Goal added and saved. Goal ID:', 'ai-webmaster-studio')) . ' ' . intval($result) . '
' . esc_html(__('The goal was not updated:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '
' . esc_html(__('Goal updated.', 'ai-webmaster-studio')) . '
' . esc_html(__('Goal deleted.', 'ai-webmaster-studio')) . '
' . esc_html(__('AI Webmaster Studio tables were checked and repaired if necessary.', 'ai-webmaster-studio')) . '