Skip to content

Commit

Permalink
Merge pull request #116 from itthinx/tested-4.18.0-6.2
Browse files Browse the repository at this point in the history
Tested 4.18.0 6.2
  • Loading branch information
itthinx authored Feb 27, 2023
2 parents ea0f87e + 5735ca3 commit c76d7df
Show file tree
Hide file tree
Showing 8 changed files with 192 additions and 11 deletions.
2 changes: 1 addition & 1 deletion COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions affiliates.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ) );
Expand Down
13 changes: 13 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
== Affiliates - Changelog ==

= 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.
* Adds the affiliates_welcome_before_buttons action.
* Adds the affiliates_welcome_after_buttons action.

= 4.17.0 =
* WordPress 6.1 compatible.
* Requires at least WordPress 5.8.
Expand Down
156 changes: 156 additions & 0 deletions lib/core/class-affiliates-admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<?php
/**
* class-affiliates-admin.php
*
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
*
* This code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This header and all notices must be kept intact.
*
* @author Karim Rahimpur
* @package affiliates
* @since 4.18.0
*/

if ( !defined( 'ABSPATH' ) ) {
exit;
}

/**
* Admin basics.
*
* @since 4.18.0
*/
class Affiliates_Admin {

/**
* Adds actions and filters.
*/
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 );
}

/**
* Admin init hook.
*/
public static function admin_init() {
if (
isset( $_REQUEST['aff_setup_show'] ) &&
isset( $_REQUEST['aff_setup_nonce'] ) &&
wp_verify_nonce( $_REQUEST['aff_setup_nonce'], 'aff_setup_show' )
) {
delete_option( 'aff_setup_hide' );
}
}

/**
* Adds particular plugin links.
*
* @param string[] $links
*
* @return string[] links
*/
public static function plugin_action_links( $links ) {

$deactivate = null;
if ( isset( $links['deactivate'] ) ) {
$deactivate = $links['deactivate'];
unset( $links['deactivate'] );
}

if ( current_user_can( AFFILIATES_ADMINISTER_OPTIONS ) ) {
$links['settings'] = sprintf(
'<a href="%s">%s</a>',
esc_url( get_admin_url( null, 'admin.php?page=affiliates-admin-settings' ) ),
esc_html__( 'Settings', 'affiliates' )
);
}

switch ( AFFILIATES_PLUGIN_NAME ) {
case 'affiliates-pro':
$links['documentation'] = sprintf(
'<a href="%s">%s</a>',
esc_url( 'https://docs.itthinx.com/document/affiliates-pro/' ),
esc_html__( 'Documentation', 'affiliates' )
);
break;
case 'affiliates-enterprise':
$links['documentation'] = sprintf(
'<a href="%s">%s</a>',
esc_url( 'https://docs.itthinx.com/document/affiliates-enterprise/' ),
esc_html__( 'Documentation', 'affiliates' )
);
break;
default:
$links['documentation'] = sprintf(
'<a href="%s">%s</a>',
esc_url( 'https://docs.itthinx.com/document/affiliates/' ),
esc_html__( 'Documentation', 'affiliates' )
);
}

if ( get_option( 'aff_setup_hide', false ) ) {
$links['welcome'] = sprintf(
'<a href="%s" title="%s">%s</a>',
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' )
);
}

$links['shop'] = sprintf(
'<a href="%s">%s</a>',
esc_url( 'https://www.itthinx.com/shop/' ),
esc_html__( 'Shop', 'affiliates' )
);

if ( $deactivate !== null ) {
$links['deactivate'] = $deactivate;
}

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[] = '<a style="color: #5da64f; font-weight: bold; padding: 1px;" href="http://www.itthinx.com/shop/affiliates-enterprise/">Affiliates Enterprise</a>';
break;
case 'affiliates-enterprise':
break;
default:
$plugin_meta[] = '<a style="color: #5da64f; font-weight: bold; padding: 1px;" href="http://www.itthinx.com/shop/affiliates-pro/">Affiliates Pro</a>';
$plugin_meta[] = '<a style="color: #5da64f; font-weight: bold; padding: 1px;" href="http://www.itthinx.com/shop/affiliates-enterprise/">Affiliates Enterprise</a>';
}
$plugin_meta[] = '<a style="color: #d65d4f; font-weight: bold; padding: 1px;" href="http://www.itthinx.com/shop/">Shop</a>';
}
return $plugin_meta;
}
}
Affiliates_Admin::init();
6 changes: 5 additions & 1 deletion lib/core/class-affiliates-settings-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ public static function section() {

$delete_data = get_option( 'aff_delete_data', false );

do_action( 'affiliates_settings_general_before_form' );

echo
'<form action="" name="options" method="post">' .
'<div>';
Expand Down Expand Up @@ -342,6 +344,8 @@ public static function section() {
'</div>' .
'</form>';

affiliates_footer();
do_action( 'affiliates_settings_general_after_form' );

affiliates_footer();
}
}
15 changes: 11 additions & 4 deletions lib/core/class-affiliates-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public static function setup_notice() {
)
);

do_action( 'affiliates_welcome_before_buttons' );

// render the buttons
echo '<p class="submit">';
echo implode( ' ', $buttons );
Expand All @@ -160,6 +162,9 @@ public static function setup_notice() {
__( 'Hide this', 'affiliates' )
);
echo '</p>';

do_action( 'affiliates_welcome_after_buttons' );

echo '</div>';
}

Expand Down Expand Up @@ -203,10 +208,11 @@ public static function admin_settings() {
echo $section_links;
echo '</div>';

echo
'<h2>' .
$section_title .
'</h2>';
echo '<h2>';
echo $section_title;
echo '</h2>';

do_action( 'affiliates_settings_before_section', $section );

switch( $section ) {
case 'integrations' :
Expand All @@ -233,6 +239,7 @@ public static function admin_settings() {
do_action( 'affiliates_settings_section', $section );
}

do_action( 'affiliates_settings_after_section', $section );
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/core/wp-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 3 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
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
Requires at least: 5.9
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.
Expand Down

0 comments on commit c76d7df

Please sign in to comment.