Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
c2efecc
types and return types
tw2113 May 4, 2026
b5fbf19
make use of full url instead of relative
tw2113 May 4, 2026
97bd759
rename callback, add param type and remove early return for is_array
tw2113 May 4, 2026
2c5e2f4
param and return types
tw2113 May 4, 2026
635d999
remove unused variables
tw2113 May 4, 2026
3aa2485
one more param and return type
tw2113 May 4, 2026
b92a130
param and return types
tw2113 May 4, 2026
47e8e0a
absolute urls
tw2113 May 4, 2026
aa2a94b
param and return types
tw2113 May 4, 2026
c33ff6c
param and return types
tw2113 May 4, 2026
50b2ed6
param and return types
tw2113 May 4, 2026
e5d6792
param and return types
tw2113 May 4, 2026
3643c2e
simplify transient life declaration
tw2113 May 4, 2026
15d9210
param and return types
tw2113 May 4, 2026
482d578
number our placeholders
tw2113 May 4, 2026
e0c817f
remove unused function
tw2113 May 4, 2026
ed1127e
param, return types, remove unused code
tw2113 May 4, 2026
b7de872
return type
tw2113 May 4, 2026
ea9ce8b
return type and property type
tw2113 May 11, 2026
705ef11
phpdocs and return types
tw2113 May 11, 2026
7628a4d
string_contains usage
tw2113 May 11, 2026
7581e82
remove unneeded local variable
tw2113 May 11, 2026
54eac76
simplify ternary, remove unneeded check
tw2113 May 11, 2026
38849bb
missed phpdoc, assign a variable
tw2113 May 11, 2026
e3a470a
numbered placeholder, use getMessage method
tw2113 May 11, 2026
647be28
specify our class
tw2113 May 11, 2026
262f0b1
exception throw doc
tw2113 May 11, 2026
a918a59
we would already fatal if not receiving array. Needless check
tw2113 May 11, 2026
16129d1
missed var declaration
tw2113 May 11, 2026
c595953
return type spacing
tw2113 May 11, 2026
cabc6b8
more return types
tw2113 May 11, 2026
bf397f4
return an empty array, we also already have a value to use at this point
tw2113 May 11, 2026
e6ef11e
str_contains usage
tw2113 May 11, 2026
49c386e
the great str_contains switch
tw2113 May 11, 2026
406c314
resolve fatal error
tw2113 May 11, 2026
81c2937
docs and return types
tw2113 May 11, 2026
c877242
str_starts_with
tw2113 May 11, 2026
f80a8a8
cast filter return type to bool
tw2113 May 11, 2026
3bf2d57
return type
tw2113 May 11, 2026
49a7c48
return and param types
tw2113 May 11, 2026
49d61cc
no need for a static variable, as we are not calling outside of WP
tw2113 May 13, 2026
e00e06d
class casting, return types
tw2113 May 19, 2026
1276cc0
class casting, return types, parameter type changes
tw2113 May 19, 2026
0abf66e
force form_id to int for consistency
tw2113 May 19, 2026
166a7dd
param and return types
tw2113 May 19, 2026
eb01d24
switch to using wp_filesystem to fetch contents. remove unused method…
tw2113 May 19, 2026
07e36fe
class,param, return types
tw2113 May 19, 2026
97eee60
sprintf numbered placeholders
tw2113 May 19, 2026
ef3f50a
update return types
tw2113 May 19, 2026
107d620
we should have a list object for sure by now
tw2113 May 19, 2026
80714cf
parameter, return types
tw2113 May 19, 2026
ef124e0
we should for sure have an array
tw2113 May 19, 2026
f827869
remove unneeded object casting
tw2113 May 19, 2026
9f71c6e
covert from foreach to in_array
tw2113 May 19, 2026
9318dd7
property and method types, return types, parameter types
tw2113 May 21, 2026
74b987a
property and method types, return types, parameter types
tw2113 May 21, 2026
715e1c1
remove array check because we force arrays as a parameter
tw2113 May 21, 2026
30fb409
reduce complexity in value references for arrays
tw2113 May 21, 2026
c11b581
reduced if statement complexity
tw2113 May 21, 2026
4d16d7a
property types
tw2113 May 21, 2026
5f21cd3
return types, remove unused parameters deprecated many years ago
tw2113 May 21, 2026
3d0206d
return types, alignment
tw2113 May 21, 2026
0eb76ea
remove a REALLY old unused method
tw2113 May 21, 2026
6167699
sync return type already used in concatenation
tw2113 May 21, 2026
0987566
remove unneeded key variable
tw2113 May 21, 2026
087215f
enforce int type on currently single used method
tw2113 May 21, 2026
9a2e0aa
return type cleanup
tw2113 May 21, 2026
c5cd272
remove unused parameter
tw2113 May 21, 2026
79265cb
numbered placeholder
tw2113 May 21, 2026
4d48237
return types in uninstall file
tw2113 Jun 15, 2026
2021ffe
return types in update file
tw2113 Jun 15, 2026
e996834
return types in turnstile file
tw2113 Jun 15, 2026
e5f20d2
param and return types
tw2113 Jun 15, 2026
fbee798
param and return types for captchas
tw2113 Jun 25, 2026
e9c2ccc
return types
tw2113 Jun 25, 2026
d34d3a7
default to empty array for no get_option value
tw2113 Jun 25, 2026
db7e482
fix php docs
tw2113 Jun 25, 2026
74ccea2
prevent null return
tw2113 Jul 1, 2026
3ba228a
throws and phpdoc ordering
tw2113 Jul 7, 2026
0b47e63
clean up get magic method. we have other methods for path/url
tw2113 Jul 7, 2026
7776d95
call url method instead of property directly
tw2113 Jul 7, 2026
f2c6f47
call url method instead of property directly
tw2113 Jul 7, 2026
eaa2457
return types and docs
tw2113 Jul 7, 2026
2e6c0ab
numerical placeholders
tw2113 Jul 7, 2026
0ac3a55
return types
tw2113 Jul 7, 2026
490d96a
return types
tw2113 Jul 7, 2026
e9e0661
spacing
tw2113 Jul 7, 2026
88773e5
switch from switch to match. PHP8.0+
tw2113 Jul 7, 2026
7d0bd8a
return type
tw2113 Jul 7, 2026
c554645
throws tags and return types
tw2113 Jul 7, 2026
8d796a6
return types
tw2113 Jul 7, 2026
a2f34a1
placeholder numbers
tw2113 Jul 7, 2026
dcdb3d5
exception tag
tw2113 Jul 7, 2026
7dfc480
many return types
tw2113 Jul 7, 2026
ac7da26
removal of unneeded brackets
tw2113 Jul 7, 2026
21292a7
param types and values
tw2113 Jul 7, 2026
ea67fa7
return types
tw2113 Jul 7, 2026
6eac8ed
touchup force_disconnect params and docs
tw2113 Jul 7, 2026
4b089c2
remove unused methods. closes #847
tw2113 Jul 7, 2026
eaa0c1a
adjust user login return types
tw2113 Jul 7, 2026
72c7dd1
return and throws
tw2113 Jul 7, 2026
931c414
placeholders
tw2113 Jul 7, 2026
836454a
return types for elementor widgets class
tw2113 Jul 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions constant-contact-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* @param string $class_name Name of the class being requested.
* @return null
*/
function constant_contact_autoload_classes( string $class_name ) {
function constant_contact_autoload_classes( string $class_name ): null {
if ( ! str_starts_with( $class_name, 'ConstantContact_' ) ) {
return null;
}
Expand Down Expand Up @@ -114,6 +114,8 @@ class Constant_Contact {
/**
* Singleton instance of plugin.
*
* @todo Leave off the class delcaration. It's causing fatal errors.
*
* @since 1.0.0
* @var Constant_Contact
*/
Expand Down Expand Up @@ -590,11 +592,19 @@ public function ajax_save_clear_first_form() {
public function __get( $field ) {
return match ( $field ) {
'version' => self::VERSION,
'basename', 'path', 'url' => $this->$field,
default => throw new Exception( 'Invalid ' . __CLASS__ . ' property: ' . $field ),
};
}

/**
* Basename getter
* @since NEXT
* @return string
*/
public function get_basename(): string {
return $this->basename;
}

/**
* Admin getter
* @since 2.11.0
Expand Down
22 changes: 12 additions & 10 deletions includes/class-admin-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ class ConstantContact_Admin_Pages {
* 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 parent.
*
* @param Constant_Contact $plugin Plugin parent.
*/
public function __construct( $plugin ) {
public function __construct( Constant_Contact $plugin ) {
$this->plugin = $plugin;
$this->hooks();
}
Expand All @@ -41,7 +43,7 @@ public function __construct( $plugin ) {
*
* @since 1.0.0
*/
public function hooks() {
public function hooks(): void {
add_action( 'admin_enqueue_scripts', [ $this, 'styles' ] );
}

Expand All @@ -50,7 +52,7 @@ public function hooks() {
*
* @since 1.0.0
*/
public function styles() {
public function styles(): void {
wp_enqueue_style( 'constant-contact-forms-admin' );
wp_enqueue_script( 'ctct_form' );
}
Expand All @@ -60,7 +62,7 @@ public function styles() {
*
* @since 1.0.0
*/
public function about_page() {
public function about_page(): void {

$auth_link = '';
$new_link = '';
Expand Down Expand Up @@ -139,8 +141,8 @@ public function about_page() {

<div class="ctct-section">
<div class="ctct-button-actions">
<a href="post-new.php?post_type=ctct_forms" class="button button-primary"><?php esc_html_e( 'Add contact form', 'constant-contact-forms' ); ?></a>
<a href="edit.php?post_type=ctct_lists" class="button"><?php esc_html_e( 'View lists', 'constant-contact-forms' ); ?></a>
<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=ctct_forms' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Add contact form', 'constant-contact-forms' ); ?></a>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=ctct_lists' ) ); ?>" class="button"><?php esc_html_e( 'View lists', 'constant-contact-forms' ); ?></a>
</div>
</div>

Expand Down Expand Up @@ -170,7 +172,7 @@ public function about_page() {
*
* @since 1.0.1
*/
public function license_page() {
public function license_page(): void {
$license_text = $this->plugin->get_license_text();
?>
<h2><?php esc_attr_e( 'Constant Contact Forms - License', 'constant-contact-forms' ); ?></h2>
Expand Down
55 changes: 18 additions & 37 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ class ConstantContact_Admin {
* @since 1.0.0
* @var object
*/
protected $plugin;
protected Constant_Contact $plugin;

/**
* Parent plugin class.
*
* @since 1.0.0
* @var object
*/
protected $basename;
protected string $basename;

/**
* The parent menu page slug.
Expand Down Expand Up @@ -92,7 +92,7 @@ public function __construct( Constant_Contact $plugin, string $basename ) {
*
* @since 1.0.0
*/
public function hooks() {
public function hooks(): void {

add_action( 'current_screen', [ $this, 'current_screen' ] );
add_action( 'admin_init', [ $this, 'init' ] );
Expand All @@ -104,7 +104,7 @@ public function hooks() {
add_filter( 'manage_ctct_lists_posts_columns', [ $this, 'set_custom_lists_columns' ] );
add_action( 'manage_ctct_lists_posts_custom_column', [ $this, 'custom_lists_columns' ], 10, 2 );

add_filter( 'plugin_action_links_' . $this->basename, [ $this, 'add_social_links' ] );
add_filter( 'plugin_action_links_' . $this->basename, [ $this, 'add_custom_links' ] );

add_action( 'admin_enqueue_scripts', [ $this, 'scripts' ] );
}
Expand All @@ -117,7 +117,7 @@ public function hooks() {
* @since 1.11.0
* @author Darren Cooney <darren.cooney@webdevstudios.com>
*/
public function current_screen( WP_Screen $screen ) {
public function current_screen( WP_Screen $screen ): void {
if ( constant_contact()->is_constant_contact() ) {
add_action( 'in_admin_header', [ $this, 'admin_page_toolbar' ] );
}
Expand All @@ -131,7 +131,7 @@ public function current_screen( WP_Screen $screen ) {
* @since 1.11.0
* @author Darren Cooney <darren.cooney@webdevstudios.com>
*/
public function admin_page_toolbar() {
public function admin_page_toolbar(): void {

global $submenu, $submenu_file, $plugin_page;

Expand Down Expand Up @@ -215,7 +215,7 @@ public function admin_page_toolbar() {
echo wp_kses( '</ul>', [ 'ul' => [] ] );
}
?>
<a href="edit.php?post_type=ctct_forms&page=ctct_options_connect" class="ctct-status ctct-<?php echo esc_attr( $api_status ); ?>" title="<?php echo esc_attr( $connect_alt ); ?>">
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=ctct_forms&page=ctct_options_connect' ) ); ?>" class="ctct-status ctct-<?php echo esc_attr( $api_status ); ?>" title="<?php echo esc_attr( $connect_alt ); ?>">
<?php echo esc_html( $connect_title ); ?>
</a>
</div>
Expand All @@ -227,7 +227,7 @@ public function admin_page_toolbar() {
*
* @since 1.0.0
*/
public function init() {
public function init(): void {
register_setting( $this->key, $this->key );
}

Expand All @@ -236,7 +236,7 @@ public function init() {
*
* @since 1.0.0
*/
public function add_options_page() {
public function add_options_page(): void {

add_submenu_page(
$this->parent_menu_slug,
Expand Down Expand Up @@ -270,7 +270,7 @@ public function add_options_page() {
*
* @since 1.0.0
*/
public function admin_page_display() {
public function admin_page_display(): void {

/**
* Fires before the Constant Contact admin page display.
Expand Down Expand Up @@ -321,12 +321,12 @@ public function admin_page_display() {
*
* @since 1.0.0
*
* @throws Exception Throws an exception if the field is invalid.
*
* @param string $field Field to retrieve.
* @return mixed Field value or exception is thrown.
*
* @return mixed Field value or exception is thrown.
* @throws Exception Throws an exception if the field is invalid.
*/
public function __get( $field ) {
public function __get( string $field ) {

$field = esc_attr( $field );

Expand Down Expand Up @@ -370,7 +370,7 @@ public function set_custom_columns( array $columns ) : array {
*
* @return void
*/
public function custom_columns( string $column, int $post_id ) {
public function custom_columns( string $column, int $post_id ): void {
$post_id = absint( $post_id );

if ( ! $post_id ) {
Expand Down Expand Up @@ -511,7 +511,7 @@ public function set_custom_lists_columns( array $columns ) : array {
*
* @return void
*/
public function custom_lists_columns( string $column, int $post_id ) {
public function custom_lists_columns( string $column, int $post_id ): void {

$post_id = absint( $post_id );

Expand Down Expand Up @@ -544,11 +544,7 @@ public function custom_lists_columns( string $column, int $post_id ) {
*
* @return array
*/
public function add_social_links( $links ): array {

if ( ! is_array( $links ) ) {
return $links;
}
public function add_custom_links( array $links ): array {

$add_links[] = $this->get_admin_link( esc_html__( 'Settings', 'constant-contact-forms' ), 'settings_general' );

Expand Down Expand Up @@ -608,7 +604,7 @@ public function get_admin_link( string $text, string $link_slug = '', $add_form
* @param array $extra_localizations Optional. An array of arrays of `[ $handle, $name, $data ]` passed to wp_localize_script.
* @return void
*/
public function scripts( $extra_localizations = [] ) {
public function scripts( $extra_localizations = [] ): void {

global $pagenow;

Expand Down Expand Up @@ -662,9 +658,6 @@ public function scripts( $extra_localizations = [] ) {
wp_enqueue_script( 'ctct_form' );
}

$current_screen = get_current_screen();
$is_block = is_object( $current_screen ) ? $current_screen->is_block_editor : true;

/**
* Filters the allowed pages to enqueue the ctct_form script on.
*
Expand Down Expand Up @@ -721,15 +714,3 @@ public function get_associated_list_by_id( string $list_id ) {
return [];
}
}

/**
* Wrapper function around cmb2_get_option.
*
* @since 1.0.0
*
* @param string $key Options array key.
* @return mixed Option value.
*/
function constantcontact_get_option( $key = '' ) {
return cmb2_get_option( constant_contact()->get_admin()->key, $key );
}
2 changes: 1 addition & 1 deletion includes/class-api-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function obfuscate_api_data_item( string $data_item ): string {
* @param string $access_token
* @return array
*/
public function parse_access_token_data( string $access_token ) {
public function parse_access_token_data( string $access_token ): array {
if ( empty( $access_token ) ) {
return [];
}
Expand Down
Loading