From 95a9accc5adac9f12032e433542d03d95e73a70d Mon Sep 17 00:00:00 2001 From: itthinx Date: Sun, 26 Feb 2023 12:36:47 +0100 Subject: [PATCH 1/8] version 4.18.0 --- affiliates.php | 4 ++-- changelog.txt | 3 +++ readme.txt | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/affiliates.php b/affiliates.php index 8e7690c..5d8cfba 100644 --- a/affiliates.php +++ b/affiliates.php @@ -21,7 +21,7 @@ * Plugin Name: Affiliates * Plugin URI: http://www.itthinx.com/plugins/affiliates * Description: The Affiliates plugin provides the right tools to maintain a partner referral program. - * Version: 4.17.0 + * Version: 4.18.0 * Author: itthinx * Author URI: http://www.itthinx.com * Donate-Link: http://www.itthinx.com @@ -35,7 +35,7 @@ } if ( !defined( 'AFFILIATES_CORE_VERSION' ) ) { - define( 'AFFILIATES_CORE_VERSION', '4.17.0' ); + define( 'AFFILIATES_CORE_VERSION', '4.18.0' ); define( 'AFFILIATES_PLUGIN_NAME', 'affiliates' ); define( 'AFFILIATES_FILE', __FILE__ ); define( 'AFFILIATES_PLUGIN_BASENAME', plugin_basename( AFFILIATES_FILE ) ); diff --git a/changelog.txt b/changelog.txt index 2899349..3ff7be4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ == Affiliates - Changelog == += 4.18.0 = +* WordPress 6.2 compatible. + = 4.17.0 = * WordPress 6.1 compatible. * Requires at least WordPress 5.8. diff --git a/readme.txt b/readme.txt index 64cf1b9..3e90173 100644 --- a/readme.txt +++ b/readme.txt @@ -3,9 +3,9 @@ Contributors: itthinx, proaktion Donate link: https://www.itthinx.com/shop/ Tags: affiliate, affiliates, affiliate marketing, referral, growth marketing, ads, AddToAny, AddThis, advertising, affiliate plugin, affiliate tool, contact form, contact form 7, downloads, e-commerce, Ecwid, Events Manager, Jigoshop, lead, link, marketing, money, partner, Pay per Click, PayPal, PPC, referral links, referrer, sales, shopping cart, track, transaction, WooCommerce Requires at least: 5.8 -Tested up to: 6.1 +Tested up to: 6.2 Requires PHP: 5.6.0 -Stable tag: 4.17.0 +Stable tag: 4.18.0 License: GPLv3 The Affiliates system provides the most powerful growth-oriented tools to run a successful Affiliate Marketing Program. From 1b29d2681a4419210390b46e93602c10dde30c16 Mon Sep 17 00:00:00 2001 From: itthinx Date: Sun, 26 Feb 2023 13:36:46 +0100 Subject: [PATCH 2/8] year updated --- COPYRIGHT.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 5e975f0..7078647 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -1,7 +1,7 @@ The Affiliates WordPress Plugin - Copyright 2010 - 2022 "kento" (Karim Rahimpur) www.itthinx.com + Copyright 2010 - 2023 "kento" (Karim Rahimpur) www.itthinx.com The files COPYRIGHT.txt and LICENSE.txt as well as ALL NOTICES IN THE HEADERS OF ALL FILES MUST BE KEPT INTACT. From 24df998e7f3f4f24f963b7e083d05038be4260c4 Mon Sep 17 00:00:00 2001 From: itthinx Date: Sun, 26 Feb 2023 13:49:53 +0100 Subject: [PATCH 3/8] min WP 5.9 --- changelog.txt | 1 + readme.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 3ff7be4..1d1b50d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ = 4.18.0 = * WordPress 6.2 compatible. +* Requires at least WordPress 5.9. = 4.17.0 = * WordPress 6.1 compatible. diff --git a/readme.txt b/readme.txt index 3e90173..7d5d62c 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: itthinx, proaktion Donate link: https://www.itthinx.com/shop/ Tags: affiliate, affiliates, affiliate marketing, referral, growth marketing, ads, AddToAny, AddThis, advertising, affiliate plugin, affiliate tool, contact form, contact form 7, downloads, e-commerce, Ecwid, Events Manager, Jigoshop, lead, link, marketing, money, partner, Pay per Click, PayPal, PPC, referral links, referrer, sales, shopping cart, track, transaction, WooCommerce -Requires at least: 5.8 +Requires at least: 5.9 Tested up to: 6.2 Requires PHP: 5.6.0 Stable tag: 4.18.0 From daab7f1f316c37575de126d569a2301e62c99d32 Mon Sep 17 00:00:00 2001 From: itthinx Date: Sun, 26 Feb 2023 16:03:22 +0100 Subject: [PATCH 4/8] adds basic admin class, plugin action links, allows to unhide the welcome note --- changelog.txt | 7 ++ lib/core/class-affiliates-admin.php | 106 ++++++++++++++++++ .../class-affiliates-settings-general.php | 6 +- lib/core/class-affiliates-settings.php | 10 +- lib/core/wp-init.php | 1 + 5 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 lib/core/class-affiliates-admin.php diff --git a/changelog.txt b/changelog.txt index 1d1b50d..8d5f4d6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,13 @@ = 4.18.0 = * WordPress 6.2 compatible. * Requires at least WordPress 5.9. +* Adds a plugin link to the settings. +* Adds a plugin link to the documentation. +* Adds a plugin link to reveal the welcome note when it is hidden. +* Adds the affiliates_settings_before_section action. +* Adds the affiliates_settings_after_section action. +* Adds the affiliates_settings_general_before_form action. +* Adds the affiliates_settings_general_after_form action. = 4.17.0 = * WordPress 6.1 compatible. diff --git a/lib/core/class-affiliates-admin.php b/lib/core/class-affiliates-admin.php new file mode 100644 index 0000000..261b0b3 --- /dev/null +++ b/lib/core/class-affiliates-admin.php @@ -0,0 +1,106 @@ +%s', + esc_url( get_admin_url( 'admin.php?page=affiliates-admin-settings' ) ), + esc_html__( 'Settings', 'affiliates' ) + ); + } + + $links['documentation'] = sprintf( + '%s', + esc_url( 'https://docs.itthinx.com/document/affiliates/' ), + esc_html__( 'Documentation', 'affiliates' ) + ); + + if ( get_option( 'aff_setup_hide', false ) ) { + $links['welcome'] = sprintf( + '%s', + esc_url( + wp_nonce_url( + add_query_arg( 'aff_setup_show', 'true', get_admin_url( null, 'admin.php?page=affiliates-admin-settings' ) ), + 'aff_setup_show', + 'aff_setup_nonce' + ) + ), + esc_html__( 'Show the welcome note', 'affiliates' ), + esc_html__( 'Welcome', 'affiliates' ) + ); + } + + if ( $deactivate !== null ) { + $links['deactivate'] = $deactivate; + } + + return $links; + } + +} +Affiliates_Admin::init(); diff --git a/lib/core/class-affiliates-settings-general.php b/lib/core/class-affiliates-settings-general.php index 8d32f4c..02f1136 100644 --- a/lib/core/class-affiliates-settings-general.php +++ b/lib/core/class-affiliates-settings-general.php @@ -238,6 +238,8 @@ public static function section() { $delete_data = get_option( 'aff_delete_data', false ); + do_action( 'affiliates_settings_general_before_form' ); + echo '
' . '
'; @@ -342,6 +344,8 @@ public static function section() { '
' . '
'; - affiliates_footer(); + do_action( 'affiliates_settings_general_after_form' ); + + affiliates_footer(); } } diff --git a/lib/core/class-affiliates-settings.php b/lib/core/class-affiliates-settings.php index 5159e59..e7e7116 100644 --- a/lib/core/class-affiliates-settings.php +++ b/lib/core/class-affiliates-settings.php @@ -203,10 +203,11 @@ public static function admin_settings() { echo $section_links; echo ''; - echo - '

