当前位置: 首页>>代码示例>>PHP>>正文


PHP c_ws_plugin__s2member_user_access::user_access_ccaps方法代码示例

本文整理汇总了PHP中c_ws_plugin__s2member_user_access::user_access_ccaps方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_user_access::user_access_ccaps方法的具体用法?PHP c_ws_plugin__s2member_user_access::user_access_ccaps怎么用?PHP c_ws_plugin__s2member_user_access::user_access_ccaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c_ws_plugin__s2member_user_access的用法示例。


在下文中一共展示了c_ws_plugin__s2member_user_access::user_access_ccaps方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_user

 /**
  * Gets data for an existing User.
  *
  * @package s2Member\API_Remote_Ops
  * @since 140103
  *
  * @param array $op An input array of Remote Operation parameters.
  *
  * @return string Returns a serialized array with an `ID` element object on success (among other array elements);
  *   else returns a string beginning with `Error:` on failure; which will include details regarding the error.
  */
 public static function get_user($op = NULL)
 {
     if (!empty($op['op']) && $op['op'] === 'get_user' && !empty($op['data']) && is_array($op['data'])) {
         if (!empty($op['data']['user_id']) && ($_user = new WP_User((int) $op['data']['user_id'])) && !empty($_user->ID)) {
             $user = $_user;
         } else {
             if (!empty($op['data']['user_login']) && ($_user = new WP_User(0, (string) $op['data']['user_login'])) && !empty($_user->ID)) {
                 $user = $_user;
             } else {
                 if (!empty($op['data']['user_email']) && ($_user = get_user_by('email', (string) $op['data']['user_email'])) && !empty($_user->ID)) {
                     $user = $_user;
                 } else {
                     return 'Error: Failed to locate this User. Unable to obtain WP_User object instance with data supplied (i.e., ID/Username/Email not found).';
                 }
             }
         }
         if (is_multisite() && !is_user_member_of_blog($user->ID)) {
             return 'Error: Failed to locate this User. Unable to obtain WP_User object instance with data supplied (i.e., ID/Username/Email not a part of this Blog).';
         }
         $role = c_ws_plugin__s2member_user_access::user_access_role($user);
         $level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
         $ccaps = c_ws_plugin__s2member_user_access::user_access_ccaps($user);
         $data = (array) $user->data;
         // Copy of data property.
         unset($data['user_pass']);
         $s2member_originating_blog = get_user_option('s2member_originating_blog', $user->ID);
         $s2member_subscr_gateway = get_user_option('s2member_subscr_gateway', $user->ID);
         $s2member_subscr_id = get_user_option('s2member_subscr_id', $user->ID);
         $s2member_custom = get_user_option('s2member_custom', $user->ID);
         $s2member_registration_ip = get_user_option('s2member_registration_ip', $user->ID);
         $s2member_notes = get_user_option('s2member_notes', $user->ID);
         $s2member_auto_eot_time = get_user_option('s2member_auto_eot_time', $user->ID);
         $s2member_custom_fields = get_user_option('s2member_custom_fields', $user->ID);
         $s2member_paid_registration_times = get_user_option('s2member_paid_registration_times', $user->ID);
         $s2member_file_download_access_log = get_user_option('s2member_file_download_access_log', $user->ID);
         return serialize(array('ID' => $user->ID, 'role' => $role, 'level' => $level, 'ccaps' => $ccaps, 'data' => $data, 's2member_originating_blog' => $s2member_originating_blog, 's2member_subscr_gateway' => $s2member_subscr_gateway, 's2member_subscr_id' => $s2member_subscr_id, 's2member_custom' => $s2member_custom, 's2member_registration_ip' => $s2member_registration_ip, 's2member_notes' => $s2member_notes, 's2member_auto_eot_time' => $s2member_auto_eot_time, 's2member_custom_fields' => $s2member_custom_fields, 's2member_paid_registration_times' => $s2member_paid_registration_times, 's2member_file_download_access_log' => $s2member_file_download_access_log));
     }
     return 'Error: Empty or invalid request ( `get_user` ). Please try again.';
 }
开发者ID:NClaus,项目名称:Ambrose,代码行数:50,代码来源:remote-ops-in.inc.php

