PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 1.4.8
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v1.4.8
3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 All 195 releases
convertkit / admin / section / class-convertkit-settings-base.php

class-convertkit-settings-base.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 1.4.8, at admin/section/class-convertkit-settings-base.php

121 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ConvertKit Settings class
4 *
5 * @package ConvertKit
6 * @author ConvertKit
7 */
8
9 /**
10 * Class ConvertKit_Settings_Base
11 */
12 abstract class ConvertKit_Settings_Base {
13
14 /**
15 * Setting
16 *
17 * @var bool
18 */
19 public $is_registerable = true;
20
21 /**
22 * Section name
23 *
24 * @var string
25 */
26 public $name;
27
28 /**
29 * Section title
30 *
31 * @var string
32 */
33 public $title;
34
35 /**
36 * Section tab text
37 *
38 * @var string
39 */
40 public $tab_text;
41
42 /**
43 * Database key
44 *
45 * @var string
46 */
47 public $settings_key;
48
49 /**
50 * API instance
51 *
52 * @var ConvertKitAPI
53 */
54 public $api;
55
56 /**
57 * Options array
58 *
59 * @var mixed|void
60 */
61 public $options;
62
63 /**
64 * Constructor
65 */
66 public function __construct() {
67 global $convertkit_settings;
68
69 $this->api = $convertkit_settings->api;
70 $this->options = get_option( $this->settings_key );
71 if ( empty( $this->tab_text ) ) {
72 $this->tab_text = $this->title;
73 }
74
75 $this->register_section();
76 }
77
78 /**
79 * Register settings section
80 */
81 public function register_section() {
82 if ( false === get_option( $this->settings_key ) ) {
83 add_option( $this->settings_key );
84 }
85
86 add_settings_section(
87 $this->name,
88 $this->title,
89 array( $this, 'print_section_info' ),
90 $this->settings_key
91 );
92
93 $this->register_fields();
94
95 register_setting(
96 $this->settings_key,
97 $this->settings_key,
98 array( $this, 'sanitize_settings' )
99 );
100 }
101
102 /**
103 * Renders the section
104 */
105 public function render() {
106 do_settings_sections( $this->settings_key );
107 settings_fields( $this->settings_key );
108 submit_button();
109 }
110
111 /**
112 * Register settings fields
113 */
114 abstract public function register_fields();
115
116 /**
117 * Prints help info for this section
118 */
119 abstract public function print_section_info();
120 }
121