'; esc_html_e('Data saved!', 'ai-keyword-swap'); echo '

'; } } // Retrieve saved choices $saved_choices = get_option('aiks_keyword_swap_choices', array()); // Retrieve saved text field data $saved_textfield_data = get_option('aiks_keyword_swap_textfield_data', ''); // Retrieve saved OpenAI API Endpoint $saved_openai_endpoint = get_option('aiks_keyword_swap_openai_endpoint_data', ''); // Display the settings form ?>

Here's a link to the documentation for the plugin. This will help you learn more about its features and how to use it.

For any feedback or queries regarding this plugin, please contact our Support team.










get_option('aiks_keyword_swap_textfield_data', ''), // Value of the 'aiks_keyword_swap_textfield_data' option 'apiKeyEndPointVal' => get_option('aiks_keyword_swap_openai_endpoint_data', ''), // Value of the 'aiks_keyword_swap_openai_endpoint_data' option 'wordsToHighlightVal' => get_option('aiks_keyword_swap_choices', array()), // Value of the 'aiks_keyword_swap_choices' option ) ); } } /** * Add Custom CSS to TinyMCE Editor * * This function adds custom CSS to the TinyMCE editor. It appends the URL of the custom CSS file * to the list of CSS files that TinyMCE should load for styling the editor content. * * @param string $wp A string containing the list of CSS files that TinyMCE should load. * @return string The updated string with the URL of the custom CSS file added. * @since 1.0.0 */ if (!function_exists('aiks_keyword_swap_tinymce_custom_css_add')) { function aiks_keyword_swap_tinymce_custom_css_add($wp) { // Append the URL of the custom CSS file to the list of CSS files $wp .= ',' . plugin_dir_url(__FILE__) . 'css/aiks-keyword-swap-editor-styles.css'; return $wp; // Return the updated string with the URL of the custom CSS file added } } // Hook the function to the 'mce_css' filter add_filter('mce_css', 'aiks_keyword_swap_tinymce_custom_css_add', 100); if (!function_exists('aiks_keyword_swap_custom_wp_admin_style')) { function aiks_keyword_swap_custom_wp_admin_style() { wp_enqueue_style('custom_wp_admin_css', plugin_dir_url(__FILE__) . 'css/aiks-keyword-swap-editor-styles.css', array(), '1.0'); } add_action('admin_enqueue_scripts', 'aiks_keyword_swap_custom_wp_admin_style'); } /** * Enqueue Editor Styles for Gutenberg Blocks * * This function enqueues editor styles specifically for Gutenberg blocks. * It registers and enqueues a CSS file containing styles for the editor. * * @since 1.0.0 */ if (!function_exists('aiks_keyword_swap_enqueue_editor_styles')) { function aiks_keyword_swap_enqueue_editor_styles() { // Register editor styles with WordPress wp_register_style('aiks-keyword-swap-editor-styles', plugin_dir_url(__FILE__) . 'css/aiks-keyword-swap-editor-styles.css', array(), '1.0'); // Enqueue editor styles wp_enqueue_style('aiks-keyword-swap-editor-styles'); } } // Hook the function to the 'enqueue_block_assets' action with a priority of 20 add_action('enqueue_block_assets', 'aiks_keyword_swap_enqueue_editor_styles', 20); /** * Add Dynamic Styles to TinyMCE Editor * * This function adds dynamic styles to the TinyMCE editor. It modifies the 'content_style' * property of the TinyMCE initialization settings to include custom CSS styles. * * @param array $mceInit An array containing the TinyMCE initialization settings. * @return array The updated array with dynamic styles added to the 'content_style' property. * @since 1.0.0 */ if (!function_exists('aiks_keyword_swap_editor_dynamic_styles')) { function aiks_keyword_swap_editor_dynamic_styles($mceInit) { // Define custom CSS styles $styles = 'body.mce-content-body .aksHighlighted { background-color: #FFFF00 !important}'; // Check if the 'content_style' property exists in the TinyMCE initialization settings if (isset($mceInit['content_style'])) { // If it exists, append custom styles to the existing 'content_style' $mceInit['content_style'] .= ' ' . $styles . ' '; } else { // If it doesn't exist, set 'content_style' to the custom styles $mceInit['content_style'] = $styles . ' '; } return $mceInit; // Return the updated array with dynamic styles added } } // Hook the function to the 'tiny_mce_before_init' filter add_filter('tiny_mce_before_init', 'aiks_keyword_swap_editor_dynamic_styles'); /** * Remove tags from post content before saving * * This function removes tags with a specific class ('aksHighlighted') from post content before it is saved. * It uses a regular expression to identify and remove the tags. * * @param string $content The content of the post being saved. * @return string The updated content with tags removed. * @since 1.0.0 */ if (!function_exists('aiks_keyword_swap_remove_span_tags')) { function aiks_keyword_swap_remove_span_tags($content) { // Define the regular expression pattern to match tags with class 'aksHighlighted' $pattern = '/(.*?)<\/span>/i'; // Replace all occurrences of the pattern with the inner text $content = preg_replace($pattern, '$1', $content); return $content; // Return the updated content with tags removed } } // Add the filter to 'content_save_pre' hook, applying the function before the post is saved add_filter('content_save_pre', 'aiks_keyword_swap_remove_span_tags'); /** * Output HTML for modal dialog * * This function outputs HTML for a modal dialog box, typically used in the WordPress admin area. * It defines the structure and content of the modal dialog box. * * @since 1.0.0 */ if (!function_exists('aiks_keyword_swap_code_model_box')) { function aiks_keyword_swap_code_model_box() { ?>
×

' . __('Settings', 'ai-keyword-swap') . ''; array_push($links, $settings_link); return $links; } } $plugin = plugin_basename(__FILE__); add_filter("plugin_action_links_$plugin", 'aiks_keyword_swap_add_settings_link'); /** * You can use these filters to add custom links to your plugin row in the plugin list. * @param $links, $file * @return $links [array] * @since 1.0.0 */ if (! function_exists('aiks_keyword_add_custom_plugin_links')) { function aiks_keyword_add_custom_plugin_links($links, $file) { if ($file === 'ai-keyword-swap/ai-keyword-swap.php') { $links[] = 'Documentation'; $links[] = 'Contact Support'; } return $links; } } add_filter('plugin_row_meta', 'aiks_keyword_add_custom_plugin_links', 10, 2);