← All changes
|
includes/integrations/contactform7/class-convertkit-contactform7-settings.php
+27
-6
2.2.0
→
3.4.4
View file →
| @@ -71,11 +71,8 @@ | ||
| 71 | 71 | |
| 72 | 72 | if ( empty( $this->get() ) ) { |
| 73 | 73 | return false; |
| 74 | 74 | } |
| 75 | - if ( count( $this->get() ) === 0 ) { // @phpstan-ignore-line. | |
| 76 | - return false; | |
| 77 | - } | |
| 78 | 75 | |
| 79 | 76 | return true; |
| 80 | 77 | |
| 81 | 78 | } |
| @@ -80,16 +77,16 @@ | ||
| 80 | 77 | |
| 81 | 78 | } |
| 82 | 79 | |
| 83 | 80 | /** |
| 84 | - * Returns the ConvertKit Form ID that is mapped against the given Contact Form 7 Form ID. | |
| 81 | + * Returns the ConvertKit subscription setting for the given Contact Form 7 Form ID. | |
| 85 | 82 | * |
| 86 | 83 | * @since 1.9.6 |
| 87 | 84 | * |
| 88 | 85 | * @param int $cf7_form_id Contact Form 7 Form ID. |
| 89 | - * @return bool|int | |
| 86 | + * @return bool|string|int | |
| 90 | 87 | */ |
| 91 | - public function get_convertkit_form_id_by_cf7_form_id( $cf7_form_id ) { | |
| 88 | + public function get_convertkit_subscribe_setting_by_cf7_form_id( $cf7_form_id ) { | |
| 92 | 89 | |
| 93 | 90 | // Bail if no settings exist. |
| 94 | 91 | if ( ! $this->has_settings() ) { |
| 95 | 92 | return false; |
| @@ -100,8 +97,32 @@ | ||
| 100 | 97 | return false; |
| 101 | 98 | } |
| 102 | 99 | |
| 103 | 100 | return $this->get()[ $cf7_form_id ]; |
| 101 | + | |
| 102 | + } | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * Returns whether Creator Network Recommendations are enabled for the given Contact Form 7 Form ID. | |
| 106 | + * | |
| 107 | + * @since 2.2.7 | |
| 108 | + * | |
| 109 | + * @param int $cf7_form_id Contact Form 7 Form ID. | |
| 110 | + * @return bool | |
| 111 | + */ | |
| 112 | + public function get_creator_network_recommendations_enabled_by_cf7_form_id( $cf7_form_id ) { | |
| 113 | + | |
| 114 | + // Bail if no settings exist for any Contact Form 7 Forms. | |
| 115 | + if ( ! $this->has_settings() ) { | |
| 116 | + return false; | |
| 117 | + } | |
| 118 | + | |
| 119 | + // Bail if no setting exists for the given Contact Form 7 Form. | |
| 120 | + if ( ! array_key_exists( 'creator_network_recommendations_' . $cf7_form_id, $this->get() ) ) { | |
| 121 | + return false; | |
| 122 | + } | |
| 123 | + | |
| 124 | + return (bool) $this->get()[ 'creator_network_recommendations_' . $cf7_form_id ]; | |
| 104 | 125 | |
| 105 | 126 | } |
| 106 | 127 | |
| 107 | 128 | /** |