set_recaptcha_keys();
@@ -686,7 +650,7 @@ public function build_recaptcha( int $form_id ) : string {
* @param int $form_id ID of form being rendered.
* @return string
*/
- public function build_hcaptcha( int $form_id ) : string {
+ public function build_hcaptcha( int $form_id ): string {
$hcaptcha = new ConstantContact_hCaptcha();
$hcaptcha->set_hcaptcha_keys();
@@ -753,7 +717,7 @@ public function build_hcaptcha( int $form_id ) : string {
* @param int $form_id ID of form being rendered.
* @return string
*/
- public function build_turnstile( int $form_id ) : string {
+ public function build_turnstile( int $form_id ): string {
$turnstile = new ConstantContact_Turnstile();
$turnstile->set_turnstile_keys();
@@ -819,7 +783,7 @@ public function build_turnstile( int $form_id ) : string {
*
* @return string
*/
- public function build_timestamp() : string {
+ public function build_timestamp(): string {
return '
'; // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested
}
@@ -830,7 +794,7 @@ public function build_timestamp() : string {
*
* @return array
*/
- public function build_custom_form_classes() : array {
+ public function build_custom_form_classes(): array {
$custom = [];
$global = [];
$per_form = [];
@@ -859,7 +823,7 @@ public function build_custom_form_classes() : array {
* @param array $form_data Options for the form.
* @return string
*/
- public function must_opt_in( array $form_data ) : string {
+ public function must_opt_in( array $form_data ): string {
if ( empty( $form_data['options']['optin']['show'] ) ) {
return '';
}
@@ -881,7 +845,7 @@ public function must_opt_in( array $form_data ) : string {
* @param int $instance Current form instance.
* @return string HTML markup
*/
- public function field( array $field, array $old_values = [], array $req_errors = [], int $form_id = 0, string $label_placement = 'top', int $instance = 0 ) : string {
+ public function field( array $field, array $old_values = [], array $req_errors = [], int $form_id = 0, string $label_placement = 'top', int $instance = 0 ): string {
if ( ! isset( $field['name'] ) || ! isset( $field['map_to'] ) ) {
return '';
}
@@ -985,7 +949,7 @@ public function field( array $field, array $old_values = [], array $req_errors =
* @param array $submitted_vals Array of submitted values.
* @return array|string Submitted value.
*/
- public function get_submitted_value( $value = '', string $map = '', array $field = [], array $submitted_vals = [] ) {
+ public function get_submitted_value( array|string $value = '', string $map = '', array $field = [], array $submitted_vals = [] ): array|string {
if ( $value ) {
return $value;
}
@@ -1003,7 +967,7 @@ public function get_submitted_value( $value = '', string $map = '', array $field
if ( 'address' === $field['name'] ) {
- if ( strpos( $post['key'], '_address___' ) !== false ) {
+ if ( str_contains( $post['key'], '_address___' ) ) {
$addr_key = explode( '___', $post['key'] );
@@ -1033,9 +997,9 @@ public function get_submitted_value( $value = '', string $map = '', array $field
* @param string $role Message role.
* @return string HTML markup.
*/
- public function message( string $type, string $message, string $role = 'log' ) : string {
+ public function message( string $type, string $message, string $role = 'log' ): string {
return sprintf(
- '
%s
',
+ '
%4$s
',
esc_attr( $type ),
esc_attr( $type ),
esc_attr( $role ),
@@ -1050,7 +1014,7 @@ public function message( string $type, string $message, string $role = 'log' ) :
*
* @return string The inline style tag for the form's description.
*/
- public function get_description_inline_styles() : string {
+ public function get_description_inline_styles(): string {
$inline_style = '';
$styles = [];
@@ -1076,11 +1040,10 @@ public function get_description_inline_styles() : string {
*
* @since 1.0.0
*
- * @param string $desc Description to output.
- * @param int|boolean $form_id Form ID.
+ * @param string $desc Description to output.
* @return string Form description markup.
*/
- public function description( string $desc = '', $form_id = false ) : string {
+ public function description( string $desc = '' ): string {
$display = '';
$inline_style = $this->get_description_inline_styles();
@@ -1103,7 +1066,7 @@ public function description( string $desc = '', $form_id = false ) : string {
* @param string $tag HTML tag for field.
* @return string HTML markup.
*/
- public function field_top( string $type = '', string $name = '', string $f_id = '', string $label = '', bool $req = false, bool $use_label = true, string $tag = 'p' ) : string {
+ public function field_top( string $type = '', string $name = '', string $f_id = '', string $label = '', bool $req = false, bool $use_label = true, string $tag = 'p' ): string {
$classes = [
'ctct-form-field',
@@ -1139,7 +1102,7 @@ public function field_top( string $type = '', string $name = '', string $f_id =
* @param string $tag HTML tag for field.
* @return string HTML markup
*/
- public function field_bottom( string $name = '', string $field_label = '', bool $use_label = true, string $tag = 'p' ) : string {
+ public function field_bottom( string $name = '', string $field_label = '', bool $use_label = true, string $tag = 'p' ): string {
$markup = '';
if ( ! empty( $name ) && ! empty( $field_label ) ) {
@@ -1160,7 +1123,7 @@ public function field_bottom( string $name = '', string $field_label = '', bool
*
* @return string
*/
- public function get_submit_inline_styles() : string {
+ public function get_submit_inline_styles(): string {
$inline_style = '';
$styles = [];
@@ -1194,7 +1157,7 @@ public function get_submit_inline_styles() : string {
* @param string $field_label Text to display as label.
* @return string HTML markup
*/
- public function get_label( string $f_id, string $field_label ) : string {
+ public function get_label( string $f_id, string $field_label ): string {
return '
';
}
@@ -1216,7 +1179,7 @@ public function get_label( string $f_id, string $field_label ) : string {
* @param int $instance Current form instance.
* @return string HTML markup for field.
*/
- public function input( string $type = 'text', string $name = '', string $id = '', string $value = '', string $label = '', bool $req = false, bool $f_only = false, bool $field_error = false, int $form_id = 0, string $label_placement = '', int $instance = 0, bool $show_label = true, string $date_part = '' ) : string {
+ public function input( string $type = 'text', string $name = '', string $id = '', string $value = '', string $label = '', bool $req = false, bool $f_only = false, bool $field_error = false, int $form_id = 0, string $label_placement = '', int $instance = 0, bool $show_label = true, string $date_part = '' ): string {
$id_salt = wp_rand();
$name = sanitize_text_field( $name );
$field_key = sanitize_title( $id );
@@ -1286,9 +1249,9 @@ public function input( string $type = 'text', string $name = '', string $id = ''
*/
$truncate_max_length = apply_filters( 'constant_contact_include_custom_field_label', false, $form_id );
$max_length = '';
- if ( false !== strpos( $id, 'custom___' ) ) {
+ if ( str_contains( $id, 'custom___' ) ) {
$max_length = $truncate_max_length ? $this->get_max_length_attr( $name ) : $this->get_max_length_attr();
- } elseif ( false !== strpos( $id, 'first_name___' ) || false !== strpos( $id, 'last_name___' ) ) {
+ } elseif ( str_contains( $id, 'first_name___' ) || str_contains( $id, 'last_name___' ) ) {
$max_length = 'maxlength="255"';
}
@@ -1381,7 +1344,7 @@ public function input( string $type = 'text', string $name = '', string $id = ''
* @param string $value Field value.
* @return string HTML markup for field.
*/
- public function input_hidden( string $name = '', string $value = '' ) : string {
+ public function input_hidden( string $name = '', string $value = '' ): string {
return sprintf(
'
',
sanitize_text_field( $name ),
@@ -1406,7 +1369,7 @@ public function input_hidden( string $name = '', string $value = '' ) : string {
* @param int $instance Current form instance.
* @return string HTML markup for checkbox.
*/
- public function checkbox( string $name = '', string $id = '', $value = [], string $label = '', bool $req = false, bool $field_error = false, int $form_id = 0, string $label_placement = '', int $instance = 0 ) : string {
+ public function checkbox( string $name = '', string $id = '', $value = [], string $label = '', bool $req = false, bool $field_error = false, int $form_id = 0, string $label_placement = '', int $instance = 0 ): string {
$name = sanitize_text_field( $name );
$field_key = sanitize_title( $id );
$field_id = "{$field_key}_$instance";
@@ -1511,7 +1474,7 @@ public function checkbox( string $name = '', string $id = '', $value = [], strin
* @param int $form_id Rendered form ID.
* @return string HTML markup.
*/
- public function submit( int $form_id = 0 ) : string {
+ public function submit( int $form_id = 0 ): string {
$button_text = get_post_meta( $form_id, '_ctct_button_text', true );
$button_text =
! empty( $button_text ) ?
@@ -1547,7 +1510,7 @@ public function submit( int $form_id = 0 ) : string {
* @param int $instance Current form instance.
* @return string Markup of optin form.
*/
- public function opt_in( array $form_data, int $instance = 0 ) : string {
+ public function opt_in( array $form_data, int $instance = 0 ): string {
if ( ! isset( $form_data['optin'] ) ) {
return '';
@@ -1578,7 +1541,7 @@ public function opt_in( array $form_data, int $instance = 0 ) : string {
* @param int $instance Current form instance.
* @return string HTML markup.
*/
- private function optin_display( array $optin, int $instance = 0 ) : string {
+ private function optin_display( array $optin, int $instance = 0 ): string {
$label = sanitize_text_field( $optin['instructions'] ?? '' );
@@ -1613,7 +1576,7 @@ private function optin_display( array $optin, int $instance = 0 ) : string {
* @param int $instance Current form instance.
* @return string HTML markup
*/
- public function get_optin_markup( string $label, string $value, string $show, int $instance = 0 ) : string {
+ public function get_optin_markup( string $label, string $value, string $show, int $instance = 0 ): string {
$checked = $show ? '' : 'checked';
$field_key = 'ctct-opt-in';
$field_id = "{$field_key}_$instance";
@@ -1640,7 +1603,7 @@ public function get_optin_markup( string $label, string $value, string $show, in
* @param int $instance Current form instance.
* @return string HTML markup.
*/
- public function address( string $name = '', string $field_key = '', array $value = [], string $desc = '', bool $req = false, string $field_error = '', int $form_id = 0, string $label_placement = 'top', int $instance = 0 ) : string {
+ public function address( string $name = '', string $field_key = '', array $value = [], string $desc = '', bool $req = false, string $field_error = '', int $form_id = 0, string $label_placement = 'top', int $instance = 0 ): string {
$field_id = "{$field_key}_$instance";
$street = esc_html__( 'Street Address', 'constant-contact-forms' );
$line_2 = esc_html__( 'Address Line 2', 'constant-contact-forms' );
@@ -1983,7 +1946,7 @@ public function anniversary( $name = '', $map = '', $value = '', $desc = '', $re
* @param int $instance Current form instance.
* @return string HTML markup.
*/
- public function textarea( string $name = '', string $map = '', string $value = '', string $desc = '', bool $req = false, string $field_error = '', string $extra_attrs = '', string $label_placement = 'top', int $instance = 0 ) : string {
+ public function textarea( string $name = '', string $map = '', string $value = '', string $desc = '', bool $req = false, string $field_error = '', string $extra_attrs = '', string $label_placement = 'top', int $instance = 0 ): string {
$classes = [ 'ctct-form-field', 'comment-form-comment' ];
$textarea_classes = [ 'ctct-textarea' ];
@@ -2035,7 +1998,7 @@ public function textarea( string $name = '', string $map = '', string $value = '
* @param array $form_data Form data.
* @return string HTML markup
*/
- public function maybe_add_disclose_note( array $form_data ) : string {
+ public function maybe_add_disclose_note( array $form_data ): string {
$opts = $form_data['options'] ?? false;
@@ -2069,7 +2032,7 @@ public function maybe_add_disclose_note( array $form_data ) : string {
*
* @return string HTML markup.
*/
- public function get_disclose_text() : string {
+ public function get_disclose_text(): string {
/**
* Filters the content used to display the disclose text.
@@ -2095,7 +2058,7 @@ public function get_disclose_text() : string {
*
* @return string
*/
- public function get_inner_disclose_text() : string {
+ public function get_inner_disclose_text(): string {
$alternative_legal_text = constant_contact_get_option( '_ctct_alternative_legal_text' );
@@ -2127,7 +2090,7 @@ public function get_inner_disclose_text() : string {
* @param string $optional_label Optional label.
* @return string
*/
- public function get_max_length_attr( string $optional_label = '' ) : string {
+ public function get_max_length_attr( string $optional_label = '' ): string {
$length = 253; // Two less than 255char custom field limit for ": ".
$label_length = 0;
@@ -2150,7 +2113,7 @@ public function get_max_length_attr( string $optional_label = '' ) : string {
* @since 2.15.0
* @return string
*/
- public function get_form_date_separator() : string {
+ public function get_form_date_separator(): string {
// https://en.wikipedia.org/wiki/List_of_date_formats_by_country
/**
* Filters the character to use to separate out the date fields visually.
@@ -2170,7 +2133,7 @@ public function get_form_date_separator() : string {
*
* @return string
*/
- private function get_inline_font_color() : string {
+ private function get_inline_font_color(): string {
$inline_font_styles = '';
if ( ! empty( $this->specific_form_styles['form_description_color'] ) ) {
$inline_font_styles = $this->specific_form_styles['form_description_color'];
@@ -2186,7 +2149,7 @@ private function get_inline_font_color() : string {
*
* @return string The required indicator markup.
*/
- public function display_required_indicator() : string {
+ public function display_required_indicator(): string {
$title_attr = esc_attr__( 'This is a required field', 'constant-contact-forms' );
/**
@@ -2207,7 +2170,7 @@ public function display_required_indicator() : string {
* @param int $instance Current instance of form.
* @return string HTML markup for instance field.
*/
- protected function create_instance_field( int $instance ) : string {
+ protected function create_instance_field( int $instance ): string {
return $this->input_hidden( 'ctct-instance', absint( $instance ) );
}
}
diff --git a/includes/class-elementor.php b/includes/class-elementor.php
index c9f4e9e6c..0bb659902 100644
--- a/includes/class-elementor.php
+++ b/includes/class-elementor.php
@@ -44,7 +44,7 @@ public function __construct( object $plugin ) {
*
* @since 1.10.0
*/
- private function hooks() {
+ private function hooks(): void {
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_widget' ] );
}
@@ -53,7 +53,7 @@ private function hooks() {
*
* @since 1.10.0
*/
- public function register_widget() {
+ public function register_widget(): void {
require_once __DIR__ . '/widgets/elementor-widget.php';
Plugin::instance()->widgets_manager->register( new ConstantContact_Elementor_Widget() );
}
diff --git a/includes/class-hcaptcha.php b/includes/class-hcaptcha.php
index 7c3410afa..a0fe908e3 100644
--- a/includes/class-hcaptcha.php
+++ b/includes/class-hcaptcha.php
@@ -91,7 +91,7 @@ public function get_hcaptcha_keys() : array {
*
* @since 2.9.0
*/
- public function set_hcaptcha_keys() {
+ public function set_hcaptcha_keys(): void {
$keys = $this->get_hcaptcha_keys();
$this->site_key = $keys['site_key'];
@@ -130,7 +130,7 @@ public function get_theme() : string {
*
* @param string $theme hCaptcha theme to use.
*/
- public function set_theme( string $theme ) {
+ public function set_theme( string $theme ): void {
$this->theme = $theme;
}
@@ -152,7 +152,7 @@ public function get_size() : string {
*
* @param string $size hCaptcha size to specify.
*/
- public function set_size( string $size ) {
+ public function set_size( string $size ): void {
$this->size = $size;
}
@@ -174,7 +174,7 @@ public function get_language() : string {
*
* @param string $language Language code for the hCaptcha object.
*/
- public function set_language( string $language ) {
+ public function set_language( string $language ): void {
$this->language = $language;
}
@@ -196,7 +196,7 @@ public function get_mode() : string {
*
* @param string $mode hCaptcha mode to use.
*/
- public function set_mode( string $mode ) {
+ public function set_mode( string $mode ): void {
$this->mode = $mode;
}
@@ -205,7 +205,7 @@ public function set_mode( string $mode ) {
*
* @since 2.9.0
*/
- public function enqueue_scripts() {
+ public function enqueue_scripts(): void {
$this->set_hcaptcha_keys();
if ( ! self::has_hcaptcha_keys() ) {
diff --git a/includes/class-lists.php b/includes/class-lists.php
index aedddf7a8..9f3b28c9e 100644
--- a/includes/class-lists.php
+++ b/includes/class-lists.php
@@ -7,8 +7,6 @@
* @author Constant Contact
* @since 1.0.0
*
- * todo: when user is disconnected then the lists should be removed
- *
* phpcs:disable WebDevStudios.All.RequireAuthor -- Don't require author tag in docblocks.
*/
@@ -23,18 +21,18 @@ class ConstantContact_Lists {
* Parent plugin class.
*
* @since 1.0.0
- * @var object
+ * @var Constant_Contact
*/
- protected $plugin;
+ protected Constant_Contact $plugin;
/**
* Constructor.
*
* @since 1.0.0
*
- * @param object $plugin Plugin base class.
+ * @param Constant_Contact $plugin Plugin base class.
*/
- public function __construct( $plugin ) {
+ public function __construct( Constant_Contact $plugin ) {
$this->plugin = $plugin;
$this->hooks();
}
@@ -44,7 +42,7 @@ public function __construct( $plugin ) {
*
* @since 1.0.0
*/
- public function hooks() {
+ public function hooks(): void {
add_action( 'cmb2_admin_init', [ $this, 'sync_lists' ] );
add_action( 'cmb2_admin_init', [ $this, 'add_lists_metabox' ] );
@@ -76,7 +74,7 @@ public function hooks() {
*
* @since 1.0.0
*/
- public function add_lists_metabox() {
+ public function add_lists_metabox(): void {
$cmb = new_cmb2_box(
[
@@ -111,7 +109,7 @@ public function add_lists_metabox() {
* @param string $field_type_object Field type object.
* @return void
*/
- public function list_info_metabox( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
+ public function list_info_metabox( $field, $escaped_value, $object_id, $object_type, $field_type_object ): void {
if ( ! $object_id ) {
echo wp_kses_post( $this->get_list_info_no_data() );
@@ -178,7 +176,7 @@ public function list_info_metabox( $field, $escaped_value, $object_id, $object_t
*
* @return string
*/
- public function get_list_info_no_data() {
+ public function get_list_info_no_data(): string {
return '
' . esc_html__( 'List information will populate upon saving.', 'constant-contact-forms' ) . '';
}
@@ -187,7 +185,7 @@ public function get_list_info_no_data() {
*
* @since 1.0.0
*/
- public function add_form_css() {
+ public function add_form_css(): void {
wp_enqueue_style( 'constant-contact-forms-admin' );
}
@@ -196,10 +194,12 @@ public function add_form_css() {
*
* @since 1.0.0
*
+ * @throws Exception
+ *
* @param bool $force Whether or not to force syncing.
* @return void
*/
- public function sync_lists( $force = false ) {
+ public function sync_lists( bool $force = false ): void {
global $pagenow;
if ( ! $pagenow || ( ! in_array( $pagenow, [ 'edit.php' ], true ) ) ) {
return;
@@ -298,7 +298,7 @@ public function sync_lists( $force = false ) {
$lists_to_insert = constant_contact()->get_api()->get_lists( true );
- if ( $lists_to_insert && is_array( $lists_to_insert ) ) {
+ if ( $lists_to_insert ) {
if ( count( $lists_to_insert ) >= 1001 ) {
$this->plugin->get_updates()->add_notification( 'too_many_lists' );
@@ -411,10 +411,12 @@ public function sync_lists( $force = false ) {
*
* @since 1.0.0
*
+ * @throws Exception
+ *
* @param int $post_id wp post id.
* @return bool Whether or not it worked.
*/
- public function save_or_update_list( $post_id ) {
+ public function save_or_update_list( int $post_id ): bool {
global $pagenow;
@@ -479,15 +481,12 @@ public function save_or_update_list( $post_id ) {
*
* @since 1.0.0
*
- * @param object $ctct_list WP Post object.
+ * @throws Exception
+ *
+ * @param WP_Post $ctct_list WP Post object.
* @return bool
*/
- public function add_list( $ctct_list ) {
-
- if ( empty( $ctct_list ) ) {
- return false;
- }
-
+ public function add_list( WP_Post $ctct_list ): bool {
$name = $this->set_unique_list_name( $ctct_list->ID, $ctct_list->post_title );
$list = constant_contact()->get_api()->add_list(
[
@@ -496,11 +495,9 @@ public function add_list( $ctct_list ) {
);
$list_id = false;
- $list = (object) $list; // Comes in as array.
-
- if ( ! empty( $list->list_id ) ) {
- add_post_meta( $ctct_list->ID, '_ctct_list_id', esc_attr( $list->list_id ) );
- $list_id = $list->list_id;
+ if ( ! empty( $list['list_id'] ) ) {
+ add_post_meta( $ctct_list->ID, '_ctct_list_id', esc_attr( $list['list_id'] ) );
+ $list_id = $list['list_id'];
}
/**
@@ -528,7 +525,7 @@ public function add_list( $ctct_list ) {
*/
do_action( 'constant_contact_update_list', $ctct_list->ID, $list_id, $list );
- return is_object( $list ) && isset( $list->list_id );
+ return true;
}
/**
@@ -540,7 +537,7 @@ public function add_list( $ctct_list ) {
* @param string $title Post title.
* @return string
*/
- public function set_unique_list_name( $id, $title = '' ) {
+ public function set_unique_list_name( int $id, string $title = '' ): string {
$original_title = $title;
$lists = $this->get_lists( true );
@@ -559,7 +556,7 @@ public function set_unique_list_name( $id, $title = '' ) {
// If our string contains what we tacked on previously,
// just remove it.
- if ( strpos( $title, ' (' . $increment . ')' ) !== false ) {
+ if ( str_contains( $title, ' (' . $increment . ')' ) ) {
$title = str_replace( ' (' . $increment . ')', '', $title );
}
@@ -590,19 +587,13 @@ public function set_unique_list_name( $id, $title = '' ) {
* @param array $lists Lists to search in.
* @return bool If exists.
*/
- public function check_if_list_exists_by_title( $title, $lists = [] ) {
+ public function check_if_list_exists_by_title( string $title, array $lists = [] ): bool {
if ( empty( $lists ) ) {
$lists = $this->get_lists();
}
- foreach ( $lists as $list ) {
- if ( $title === $list ) {
- return true;
- }
- }
-
- return false;
+ return in_array( $title, $lists, true );
}
/**
diff --git a/includes/class-logging.php b/includes/class-logging.php
index 8aad77dec..530a933de 100644
--- a/includes/class-logging.php
+++ b/includes/class-logging.php
@@ -29,9 +29,9 @@ class ConstantContact_Logging {
* Parent plugin class.
*
* @since 1.3.7
- * @var object
+ * @var Constant_Contact
*/
- protected object $plugin;
+ protected Constant_Contact $plugin;
/**
* Logging admin page URL.
@@ -112,9 +112,11 @@ class ConstantContact_Logging {
*
* @since 1.3.7
*
- * @param object $plugin Parent class.
+ * @throws Exception
+ *
+ * @param Constant_Contact $plugin Parent class.
*/
- public function __construct( $plugin ) {
+ public function __construct( Constant_Contact $plugin ) {
$this->plugin = $plugin;
$this->options_url = admin_url( 'edit.php?post_type=ctct_forms&page=ctct_options_logging' );
$uploads_dir = wp_upload_dir();
@@ -139,7 +141,7 @@ public function __construct( $plugin ) {
*
* @since 1.3.7
*/
- public function hooks() {
+ public function hooks(): void {
add_action( 'admin_menu', [ $this, 'add_options_page' ] );
add_action( 'admin_init', [ $this, 'delete_log_file' ] );
add_action( 'admin_init', [ $this, 'maybe_delete_old_log_dir' ] );
@@ -153,7 +155,7 @@ public function hooks() {
*
* @since 1.3.7
*/
- public function scripts() {
+ public function scripts(): void {
$screen = get_current_screen();
if ( 'ctct_forms_page_ctct_options_logging' !== $screen->base ) {
return;
@@ -168,7 +170,7 @@ public function scripts() {
*
* @since 1.3.7
*/
- public function dialog() {
+ public function dialog(): void {
?>
@@ -181,7 +183,7 @@ public function dialog() {
*
* @since 1.3.7
*/
- public function add_options_page() {
+ public function add_options_page(): void {
$debugging_enabled = constant_contact_get_option( '_ctct_logging', '' );
@@ -206,7 +208,7 @@ public function add_options_page() {
* @author Michael Beckwith
* @since 1.4.5
*/
- public function set_file_system() {
+ public function set_file_system(): void {
global $wp_filesystem;
WP_Filesystem();
$this->file_system = $wp_filesystem;
@@ -217,7 +219,7 @@ public function set_file_system() {
*
* @since 1.3.7
*/
- public function admin_page_display() {
+ public function admin_page_display(): void {
// We will be nice and remove the exception/error status once they visit the logging page.
constant_contact_set_has_exceptions( 'false' );
@@ -245,7 +247,7 @@ public function admin_page_display() {
}
if ( is_file( $this->log_location_file ) && is_readable( $this->log_location_file ) ) {
- $contents = file_get_contents( $this->log_location_file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Not reading over network, it's on the filesystem.
+ $contents = $this->file_system->get_contents( $this->log_location_file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Not reading over network, it's on the filesystem.
}
?>
@@ -265,7 +267,7 @@ public function admin_page_display() {