PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 1.3.5
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v1.3.5
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 2.3.3 All 194 releases
convertkit / admin / section / base.php

base.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 1.3.5, at admin/section/base.php

66 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 abstract class ConvertKitSettingsSection {
4 public $is_registerable = true;
5 public $name;
6 public $title;
7 public $tab_text;
8 public $settings_key;
9
10 public $api;
11 public $options;
12
13 public function __construct() {
14 global $convertkit_settings;
15
16 $this->api = $convertkit_settings->api;
17 $this->options = get_option($this->settings_key);
18 if (empty($this->tab_text)) $this->tab_text = $this->title;
19
20 $this->register_section();
21 }
22
23 /**
24 * Register settings section
25 */
26 public function register_section() {
27 if(false == get_option($this->settings_key)) {
28 add_option($this->settings_key);
29 }
30
31 add_settings_section(
32 $this->name, // Section name (machine-readable)
33 $this->title, // Section title
34 array($this, 'print_section_info'), // Info callback
35 $this->settings_key // Settings page
36 );
37
38 $this->register_fields();
39
40 register_setting(
41 $this->settings_key, // Page
42 $this->settings_key, // Settings DB Key
43 array($this, 'sanitize_settings')
44 );
45 }
46
47 /**
48 * Renders the section
49 */
50 public function render() {
51 do_settings_sections( $this->settings_key );
52 settings_fields( $this->settings_key );
53 submit_button();
54 }
55
56 /**
57 * Register settings fields
58 */
59 abstract public function register_fields();
60
61 /**
62 * Prints help info for this section
63 */
64 abstract public function print_section_info();
65 }
66