示例2: get_user

 /**
  * Gets data for an existing User.
  *
  * @package s2Member\API_Remote_Ops
  * @since 140103
  *
  * @param array An input array of Remote Operation parameters.
  * @return str Returns a serialized array with an `ID` element object on success (among other array elements);
  * 	else returns a string beginning with `Error:` on failure; which will include details regarding the error.
  */
 public static function get_user($op = NULL)
 {
     if (!empty($op["op"]) && $op["op"] === "get_user" && !empty($op["data"]) && is_array($op["data"])) {
         if (!empty($op["data"]["user_id"]) && ($_user = new WP_User((int) $op["data"]["user_id"])) && !empty($_user->ID)) {
             $user = $_user;
         } else {
             if (!empty($op["data"]["user_login"]) && ($_user = new WP_User((string) $op["data"]["user_login"])) && !empty($_user->ID)) {
                 $user = $_user;
             } else {
                 if (!empty($op["data"]["user_email"]) && ($_user = get_user_by('email', (string) $op["data"]["user_email"])) && !empty($_user->ID)) {
                     $user = $_user;
                 } else {
                     return "Error: Failed to locate this User. Unable to obtain WP_User object instance with data supplied (i.e. ID/Username/Email not found).";
                 }
             }
         }
         if (is_multisite() && !is_user_member_of_blog($user->ID)) {
             return "Error: Failed to locate this User. Unable to obtain WP_User object instance with data supplied (i.e. ID/Username/Email not a part of this Blog).";
         }
         $role = c_ws_plugin__s2member_user_access::user_access_role($user);
         $level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
         $ccaps = c_ws_plugin__s2member_user_access::user_access_ccaps($user);
         $data = (array) $user->data;
         unset($data['user_pass']);
         $s2member_originating_blog = get_user_option("s2member_originating_blog", $user->ID);
         $s2member_subscr_gateway = get_user_option("s2member_subscr_gateway", $user->ID);
         $s2member_subscr_id = get_user_option("s2member_subscr_id", $user->ID);
         $s2member_custom = get_user_option("s2member_custom", $user->ID);
         $s2member_registration_ip = get_user_option("s2member_registration_ip", $user->ID);
         $s2member_notes = get_user_option("s2member_notes", $user->ID);
         $s2member_auto_eot_time = get_user_option("s2member_auto_eot_time", $user->ID);
         $s2member_custom_fields = get_user_option("s2member_custom_fields", $user->ID);
         $s2member_paid_registration_times = get_user_option("s2member_paid_registration_times", $user->ID);
         $s2member_file_download_access_log = get_user_option("s2member_file_download_access_log", $user->ID);
         return serialize(array("ID" => $user->ID, "role" => $role, "level" => $level, "ccaps" => $ccaps, "data" => $data, "s2member_originating_blog" => $s2member_originating_blog, "s2member_subscr_gateway" => $s2member_subscr_gateway, "s2member_subscr_id" => $s2member_subscr_id, "s2member_custom" => $s2member_custom, "s2member_registration_ip" => $s2member_registration_ip, "s2member_notes" => $s2member_notes, "s2member_auto_eot_time" => $s2member_auto_eot_time, "s2member_custom_fields" => $s2member_custom_fields, "s2member_paid_registration_times" => $s2member_paid_registration_times, "s2member_file_download_access_log" => $s2member_file_download_access_log));
     }
     return "Error: Empty or invalid request ( `get_user` ). Please try again.";
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:48,代码来源:remote-ops-in.inc.php

示例3: process_list_server_removals

 /**
  * 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;
     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);
     if (c_ws_plugin__s2member_list_servers::list_servers_integrated() && ($args = func_get_args()) && $role && is_string($role) && is_numeric($level) && $login && is_string($login) && is_string($pass = (string) $pass) && $email && is_string($email) && is_email($email) && is_string($fname = (string) $fname) && is_string($lname = (string) $lname) && is_string($ip = (string) $ip) && is_bool($opt_out = (bool) $opt_out) && $opt_out && $user_id && is_numeric($user_id) && is_object($user = new WP_User($user_id)) && !empty($user->ID)) {
         $ccaps = implode(",", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
         $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
         c_ws_plugin__s2member_email_configs::email_config_release();
         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_once dirname(dirname(__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
             }
             $mcapi = new NC_MCAPI($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"], true);
             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))) {
                     if ($mailchimp["api_removal_response"] = $mcapi->{$mailchimp["api_removal_method"]}($mailchimp["list_id"], $email, $mailchimp["api_removal_delete_member"] = apply_filters("ws_plugin__s2member_mailchimp_removal_delete_member", false, get_defined_vars()), $mailchimp["api_removal_send_goodbye"] = apply_filters("ws_plugin__s2member_mailchimp_removal_send_goodbye", false, get_defined_vars()), $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).
                     $logt = c_ws_plugin__s2member_utilities::time_details();
                     $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, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($mailchimp, true)) . "\n\n", FILE_APPEND);
                             }
                         }
                     }
                 }
             }
         }
         if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"]) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"])) {
             foreach (preg_split("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]) as $getresponse_list) {
                 $getresponse = array("function" => __FUNCTION__, "func_get_args" => $args, "api_method" => "get_contacts");
                 if ($getresponse["list_id"] = $getresponse["list"] = trim($getresponse_list)) {
                     $getresponse["api_headers"] = array("Content-Type" => "application/json");
                     $getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("campaigns" => array($getresponse["list_id"]), "email" => array("EQUALS" => $email)));
                     $getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
                     if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && ($getresponse["api_response_contact_ids"] = array_keys((array) $getresponse["api_response"]->result)) && ($getresponse["api_response_contact_id"] = $getresponse["api_response_contact_ids"][0])) {
                         $getresponse["api_method"] = "delete_contact";
                         // Update method now.
                         $getresponse["api_headers"] = array("Content-Type" => "application/json");
                         $getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("contact" => $getresponse["api_response_contact_id"]));
                         $getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
                         if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && $getresponse["api_response"]->result->deleted) {
                             $getresponse["api_success"] = $success = true;
                         }
                     }
                     $logt = c_ws_plugin__s2member_utilities::time_details();
                     $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() ? "getresponse-api-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "getresponse-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, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($getresponse, 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) {
//.........这里部分代码省略.........
开发者ID:donwea,项目名称:nhap.org,代码行数:101,代码来源:list-servers.inc.php

示例4: new_user_notification

 /**
  * Handles new User/Member notifications.
  *
  * @package s2Member\Email_Configs
  * @since 110707
  *
  * @param string|int $user_id A numeric WordPress User ID.
  * @param string $user_pass Optional. A plain text version of the User's password.
  * 	If omitted, only the administrative notification will be sent.
  * @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
  * @param string $user_email Optional. This defaults to the user's currently configured email address.
  * @return bool True if all required parameters are supplied, else false.
  */
 public static function new_user_notification($user_id = FALSE, $user_pass = FALSE, $notify = array("user", "admin"), $user_email = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_new_user_notification", get_defined_vars());
     unset($__refs, $__v);
     if ($user_id && ($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && is_array($notify) && !empty($notify)) {
         $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
         c_ws_plugin__s2member_email_configs::email_config_release();
         if (in_array("user", $notify) && $user_pass) {
             $fields = get_user_option("s2member_custom_fields", $user_id);
             $cv = preg_split("/\\|/", get_user_option("s2member_custom", $user_id));
             $role = c_ws_plugin__s2member_user_access::user_access_role($user);
             $label = c_ws_plugin__s2member_user_access::user_access_label($user);
             $level = c_ws_plugin__s2member_user_access::user_access_level($user);
             $ccaps = implode(",", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
             $user->user_email = $user_email ? $user_email : $user->user_email;
             $user_full_name = trim($user->first_name . " " . $user->last_name);
             $user_ip = $_SERVER["REMOTE_ADDR"];
             if ($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_subject"]) {
                 if ($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)) {
                     if ($sbj = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
                         if ($sbj = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
                             if ($sbj = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
                                 if ($sbj = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
                                     if ($sbj = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
                                         if ($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
                                             if ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
                                                 if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
                                                     if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                         if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                             if ($sbj = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
                                                                 if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
                                                                     if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                         if (is_array($fields) && !empty($fields)) {
                                                                             foreach ($fields as $var => $val) {
                                                                                 if (!($sbj = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
                                                                                     break;
                                                                                 }
                                                                             }
                                                                         }
                                                                         if ($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_message"]) {
                                                                             if ($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) {
                                                                                 if ($msg = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $msg)) {
                                                                                     if ($msg = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $msg)) {
                                                                                         if ($msg = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $msg)) {
                                                                                             if ($msg = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $msg)) {
                                                                                                 if ($msg = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $msg)) {
                                                                                                     if ($msg = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) {
                                                                                                         if ($msg = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)) {
                                                                                                             if ($msg = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $msg)) {
                                                                                                                 if ($msg = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                     if ($msg = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                         if ($msg = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $msg)) {
                                                                                                                             if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $msg)) {
                                                                                                                                 if ($msg = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
                                                                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                                                                         foreach ($fields as $var => $val) {
                                                                                                                                             if (!($msg = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg))) {
                                                                                                                                                 break;
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                     if (($sbj = trim(preg_replace("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                                                                                                         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                                             $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                                             $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                                         }
                                                                                                                                         c_ws_plugin__s2member_email_configs::email_config() . wp_mail($user->user_email, apply_filters("ws_plugin__s2member_welcome_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_welcome_email_msg", $msg, get_defined_vars()), "From: \"" . preg_replace('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release();
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
//.........这里部分代码省略.........
开发者ID:NClaus,项目名称:Ambrose,代码行数:101,代码来源:email-configs.inc.php

示例5: fill_ruri_level_access_rc_vars

 /**
  * Fills Replacement Code variables in URIs; collectively.
  *
  * @package s2Member\URIs
  * @since 3.5
  *
  * @param string $uris A URI string, or a string of multiple URIs is also fine.
  * @param object $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
  *
  * @return string Collective string of input URIs, with Replacement Codes having been filled.
  */
 public static function fill_ruri_level_access_rc_vars($uris = '', $user = NULL)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_fill_ruri_level_access_rc_vars', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $uris = (string) $uris;
     // Force ``$uris`` to a string value.
     $orig_uris = $uris;
     // Record the original URIs that were passed in; collectively.
     $user = (is_object($user) || is_object($user = wp_get_current_user())) && !empty($user->ID) ? $user : NULL;
     $user_id = $user ? (string) $user->ID : '';
     $user_login = $user ? (string) strtolower($user->user_login) : '';
     $user_nicename = $user ? (string) strtolower($user->user_nicename) : '';
     $user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
     $user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
     $user_ccaps = (string) implode('-', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
     $user_logins = $user ? (string) (int) get_user_option('s2member_login_counter', $user_id) : '-1';
     $uris = strlen($user_login) ? preg_replace('/%%current_user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_login)), $uris) : $uris;
     $uris = strlen($user_nicename) ? preg_replace('/%%current_user_nicename%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_nicename)), $uris) : $uris;
     $uris = strlen($user_id) ? preg_replace('/%%current_user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $uris) : $uris;
     $uris = strlen($user_level) ? preg_replace('/%%current_user_level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_level)), $uris) : $uris;
     $uris = strlen($user_role) ? preg_replace('/%%current_user_role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_role)), $uris) : $uris;
     $uris = strlen($user_ccaps) ? preg_replace('/%%current_user_ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_ccaps)), $uris) : $uris;
     $uris = strlen($user_logins) ? preg_replace('/%%current_user_logins%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_logins)), $uris) : $uris;
     return apply_filters('ws_plugin__s2member_fill_ruri_level_access_rc_vars', $uris, get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:40,代码来源:ruris.inc.php

示例6: get_user_field

 /**
  * Retrieves a field value. Also supports Custom Fields.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
  * 	Or, this could be set to any property that exists on the WP_User object for a particular User;
  * 	( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
  * 	`s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
  * 	`s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
  * 	`s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
  * 	`s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
  * 	`s2member_access_ccaps`, etc, etc. ).
  * @param int|str $user_id Optional. Defaults to the current User's ID.
  * @return mixed The value of the requested field, or false if the field does not exist.
  */
 public static function get_user_field($field_id = FALSE, $user_id = FALSE)
 {
     global $wpdb;
     $current_user = wp_get_current_user();
     if (is_object($user = $user_id ? new WP_User($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID)) {
         if (isset($user->{$field_id})) {
             return $user->{$field_id};
         } else {
             if (isset($user->data->{$field_id})) {
                 return $user->data->{$field_id};
             } else {
                 if (isset($user->{$wpdb->prefix . $field_id})) {
                     return $user->{$wpdb->prefix . $field_id};
                 } else {
                     if (isset($user->data->{$wpdb->prefix . $field_id})) {
                         return $user->data->{$wpdb->prefix . $field_id};
                     } else {
                         if (strcasecmp($field_id, "full_name") === 0) {
                             return trim($user->first_name . " " . $user->last_name);
                         } else {
                             if (preg_match("/^(email|user_email)\$/i", $field_id)) {
                                 return $user->user_email;
                             } else {
                                 if (preg_match("/^(login|user_login)\$/i", $field_id)) {
                                     return $user->user_login;
                                 } else {
                                     if (strcasecmp($field_id, "s2member_access_role") === 0) {
                                         return c_ws_plugin__s2member_user_access::user_access_role($user);
                                     } else {
                                         if (strcasecmp($field_id, "s2member_access_level") === 0) {
                                             return c_ws_plugin__s2member_user_access::user_access_level($user);
                                         } else {
                                             if (strcasecmp($field_id, "s2member_access_label") === 0) {
                                                 return c_ws_plugin__s2member_user_access::user_access_label($user);
                                             } else {
                                                 if (strcasecmp($field_id, "s2member_access_ccaps") === 0) {
                                                     return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
                                                 } else {
                                                     if (strcasecmp($field_id, "ip") === 0 && is_object($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID)) {
                                                         return $_SERVER["REMOTE_ADDR"];
                                                     } else {
                                                         if (strcasecmp($field_id, "s2member_registration_ip") === 0 || strcasecmp($field_id, "reg_ip") === 0 || strcasecmp($field_id, "ip") === 0) {
                                                             return get_user_option("s2member_registration_ip", $user_id);
                                                         } else {
                                                             if (strcasecmp($field_id, "s2member_subscr_or_wp_id") === 0) {
                                                                 return ($subscr_id = get_user_option("s2member_subscr_id", $user_id)) ? $subscr_id : $user_id;
                                                             } else {
                                                                 if (is_array($fields = get_user_option("s2member_custom_fields", $user_id))) {
                                                                     if (isset($fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))])) {
                                                                         return $fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))];
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:86,代码来源:utils-users.inc.php

示例7: fill_ruri_level_access_rc_vars

 /**
  * Fills Replacement Code variables in URIs; collectively.
  *
  * @package s2Member\URIs
  * @since 3.5
  *
  * @param str $uris A URI string, or a string of multiple URIs is also fine.
  * @param obj $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
  * @return str Collective string of input URIs, with Replacement Codes having been filled.
  */
 public static function fill_ruri_level_access_rc_vars($uris = FALSE, $user = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars());
     unset($__refs, $__v);
     $uris = (string) $uris;
     // Force ``$uris`` to a string value.
     $orig_uris = $uris;
     // Record the original URIs that were passed in; collectively.
     $user = (is_object($user) || is_object($user = is_user_logged_in() ? wp_get_current_user() : false)) && !empty($user->ID) ? $user : false;
     $user_id = $user ? (string) $user->ID : "";
     $user_login = $user ? (string) strtolower($user->user_login) : "";
     $user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
     $user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
     $user_ccaps = (string) implode("-", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
     $user_logins = $user ? (string) (int) get_user_option("s2member_login_counter", $user_id) : "-1";
     $uris = strlen($user_login) ? preg_replace("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_login), $uris) : $uris;
     $uris = strlen($user_id) ? preg_replace("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $uris) : $uris;
     $uris = strlen($user_level) ? preg_replace("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_level), $uris) : $uris;
     $uris = strlen($user_role) ? preg_replace("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_role), $uris) : $uris;
     $uris = strlen($user_ccaps) ? preg_replace("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ccaps), $uris) : $uris;
     $uris = strlen($user_logins) ? preg_replace("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_logins), $uris) : $uris;
     return apply_filters("ws_plugin__s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars());
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:36,代码来源:ruris.inc.php

示例8: export_users


//.........这里部分代码省略.........
         $users = $wpdb->get_results("SELECT `" . $wpdb->users . "`.`ID` FROM `" . $wpdb->users . "`, `" . $wpdb->usermeta . "` WHERE `" . $wpdb->users . "`.`ID` = `" . $wpdb->usermeta . "`.`user_id` AND `" . $wpdb->usermeta . "`.`meta_key` = '" . esc_sql($wpdb->prefix . 'capabilities') . "' ORDER BY `" . $wpdb->users . "`.`ID` ASC LIMIT " . $sql_s . ", " . $limit);
         $users = is_array($users) ? $users : array();
         // List of the users on this blog.
         foreach ($users as $_user) {
             $_user_line = '';
             // Initialize the export line for this user.
             if (!is_object($_user = new WP_User($_user->ID)) || !$_user->ID) {
                 continue;
             }
             // Nothing to export for this user.
             foreach ($user_keys as $_user_key) {
                 $_value = '';
                 // Intialize value.
                 switch ($_user_key) {
                     default:
                         // Default handler.
                         $_value = $_user->{$_user_key};
                         break;
                 }
                 $_user_line .= ',"' . c_ws_plugin__s2member_utils_strings::esc_dq((string) $_value, 1, '"') . '"';
             }
             unset($_user_key, $_value);
             // Housekeeping.
             foreach ($user_permission_keys as $_user_permission_key) {
                 $_value = '';
                 // Intialize value.
                 switch ($_user_permission_key) {
                     case 'role':
                         // The user's role.
                         $_value = c_ws_plugin__s2member_user_access::user_access_role($_user);
                         break;
                     case 'ccaps':
                         // s2 custom capabilities.
                         $_value = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($_user));
                         break;
                 }
                 $_user_line .= ',"' . c_ws_plugin__s2member_utils_strings::esc_dq($_value, 1, '"') . '"';
             }
             unset($_user_permission_key, $_value);
             // Housekeeping.
             $_user_meta_values = $wpdb->get_results("SELECT `meta_key`, `meta_value` FROM `" . $wpdb->usermeta . "` WHERE `user_id` = '" . esc_sql($_user->ID) . "'", OBJECT_K);
             foreach ($user_meta_keys as $_user_meta_key) {
                 $_value = '';
                 // Intialize value.
                 switch ($_user_meta_key) {
                     case $wpdb->prefix . 'capabilities':
                     case $wpdb->prefix . 's2member_sp_references':
                     case $wpdb->prefix . 's2member_ipn_signup_vars':
                     case $wpdb->prefix . 's2member_access_cap_times':
                     case $wpdb->prefix . 's2member_paid_registration_times':
                     case $wpdb->prefix . 's2member_file_download_access_arc':
                     case $wpdb->prefix . 's2member_file_download_access_log':
                         // This handles JSON-encoding for known array values.
                         if (isset($_user_meta_values[$_user_meta_key]->meta_value[0])) {
                             $_value = json_encode(maybe_unserialize($_user_meta_values[$_user_meta_key]->meta_value));
                         }
                         break;
                     default:
                         // Default handler.
                         if (isset($_user_meta_values[$_user_meta_key]->meta_value[0])) {
                             if ($format === 'readable' && strpos($_user_meta_values[$_user_meta_key]->meta_value, '{')) {
                                 $_value = json_encode(maybe_unserialize($_user_meta_values[$_user_meta_key]->meta_value));
                             } else {
                                 $_value = $_user_meta_values[$_user_meta_key]->meta_value;
                             }
                         }
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:67,代码来源:exports-in.inc.php

示例9: validate_args

 /**
  * Validates args.
  *
  * @since 141004
  * @package s2Member\List_Servers
  *
  * @param array $args Input arguments.
  *
  * @return \stdClass|null An object with only valid properties.
  *    If unable to validate, this returns a `NULL` value.
  */
 public static function validate_args($args)
 {
     if (!$args || !is_array($args)) {
         return NULL;
     }
     $defaults = array('role' => '', 'level' => '', 'ccaps' => '', 'login' => '', 'pass' => '', 'email' => '', 'fname' => '', 'lname' => '', 'ip' => '', 'opt_out' => FALSE, 'opt_in' => FALSE, 'double_opt_in' => FALSE, 'user' => NULL, 'user_id' => 0);
     $args = array_merge($defaults, $args);
     $args = (object) array_intersect_key($args, $defaults);
     foreach ($args as $_key => &$_value) {
         switch ($_key) {
             case 'role':
             case 'level':
                 $_value = (string) $_value;
                 break;
             case 'ccaps':
                 // Input can be a string or an array.
                 $_value = is_array($_value) ? implode(',', $_value) : (string) $_value;
                 break;
             case 'login':
             case 'pass':
             case 'email':
             case 'fname':
             case 'lname':
             case 'ip':
                 $_value = (string) $_value;
                 break;
             case 'opt_in':
             case 'double_opt_in':
                 $_value = (bool) $_value;
                 break;
             case 'user':
                 // A `WP_User` object instance.
                 $_value = $_value instanceof WP_User ? $_value : NULL;
                 break;
             case 'user_id':
                 // User ID.
                 $_value = (int) $_value;
                 break;
         }
     }
     unset($_key, $_value);
     // Housekeeping.
     if (!$args->user_id && $args->user && $args->user->exists()) {
         $args->user_id = $args->user->ID;
     }
     // Use this ID.
     $args->user = new WP_User($args->user_id);
     // Always based on ID.
     $args->ccaps = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($args->user));
     $args->fname = !$args->fname ? ucwords((string) strstr($args->email, '@', TRUE)) : $args->fname;
     $args->lname = !$args->lname ? '-' : $args->lname;
     // Default last name to `-` because MC requires this.
     $args->name = $args->fname || $args->lname ? trim($args->fname . ' ' . $args->lname) : ucwords((string) strstr($args->email, '@', TRUE));
     if (!$args->role || !isset($args->level[0]) || !is_numeric($args->level) || !$args->login || !$args->email || !is_email($args->email) || !$args->user_id || !$args->user || !$args->user->exists()) {
         return NULL;
     }
     // Required arguments missing.
     return $args;
     // Now a \stdClass object.
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:71,代码来源:list-server-base.inc.php

示例10: new_user_notification

 /**
  * Handles new User/Member notifications.
  *
  * @package s2Member\Email_Configs
  * @since 110707
  *
  * @param string|int $user_id A numeric WordPress User ID.
  * @param string $user_pass Optional. A plain text version of the User's password.
  * 	If omitted, only the administrative notification will be sent.
  * @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
  * @param string $user_email Optional. This defaults to the user's currently configured email address.
  * @return bool True if all required parameters are supplied, else false.
  */
 public static function new_user_notification($user_id = 0, $user_pass = '', $notify = array('user', 'admin'), $user_email = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_new_user_notification', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $user_id = (int) $user_id;
     $user_pass = (string) $user_pass;
     $notify = (array) $notify;
     $user_email = (string) $user_email;
     if (!$user_pass && !empty($GLOBALS['ws_plugin__s2member_plain_text_pass'])) {
         $user_pass = (string) $GLOBALS['ws_plugin__s2member_plain_text_pass'];
     }
     if ($user_id && ($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && $notify) {
         $is_gte_wp43 = version_compare(get_bloginfo('version'), '4.3', '>=');
         $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
         c_ws_plugin__s2member_email_configs::email_config_release();
         if (in_array('user', $notify, true) && empty($GLOBALS['ws_plugin__s2member_custom_wp_login_bp_password']) && ($user_pass && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%user_pass%%') !== false || $is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%wp_set_pass_url%%') !== false || $is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'] = sprintf(_x("Your Username/Password for:\n%s\n\nUsername: %%%%user_login%%%%\nTo set your password, visit: %%%%wp_set_pass_url%%%%\n\n%%%%wp_login_url%%%%", 's2member-front', 's2member'), get_bloginfo('name')), '%%wp_set_pass_url%%') !== false)) {
             if ($is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%wp_set_pass_url%%') !== false) {
                 remove_filter('random_password', 'c_ws_plugin__s2member_registrations::generate_password');
                 $user_activation_key = wp_generate_password(20, false);
                 // ↑ Make sure it's w/o filter.
                 do_action('retrieve_password_key', $user->user_login, $user_activation_key);
                 if (!class_exists('PasswordHash')) {
                     require_once ABSPATH . WPINC . '/class-phpass.php';
                 }
                 $wp_hasher = new PasswordHash(8, true);
                 $user_activation_key_hash = time() . ':' . $wp_hasher->HashPassword($user_activation_key);
                 $GLOBALS['wpdb']->update($GLOBALS['wpdb']->users, array('user_activation_key' => $user_activation_key_hash), array('user_login' => $user->user_login));
                 $wp_set_pass_url_args = array('action' => 'rp', 'key' => $user_activation_key, 'login' => $user->user_login);
                 $wp_set_pass_url = add_query_arg(urlencode_deep($wp_set_pass_url_args), wp_login_url());
             } else {
                 $wp_set_pass_url = wp_lostpassword_url();
             }
             // Default behavior; and older versions of WordPress.
             $fields = get_user_option('s2member_custom_fields', $user_id);
             $cv = preg_split('/\\|/', get_user_option('s2member_custom', $user_id));
             $role = c_ws_plugin__s2member_user_access::user_access_role($user);
             $label = c_ws_plugin__s2member_user_access::user_access_label($user);
             $level = c_ws_plugin__s2member_user_access::user_access_level($user);
             $ccaps = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
             $user->user_email = $user_email ? $user_email : $user->user_email;
             $user_full_name = trim($user->first_name . ' ' . $user->last_name);
             $user_ip = $_SERVER['REMOTE_ADDR'];
             if ($sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_subject']) {
                 if ($sbj = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $sbj)) {
                     if ($sbj = preg_replace('/%%wp_set_pass_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($wp_set_pass_url), $sbj)) {
                         if ($sbj = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
                             if ($sbj = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
                                 if ($sbj = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
                                     if ($sbj = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
                                         if ($sbj = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
                                             if ($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
                                                 if ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
                                                     if ($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
                                                         if ($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                             if ($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                                 if ($sbj = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
                                                                     if ($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
                                                                         if ($sbj = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                             if (is_array($fields) && !empty($fields)) {
                                                                                 foreach ($fields as $var => $val) {
                                                                                     // Custom Registration/Profile Fields.
                                                                                     if (!($sbj = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
                                                                                         break;
                                                                                     }
                                                                                 }
                                                                             }
                                                                             // Empty; we can stop here.
                                                                             if ($msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message']) {
                                                                                 if ($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) {
                                                                                     if ($msg = preg_replace('/%%wp_set_pass_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($wp_set_pass_url), $msg)) {
                                                                                         if ($msg = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $msg)) {
                                                                                             if ($msg = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $msg)) {
                                                                                                 if ($msg = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $msg)) {
                                                                                                     if ($msg = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $msg)) {
                                                                                                         if ($msg = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $msg)) {
                                                                                                             if ($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) {
                                                                                                                 if ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)) {
                                                                                                                     if ($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $msg)) {
                                                                                                                         if ($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                             if ($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                                 if ($msg = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $msg)) {
                                                                                                                                     if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $msg)) {
                                                                                                                                         if ($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
//.........这里部分代码省略.........
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:email-configs.inc.php

示例11: fill_login_redirect_rc_vars

 /**
  * Fills Replacement Codes in Special Redirection URLs.
  *
  * @package s2Member\Login_Redirects
  * @since 3.5
  *
  * @param str $url A URL with possible Replacement Codes in it.
  * @param obj $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
  * @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
  * @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
  */
 public static function fill_login_redirect_rc_vars($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     $url = (string) $url;
     /* Force ``$url`` to a string value. */
     $orig_url = $url;
     /* Record the original URL that was passed in. */
     /**/
     $user = (is_object($user) || is_object($user = is_user_logged_in() ? wp_get_current_user() : false)) && !empty($user->ID) ? $user : false;
     /**/
     $user_id = $user ? (string) $user->ID : "";
     $user_login = $user ? (string) strtolower($user->user_login) : "";
     /**/
     $user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
     $user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
     $user_ccaps = (string) implode("-", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
     $user_logins = $user ? (string) (int) get_user_option("s2member_login_counter", $user_id) : "-1";
     /**/
     $url = preg_replace("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_login), $url);
     $url = preg_replace("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $url);
     $url = preg_replace("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_level), $url);
     $url = preg_replace("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_role), $url);
     $url = preg_replace("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ccaps), $url);
     $url = preg_replace("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_logins), $url);
     /**/
     if ($url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url($url, -1, false)) || !empty($parse["path"]) && strpos($parse["path"], "//") !== false)) {
         $url = site_url("/");
     }
     /* Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. with `//` ). */
     /**/
     if ($root_returns_false && c_ws_plugin__s2member_utils_conds::is_site_root($url)) {
         $url = false;
     }
     /* In case we need to return false on root URLs ( i.e. don't protect the Home Page inadvertently ). */
     /**/
     return apply_filters("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars());
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:52,代码来源:login-redirects.inc.php

示例12: process_list_server_removals

 /**
  * 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 (c_ws_plugin__s2member_list_servers::list_servers_integrated() && ($args = func_get_args()) && $role && is_string($role) && is_numeric($level) && $login && is_string($login) && is_string($pass = (string) $pass) && $email && is_string($email) && is_email($email) && is_string($fname = (string) $fname) && is_string($lname = (string) $lname) && is_string($ip = (string) $ip) && is_bool($opt_out = (bool) $opt_out) && $opt_out && $user_id && is_numeric($user_id) && is_object($user = new WP_User($user_id)) && !empty($user->ID)) {
         $ccaps = implode(",", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
         /* Get Custom Capabilities. */
         /**/
         $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
         /* s2Member Filters enabled? */
         c_ws_plugin__s2member_email_configs::email_config_release();
         /* Release s2Member 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))) {
                     if ($mailchimp["api_removal_response"] = $mcapi->{$mailchimp["api_removal_method"]}($mailchimp["list_id"], $email, $mailchimp["api_removal_delete_member"] = apply_filters("ws_plugin__s2member_mailchimp_removal_delete_member", false, get_defined_vars()), $mailchimp["api_removal_send_goodbye"] = apply_filters("ws_plugin__s2member_mailchimp_removal_send_goodbye", false, get_defined_vars()), $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)) {
                     $aweber["removal_bcc"] = apply_filters("ws_plugin__s2member_aweber_removal_bcc", false, get_defined_vars());
                     /**/
                     c_ws_plugin__s2member_email_configs::email_config();
                     /* Email configs MUST be ON for removal requests.
                     			The `From:` address MUST match AWeber account. See: <http://www.aweber.com/faq/questions/62/Can+I+Unsubscribe+People+Via+Email%3F>. */
                     /**/
                     if ($aweber["wp_mail_removal_response"] = wp_mail($aweber["list_id"] . "@aweber.com", $aweber["wp_mail_removal_sbj"] = apply_filters("ws_plugin__s2member_aweber_removal_sbj", "REMOVE#" . $email . "#s2Member#" . $aweber["list_id"], get_defined_vars()), $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. */
                     /**/
                     c_ws_plugin__s2member_email_configs::email_config_release();
                     /* Release. */
                     /**/
                     $logv = c_ws_plugin__s2member_utilities::ver_details();
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:list-servers.inc.php

示例13: get_user_field

 /**
  * Retrieves a field value. Also supports Custom Fields.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
  * 	Or, this could be set to any property that exists on the WP_User object for a particular User;
  * 	( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
  * 	`s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
  * 	`s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
  * 	`s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
  * 	`s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
  * 	`s2member_access_ccaps`, etc, etc. ).
  * @param int|str $user_id Optional. Defaults to the current User's ID.
  * @return mixed The value of the requested field, or false if the field does not exist.
  */
 public static function get_user_field($field_id = FALSE, $user_id = FALSE)
 {
     global $wpdb;
     /* Global database object reference. We'll need this to obtain the right database prefix. */
     /**/
     $current_user = wp_get_current_user();
     /* Current User's object ( used when/if `$user_id` is empty ). */
     /**/
     if (is_object($user = $user_id ? new WP_User($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID)) {
         if (isset($user->{$field_id})) {
             /* Immediate User object property? ( most likely ) */
             return $user->{$field_id};
         } else {
             if (isset($user->data->{$field_id})) {
                 /* Also try the data object property. */
                 return $user->data->{$field_id};
             } else {
                 if (isset($user->{$wpdb->prefix . $field_id})) {
                     /* Immediate prefixed? */
                     return $user->{$wpdb->prefix . $field_id};
                 } else {
                     if (isset($user->data->{$wpdb->prefix . $field_id})) {
                         /* Data prefixed? */
                         return $user->data->{$wpdb->prefix . $field_id};
                     } else {
                         if (strcasecmp($field_id, "full_name") === 0) {
                             /* First/last full name? */
                             return trim($user->first_name . " " . $user->last_name);
                         } else {
                             if (preg_match("/^(email|user_email)\$/i", $field_id)) {
                                 /* Email address? */
                                 return $user->user_email;
                             } else {
                                 if (preg_match("/^(login|user_login)\$/i", $field_id)) {
                                     /* Username / login? */
                                     return $user->user_login;
                                 } else {
                                     if (strcasecmp($field_id, "s2member_access_role") === 0) {
                                         /* Role name/ID? */
                                         return c_ws_plugin__s2member_user_access::user_access_role($user);
                                     } else {
                                         if (strcasecmp($field_id, "s2member_access_level") === 0) {
                                             /* Access Level? */
                                             return c_ws_plugin__s2member_user_access::user_access_level($user);
                                         } else {
                                             if (strcasecmp($field_id, "s2member_access_label") === 0) {
                                                 /* Access Label? */
                                                 return c_ws_plugin__s2member_user_access::user_access_label($user);
                                             } else {
                                                 if (strcasecmp($field_id, "s2member_access_ccaps") === 0) {
                                                     /* Custom Caps? */
                                                     return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
                                                 } else {
                                                     if (strcasecmp($field_id, "ip") === 0 && is_object($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID)) {
                                                         return $_SERVER["REMOTE_ADDR"];
                                                     } else {
                                                         if (strcasecmp($field_id, "s2member_registration_ip") === 0 || strcasecmp($field_id, "reg_ip") === 0 || strcasecmp($field_id, "ip") === 0) {
                                                             return get_user_option("s2member_registration_ip", $user_id);
                                                         } else {
                                                             if (strcasecmp($field_id, "s2member_subscr_or_wp_id") === 0) {
                                                                 return ($subscr_id = get_user_option("s2member_subscr_id", $user_id)) ? $subscr_id : $user_id;
                                                             } else {
                                                                 if (is_array($fields = get_user_option("s2member_custom_fields", $user_id))) {
                                                                     if (isset($fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))])) {
                                                                         return $fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))];
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     /**/
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:utils-users.inc.php

示例14: get_user_field

 /**
  * Retrieves a field value. Also supports Custom Fields.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param string     $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
  *   Or, this could be set to any property that exists on the WP_User object for a particular User;
  *   ( i.e., `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
  *   `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
  *   `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
  *   `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
  *   `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
  *   `s2member_access_ccaps`, etc, etc. ).
  * @param int|string $user_id Optional. Defaults to the current User's ID.
  *
  * @return mixed The value of the requested field, or false if the field does not exist.
  */
 public static function get_user_field($field_id = '', $user_id = 0)
 {
     global $wpdb;
     /** @var wpdb $wpdb */
     $current_user = wp_get_current_user();
     // Current User's object (used when/if `$user_id` is empty).
     if (is_object($user = $user_id ? new WP_User($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID)) {
         if (isset($user->{$field_id})) {
             return $user->{$field_id};
         } else {
             if (isset($user->data->{$field_id})) {
                 return $user->data->{$field_id};
             } else {
                 if (isset($user->{$wpdb->prefix . $field_id})) {
                     return $user->{$wpdb->prefix . $field_id};
                 } else {
                     if (isset($user->data->{$wpdb->prefix . $field_id})) {
                         return $user->data->{$wpdb->prefix . $field_id};
                     } else {
                         if (strcasecmp($field_id, 'full_name') === 0) {
                             return trim($user->first_name . ' ' . $user->last_name);
                         } else {
                             if (preg_match('/^(email|user_email)$/i', $field_id)) {
                                 return $user->user_email;
                             } else {
                                 if (preg_match('/^(login|user_login)$/i', $field_id)) {
                                     return $user->user_login;
                                 } else {
                                     if (preg_match('/^(s2member_)?registration_time$/i', $field_id)) {
                                         return $user->user_registered;
                                     } else {
                                         if (strcasecmp($field_id, 's2member_access_role') === 0) {
                                             return c_ws_plugin__s2member_user_access::user_access_role($user);
                                         } else {
                                             if (strcasecmp($field_id, 's2member_access_level') === 0) {
                                                 return c_ws_plugin__s2member_user_access::user_access_level($user);
                                             } else {
                                                 if (strcasecmp($field_id, 's2member_access_label') === 0) {
                                                     return c_ws_plugin__s2member_user_access::user_access_label($user);
                                                 } else {
                                                     if (strcasecmp($field_id, 's2member_access_ccaps') === 0) {
                                                         return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
                                                     } else {
                                                         if (strcasecmp($field_id, 'ip') === 0 && is_object($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID)) {
                                                             return $_SERVER['REMOTE_ADDR'];
                                                         } else {
                                                             if (strcasecmp($field_id, 's2member_registration_ip') === 0 || strcasecmp($field_id, 'reg_ip') === 0 || strcasecmp($field_id, 'ip') === 0) {
                                                                 return get_user_option('s2member_registration_ip', $user_id);
                                                             } else {
                                                                 if (strcasecmp($field_id, 's2member_subscr_or_wp_id') === 0) {
                                                                     return ($subscr_id = get_user_option('s2member_subscr_id', $user_id)) ? $subscr_id : $user_id;
                                                                 } else {
                                                                     if (is_array($fields = get_user_option('s2member_custom_fields', $user_id))) {
                                                                         if (isset($fields[preg_replace('/[^a-z0-9]/i', '_', strtolower($field_id))])) {
                                                                             return $fields[preg_replace('/[^a-z0-9]/i', '_', strtolower($field_id))];
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return FALSE;
     // Otherwise, return false.
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:94,代码来源:utils-users.inc.php

示例15: configure_user_registration


//.........这里部分代码省略.........
                                         }
                                     }
                                     if ($ccaps && preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $ccaps))) {
                                         foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $ccaps))) as $ccap) {
                                             if (strlen($ccap = trim(strtolower(preg_replace('/[^a-z_0-9]/i', '', $ccap))))) {
                                                 $user->add_cap('access_s2member_ccap_' . $ccap);
                                             }
                                         }
                                     }
                                     if (!($fields = array()) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
                                         foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
                                             $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
                                             $field_id_class = preg_replace('/_/', '-', $field_var);
                                             if (isset($_pmr['ws_plugin__s2member_custom_reg_field_' . $field_var])) {
                                                 $fields[$field_var] = $_pmr['ws_plugin__s2member_custom_reg_field_' . $field_var];
                                             }
                                         }
                                     }
                                     unset($field, $field_var, $field_id_class);
                                     // Housekeeping.
                                     if (!empty($fields)) {
                                         // Only if NOT empty.
                                         update_user_option($user_id, 's2member_custom_fields', $fields);
                                     }
                                     if ($level > 0) {
                                         $pr_times = get_user_option('s2member_paid_registration_times', $user_id);
                                         $pr_times['level'] = empty($pr_times['level']) ? time() : $pr_times['level'];
                                         $pr_times['level' . $level] = empty($pr_times['level' . $level]) ? time() : $pr_times['level' . $level];
                                         update_user_option($user_id, 's2member_paid_registration_times', $pr_times);
                                         // Update now.
                                     }
                                     if (!is_multisite() && c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_register_page()) {
                                         update_user_option($user_id, 's2member_bp_activation_role', $role);
                                         update_user_option($user_id, 's2member_bp_activation_ccaps', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
                                     }
                                     if (($transient = 's2m_' . md5('s2member_transient_ipn_signup_vars_' . $subscr_id)) && is_array($ipn_signup_vars = get_transient($transient))) {
                                         update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
                                         // For future reference.
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (($transient = 's2m_' . md5('s2member_transient_ipn_subscr_payment_' . $subscr_id)) && is_array($subscr_payment = get_transient($transient)) && !empty($subscr_payment['subscr_gateway'])) {
                                         $proxy = array('s2member_paypal_proxy' => stripslashes((string) $subscr_payment['subscr_gateway']), 's2member_paypal_proxy_verification' => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
                                         c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), array_merge(stripslashes_deep($subscr_payment), $proxy), array('timeout' => 20));
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (($transient = 's2m_' . md5('s2member_transient_ipn_subscr_eot_' . $subscr_id)) && is_array($subscr_eot = get_transient($transient)) && !empty($subscr_eot['subscr_gateway'])) {
                                         $proxy = array('s2member_paypal_proxy' => stripslashes((string) $subscr_eot['subscr_gateway']), 's2member_paypal_proxy_verification' => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
                                         c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), array_merge(stripslashes_deep($subscr_eot), $proxy), array('timeout' => 20));
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (!headers_sent()) {
                                         // Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies.
                                         @setcookie('s2member_tracking', $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($subscr_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie('s2member_tracking', $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_tracking'] = $s2member_tracking);
                                     }
                                     foreach (array_keys(get_defined_vars()) as $__v) {
                                         $__refs[$__v] =& ${$__v};
                                     }
                                     do_action('ws_plugin__s2member_during_configure_user_registration_front_side_paid', get_defined_vars());
                                     do_action('ws_plugin__s2member_during_configure_user_registration_front_side', get_defined_vars());
                                     unset($__refs, $__v);
                                 } else {
                                     if (!is_admin() && (!c_ws_plugin__s2member_utils_conds::pro_is_installed() || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op('create_user'))) {
                                         /* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
开发者ID:adnandot,项目名称:intenseburn,代码行数:67,代码来源:registrations.inc.php


注:本文中的c_ws_plugin__s2member_user_access::user_access_ccaps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。