AIIFY_WRITER_PROMPTS, 'edits' => array_keys(AIIFY_EDIT_PROMPTS), 'after' => array_keys(AIIFY_GENERATE_AFTER_PROMPTS), 'before' => array_keys(AIIFY_GENERATE_BEFORE_PROMPTS), 'styles' => array_to_options(AIIFY_STYLES) , 'style' => AIIFY_WRITING_STYLE, 'tones' => array_to_options(AIIFY_TONES) , 'languages' => array_to_options(get_languages()) , 'language' => AIIFY_WRITING_LANGUAGE , 'tone' => AIIFY_WRITING_TONE, 'maxWords' => AIIFY_WRITING_MAX_WORDS, 'nonce' => wp_create_nonce("secure-nonce"), 'currentPlan' => aii_fs()->get_plan_name(), 'paragraphPrompt' => AIIFY_PARAGRAPH_BLOCK_PROMPT, 'latestPrompt' => '' ]; } function register_aiify_block() { if (!defined('AIIFY_OPEN_AI_KEY') || AIIFY_OPEN_AI_KEY == '') { // just bail if no key is there and notify add_action('admin_notices', function () { // phpcs:ignore WordPress.Security.NonceVerification.Recommended if (isset($_GET['page']) && $_GET['page'] == 'aiify') { return; } ?>


$value) { $options[] = ['label' => $value, 'value' => $key]; } return $options; } wp_localize_script( 'aiify-aiify-editor-script', 'aiify', js_config() ); add_filter('write_your_story', function () { return AIIFY_PARAGRAPH_BLOCK_PROMPT; }, 100, 0); } } if (defined('WP_ADMIN') && WP_ADMIN) { require AIIFY_INCLUDES . 'settings.php'; require AIIFY_INCLUDES . 'tinymce.php'; //allow only on admin ( or ajax ) add_action('admin_init', __NAMESPACE__.'\register_aiify_block'); }