Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-20T09:49:34-05:00 http://www.primothemes.com/forums/feed.php?f=40&t=13018 2011-12-20T09:49:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=57728#p57728 <![CDATA[s2Member v111220 / Source Code: s2member\i...]]>
s2Member v111220
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: December 20, 2011, 9:49 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 20th, 2011, 9:49 am


]]>
2011-12-07T01:02:35-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=55410#p55410 <![CDATA[s2Member v111206 / Source Code: s2member\i...]]>
s2Member v111206
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: December 7, 2011, 1:02 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 7th, 2011, 1:02 am


]]>
2011-11-05T19:25:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=51784#p51784 <![CDATA[s2Member v111105 / Source Code: s2member\i...]]>
s2Member v111105
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: November 5, 2011, 8:25 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — November 5th, 2011, 7:25 pm


]]>
2011-10-29T20:34:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=49879#p49879 <![CDATA[s2Member v111029 / Source Code: s2member\i...]]>
s2Member v111029
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: October 29, 2011, 9:34 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 29th, 2011, 8:34 pm


]]>
2011-10-17T15:38:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=47673#p47673 <![CDATA[s2Member v111017 / Source Code: s2member\i...]]>
s2Member v111017
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: October 17, 2011, 1:38 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 17th, 2011, 3:38 pm


]]>
2011-10-11T14:34:30-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=46073#p46073 <![CDATA[s2Member v111011 / Source Code: s2member\i...]]>
s2Member v111011
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: October 11, 2011, 12:34 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 11th, 2011, 2:34 pm


]]>
2011-10-03T15:46:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=44204#p44204 <![CDATA[s2Member v111003 / Source Code: s2member\i...]]>
s2Member v111003
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: October 3, 2011, 1:46 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:46 pm


]]>
2011-10-03T03:40:25-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=42911#p42911 <![CDATA[s2Member v111002 / Source Code: s2member\i...]]>
s2Member v111002
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: October 3, 2011, 1:40 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:40 am


]]>
2011-09-27T05:25:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=41157#p41157 <![CDATA[s2Member v110927 / Source Code: s2member\i...]]>
s2Member v110927
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: September 27, 2011, 3:25 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 27th, 2011, 5:25 am


]]>
2011-09-26T21:02:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=39913#p39913 <![CDATA[s2Member v110926 / Source Code: s2member\i...]]>
s2Member v110926
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: September 26, 2011, 7:03 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 26th, 2011, 9:02 pm


]]>
2011-09-17T16:19:32-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=38057#p38057 <![CDATA[s2Member v110915 / Source Code: s2member\i...]]>
s2Member v110915
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: September 17, 2011, 2:19 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 17th, 2011, 4:19 pm


]]>
2011-09-14T01:27:24-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=36638#p36638 <![CDATA[s2Member v110913 / Source Code: s2member\i...]]>
s2Member v110913
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: September 13, 2011, 11:27 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 14th, 2011, 1:27 am


]]>
2011-09-13T12:02:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=35366#p35366 <![CDATA[s2Member v110912 / Source Code: s2member\i...]]>
s2Member v110912
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: September 13, 2011, 10:02 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 13th, 2011, 12:02 pm


]]>
2011-08-15T14:11:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=31473#p31473 <![CDATA[s2Member v110815 / Source Code: s2member\i...]]>
s2Member v110815
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: August 15, 2011, 3:12 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\classes\list-servers.inc.php ?php /** * List Server integrations. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member\List_Servers * @since 3.5 */ if ( realpath ( __FILE__ ) === realpath ( $_SERVER [ "SCRIPT_FILENAME" ] ) ) exit ( "Do not access this file directly." ) ; /**/ if ( ! class_exists ( "c_ws_plugin__s2member_list_servers" ) ) { /** * List Server integrations. * * @package s2Member\List_Servers * @since 3.5 */ class c_ws_plugin__s2member_list_servers { /** * Determines whether or not any List Servers have been integrated. * * @package s2Member\List_Servers * @since 3.5 * * @return bool True if List Servers have been integrated, else false. */ public static function list_servers_integrated ( ) { do_action ( "ws_plugin__s2member_before_list_servers_integrated" , get_defined_vars ( ) ) ; /**/ for ( $n = 0 ; $n = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "levels" ] ; $n ++ ) /* Go through each Level; looking for a configured list. */ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $n . "_mailchimp_list_ids" ] ) || ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $n . "_aweber_list_ids" ] ) ) return apply_filters ( "ws_plugin__s2member_list_servers_integrated" , true , get_defined_vars ( ) ) ; /**/ return apply_filters ( "ws_plugin__s2member_list_servers_integrated" , false , get_defined_vars ( ) ) ; } /** * Processes List Server integrations for s2Member. * * @package s2Member\List_Servers * @since 3.5 * * @param str $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`. * @param int|str $level A numeric s2Member Access Level number. * @param str $login Username for the User. * @param str $pass Plain Text Password for the User. * @param str $email Email Address for the User. * @param str $fname First Name for the User. * @param str $lname Last Name for the User. * @param str $ip IP Address for the User. * @param bool $opt_in Defaults to false; must be set to true. Indicates the User IS opting in. * @param bool $double_opt_in Defaults to true. If false, no email confirmation is required. Use at your own risk. * @param int|str $user_id A WordPress User ID, numeric string or integer. * @return bool True if at least one List Server is processed successfully, else false. * * @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}. * @todo Add a separate option for mail debugging; or consolidate? * @todo Integrate AWeber® API ( much like the MailChimp® API ). */ public static function process_list_servers ( $role = FALSE , $level = FALSE , $login = FALSE , $pass = FALSE , $email = FALSE , $fname = FALSE , $lname = FALSE , $ip = FALSE , $opt_in = FALSE , $double_opt_in = TRUE , $user_id = FALSE ) { global $current_site , $current_blog ; /* For Multisite support. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_process_list_servers" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ( $args = func_get_args ( ) ) && $role && strlen ( $level ) && $login && is_email ( $email ) && $opt_in && $user_id && is_object ( $user = new WP_User ( $user_id ) ) && ( $user_id = $user - ID ) ) { $ccaps = implode ( "," , c_ws_plugin__s2member_user_access:: user_access_ccaps ( $user ) ) ; /* Get Custom Capabilities ( comma-delimited ). */ /**/ $email_configs_were_on = c_ws_plugin__s2member_email_configs:: email_config_status ( false ) ; /* s2Member Filters enabled? */ c_ws_plugin__s2member_email_configs:: email_config_release ( true ) ; /* Release all mail Filters before we begin this routine. */ /**/ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "mailchimp_api_key" ] ) && ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_mailchimp_list_ids" ] ) ) { if ( ! class_exists ( "NC_MCAPI" ) ) /* Include the MailChimp® API Class here. */ include_once dirname ( dirname ( __FILE__ ) ) . "/_xtnls/mailchimp/nc-mcapi.inc.php" ; /* MailChimp® API ( no-conflict version ). */ /**/ $mcapi = new NC_MCAPI ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "mailchimp_api_key" ] , true ) ; /* MailChimp® API ( no-conflict ). */ /**/ foreach ( preg_split ( "/[\r \n \t;,]+/" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_mailchimp_list_ids" ] ) as $mailchimp_list ) { $mailchimp = array ( "function" = __FUNCTION__ , "func_get_args" = $args , "api_method" = "listSubscribe" ) ; /**/ if ( ( $mailchimp [ "list" ] = trim ( $mailchimp_list ) ) ) /* Trim this up. NO trailing white space. */ { if ( strpos ( $mailchimp [ "list" ] , "::" ) !== false ) /* Also contains Interest Groups? */ { list ( $mailchimp [ "list_id" ] , $mailchimp [ "interest_groups_title" ] , $mailchimp [ "interest_groups" ] ) = preg_split ( "/\:\:/" , $mailchimp [ "list" ] , 3 ) ; /**/ if ( ( $mailchimp [ "interest_groups_title" ] = trim ( $mailchimp [ "interest_groups_title" ] ) ) ) /* This is a title configured by the list master. */ if ( ( $mailchimp [ "interest_groups" ] = ( trim ( $mailchimp [ "interest_groups" ] ) ) ? preg_split ( "/\|/" , trim ( $mailchimp [ "interest_groups" ] ) ) : false ) ) $mailchimp [ "interest_groups" ] = array ( "GROUPINGS" = array ( array ( "name" = $mailchimp [ "interest_groups_title" ] , "groups" = implode ( "," , $mailchimp [ "interest_groups" ] ) ) ) ) ; /**/ if ( empty ( $mailchimp [ "list_id" ] ) ) /* Need to double-check this. If empty, skip over this entry. */ continue ; /* Continue to next List, if there is one. */ } else /* Else, it's just a List ID. */ $mailchimp [ "list_id" ] = $mailchimp [ "list" ] ; /**/ $mailchimp [ "merge_array" ] = array ( "MERGE1" = $fname , "MERGE2" = $lname , "OPTIN_IP" = $ip , "OPTIN_TIME" = date ( "Y-m-d H:i:s" ) ) ; $mailchimp [ "merge_array" ] = ( $mailchimp [ "interest_groups" ] ) ? array_merge ( $mailchimp [ "merge_array" ] , $mailchimp [ "interest_groups" ] ) : $mailchimp [ "merge_array" ] ; $mailchimp [ "merge_array" ] = apply_filters ( /* Deprecated. */ "ws_plugin__s2member_mailchimp_array" , $mailchimp [ "merge_array" ] , get_defined_vars ( ) ) ; /* Filter: `ws_plugin__s2member_mailchimp_array` deprecated in v110523. Please use Filter: `ws_plugin__s2member_mailchimp_merge_array`. */ /**/ if ( $mailchimp [ "api_response" ] = $mcapi - { $mailchimp [ "api_method" ] } ( $mailchimp [ "list_id" ] , $email , /* See: `http://apidocs.mailchimp.com/` for full details. */ ( $mailchimp [ "api_merge_array" ] = apply_filters ( "ws_plugin__s2member_mailchimp_merge_array" , $mailchimp [ "merge_array" ] , get_defined_vars ( ) ) ) , /* Configured merge array above. */ ( $mailchimp [ "api_email_type" ] = apply_filters ( "ws_plugin__s2member_mailchimp_email_type" , "html" , get_defined_vars ( ) ) ) , /* Type of email to receive ( i.e. html,text,mobile ).*/ ( $mailchimp [ "api_double_optin" ] = apply_filters ( "ws_plugin__s2member_mailchimp_double_optin" , $double_opt_in , get_defined_vars ( ) ) ) , /* Abuse of this may cause account suspension. */ ( $mailchimp [ "api_update_existing" ] = apply_filters ( "ws_plugin__s2member_mailchimp_update_existing" , false , get_defined_vars ( ) ) ) , /* Existing subscribers should be updated with this? */ ( $mailchimp [ "api_replace_interests" ] = apply_filters ( "ws_plugin__s2member_mailchimp_replace_interests" , true , get_defined_vars ( ) ) ) , /* Replace interest groups? ( only if provided ) */ ( $mailchimp [ "api_send_welcome" ] = apply_filters ( "ws_plugin__s2member_mailchimp_send_welcome" , false , get_defined_vars ( ) ) ) ) ) /* See documentation. This is a weird option. */ $mailchimp [ "api_success" ] = $success = true ; /* Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value. */ $mailchimp [ "api_properties" ] = $mcapi ; /* Include API instance too; as it contains some additional information after each method is processed ( need this in the logs ). */ /**/ $logv = c_ws_plugin__s2member_utilities:: ver_details ( ) ; $logm = c_ws_plugin__s2member_utilities:: mem_details ( ) ; $log4 = $_SERVER [ "HTTP_HOST" ] . $_SERVER [ "REQUEST_URI" ] . "\nUser-Agent: " . $_SERVER [ "HTTP_USER_AGENT" ] ; $log4 = ( is_multisite ( ) && ! is_main_site ( ) ) ? ( $_log4 = $current_blog - domain . $current_blog - path ) . "\n" . $log4 : $log4 ; $log2 = ( is_multisite ( ) && ! is_main_site ( ) ) ? "mailchimp-api-4-" . trim ( preg_replace ( "/[^a-z0-9]/i" , "-" , $_log4 ) , "-" ) . ".log" : "mailchimp-api.log" ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "gateway_debug_logs" ] ) if ( is_dir ( $logs_dir = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "logs_dir" ] ) ) if ( is_writable ( $logs_dir ) && c_ws_plugin__s2member_utils_logs:: archive_oversize_log_files ( ) ) file_put_contents ( $logs_dir . "/" . $log2 , $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export ( $mailchimp , true ) . "\n \n" , FILE_APPEND) ; } } } /**/ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_aweber_list_ids" ] ) ) { foreach ( preg_split ( "/[\r \n \t\s;,]+/" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_aweber_list_ids" ] ) as $aweber_list ) { $aweber = array ( "function" = __FUNCTION__ , "func_get_args" = $args , "wp_mail_method" = "listSubscribe" ) ; /**/ if ( ( $aweber [ "list_id" ] = trim ( $aweber_list ) ) ) /* Trim this up. NO trailing white space. */ { $aweber [ "bcc" ] = apply_filters ( "ws_plugin__s2member_aweber_bcc" , false , get_defined_vars ( ) ) ; $aweber [ "pass_inclusion" ] = ( apply_filters ( "ws_plugin__s2member_aweber_pass_inclusion" , false , get_defined_vars ( ) ) && $pass ) ? "\nPass: " . $pass : false ; /**/ if ( $aweber [ "wp_mail_response" ] = wp_mail ( $aweber [ "list_id" ] . "@aweber.com" , /* AWeber® List ID converts to email address @aweber.com. */ ( $aweber [ "wp_mail_sbj" ] = apply_filters ( "ws_plugin__s2member_aweber_sbj" , "s2Member Subscription Request" , get_defined_vars ( ) ) ) , /* These Filters make it possible to customize these emails. */ ( $aweber [ "wp_mail_msg" ] = apply_filters ( "ws_plugin__s2member_aweber_msg" , "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nAd Tracking: s2Member-" . ( ( is_multisite ( ) && ! is_main_site ( ) ) ? $current_blog - domain . $current_blog - path : $_SERVER [ "HTTP_HOST" ] ) . "\nEMail Address: " . $email . "\nBuyer: " . $fname . " " . $lname . "\nFull Name: " . $fname . " " . $lname . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nUser ID: " . $user_id . "\nLogin: " . $login . $aweber [ "pass_inclusion" ] . "\nRole: " . $role . "\nLevel: " . $level . "\nCCaps: " . $ccaps . "\n - end." , get_defined_vars ( ) ) ) , /**/ ( $aweber [ "wp_mail_headers" ] = "From: \"" . preg_replace ( "/\"/" , "" , $fname . " " . $lname ) . "\" " . $email . "" . ( ( $aweber [ "bcc" ] ) ? "\r \nBcc: " . $aweber [ "bcc" ] : "" ) . "\r \nContent-Type: text/plain; charset=utf-8" ) ) ) $aweber [ "wp_mail_success" ] = $success = true ; /* Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value. */ /**/ $logv = c_ws_plugin__s2member_utilities:: ver_details ( ) ; $logm = c_ws_plugin__s2member_utilities:: mem_details ( ) ; $log4 = $_SERVER [ "HTTP_HOST" ] . $_SERVER [ "REQUEST_URI" ] . "\nUser-Agent: " . $_SERVER [ "HTTP_USER_AGENT" ] ; $log4 = ( is_multisite ( ) && ! is_main_site ( ) ) ? ( $_log4 = $current_blog - domain . $current_blog - path ) . "\n" . $log4 : $log4 ; $log2 = ( is_multisite ( ) && ! is_main_site ( ) ) ? "aweber-api-4-" . trim ( preg_replace ( "/[^a-z0-9]/i" , "-" , $_log4 ) , "-" ) . ".log" : "aweber-api.log" ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "gateway_debug_logs" ] ) if ( is_dir ( $logs_dir = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "logs_dir" ] ) ) if ( is_writable ( $logs_dir ) && c_ws_plugin__s2member_utils_logs:: archive_oversize_log_files ( ) ) file_put_contents ( $logs_dir . "/" . $log2 , $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export ( $aweber , true ) . "\n \n" , FILE_APPEND) ; } } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_process_list_servers" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( $email_configs_were_on ) /* Back on? */ c_ws_plugin__s2member_email_configs:: email_config ( ) ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_after_process_list_servers" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ return apply_filters ( "ws_plugin__s2member_process_list_servers" , ( isset ( $success ) && $success ) , get_defined_vars ( ) ) ; } /** * Processes List Server removals for s2Member. * * @package s2Member\List_Servers * @since 3.5 * * @param str $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`. * @param int|str $level A numeric s2Member Access Level number. * @param str $login Username for the User. * @param str $pass Plain Text Password for the User. * @param str $email Email address for the User. * @param str $fname First Name for the User. * @param str $lname Last Name for the User. * @param str $ip IP Address for the User. * @param bool $opt_out Defaults to false; must be set to true. Indicates the User IS opting out. * @param int|str $user_id A WordPress User ID, numeric string or integer. * @return bool True if at least one List Server is processed successfully, else false. * * @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}. * @todo Add a separate option for mail debugging; or consolidate? * @todo Integrate AWeber® API ( much like the MailChimp® API ). */ public static function process_list_server_removals ( $role = FALSE , $level = FALSE , $login = FALSE , $pass = FALSE , $email = FALSE , $fname = FALSE , $lname = FALSE , $ip = FALSE , $opt_out = FALSE , $user_id = FALSE ) { global $current_site , $current_blog ; /* For Multisite support. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ( $args = func_get_args ( ) ) && $role && strlen ( $level ) && $login && is_email ( $email ) && $opt_out && $user_id && is_object ( $user = new WP_User ( $user_id ) ) && ( $user_id = $user - ID ) ) { $email_configs_were_on = c_ws_plugin__s2member_email_configs:: email_config_status ( false ) ; /* s2Member Filters enabled? */ c_ws_plugin__s2member_email_configs:: email_config_release ( true ) ; /* Release all mail Filters before we begin this routine. */ /**/ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "mailchimp_api_key" ] ) && ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_mailchimp_list_ids" ] ) ) { if ( ! class_exists ( "NC_MCAPI" ) ) /* Include the MailChimp® API Class here. */ include_once dirname ( dirname ( __FILE__ ) ) . "/_xtnls/mailchimp/nc-mcapi.inc.php" ; /* MailChimp® API ( no-conflict version ). */ /**/ $mcapi = new NC_MCAPI ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "mailchimp_api_key" ] , true ) ; /* MailChimp® API ( no-conflict ). */ /**/ foreach ( preg_split ( "/[\r \n \t;,]+/" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_mailchimp_list_ids" ] ) as $mailchimp_list ) { $mailchimp = array ( "function" = __FUNCTION__ , "func_get_args" = $args , "api_removal_method" = "listUnsubscribe" ) ; /**/ if ( ( $mailchimp [ "list_id" ] = trim ( preg_replace ( "/\:\:.*$/" , "" , $mailchimp_list ) ) ) ) /* Trim & strip groups. */ { if ( $mailchimp [ "api_removal_response" ] = $mcapi - { $mailchimp [ "api_removal_method" ] } ( $mailchimp [ "list_id" ] , $email , /* See: `http://apidocs.mailchimp.com/`. */ ( $mailchimp [ "api_removal_delete_member" ] = apply_filters ( "ws_plugin__s2member_mailchimp_removal_delete_member" , false , get_defined_vars ( ) ) ) , /* Completely delete? */ ( $mailchimp [ "api_removal_send_goodbye" ] = apply_filters ( "ws_plugin__s2member_mailchimp_removal_send_goodbye" , false , get_defined_vars ( ) ) ) , /* Send goodbye letter? */ ( $mailchimp [ "api_removal_send_notify" ] = apply_filters ( "ws_plugin__s2member_mailchimp_removal_send_notify" , false , get_defined_vars ( ) ) ) ) ) /* Send notification? */ $mailchimp [ "api_removal_success" ] = $removal_success = true ; /* Flag indicating that we DO have a successful removal; affects the function's overall return value. */ $mailchimp [ "api_removal_properties" ] = $mcapi ; /* Include API instance too; as it contains some additional information after each method is processed ( need this in the logs ). */ /**/ $logv = c_ws_plugin__s2member_utilities:: ver_details ( ) ; $logm = c_ws_plugin__s2member_utilities:: mem_details ( ) ; $log4 = $_SERVER [ "HTTP_HOST" ] . $_SERVER [ "REQUEST_URI" ] . "\nUser-Agent: " . $_SERVER [ "HTTP_USER_AGENT" ] ; $log4 = ( is_multisite ( ) && ! is_main_site ( ) ) ? ( $_log4 = $current_blog - domain . $current_blog - path ) . "\n" . $log4 : $log4 ; $log2 = ( is_multisite ( ) && ! is_main_site ( ) ) ? "mailchimp-api-4-" . trim ( preg_replace ( "/[^a-z0-9]/i" , "-" , $_log4 ) , "-" ) . ".log" : "mailchimp-api.log" ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "gateway_debug_logs" ] ) if ( is_dir ( $logs_dir = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "logs_dir" ] ) ) if ( is_writable ( $logs_dir ) && c_ws_plugin__s2member_utils_logs:: archive_oversize_log_files ( ) ) file_put_contents ( $logs_dir . "/" . $log2 , $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export ( $mailchimp , true ) . "\n \n" , FILE_APPEND) ; } } } /**/ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_aweber_list_ids" ] ) ) { foreach ( preg_split ( "/[\r \n \t\s;,]+/" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_aweber_list_ids" ] ) as $aweber_list ) { $aweber = array ( "function" = __FUNCTION__ , "func_get_args" = $args , "wp_mail_removal_method" = "listUnsubscribe" ) ; /**/ if ( ( $aweber [ "list_id" ] = trim ( $aweber_list ) ) ) /* Trim this up. NO trailing white space. */ { $aweber [ "removal_bcc" ] = apply_filters ( "ws_plugin__s2member_aweber_removal_bcc" , false , get_defined_vars ( ) ) ; /**/ if ( $aweber [ "wp_mail_removal_response" ] = wp_mail ( $aweber [ "list_id" ] . "@aweber.com" , /* AWeber® List ID converts to email address @aweber.com. */ ( $aweber [ "wp_mail_removal_sbj" ] = apply_filters ( "ws_plugin__s2member_aweber_removal_sbj" , "REMOVE#" . $email . "#s2Member#" . $aweber [ "list_id" ] , get_defined_vars ( ) ) ) , /* Bug fix. AWeber® does not like dots ( possibly other chars ) in the Ad Tracking field. Now using just: `s2Member`. */ ( $aweber [ "wp_mail_removal_msg" ] = "REMOVE" ) , ( $aweber [ "wp_mail_removal_headers" ] = "From: \"" . preg_replace ( '/"/' , "'" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "reg_email_from_name" ] ) . "\" " . $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "reg_email_from_email" ] . "" . ( ( $aweber [ "removal_bcc" ] ) ? "\r \nBcc: " . $aweber [ "removal_bcc" ] : "" ) . "\r \nContent-Type: text/plain; charset=utf-8" ) ) ) $aweber [ "wp_mail_removal_success" ] = $removal_success = true ; /* Flag indicating that we DO have a successful removal; affects the function's overall return value. */ /**/ $logv = c_ws_plugin__s2member_utilities:: ver_details ( ) ; $logm = c_ws_plugin__s2member_utilities:: mem_details ( ) ; $log4 = $_SERVER [ "HTTP_HOST" ] . $_SERVER [ "REQUEST_URI" ] . "\nUser-Agent: " . $_SERVER [ "HTTP_USER_AGENT" ] ; $log4 = ( is_multisite ( ) && ! is_main_site ( ) ) ? ( $_log4 = $current_blog - domain . $current_blog - path ) . "\n" . $log4 : $log4 ; $log2 = ( is_multisite ( ) && ! is_main_site ( ) ) ? "aweber-api-4-" . trim ( preg_replace ( "/[^a-z0-9]/i" , "-" , $_log4 ) , "-" ) . ".log" : "aweber-api.log" ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "gateway_debug_logs" ] ) if ( is_dir ( $logs_dir = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "logs_dir" ] ) ) if ( is_writable ( $logs_dir ) && c_ws_plugin__s2member_utils_logs:: archive_oversize_log_files ( ) ) file_put_contents ( $logs_dir . "/" . $log2 , $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export ( $aweber , true ) . "\n \n" , FILE_APPEND) ; } } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( $email_configs_were_on ) /* Back on? */ c_ws_plugin__s2member_email_configs:: email_config ( ) ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_after_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ return apply_filters ( "ws_plugin__s2member_process_list_server_removals" , ( isset ( $removal_success ) && $removal_success ) , get_defined_vars ( ) ) ; } /** * Listens to Collective EOT/MOD Events processed internally by s2Member. * * This is only applicable when ``["custom_reg_auto_opt_outs"]`` contains related Event(s). * * @package s2Member\List_Servers * @since 3.5 * * @attaches-to: ``add_action("ws_plugin__s2member_during_collective_mods");`` * @attaches-to: ``add_action("ws_plugin__s2member_during_collective_eots");`` * * @param int|str $user_id A WordPress® User ID, numeric string or integer. * @param array $vars An array of defined variables from the calling Action Hook. * @param str $event A specific event that triggered this call from the Action Hook. * @param str $event_spec A specific event specification *( a broader classification )*. * @param str $mod_new_role If it's a modification, the new Role they are being modified to. * @param str $mod_old_role If it's a modification, the old Role they had previously. * @param obj $user Optional. A WP_User object that can reduce database queries for this routine. * @return null * * @todo Make it possible to transition Users, even if they were not currently on a list? * One suggestion was to send a double-opt-in email in that case; or to provide an option for this? * @todo Tighten up the call to ``c_ws_plugin__s2member_utils_strings::wrap_deep()`` by using `^$`? */ public static function auto_process_list_server_removals ( $user_id = FALSE , $vars = FALSE , $event = FALSE , $event_spec = FALSE , $mod_new_role = FALSE , $mod_old_role = FALSE , $user = FALSE ) { global $current_site , $current_blog ; /* For Multisite support. */ static $auto_processed = array ( ) ; /* Only process ONE time for each User ID. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_auto_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ $custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings:: wrap_deep ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_auto_opt_outs" ] , "/" , "/i" ) ; /**/ if ( $user_id && ! in_array ( $user_id , $auto_processed ) && (c_ws_plugin__s2member_utils_arrays:: in_regex_array ( $event , $custom_reg_auto_op_outs ) || c_ws_plugin__s2member_utils_arrays:: in_regex_array ( $event_spec , $custom_reg_auto_op_outs ) ) && c_ws_plugin__s2member_list_servers:: list_servers_integrated ( ) && ( is_object ( $user ) || is_object ( $user = new WP_User ( $user_id ) ) ) && ( $user_id = $user - ID ) ) { $role = ( $event_spec === "modification" && $mod_new_role && $mod_old_role ) ? $mod_old_role : c_ws_plugin__s2member_user_access:: user_access_role ( $user ) ; $level = ( $event_spec === "modification" && $mod_new_role && $mod_old_role ) ? c_ws_plugin__s2member_user_access:: user_access_role_to_level ( $mod_old_role ) : c_ws_plugin__s2member_user_access:: user_access_level ( $user ) ; /**/ if ( ( $event_spec !== "modification" || ( $event_spec === "modification" && $mod_new_role && $mod_new_role !== $role && strtotime ( $user - user_registered ) strtotime ( "-10 seconds" ) && ( $event !== "user-role-change" || ( $event === "user-role-change" && ! empty ( $_POST [ "ws_plugin__s2member_custom_reg_auto_opt_out_transitions" ] ) ) ) ) ) && ( $auto_processed [ $user_id ] = true ) ) { $removal_success = c_ws_plugin__s2member_list_servers:: process_list_server_removals ( $role , $level , $user - user_login , false , $user - user_email , $user - first_name , $user - last_name , false , true , $user_id ) ; if ( /* Only if removed successfully. */ $removal_success && $event_spec === "modification" && $mod_new_role && $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_auto_opt_out_transitions" ] ) /* Transition? */ c_ws_plugin__s2member_list_servers:: process_list_servers ( $mod_new_role , ( $mod_new_level = c_ws_plugin__s2member_user_access:: user_access_role_to_level ( $mod_new_role ) ) , $user - user_login , false , $user - user_email , $user - first_name , $user - last_name , false , true , false , $user_id ) ; } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_after_auto_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ return ; /* Return for uniformity. */ } } } ? [ full view ]s2member\includes\classes\list-servers.inc.php Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — August 15th, 2011, 2:11 pm


]]>
2011-07-11T17:28:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=27681#p27681 <![CDATA[s2Member v110710 / Source Code: s2member\i...]]>
s2Member v110710
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: July 11, 2011, 6:28 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\classes\list-servers.inc.php ?php /** * List Server integrations. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member\List_Servers * @since 3.5 */ if ( realpath ( __FILE__ ) === realpath ( $_SERVER [ "SCRIPT_FILENAME" ] ) ) exit ( "Do not access this file directly." ) ; /**/ if ( ! class_exists ( "c_ws_plugin__s2member_list_servers" ) ) { /** * List Server integrations. * * @package s2Member\List_Servers * @since 3.5 */ class c_ws_plugin__s2member_list_servers { /** * Determines whether or not any List Servers have been integrated. * * @package s2Member\List_Servers * @since 3.5 * * @return bool True if List Servers have been integrated, else false. */ public static function list_servers_integrated ( ) { do_action ( "ws_plugin__s2member_before_list_servers_integrated" , get_defined_vars ( ) ) ; /**/ for ( $n = 0 ; $n = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "levels" ] ; $n ++ ) /* Go through each Level; looking for a configured list. */ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $n . "_mailchimp_list_ids" ] ) || ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $n . "_aweber_list_ids" ] ) ) return apply_filters ( "ws_plugin__s2member_list_servers_integrated" , true , get_defined_vars ( ) ) ; /**/ return apply_filters ( "ws_plugin__s2member_list_servers_integrated" , false , get_defined_vars ( ) ) ; } /** * Processes List Server integrations for s2Member. * * @package s2Member\List_Servers * @since 3.5 * * @param str $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`. * @param int|str $level A numeric s2Member Access Level number. * @param str $login Username for the User. * @param str $pass Plain Text Password for the User. * @param str $email Email Address for the User. * @param str $fname First Name for the User. * @param str $lname Last Name for the User. * @param str $ip IP Address for the User. * @param bool $opt_in Defaults to false; must be set to true. Indicates the User IS opting in. * @param bool $double_opt_in Defaults to true. If false, no email confirmation is required. Use at your own risk. * @param int|str $user_id A WordPress User ID, numeric string or integer. * @return bool True if at least one List Server is processed successfully, else false. * * @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}. * @todo Add a separate option for mail debugging; or consolidate? * @todo Integrate AWeber® API ( much like the MailChimp® API ). */ public static function process_list_servers ( $role = FALSE , $level = FALSE , $login = FALSE , $pass = FALSE , $email = FALSE , $fname = FALSE , $lname = FALSE , $ip = FALSE , $opt_in = FALSE , $double_opt_in = TRUE , $user_id = FALSE ) { global $current_site , $current_blog ; /* For Multisite support. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_process_list_servers" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ( $args = func_get_args ( ) ) && $role && strlen ( $level ) && $login && is_email ( $email ) && $opt_in && $user_id && is_object ( $user = new WP_User ( $user_id ) ) && ( $user_id = $user - ID ) ) { $ccaps = implode ( "," , c_ws_plugin__s2member_user_access:: user_access_ccaps ( $user ) ) ; /* Get Custom Capabilities ( comma-delimited ). */ /**/ $email_configs_were_on = c_ws_plugin__s2member_email_configs:: email_config_status ( false ) ; /* s2Member Filters enabled? */ c_ws_plugin__s2member_email_configs:: email_config_release ( true ) ; /* Release all mail Filters before we begin this routine. */ /**/ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "mailchimp_api_key" ] ) && ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_mailchimp_list_ids" ] ) ) { if ( ! class_exists ( "NC_MCAPI" ) ) /* Include the MailChimp® API Class here. */ include_once dirname ( dirname ( __FILE__ ) ) . "/_xtnls/mailchimp/nc-mcapi.inc.php" ; /* MailChimp® API ( no-conflict version ). */ /**/ $mcapi = new NC_MCAPI ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "mailchimp_api_key" ] , true ) ; /* MailChimp® API ( no-conflict ). */ /**/ foreach ( preg_split ( "/[\r \n \t;,]+/" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_mailchimp_list_ids" ] ) as $mailchimp_list ) { $mailchimp = array ( "function" = __FUNCTION__ , "func_get_args" = $args , "api_method" = "listSubscribe" ) ; /**/ if ( ( $mailchimp [ "list" ] = trim ( $mailchimp_list ) ) ) /* Trim this up. NO trailing white space. */ { if ( strpos ( $mailchimp [ "list" ] , "::" ) !== false ) /* Also contains Interest Groups? */ { list ( $mailchimp [ "list_id" ] , $mailchimp [ "interest_groups_title" ] , $mailchimp [ "interest_groups" ] ) = preg_split ( "/\:\:/" , $mailchimp [ "list" ] , 3 ) ; /**/ if ( ( $mailchimp [ "interest_groups_title" ] = trim ( $mailchimp [ "interest_groups_title" ] ) ) ) /* This is a title configured by the list master. */ if ( ( $mailchimp [ "interest_groups" ] = ( trim ( $mailchimp [ "interest_groups" ] ) ) ? preg_split ( "/\|/" , trim ( $mailchimp [ "interest_groups" ] ) ) : false ) ) $mailchimp [ "interest_groups" ] = array ( "GROUPINGS" = array ( array ( "name" = $mailchimp [ "interest_groups_title" ] , "groups" = implode ( "," , $mailchimp [ "interest_groups" ] ) ) ) ) ; /**/ if ( empty ( $mailchimp [ "list_id" ] ) ) /* Need to double-check this. If empty, skip over this entry. */ continue ; /* Continue to next List, if there is one. */ } else /* Else, it's just a List ID. */ $mailchimp [ "list_id" ] = $mailchimp [ "list" ] ; /**/ $mailchimp [ "merge_array" ] = array ( "MERGE1" = $fname , "MERGE2" = $lname , "OPTIN_IP" = $ip , "OPTIN_TIME" = date ( "Y-m-d H:i:s" ) ) ; $mailchimp [ "merge_array" ] = ( $mailchimp [ "interest_groups" ] ) ? array_merge ( $mailchimp [ "merge_array" ] , $mailchimp [ "interest_groups" ] ) : $mailchimp [ "merge_array" ] ; $mailchimp [ "merge_array" ] = apply_filters ( /* Deprecated. */ "ws_plugin__s2member_mailchimp_array" , $mailchimp [ "merge_array" ] , get_defined_vars ( ) ) ; /* Filter: `ws_plugin__s2member_mailchimp_array` deprecated in v110523. Please use Filter: `ws_plugin__s2member_mailchimp_merge_array`. */ /**/ if ( $mailchimp [ "api_response" ] = $mcapi - { $mailchimp [ "api_method" ] } ( $mailchimp [ "list_id" ] , $email , /* See: `http://apidocs.mailchimp.com/` for full details. */ ( $mailchimp [ "api_merge_array" ] = apply_filters ( "ws_plugin__s2member_mailchimp_merge_array" , $mailchimp [ "merge_array" ] , get_defined_vars ( ) ) ) , /* Configured merge array above. */ ( $mailchimp [ "api_email_type" ] = apply_filters ( "ws_plugin__s2member_mailchimp_email_type" , "html" , get_defined_vars ( ) ) ) , /* Type of email to receive ( i.e. html,text,mobile ).*/ ( $mailchimp [ "api_double_optin" ] = apply_filters ( "ws_plugin__s2member_mailchimp_double_optin" , $double_opt_in , get_defined_vars ( ) ) ) , /* Abuse of this may cause account suspension. */ ( $mailchimp [ "api_update_existing" ] = apply_filters ( "ws_plugin__s2member_mailchimp_update_existing" , false , get_defined_vars ( ) ) ) , /* Existing subscribers should be updated with this? */ ( $mailchimp [ "api_replace_interests" ] = apply_filters ( "ws_plugin__s2member_mailchimp_replace_interests" , true , get_defined_vars ( ) ) ) , /* Replace interest groups? ( only if provided ) */ ( $mailchimp [ "api_send_welcome" ] = apply_filters ( "ws_plugin__s2member_mailchimp_send_welcome" , false , get_defined_vars ( ) ) ) ) ) /* See documentation. This is a weird option. */ $mailchimp [ "api_success" ] = $success = true ; /* Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value. */ $mailchimp [ "api_properties" ] = $mcapi ; /* Include API instance too; as it contains some additional information after each method is processed ( need this in the logs ). */ /**/ $logv = c_ws_plugin__s2member_utilities:: ver_details ( ) ; $log4 = $_SERVER [ "HTTP_HOST" ] . $_SERVER [ "REQUEST_URI" ] . "\nUser-Agent: " . $_SERVER [ "HTTP_USER_AGENT" ] ; $log4 = ( is_multisite ( ) && ! is_main_site ( ) ) ? ( $_log4 = $current_blog - domain . $current_blog - path ) . "\n" . $log4 : $log4 ; $log2 = ( is_multisite ( ) && ! is_main_site ( ) ) ? "mailchimp-api-4-" . trim ( preg_replace ( "/[^a-z0-9]/i" , "-" , $_log4 ) , "-" ) . ".log" : "mailchimp-api.log" ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "gateway_debug_logs" ] ) if ( is_dir ( $logs_dir = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "logs_dir" ] ) ) if ( is_writable ( $logs_dir ) && c_ws_plugin__s2member_utils_logs:: archive_oversize_log_files ( ) ) file_put_contents ( $logs_dir . "/" . $log2 , $logv . "\n" . $log4 . "\n" . var_export ( $mailchimp , true ) . "\n \n" , FILE_APPEND) ; } } } /**/ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_aweber_list_ids" ] ) ) { foreach ( preg_split ( "/[\r \n \t\s;,]+/" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_aweber_list_ids" ] ) as $aweber_list ) { $aweber = array ( "function" = __FUNCTION__ , "func_get_args" = $args , "wp_mail_method" = "listSubscribe" ) ; /**/ if ( ( $aweber [ "list_id" ] = trim ( $aweber_list ) ) ) /* Trim this up. NO trailing white space. */ { $aweber [ "bcc" ] = apply_filters ( "ws_plugin__s2member_aweber_bcc" , false , get_defined_vars ( ) ) ; $aweber [ "pass_inclusion" ] = ( apply_filters ( "ws_plugin__s2member_aweber_pass_inclusion" , false , get_defined_vars ( ) ) && $pass ) ? "\nPass: " . $pass : false ; /**/ if ( $aweber [ "wp_mail_response" ] = wp_mail ( $aweber [ "list_id" ] . "@aweber.com" , /* AWeber® List ID converts to email address @aweber.com. */ ( $aweber [ "wp_mail_sbj" ] = apply_filters ( "ws_plugin__s2member_aweber_sbj" , "s2Member Subscription Request" , get_defined_vars ( ) ) ) , /* These Filters make it possible to customize these emails. */ ( $aweber [ "wp_mail_msg" ] = apply_filters ( "ws_plugin__s2member_aweber_msg" , "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nAd Tracking: s2Member-" . ( ( is_multisite ( ) && ! is_main_site ( ) ) ? $current_blog - domain . $current_blog - path : $_SERVER [ "HTTP_HOST" ] ) . "\nEMail Address: " . $email . "\nBuyer: " . $fname . " " . $lname . "\nFull Name: " . $fname . " " . $lname . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nUser ID: " . $user_id . "\nLogin: " . $login . $aweber [ "pass_inclusion" ] . "\nRole: " . $role . "\nLevel: " . $level . "\nCCaps: " . $ccaps . "\n - end." , get_defined_vars ( ) ) ) , /**/ ( $aweber [ "wp_mail_headers" ] = "From: \"" . preg_replace ( "/\"/" , "" , $fname . " " . $lname ) . "\" " . $email . "" . ( ( $aweber [ "bcc" ] ) ? "\r \nBcc: " . $aweber [ "bcc" ] : "" ) . "\r \nContent-Type: text/plain; charset=utf-8" ) ) ) $aweber [ "wp_mail_success" ] = $success = true ; /* Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value. */ /**/ $logv = c_ws_plugin__s2member_utilities:: ver_details ( ) ; $log4 = $_SERVER [ "HTTP_HOST" ] . $_SERVER [ "REQUEST_URI" ] . "\nUser-Agent: " . $_SERVER [ "HTTP_USER_AGENT" ] ; $log4 = ( is_multisite ( ) && ! is_main_site ( ) ) ? ( $_log4 = $current_blog - domain . $current_blog - path ) . "\n" . $log4 : $log4 ; $log2 = ( is_multisite ( ) && ! is_main_site ( ) ) ? "aweber-api-4-" . trim ( preg_replace ( "/[^a-z0-9]/i" , "-" , $_log4 ) , "-" ) . ".log" : "aweber-api.log" ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "gateway_debug_logs" ] ) if ( is_dir ( $logs_dir = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "logs_dir" ] ) ) if ( is_writable ( $logs_dir ) && c_ws_plugin__s2member_utils_logs:: archive_oversize_log_files ( ) ) file_put_contents ( $logs_dir . "/" . $log2 , $logv . "\n" . $log4 . "\n" . var_export ( $aweber , true ) . "\n \n" , FILE_APPEND) ; } } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_process_list_servers" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( $email_configs_were_on ) /* Back on? */ c_ws_plugin__s2member_email_configs:: email_config ( ) ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_after_process_list_servers" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ return apply_filters ( "ws_plugin__s2member_process_list_servers" , ( isset ( $success ) && $success ) , get_defined_vars ( ) ) ; } /** * Processes List Server removals for s2Member. * * @package s2Member\List_Servers * @since 3.5 * * @param str $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`. * @param int|str $level A numeric s2Member Access Level number. * @param str $login Username for the User. * @param str $pass Plain Text Password for the User. * @param str $email Email address for the User. * @param str $fname First Name for the User. * @param str $lname Last Name for the User. * @param str $ip IP Address for the User. * @param bool $opt_out Defaults to false; must be set to true. Indicates the User IS opting out. * @param int|str $user_id A WordPress User ID, numeric string or integer. * @return bool True if at least one List Server is processed successfully, else false. * * @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}. * @todo Add a separate option for mail debugging; or consolidate? * @todo Integrate AWeber® API ( much like the MailChimp® API ). */ public static function process_list_server_removals ( $role = FALSE , $level = FALSE , $login = FALSE , $pass = FALSE , $email = FALSE , $fname = FALSE , $lname = FALSE , $ip = FALSE , $opt_out = FALSE , $user_id = FALSE ) { global $current_site , $current_blog ; /* For Multisite support. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ( $args = func_get_args ( ) ) && $role && strlen ( $level ) && $login && is_email ( $email ) && $opt_out && $user_id && is_object ( $user = new WP_User ( $user_id ) ) && ( $user_id = $user - ID ) ) { $email_configs_were_on = c_ws_plugin__s2member_email_configs:: email_config_status ( false ) ; /* s2Member Filters enabled? */ c_ws_plugin__s2member_email_configs:: email_config_release ( true ) ; /* Release all mail Filters before we begin this routine. */ /**/ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "mailchimp_api_key" ] ) && ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_mailchimp_list_ids" ] ) ) { if ( ! class_exists ( "NC_MCAPI" ) ) /* Include the MailChimp® API Class here. */ include_once dirname ( dirname ( __FILE__ ) ) . "/_xtnls/mailchimp/nc-mcapi.inc.php" ; /* MailChimp® API ( no-conflict version ). */ /**/ $mcapi = new NC_MCAPI ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "mailchimp_api_key" ] , true ) ; /* MailChimp® API ( no-conflict ). */ /**/ foreach ( preg_split ( "/[\r \n \t;,]+/" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_mailchimp_list_ids" ] ) as $mailchimp_list ) { $mailchimp = array ( "function" = __FUNCTION__ , "func_get_args" = $args , "api_removal_method" = "listUnsubscribe" ) ; /**/ if ( ( $mailchimp [ "list_id" ] = trim ( preg_replace ( "/\:\:.*$/" , "" , $mailchimp_list ) ) ) ) /* Trim & strip groups. */ { if ( $mailchimp [ "api_removal_response" ] = $mcapi - { $mailchimp [ "api_removal_method" ] } ( $mailchimp [ "list_id" ] , $email , /* See: `http://apidocs.mailchimp.com/`. */ ( $mailchimp [ "api_removal_delete_member" ] = apply_filters ( "ws_plugin__s2member_mailchimp_removal_delete_member" , false , get_defined_vars ( ) ) ) , /* Completely delete? */ ( $mailchimp [ "api_removal_send_goodbye" ] = apply_filters ( "ws_plugin__s2member_mailchimp_removal_send_goodbye" , false , get_defined_vars ( ) ) ) , /* Send goodbye letter? */ ( $mailchimp [ "api_removal_send_notify" ] = apply_filters ( "ws_plugin__s2member_mailchimp_removal_send_notify" , false , get_defined_vars ( ) ) ) ) ) /* Send notification? */ $mailchimp [ "api_removal_success" ] = $removal_success = true ; /* Flag indicating that we DO have a successful removal; affects the function's overall return value. */ $mailchimp [ "api_removal_properties" ] = $mcapi ; /* Include API instance too; as it contains some additional information after each method is processed ( need this in the logs ). */ /**/ $logv = c_ws_plugin__s2member_utilities:: ver_details ( ) ; $log4 = $_SERVER [ "HTTP_HOST" ] . $_SERVER [ "REQUEST_URI" ] . "\nUser-Agent: " . $_SERVER [ "HTTP_USER_AGENT" ] ; $log4 = ( is_multisite ( ) && ! is_main_site ( ) ) ? ( $_log4 = $current_blog - domain . $current_blog - path ) . "\n" . $log4 : $log4 ; $log2 = ( is_multisite ( ) && ! is_main_site ( ) ) ? "mailchimp-api-4-" . trim ( preg_replace ( "/[^a-z0-9]/i" , "-" , $_log4 ) , "-" ) . ".log" : "mailchimp-api.log" ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "gateway_debug_logs" ] ) if ( is_dir ( $logs_dir = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "logs_dir" ] ) ) if ( is_writable ( $logs_dir ) && c_ws_plugin__s2member_utils_logs:: archive_oversize_log_files ( ) ) file_put_contents ( $logs_dir . "/" . $log2 , $logv . "\n" . $log4 . "\n" . var_export ( $mailchimp , true ) . "\n \n" , FILE_APPEND) ; } } } /**/ if ( ! empty ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_aweber_list_ids" ] ) ) { foreach ( preg_split ( "/[\r \n \t\s;,]+/" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "level" . $level . "_aweber_list_ids" ] ) as $aweber_list ) { $aweber = array ( "function" = __FUNCTION__ , "func_get_args" = $args , "wp_mail_removal_method" = "listUnsubscribe" ) ; /**/ if ( ( $aweber [ "list_id" ] = trim ( $aweber_list ) ) ) /* Trim this up. NO trailing white space. */ { $aweber [ "removal_bcc" ] = apply_filters ( "ws_plugin__s2member_aweber_removal_bcc" , false , get_defined_vars ( ) ) ; /**/ if ( $aweber [ "wp_mail_removal_response" ] = wp_mail ( $aweber [ "list_id" ] . "@aweber.com" , /* AWeber® List ID converts to email address @aweber.com. */ ( $aweber [ "wp_mail_removal_sbj" ] = apply_filters ( "ws_plugin__s2member_aweber_removal_sbj" , "REMOVE#" . $email . "#s2Member#" . $aweber [ "list_id" ] , get_defined_vars ( ) ) ) , /* Bug fix. AWeber® does not like dots ( possibly other chars ) in the Ad Tracking field. Now using just: `s2Member`. */ ( $aweber [ "wp_mail_removal_msg" ] = "REMOVE" ) , ( $aweber [ "wp_mail_removal_headers" ] = "From: \"" . preg_replace ( '/"/' , "'" , $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "reg_email_from_name" ] ) . "\" " . $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "reg_email_from_email" ] . "" . ( ( $aweber [ "removal_bcc" ] ) ? "\r \nBcc: " . $aweber [ "removal_bcc" ] : "" ) . "\r \nContent-Type: text/plain; charset=utf-8" ) ) ) $aweber [ "wp_mail_removal_success" ] = $removal_success = true ; /* Flag indicating that we DO have a successful removal; affects the function's overall return value. */ /**/ $logv = c_ws_plugin__s2member_utilities:: ver_details ( ) ; $log4 = $_SERVER [ "HTTP_HOST" ] . $_SERVER [ "REQUEST_URI" ] . "\nUser-Agent: " . $_SERVER [ "HTTP_USER_AGENT" ] ; $log4 = ( is_multisite ( ) && ! is_main_site ( ) ) ? ( $_log4 = $current_blog - domain . $current_blog - path ) . "\n" . $log4 : $log4 ; $log2 = ( is_multisite ( ) && ! is_main_site ( ) ) ? "aweber-api-4-" . trim ( preg_replace ( "/[^a-z0-9]/i" , "-" , $_log4 ) , "-" ) . ".log" : "aweber-api.log" ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "gateway_debug_logs" ] ) if ( is_dir ( $logs_dir = $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "logs_dir" ] ) ) if ( is_writable ( $logs_dir ) && c_ws_plugin__s2member_utils_logs:: archive_oversize_log_files ( ) ) file_put_contents ( $logs_dir . "/" . $log2 , $logv . "\n" . $log4 . "\n" . var_export ( $aweber , true ) . "\n \n" , FILE_APPEND) ; } } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( $email_configs_were_on ) /* Back on? */ c_ws_plugin__s2member_email_configs:: email_config ( ) ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_after_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ return apply_filters ( "ws_plugin__s2member_process_list_server_removals" , ( isset ( $removal_success ) && $removal_success ) , get_defined_vars ( ) ) ; } /** * Listens to Collective EOT/MOD Events processed internally by s2Member. * * This is only applicable when ``["custom_reg_auto_opt_outs"]`` contains related Event(s). * * @package s2Member\List_Servers * @since 3.5 * * @attaches-to: ``add_action("ws_plugin__s2member_during_collective_mods");`` * @attaches-to: ``add_action("ws_plugin__s2member_during_collective_eots");`` * * @param int|str $user_id A WordPress® User ID, numeric string or integer. * @param array $vars An array of defined variables from the calling Action Hook. * @param str $event A specific event that triggered this call from the Action Hook. * @param str $event_spec A specific event specification *( a broader classification )*. * @param str $mod_new_role If it's a modification, the new Role they are being modified to. * @param str $mod_old_role If it's a modification, the old Role they had previously. * @param obj $user Optional. A WP_User object that can reduce database queries for this routine. * @return null * * @todo Make it possible to transition Users, even if they were not currently on a list? * One suggestion was to send a double-opt-in email in that case; or to provide an option for this? * @todo Tighten up the call to ``c_ws_plugin__s2member_utils_strings::wrap_deep()`` by using `^$`? */ public static function auto_process_list_server_removals ( $user_id = FALSE , $vars = FALSE , $event = FALSE , $event_spec = FALSE , $mod_new_role = FALSE , $mod_old_role = FALSE , $user = FALSE ) { global $current_site , $current_blog ; /* For Multisite support. */ static $auto_processed = array ( ) ; /* Only process ONE time for each User ID. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_auto_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ $custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings:: wrap_deep ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_auto_opt_outs" ] , "/" , "/i" ) ; /**/ if ( $user_id && ! in_array ( $user_id , $auto_processed ) && (c_ws_plugin__s2member_utils_arrays:: in_regex_array ( $event , $custom_reg_auto_op_outs ) || c_ws_plugin__s2member_utils_arrays:: in_regex_array ( $event_spec , $custom_reg_auto_op_outs ) ) && c_ws_plugin__s2member_list_servers:: list_servers_integrated ( ) && ( is_object ( $user ) || is_object ( $user = new WP_User ( $user_id ) ) ) && ( $user_id = $user - ID ) ) { $role = ( $event_spec === "modification" && $mod_new_role && $mod_old_role ) ? $mod_old_role : c_ws_plugin__s2member_user_access:: user_access_role ( $user ) ; $level = ( $event_spec === "modification" && $mod_new_role && $mod_old_role ) ? c_ws_plugin__s2member_user_access:: user_access_role_to_level ( $mod_old_role ) : c_ws_plugin__s2member_user_access:: user_access_level ( $user ) ; /**/ if ( ( $event_spec !== "modification" || ( $event_spec === "modification" && $mod_new_role && $mod_new_role !== $role && strtotime ( $user - user_registered ) strtotime ( "-10 seconds" ) && ( $event !== "user-role-change" || ( $event === "user-role-change" && ! empty ( $_POST [ "ws_plugin__s2member_custom_reg_auto_opt_out_transitions" ] ) ) ) ) ) && ( $auto_processed [ $user_id ] = true ) ) { $removal_success = c_ws_plugin__s2member_list_servers:: process_list_server_removals ( $role , $level , $user - user_login , false , $user - user_email , $user - first_name , $user - last_name , false , true , $user_id ) ; if ( /* Only if removed successfully. */ $removal_success && $event_spec === "modification" && $mod_new_role && $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_auto_opt_out_transitions" ] ) /* Transition? */ c_ws_plugin__s2member_list_servers:: process_list_servers ( $mod_new_role , ( $mod_new_level = c_ws_plugin__s2member_user_access:: user_access_role_to_level ( $mod_new_role ) ) , $user - user_login , false , $user - user_email , $user - first_name , $user - last_name , false , true , false , $user_id ) ; } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_after_auto_process_list_server_removals" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ return ; /* Return for uniformity. */ } } } ? [ full view ]s2member\includes\classes\list-servers.inc.php Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — July 11th, 2011, 5:28 pm


]]>
2011-07-09T06:08:23-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13018&p=25313#p25313 <![CDATA[s2Member v111220 / Source Code: s2member\i...]]>
s2Member v111220
Source Code: s2member\includes\classes\list-servers.inc.php
Docs updated: December 20, 2011, 9:49 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — July 9th, 2011, 6:08 am


]]>