$action ) { $type = sanitize_key( $action['type'] ?? 'external_link' ); if ( ! in_array( $type, array( 'copy_markdown', 'view_markdown', 'external_link' ), true ) ) { $type = 'external_link'; } $actions[] = array( 'id' => sanitize_key( $action['id'] ?? 'action_' . $idx ), 'enabled' => ! empty( $action['enabled'] ), 'label' => sanitize_text_field( $action['label'] ?? '' ), 'icon' => sanitize_text_field( $action['icon'] ?? '' ), 'type' => $type, 'link' => esc_url_raw( $action['link'] ?? '' ), 'order' => absint( $action['order'] ?? $idx ), ); } usort( $actions, fn( $a, $b ) => $a['order'] <=> $b['order'] ); } $sanitized['actions'] = $actions; return $sanitized; } /** * Enqueue admin assets. * * @param string $hook Current admin page hook. */ public static function enqueue_admin_assets( $hook ) { if ( 'settings_page_ajwa-settings' !== $hook ) { return; } wp_enqueue_media(); wp_enqueue_script( 'jquery-ui-sortable' ); wp_enqueue_style( 'ajwa-admin', AJWA_PLUGIN_URL . 'admin/admin.css', array(), AJWA_VERSION ); wp_enqueue_script( 'ajwa-admin', AJWA_PLUGIN_URL . 'admin/admin.js', array( 'jquery', 'jquery-ui-sortable' ), AJWA_VERSION, true ); wp_localize_script( 'ajwa-admin', 'ajwaAdmin', array( 'nonce' => wp_create_nonce( 'ajwa_admin_nonce' ), 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'default_icon' => AJWA_PLUGIN_URL . 'assets/icons/default.svg', ) ); } /** * Render the settings page. */ public static function render_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $settings = ajwa_get_settings(); $post_types = get_post_types( array( 'public' => true ), 'objects' ); $shortcode = '[ajwa_widget]'; ?>

⚙️

👁️

🎛️

[page_url] for the current page URL and [md_url] for the Markdown URL in link fields.', 'ajw-ai-markdown-page-widget' ), array( 'code' => array() ) ); ?>

( $a['order'] ?? 0 ) <=> ( $b['order'] ?? 0 ) ); foreach ( $actions as $idx => $action ) : self::render_action_row( $idx, $action ); endforeach; ?>
📋

[ajwa_widget position="left"]
[ajwa_widget position="right"]


Appearance → Widgets and add the AJW AI Widget block to any widget area.', 'ajw-ai-markdown-page-widget' ), esc_url( admin_url( 'widgets.php' ) ) ), array( 'a' => array( 'href' => array() ), 'strong' => array(), ) ); ?>

☕

100%
0
💙

ℹ️

/your-page/md/
ajw-ai-markdown-page-widget

⭐

'', 'enabled' => true, 'label' => '', 'icon' => '', 'type' => 'external_link', 'link' => '', 'order' => 0, ), true ); ?>
⠿
?