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


PHP wp_salt函数代码示例

本文整理汇总了PHP中wp_salt函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_salt函数的具体用法?PHP wp_salt怎么用?PHP wp_salt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: key

 /**
  * Encryption/decryption key to use.
  *
  * @param string $key Force a specific key?
  *
  * @return string Encryption/decryption key.
  */
 public function key($key = '')
 {
     if ($key = trim((string) $key)) {
         return $key;
     }
     return $key = wp_salt();
 }
开发者ID:websharks,项目名称:comment-mail,代码行数:14,代码来源:UtilsEnc.php

示例2: set_programme_round_token

 private function set_programme_round_token()
 {
     $post_id = $this->container->post_id;
     $token = sha1('token_constant' . $post_id . wp_salt());
     update_post_meta($post_id, 'update_token', $token);
     return $token;
 }
开发者ID:retrorism,项目名称:exchange-plugin,代码行数:7,代码来源:class-controller-programme-round.php

示例3: assertion

 public function assertion()
 {
     global $json_api;
     $uid_str = $json_api->query->uid;
     $uid = explode("-", $uid_str);
     $post_id = $uid[0];
     $user_id = $uid[2];
     $assertion = array();
     if (isset($post_id)) {
         $base_url = home_url() . '/' . get_option('json_api_base', 'api');
         $submission = get_post($post_id);
         $salt = wp_salt('nonce');
         $email = BadgeOS_OpenBadgesIssuer::registered_email($user_id);
         $post_type = get_post_type($post_id);
         if ($post_type === "submission" && get_option('badgeos_obi_issuer_public_evidence')) {
             $achievement_id = get_post_meta($post_id, '_badgeos_submission_achievement_id', true);
             $assertion['evidence'] = get_permalink($post_id);
         } else {
             $achievement_id = $post_id;
         }
         //return badgeos_get_user_achievements();
         $assertion = array_merge(array("uid" => $uid_str, "recipient" => array("type" => "email", "hashed" => true, "salt" => $salt, "identity" => 'sha256$' . hash('sha256', $email . $salt)), "image" => wp_get_attachment_url(get_post_thumbnail_id($achievement_id)), "issuedOn" => strtotime($submission->post_date), "badge" => $base_url . '/badge/badge_class/?uid=' . $achievement_id, "verify" => array("type" => "hosted", "url" => $base_url . '/badge/assertion/?uid=' . $uid_str)), $assertion);
     }
     return $assertion;
 }
开发者ID:geoffroigaron,项目名称:open-badges-issuer-addon,代码行数:25,代码来源:badge.php

