PluginProbe
Post Grid Gutenberg Blocks – PostX / 4.0.3
Post Grid Gutenberg Blocks – PostX v4.0.3
5.0.41 5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 All 238 releases
ultimate-post / addons / chatgpt / init.php

init.php in Post Grid Gutenberg Blocks – PostX 4.0.3, at addons/chatgpt/init.php

78 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3
4 add_filter( 'ultp_addons_config', 'ultp_chatgpt_config' );
5 /**
6 * ChatGPT Addon Config
7 *
8 * @param array $config Addon Config.
9 * @return array
10 */
11 function ultp_chatgpt_config( $config ) {
12 $configuration = array(
13 'name' => __( 'ChatGPT', 'ultimate-post' ),
14 'desc' => __( 'PostX brings the ChatGPT into the WordPress Dashboard to let you generate content effortlessly. ', 'ultimate-post' ),
15 'img' => ULTP_URL . 'assets/img/addons/ChatGPT.svg',
16 'docs' => 'https://wpxpo.com/docs/postx/add-on/chatgpt-addon/',
17 'live' => 'https://www.wpxpo.com/postx-chatgpt-wordpress-ai-content-generator/live_demo_args',
18 'video' => 'https://www.youtube.com/watch?v=NE4BPw4OTAA',
19 'is_pro' => false,
20 'position' => 6
21 );
22 $config['ultp_chatgpt'] = $configuration;
23 return $config;
24 }
25
26 add_action( 'init', 'ultp_chatgpt_init' );
27 function ultp_chatgpt_init() {
28 $settings = isset( $GLOBALS['ultp_settings'] ) ? $GLOBALS['ultp_settings'] : array();
29 if ( isset( $settings['ultp_chatgpt'] ) ) {
30 add_filter( 'ultp_settings', 'get_chatgpt_settings', 10, 1 );
31 }
32 }
33
34 function get_chatgpt_settings( $config ) {
35 $arr = array(
36 'ultp_chatgpt' => array(
37 'label' => __( 'ChatGPT', 'ultimate-post' ),
38 'attr' => array(
39 'chatgpt_heading' => array(
40 'type' => 'heading',
41 'label' => __( 'ChatGPT Settings', 'ultimate-post' ),
42 ),
43 'chatgpt_secret_key' => array(
44 'type' => 'text',
45 'label' => __( 'OpenAI API Secret Key', 'ultimate-post' ),
46 'desc' => __( 'For using ChatGPT addon, you have to add your OpenAI secret key.', 'ultimate-post' ),
47 'link' => __( 'https://platform.openai.com/account/api-keys' ),
48 'linkText' => __( 'Get key.', 'ultimate-post' ),
49 ),
50 'chatgpt_model' => array(
51 'type' => 'select',
52 'label' => __( 'OpenAI Model', 'ultimate-post' ),
53 'desc' => __( 'Choose your preferable OpenAI model', 'ultimate-post' ),
54 'options' => array(
55 'gpt-3.5-turbo' => 'gpt-3.5-turbo',
56 'text-davinci-002' => 'text-davinci-002',
57 'text-davinci-003' => 'text-davinci-003',
58 'gpt-4' => 'gpt-4',
59 ),
60 'default' => 'gpt-3.5-turbo'
61 ),
62 'chatgpt_response_time' => array(
63 'type' => 'number',
64 'label' => __( 'Response Time', 'ultimate-post' ),
65 'desc' => __( 'Choose your preferable OpenAI response time', 'ultimate-post' ),
66 'default' => 60
67 ),
68 'chatgpt_max_tokens' => array(
69 'type' => 'number',
70 'label' => __( 'Max Tokens', 'ultimate-post' ),
71 'desc' => __( 'Choose your preferable OpenAI max Number of Tokens to be generated by ChatGPT', 'ultimate-post' ),
72 'default' => 400
73 ),
74 ),
75 ),
76 );
77 return array_merge( $config, $arr );
78 }