PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | inc/admin/settings/email-groups/class-lp-settings-emails-group.php +103 -103 4.3.8 → 4.4.9 View file →
@@ -1,103 +1,103 @@
1 -<?php
2 -
3 -/**
4 - * Class LP_Settings_Emails_Group
5 - *
6 - * @since 3.0.0
7 - */
8 -class LP_Settings_Emails_Group extends LP_Settings {
9 -
10 - /**
11 - * Items
12 - *
13 - * @var array
14 - */
15 - public $items = array();
16 -
17 - /**
18 - * @var string
19 - */
20 - public $group_id = '';
21 -
22 - /**
23 - * LP_Settings_Emails_Group constructor.
24 - */
25 - public function __construct() {
26 - parent::__construct();
27 -
28 - $emails = LP_Emails::instance()->emails;
29 - $this->items = apply_filters(
30 - "learn-press/settings/emails-group/$this->group_id/key-ids",
31 - $this->items
32 - );
33 -
34 - $ids = [];
35 - foreach ( $emails as $email ) {
36 - if ( ! is_object( $email ) ) {
37 - continue;
38 - }
39 -
40 - //Todo: need review code here
41 - if ( ! in_array( $email->id, $this->items ) ) {
42 - continue;
43 - }
44 - $email->group = $this;
45 - $ids[ $email->id ] = $email;
46 - }
47 -
48 - $this->items = $ids;
49 -
50 - add_action( 'learn-press/admin/setting-payments/admin-options-' . $this->group_id, array( $this, 'output_settings' ) );
51 - add_filter( 'learn-press/admin/get-settings/admin-options-' . $this->group_id, array( $this, 'filter_get_settings' ) );
52 - }
53 -
54 - public function output_settings() {
55 - $current = $this->get_current_section();
56 -
57 - echo '<ul class="subsubsub">';
58 -
59 - foreach ( $this->items as $email ) {
60 - if ( ! is_object( $email ) ) {
61 - continue;
62 - }
63 - if ( $current == $email->id ) {
64 - echo '<li class="active"><span>' . wp_kses_post( $email->title ) . '</span></li>';
65 - } else {
66 - echo '<li><a href="' . esc_url_raw( add_query_arg( 'sub-section', $email->id ) ) . '">' . wp_kses_post( $email->title ) . '</a></li>';
67 - }
68 - }
69 -
70 - echo '</ul>';
71 -
72 - if ( ! empty( $this->items[ $current ] ) ) {
73 - $this->items[ $current ]->admin_option_settings(); // Email content show in here <nhamdv> LP_Abstract_Settings.
74 - }
75 - }
76 -
77 - /**
78 - * Filter save setting.
79 - *
80 - * @return array list setting Email.
81 - * @version 4.0.0
82 - * @author Nhamdv
83 - */
84 - public function filter_get_settings() {
85 - $current = $this->get_current_section();
86 -
87 - if ( ! empty( $this->items[ $current ] ) ) {
88 - return $this->items[ $current ]->get_settings();
89 - }
90 - }
91 -
92 - public function get_current_section() {
93 - $ids = array_keys( $this->items );
94 -
95 - return ! empty( $_REQUEST['sub-section'] ) ? sanitize_text_field( $_REQUEST['sub-section'] ) : reset( $ids );
96 - }
97 -
98 - public function __toString() {
99 - $name = str_replace( array( 'LP_Settings_', '_' ), array( '', ' ' ), get_class( $this ) );
100 -
101 - return (string) $name;
102 - }
103 -}
1 +<?php
2 +
3 +/**
4 + * Class LP_Settings_Emails_Group
5 + *
6 + * @since 3.0.0
7 + */
8 +class LP_Settings_Emails_Group extends LP_Settings {
9 +
10 + /**
11 + * Items
12 + *
13 + * @var array
14 + */
15 + public $items = array();
16 +
17 + /**
18 + * @var string
19 + */
20 + public $group_id = '';
21 +
22 + /**
23 + * LP_Settings_Emails_Group constructor.
24 + */
25 + public function __construct() {
26 + parent::__construct();
27 +
28 + $emails = LP_Emails::instance()->emails;
29 + $this->items = apply_filters(
30 + "learn-press/settings/emails-group/$this->group_id/key-ids",
31 + $this->items
32 + );
33 +
34 + $ids = [];
35 + foreach ( $emails as $email ) {
36 + if ( ! is_object( $email ) ) {
37 + continue;
38 + }
39 +
40 + //Todo: need review code here
41 + if ( ! in_array( $email->id, $this->items ) ) {
42 + continue;
43 + }
44 + $email->group = $this;
45 + $ids[ $email->id ] = $email;
46 + }
47 +
48 + $this->items = $ids;
49 +
50 + add_action( 'learn-press/admin/setting-payments/admin-options-' . $this->group_id, array( $this, 'output_settings' ) );
51 + add_filter( 'learn-press/admin/get-settings/admin-options-' . $this->group_id, array( $this, 'filter_get_settings' ) );
52 + }
53 +
54 + public function output_settings() {
55 + $current = $this->get_current_section();
56 +
57 + echo '<ul class="subsubsub">';
58 +
59 + foreach ( $this->items as $email ) {
60 + if ( ! is_object( $email ) ) {
61 + continue;
62 + }
63 + if ( $current == $email->id ) {
64 + echo '<li class="active"><span>' . wp_kses_post( $email->title ) . '</span></li>';
65 + } else {
66 + echo '<li><a href="' . esc_url_raw( add_query_arg( 'sub-section', $email->id ) ) . '">' . wp_kses_post( $email->title ) . '</a></li>';
67 + }
68 + }
69 +
70 + echo '</ul>';
71 +
72 + if ( ! empty( $this->items[ $current ] ) ) {
73 + $this->items[ $current ]->admin_option_settings(); // Email content show in here <nhamdv> LP_Abstract_Settings.
74 + }
75 + }
76 +
77 + /**
78 + * Filter save setting.
79 + *
80 + * @return array list setting Email.
81 + * @version 4.0.0
82 + * @author Nhamdv
83 + */
84 + public function filter_get_settings() {
85 + $current = $this->get_current_section();
86 +
87 + if ( ! empty( $this->items[ $current ] ) ) {
88 + return $this->items[ $current ]->get_settings();
89 + }
90 + }
91 +
92 + public function get_current_section() {
93 + $ids = array_keys( $this->items );
94 +
95 + return ! empty( $_REQUEST['sub-section'] ) ? sanitize_text_field( $_REQUEST['sub-section'] ) : reset( $ids );
96 + }
97 +
98 + public function __toString() {
99 + $name = str_replace( array( 'LP_Settings_', '_' ), array( '', ' ' ), get_class( $this ) );
100 +
101 + return (string) $name;
102 + }
103 +}