| 1 |
<?php |
| 2 |
|
| 3 |
namespace Leadin\admin; |
| 4 |
|
| 5 |
use Leadin\data\Filters; |
| 6 |
|
| 7 |
const IR_CLICK_ID = 'irclickid'; |
| 8 |
const MPID = 'mpid'; |
| 9 |
|
| 10 |
/** |
| 11 |
* Class containing the logic to get Impact affiliate information when necessary |
| 12 |
*/ |
| 13 |
class Impact { |
| 14 |
/** |
| 15 |
* Apply leadin_impact_code filter. |
| 16 |
*/ |
| 17 |
public static function get_affiliate_link() { |
| 18 |
return Filters::apply_impact_code_filters(); |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Get impact properties from query parameters. |
| 23 |
*/ |
| 24 |
public static function get_params() { |
| 25 |
$params = array(); |
| 26 |
|
| 27 |
// phpcs:disable WordPress.Security.NonceVerification.Recommended |
| 28 |
if ( isset( $_GET['leadin_irclickid'] ) ) { |
| 29 |
$params[ IR_CLICK_ID ] = sanitize_text_field( \wp_unslash( $_GET['leadin_irclickid'] ) ); |
| 30 |
} |
| 31 |
|
| 32 |
if ( isset( $_GET['leadin_mpid'] ) ) { |
| 33 |
$params[ MPID ] = sanitize_text_field( \wp_unslash( $_GET['leadin_mpid'] ) ); |
| 34 |
} |
| 35 |
// phpcs:enable |
| 36 |
|
| 37 |
return $params; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Return true if the function `get_params` returns both irclickid and mpid. |
| 42 |
*/ |
| 43 |
public static function has_params() { |
| 44 |
return 2 === \count( self::get_params() ); |
| 45 |
} |
| 46 |
} |
| 47 |
|