PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 1.4.0
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v1.4.0
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.4.0, at admin/section/base.php

72 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 /**
4 * Class ConvertKitSettingsSection
5 */
6 abstract class ConvertKitSettingsSection {
7 public $is_registerable = true;
8 public $name;
9 public $title;
10 public $tab_text;
11 public $settings_key;
12
13 public $api;
14 public $options;
15
16 /**
17 * Constructor
18 */
19 public function __construct() {
20 global $convertkit_settings;
21
22 $this->api = $convertkit_settings->api;
23 $this->options = get_option($this->settings_key);
24 if (empty($this->tab_text)) $this->tab_text = $this->title;
25
26 $this->register_section();
27 }
28
29 /**
30 * Register settings section
31 */
32 public function register_section() {
33 if(false == get_option($this->settings_key)) {
34 add_option($this->settings_key);
35 }
36
37 add_settings_section(
38 $this->name, // Section name (machine-readable)
39 $this->title, // Section title
40 array($this, 'print_section_info'), // Info callback
41 $this->settings_key // Settings page
42 );
43
44 $this->register_fields();
45
46 register_setting(
47 $this->settings_key, // Page
48 $this->settings_key, // Settings DB Key
49 array($this, 'sanitize_settings')
50 );
51 }
52
53 /**
54 * Renders the section
55 */
56 public function render() {
57 do_settings_sections( $this->settings_key );
58 settings_fields( $this->settings_key );
59 submit_button();
60 }
61
62 /**
63 * Register settings fields
64 */
65 abstract public function register_fields();
66
67 /**
68 * Prints help info for this section
69 */
70 abstract public function print_section_info();
71 }
72