' . - $section_title . - '

'; + echo '

'; + echo $section_title; + echo '

'; + + do_action( 'affiliates_settings_before_section', $section ); switch( $section ) { case 'integrations' : @@ -233,6 +234,7 @@ public static function admin_settings() { do_action( 'affiliates_settings_section', $section ); } + do_action( 'affiliates_settings_after_section', $section ); } /** diff --git a/lib/core/wp-init.php b/lib/core/wp-init.php index e6d2c09..e56b5da 100644 --- a/lib/core/wp-init.php +++ b/lib/core/wp-init.php @@ -1764,6 +1764,7 @@ function affiliates_get_direct_id() { // only needed when in admin if ( is_admin() ) { + require_once AFFILIATES_CORE_LIB . '/class-affiliates-admin.php'; require_once AFFILIATES_CORE_LIB . '/affiliates-admin.php'; require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings.php'; require_once AFFILIATES_CORE_LIB . '/affiliates-admin-user-registration.php'; From ee838c96466a478859a06dad162da62fddfbc7ef Mon Sep 17 00:00:00 2001 From: itthinx Date: Sun, 26 Feb 2023 16:09:46 +0100 Subject: [PATCH 5/8] shop --- lib/core/class-affiliates-admin.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/core/class-affiliates-admin.php b/lib/core/class-affiliates-admin.php index 261b0b3..52ef4a4 100644 --- a/lib/core/class-affiliates-admin.php +++ b/lib/core/class-affiliates-admin.php @@ -95,6 +95,12 @@ public static function plugin_action_links( $links ) { ); } + $links['shop'] = sprintf( + '%s', + esc_url( 'https://www.itthinx.com/shop/' ), + esc_html__( 'Shop', 'affiliates' ) + ); + if ( $deactivate !== null ) { $links['deactivate'] = $deactivate; } From 3b6699945ee899a8a0b1e8630585f22be34f0da6 Mon Sep 17 00:00:00 2001 From: itthinx Date: Sun, 26 Feb 2023 20:25:09 +0100 Subject: [PATCH 6/8] plugin row meta --- lib/core/class-affiliates-admin.php | 54 ++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/lib/core/class-affiliates-admin.php b/lib/core/class-affiliates-admin.php index 52ef4a4..81c9f3b 100644 --- a/lib/core/class-affiliates-admin.php +++ b/lib/core/class-affiliates-admin.php @@ -36,6 +36,7 @@ class Affiliates_Admin { public static function init() { add_action( 'admin_init', array( __CLASS__, 'admin_init' ) ); add_filter( 'plugin_action_links_'. plugin_basename( AFFILIATES_FILE ), array( __CLASS__, 'plugin_action_links' ) ); + add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 4 ); } /** @@ -74,11 +75,28 @@ public static function plugin_action_links( $links ) { ); } - $links['documentation'] = sprintf( - '%s', - esc_url( 'https://docs.itthinx.com/document/affiliates/' ), - esc_html__( 'Documentation', 'affiliates' ) - ); + switch ( AFFILIATES_PLUGIN_NAME ) { + case 'affiliates-pro': + $links['documentation'] = sprintf( + '%s', + esc_url( 'https://docs.itthinx.com/document/affiliates-pro/' ), + esc_html__( 'Documentation', 'affiliates' ) + ); + break; + case 'affiliates-enterprise': + $links['documentation'] = sprintf( + '%s', + esc_url( 'https://docs.itthinx.com/document/affiliates-enterprise/' ), + esc_html__( 'Documentation', 'affiliates' ) + ); + break; + default: + $links['documentation'] = sprintf( + '%s', + esc_url( 'https://docs.itthinx.com/document/affiliates/' ), + esc_html__( 'Documentation', 'affiliates' ) + ); + } if ( get_option( 'aff_setup_hide', false ) ) { $links['welcome'] = sprintf( @@ -108,5 +126,31 @@ public static function plugin_action_links( $links ) { return $links; } + /** + * Adds plugin metas. + * + * @param string[] $plugin_meta + * @param string $plugin_file + * @param array $plugin_data + * @param string $status + * + * @return string[] + */ + public static function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) { + if ( $plugin_file === plugin_basename( AFFILIATES_FILE ) ) { + switch ( AFFILIATES_PLUGIN_NAME ) { + case 'affiliates-pro': + $plugin_meta[] = 'Affiliates Enterprise'; + break; + case 'affiliates-enterprise': + break; + default: + $plugin_meta[] = 'Affiliates Pro'; + $plugin_meta[] = 'Affiliates Enterprise'; + } + $plugin_meta[] = 'Shop'; + } + return $plugin_meta; + } } Affiliates_Admin::init(); From c928b524d78834089abdf92182d9bbec6573f428 Mon Sep 17 00:00:00 2001 From: itthinx Date: Sun, 26 Feb 2023 21:18:25 +0100 Subject: [PATCH 7/8] welcome actions --- changelog.txt | 2 ++ lib/core/class-affiliates-settings.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/changelog.txt b/changelog.txt index 8d5f4d6..7f8f45c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -10,6 +10,8 @@ * Adds the affiliates_settings_after_section action. * Adds the affiliates_settings_general_before_form action. * Adds the affiliates_settings_general_after_form action. +* Adds the affiliates_welcome_before_buttons action. +* Adds the affiliates_welcome_after_buttons action. = 4.17.0 = * WordPress 6.1 compatible. diff --git a/lib/core/class-affiliates-settings.php b/lib/core/class-affiliates-settings.php index e7e7116..4c5b60b 100644 --- a/lib/core/class-affiliates-settings.php +++ b/lib/core/class-affiliates-settings.php @@ -147,6 +147,8 @@ public static function setup_notice() { ) ); + do_action( 'affiliates_welcome_before_buttons' ); + // render the buttons echo '

'; echo implode( ' ', $buttons ); @@ -160,6 +162,9 @@ public static function setup_notice() { __( 'Hide this', 'affiliates' ) ); echo '

'; + + do_action( 'affiliates_welcome_after_buttons' ); + echo ''; } From 5735ca31fb3f486ed50303afca177213885d5848 Mon Sep 17 00:00:00 2001 From: itthinx Date: Mon, 27 Feb 2023 15:54:53 +0100 Subject: [PATCH 8/8] fixed missing parameter --- lib/core/class-affiliates-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/class-affiliates-admin.php b/lib/core/class-affiliates-admin.php index 81c9f3b..0bffb8b 100644 --- a/lib/core/class-affiliates-admin.php +++ b/lib/core/class-affiliates-admin.php @@ -70,7 +70,7 @@ public static function plugin_action_links( $links ) { if ( current_user_can( AFFILIATES_ADMINISTER_OPTIONS ) ) { $links['settings'] = sprintf( '%s', - esc_url( get_admin_url( 'admin.php?page=affiliates-admin-settings' ) ), + esc_url( get_admin_url( null, 'admin.php?page=affiliates-admin-settings' ) ), esc_html__( 'Settings', 'affiliates' ) ); }