示例4: key

 /**
  * Determines the proper encryption/decryption Key to use.
  *
  * @package s2Member\Utilities
  * @since 111106
  *
  * @param str $key Optional. Attempt to force a specific Key. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
  * @return str Proper encryption/decryption Key. If ``$key`` is passed in, and it validates, we'll return that. Otherwise use a default Key.
  */
 public static function key($key = FALSE)
 {
     $key = !is_string($key) || !strlen($key) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
     $key = !is_string($key) || !strlen($key) ? wp_salt() : $key;
     $key = !is_string($key) || !strlen($key) ? md5($_SERVER["HTTP_HOST"]) : $key;
     return $key;
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:16,代码来源:utils-encryption.inc.php

示例5: store

 function store($hasher = '')
 {
     // Just uses the default wordpress salt.
     // Useful because it should be different from site to site
     $salt = str_split(wp_salt());
     $d = str_split($hasher);
     $hash = '';
     for ($i = 0; $i < count($d); $i++) {
         $hash .= ord($d[$i]) * ord($salt[$i]) . ' ';
     }
     return substr($hash, 0, -1);
 }
开发者ID:iCaspar,项目名称:SalsaPress,代码行数:12,代码来源:crypt.php

示例6: generate_key

 /**
  * There might be a sensitive infromation given
  * Make it as hard as possible for reversing
  */
 protected function generate_key()
 {
     $invoice_params = $this->args;
     $invoice_params = array_map('trim', $invoice_params);
     $invoice_params = array_filter($invoice_params);
     $invoice_params = array_map('md5', $invoice_params);
     $key = md5(implode('', $invoice_params));
     // for WP integration
     if (function_exists('wp_salt')) {
         $key = wp_salt($key);
     }
     $this->key = $key;
 }
开发者ID:brutalenemy666,项目名称:scripts,代码行数:17,代码来源:class-unique-id.php

示例7: key

 /**
  * Determines the proper encryption/decryption Key to use.
  *
  * @package s2Member\Utilities
  * @since 111106
  *
  * @param string $key Optional. Attempt to force a specific Key. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
  *
  * @return string Proper encryption/decryption Key. If ``$key`` is passed in, and it validates, we'll return that. Otherwise use a default Key.
  */
 public static function key($key = '')
 {
     if ($key = trim((string) $key)) {
         return $key;
     }
     if ($key = trim($GLOBALS['WS_PLUGIN__']['s2member']['o']['sec_encryption_key'])) {
         return $key;
     }
     if ($key = trim(wp_salt())) {
         return $key;
     }
     return $key = md5($_SERVER['HTTP_HOST']);
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:23,代码来源:utils-encryption.inc.php

示例8: key

 /**
  * Determines the proper encryption/decryption key to use.
  *
  * @param string $key Optional. Attempt to force a specific key?
  *
  * @return string Proper encryption/decryption key.
  *
  * @throws exception If invalid types are passed through arguments lists.
  * @throws exception If unable to obtain a valid encryption key, by any means.
  */
 public function key($key = '')
 {
     $this->check_arg_types('string', func_get_args());
     if (isset($key[0])) {
         return $key;
     }
     $key = $this->©options->get('encryption.key');
     $key = !isset($key[0]) ? wp_salt() : $key;
     $key = !isset($key[0]) ? md5($this->©url->current_host()) : $key;
     if (!isset($key[0])) {
         throw $this->©exception($this->method(__FUNCTION__) . '#key_missing', get_defined_vars(), $this->__('No encryption key.'));
     }
     return $key;
     // It's a good day in Eureka!
 }
开发者ID:panvagenas,项目名称:x-related-posts,代码行数:25,代码来源:encryption.php

示例9: __construct

 /**
  * Class constructor.
  *
  * @since 160710 Common utils.
  */
 public function __construct()
 {
     $this->is_multisite = is_multisite();
     $this->is_main_site = !$this->is_multisite || is_main_site();
     $this->is_admin = is_admin();
     $this->is_user_admin = $this->is_admin && is_user_admin();
     $this->is_network_admin = $this->is_admin && $this->is_multisite && is_network_admin();
     $this->debug = defined('WP_DEBUG') && WP_DEBUG;
     $this->debug_edge = $this->debug && defined('WP_DEBUG_EDGE') && WP_DEBUG_EDGE;
     $this->debug_log = $this->debug && defined('WP_DEBUG_LOG') && WP_DEBUG_LOG;
     $this->debug_display = $this->debug && defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY;
     if (!($this->salt = wp_salt())) {
         throw new Exception('Failed to acquire WP salt.');
     }
     if (!($this->tmp_dir = rtrim(get_temp_dir(), '/'))) {
         throw new Exception('Failed to acquire a writable tmp dir.');
     }
     if (!($this->site_url = site_url('/'))) {
         throw new Exception('Failed to acquire site URL.');
     } elseif (!($this->site_url_parts = parse_url($this->site_url))) {
         throw new Exception('Failed to parse site URL parts.');
     } elseif (!($this->site_url_host = $this->site_url_parts['host'] ?? '')) {
         throw new Exception('Failed to parse site URL host.');
     } elseif (!($this->site_url_root_host = implode('.', array_slice(explode('.', $this->site_url_host), -2)))) {
         throw new Exception('Failed to parse site URL root host.');
     }
     if (!($this->site_url_option = get_option('siteurl'))) {
         throw new Exception('Failed to acquire site URL option.');
     } elseif (!($this->site_url_option_parts = parse_url($this->site_url_option))) {
         throw new Exception('Failed to parse site URL option parts.');
     } elseif (!($this->site_default_scheme = $this->site_url_option_parts['scheme'] ?? '')) {
         throw new Exception('Failed to parse site URL option scheme.');
     }
     if (!($this->template_directory_url = get_template_directory_uri())) {
         throw new Exception('Failed to acquire template directory URL.');
     } elseif (!($this->template_directory_url_parts = parse_url($this->template_directory_url))) {
         throw new Exception('Failed to parse template directory URL parts.');
     }
     $this->template = get_template();
     $this->stylesheet = get_stylesheet();
     $this->is_woocommerce_active = defined('WC_VERSION');
     $this->is_woocommerce_product_vendors_active = defined('WC_PRODUCT_VENDORS_VERSION');
     $this->is_jetpack_active = defined('JETPACK__VERSION');
 }
开发者ID:websharks,项目名称:wp-sharks-core,代码行数:49,代码来源:Wp.php

示例10: wp_verify_nonce

function wp_verify_nonce($nonce, $action = -1)
{
    $user = wp_get_current_user();
    $uid = (int) $user->ID;
    if (!$uid) {
        /** This filter is documented in wp-includes/pluggable.php */
        $uid = apply_filters('nonce_user_logged_out', $uid, $action);
    }
    /**
     * Filter the lifespan of nonces in seconds.
     *
     * @since 2.5.0
     *
     * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day.
     */
    $nonce_life = apply_filters('nonce_life', DAY_IN_SECONDS);
    $token = wp_get_session_token();
    $verifier = new Verifier();
    $verifier->setUserId($uid);
    $verifier->setLifespan($nonce_life);
    $verifier->setSessionToken($token);
    $verifier->setSalt(wp_salt('nonce'));
    $nonce = (string) $nonce;
    $verified = $verifier->verify($nonce, $action);
    if (false !== $verified) {
        return $verified;
    }
    /**
     * Fires when nonce verification fails.
     *
     * @since 4.4.0
     *
     * @param string $nonce The invalid nonce.
     * @param string|int $action The nonce action.
     * @param WP_User $user The current user object.
     * @param string $token The user's session token.
     */
    do_action('wp_verify_nonce_failed', $nonce, $action, $user, $token);
    return false;
}
开发者ID:rhurling,项目名称:wp-oo-nonces-plugin,代码行数:40,代码来源:pluggable-functions.php

示例11: loginAction

 public static function loginAction($username)
 {
     if (sizeof($_POST) < 1) {
         return;
     }
     //only execute if login form is posted
     if (!$username) {
         return;
     }
     wfConfig::inc('totalLogins');
     $user = get_user_by('login', $username);
     $userID = $user ? $user->ID : 0;
     self::getLog()->logLogin('loginOK', 0, $username);
     if (wfUtils::isAdmin($user)) {
         wfConfig::set_ser('lastAdminLogin', array('userID' => $userID, 'username' => $username, 'firstName' => $user->first_name, 'lastName' => $user->last_name, 'time' => wfUtils::localHumanDateShort(), 'IP' => wfUtils::getIP()));
     }
     $salt = wp_salt('logged_in');
     $cookiename = 'wf_loginalerted_' . hash_hmac('sha256', wfUtils::getIP() . '|' . $user->ID, $salt);
     $cookievalue = hash_hmac('sha256', $user->user_login, $salt);
     if (user_can($userID, 'update_core')) {
         if (wfConfig::get('alertOn_adminLogin')) {
             $shouldAlert = true;
             if (wfConfig::get('alertOn_firstAdminLoginOnly') && isset($_COOKIE[$cookiename])) {
                 $shouldAlert = !hash_equals($cookievalue, $_COOKIE[$cookiename]);
             }
             if ($shouldAlert) {
                 wordfence::alert("Admin Login", "A user with username \"{$username}\" who has administrator access signed in to your WordPress site.", wfUtils::getIP());
             }
         }
     } else {
         if (wfConfig::get('alertOn_nonAdminLogin')) {
             $shouldAlert = true;
             if (wfConfig::get('alertOn_firstNonAdminLoginOnly') && isset($_COOKIE[$cookiename])) {
                 $shouldAlert = !hash_equals($cookievalue, $_COOKIE[$cookiename]);
             }
             if ($shouldAlert) {
                 wordfence::alert("User login", "A non-admin user with username \"{$username}\" signed in to your WordPress site.", wfUtils::getIP());
             }
         }
     }
     if (wfConfig::get('alertOn_firstAdminLoginOnly') || wfConfig::get('alertOn_firstNonAdminLoginOnly')) {
         wfUtils::setcookie($cookiename, $cookievalue, time() + 86400 * 365, '/', null, null, true);
     }
 }
开发者ID:Jerram-Marketing,项目名称:Gummer-Co,代码行数:44,代码来源:wordfenceClass.php

示例12: ass_digest_format_item_group

/**
 * Displays the introduction for the group and loops through each item
 *
 * I've chosen to cache on an individual-activity basis, instead of a group-by-group basis. This
 * requires just a touch more overhead (in terms of looping through individual activity_ids), and
 * doesn't really have any added effect at the moment (since an activity item can only be associated
 * with a single group). But it provides the greatest amount of flexibility going forward, both in
 * terms of the possibility that activity items could be associated with more than one group, and
 * the possibility that users within a single group would want more highly-filtered digests.
 */
function ass_digest_format_item_group($group_id, $activity_ids, $type, $group_name, $group_slug, $user_id)
{
    global $bp, $ass_email_css;
    $group_permalink = apply_filters('bp_get_group_permalink', bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group_slug . '/');
    $group_name_link = '<a href="' . $group_permalink . '" name="' . $group_slug . '">' . $group_name . '</a>';
    $userdomain = ass_digest_get_user_domain($user_id);
    $unsubscribe_link = "{$userdomain}?bpass-action=unsubscribe&group={$group_id}&access_key=" . md5("{$group_id}{$user_id}unsubscribe" . wp_salt());
    $gnotifications_link = ass_get_login_redirect_url($group_permalink . 'notifications/');
    // add the group title bar
    if ($type == 'dig') {
        $group_message = "\n<div {$ass_email_css['group_title']}>" . sprintf(__('Group: %s', 'bp-ass'), $group_name_link) . "</div>\n\n";
    } elseif ($type == 'sum') {
        $group_message = "\n<div {$ass_email_css['group_title']}>" . sprintf(__('Group: %s weekly summary', 'bp-ass'), $group_name_link) . "</div>\n";
    }
    // add change email settings link
    $group_message .= "\n<div {$ass_email_css['change_email']}>";
    $group_message .= __('To disable these notifications for this group click ', 'bp-ass') . " <a href=\"{$unsubscribe_link}\">" . __('unsubscribe', 'bp-ass') . '</a> - ';
    $group_message .= __('change ', 'bp-ass') . '<a href="' . $gnotifications_link . '">' . __('email options', 'bp-ass') . '</a>';
    $group_message .= "</div>\n\n";
    $group_message = apply_filters('ass_digest_group_message_title', $group_message, $group_id, $type);
    // Finally, add the markup to the digest
    foreach ($activity_ids as $activity_id) {
        // Cache is set earlier in ass_digest_fire()
        $activity_item = !empty($bp->ass->items[$activity_id]) ? $bp->ass->items[$activity_id] : false;
        if (!empty($activity_item)) {
            $group_message .= ass_digest_format_item($activity_item, $type);
        }
        //$group_message .= '<pre>'. $item->id .'</pre>';
    }
    return apply_filters('ass_digest_format_item_group', $group_message, $group_id, $type);
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:41,代码来源:bp-activity-subscription-digest.php

示例13: save

 public function save()
 {
     global $wpdb;
     $this->id = $this->id ? $this->id : md5(microtime() . rand() . wp_salt());
     $data = array('id' => $this->id, 'state' => serialize((array) $this), 'updated_on' => current_time('mysql'));
     $wpdb->replace($wpdb->prefix . 'wpbdp_submit_state', $data);
 }
开发者ID:Nedick,项目名称:stzagora-website,代码行数:7,代码来源:view-submit-listing.php

示例14: define

<?php

define('PMP_NOTIFICATIONS_SECRET', crypt(get_bloginfo('url'), wp_salt('auth')));
define('PMP_NOTIFICATIONS_HUB', 'notifications');
define('PMP_NOTIFICATIONS_TOPIC_UPDATED', 'topics/updated');
define('PMP_NOTIFICATIONS_TOPIC_DELETED', 'topics/deleted');
/**
 * Add '?pmp-notifications' as a valid query var
 *
 * @since 0.3
 */
function pmp_bless_notification_query_var()
{
    add_rewrite_endpoint('pmp-notifications', EP_ALL);
}
add_action('init', 'pmp_bless_notification_query_var');
/**
 * Template redirect for PubSubHubBub operations
 *
 * If the request is POST, we're dealing with a notification.
 *
 * If the request is GET, we're being asked to verify a subscription.
 *
 * @since 0.3
 */
function pmp_notifications_template_redirect()
{
    global $wp_query;
    if (!isset($wp_query->query_vars['pmp-notifications'])) {
        return false;
    }
开发者ID:jackbrighton,项目名称:pmp-wordpress,代码行数:31,代码来源:notifications.php

示例15: decrypt

 public static function decrypt($text, $key)
 {
     $db = self::get_instance();
     $decrypted = $db->get_var($db->prepare('SELECT AES_DECRYPT(%s, %s) AS data', base64_decode($text), wp_salt('nonce')));
     return $decrypted;
 }
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:6,代码来源:common.php


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