| 1 |
<?php |
| 2 |
/** |
| 3 |
* Tracking Codes. |
| 4 |
* |
| 5 |
* Copyright: © 2009-2011 |
| 6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.} |
| 7 |
* ( coded in the USA ) |
| 8 |
* |
| 9 |
* Released under the terms of the GNU General Public License. |
| 10 |
* You should have received a copy of the GNU General Public License, |
| 11 |
* along with this software. In the main directory, see: /licensing/ |
| 12 |
* If not, see: {@link http://www.gnu.org/licenses/}. |
| 13 |
* |
| 14 |
* @package s2Member\Tracking |
| 15 |
* @since 3.5 |
| 16 |
*/ |
| 17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"])) |
| 18 |
exit ("Do not access this file directly."); |
| 19 |
/**/ |
| 20 |
if (!class_exists ("c_ws_plugin__s2member_tracking_codes")) |
| 21 |
{ |
| 22 |
/** |
| 23 |
* Tracking Codes. |
| 24 |
* |
| 25 |
* @package s2Member\Tracking |
| 26 |
* @since 3.5 |
| 27 |
*/ |
| 28 |
class c_ws_plugin__s2member_tracking_codes |
| 29 |
{ |
| 30 |
/** |
| 31 |
* Displays Signup Tracking Codes. |
| 32 |
* |
| 33 |
* These are stored inside s2Member's Transient Queue by the IPN processor. |
| 34 |
* |
| 35 |
* Tracking Codes are only displayed/processed one time. |
| 36 |
* s2Member will display Tracking Codes in (1) of these 3 locations: |
| 37 |
* |
| 38 |
* o If possible, on the Registration Form, after returning from your Payment Gateway. |
| 39 |
* o Otherwise, if possible, on the Login Form *( in the footer )* after Registration is completed. |
| 40 |
* o Otherwise, in the footer of your WordPress® theme, as soon as possible; or after the Customer's very first login. |
| 41 |
* |
| 42 |
* @package s2Member\Tracking |
| 43 |
* @since 3.5 |
| 44 |
* |
| 45 |
* @attaches-to: ``add_action("login_footer");`` |
| 46 |
* @attaches-to: ``add_action("wp_footer");`` |
| 47 |
* |
| 48 |
* @return null After displaying possible Tracking Code(s). |
| 49 |
*/ |
| 50 |
public static function display_signup_tracking_codes () |
| 51 |
{ |
| 52 |
do_action ("ws_plugin__s2member_before_display_signup_tracking_codes", get_defined_vars ()); |
| 53 |
/**/ |
| 54 |
if ((($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies)) || (!empty ($_COOKIE["s2member_signup_tracking"]) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_signup_tracking"])))) |
| 55 |
{ |
| 56 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_signup_tracking_codes_" . $subscr_id)))) |
| 57 |
{ |
| 58 |
delete_transient ($transient); /* Only display this ONE time. Delete transient immediately. */ |
| 59 |
/**/ |
| 60 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_signup_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n"; |
| 61 |
/**/ |
| 62 |
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); |
| 63 |
do_action ("ws_plugin__s2member_during_display_signup_tracking_codes", get_defined_vars ()); |
| 64 |
unset ($__refs, $__v); /* Unset defined __refs, __v. */ |
| 65 |
/**/ |
| 66 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) |
| 67 |
{ |
| 68 |
echo do_shortcode ($code) . "\n"; /* No PHP here. */ |
| 69 |
} |
| 70 |
else /* Otherwise, safe to allow PHP code. */ |
| 71 |
{ |
| 72 |
echo do_shortcode (c_ws_plugin__s2member_utilities::evl ($code)); |
| 73 |
} |
| 74 |
} |
| 75 |
} |
| 76 |
/**/ |
| 77 |
do_action ("ws_plugin__s2member_after_display_signup_tracking_codes", get_defined_vars ()); |
| 78 |
/**/ |
| 79 |
return; /* Return for uniformity. */ |
| 80 |
} |
| 81 |
/** |
| 82 |
* Displays Specific Post/Page Tracking Codes. |
| 83 |
* |
| 84 |
* These are stored inside s2Member's Transient Queue, by BOTH the IPN & Return-Data processors. |
| 85 |
* |
| 86 |
* Specific Post/Page Tracking Codes are only displayed/processed one time. |
| 87 |
* s2Member will display Tracking Codes in the footer of your theme. |
| 88 |
* |
| 89 |
* @package s2Member\Tracking |
| 90 |
* @since 3.5 |
| 91 |
* |
| 92 |
* @attaches-to: ``add_action("wp_footer");`` |
| 93 |
* |
| 94 |
* @return null After displaying possible Tracking Code(s). |
| 95 |
*/ |
| 96 |
public static function display_sp_tracking_codes () |
| 97 |
{ |
| 98 |
do_action ("ws_plugin__s2member_before_display_sp_tracking_codes", get_defined_vars ()); |
| 99 |
/**/ |
| 100 |
if (!empty ($_COOKIE["s2member_sp_tracking"]) && ($txn_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_sp_tracking"]))) |
| 101 |
{ |
| 102 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_sp_tracking_codes_" . $txn_id)))) |
| 103 |
{ |
| 104 |
delete_transient ($transient); /* Only display this ONE time. Delete transient immediately. */ |
| 105 |
/**/ |
| 106 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_sp_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n"; |
| 107 |
/**/ |
| 108 |
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); |
| 109 |
do_action ("ws_plugin__s2member_during_display_sp_tracking_codes", get_defined_vars ()); |
| 110 |
unset ($__refs, $__v); /* Unset defined __refs, __v. */ |
| 111 |
/**/ |
| 112 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) |
| 113 |
{ |
| 114 |
echo $code . "\n"; /* No PHP here. */ |
| 115 |
} |
| 116 |
else /* Otherwise, it's safe to allow PHP code. */ |
| 117 |
{ |
| 118 |
eval ("?>" . $code); |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
/**/ |
| 123 |
do_action ("ws_plugin__s2member_after_display_sp_tracking_codes", get_defined_vars ()); |
| 124 |
/**/ |
| 125 |
return; /* Return for uniformity. */ |
| 126 |
} |
| 127 |
} |
| 128 |
} |
| 129 |
?> |