本文整理汇总了PHP中Social::wp39_nonce_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Social::wp39_nonce_url方法的具体用法?PHP Social::wp39_nonce_url怎么用?PHP Social::wp39_nonce_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Social
的用法示例。
在下文中一共展示了Social::wp39_nonce_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
/**
* Handles the remote timeout requests for Social.
*
* @param string $url url to request
* @param string $nonce_key key to use when generating the nonce
* @param bool $post set to true to do a wp_remote_post
* @return void
*/
private function request($url, $nonce_key = null, $post = false)
{
if ($nonce_key !== null) {
$url = str_replace('&', '&', Social::wp39_nonce_url($url, $nonce_key));
}
$data = array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true));
if ($post) {
Social::log('POST request to: :url', array('url' => $url));
wp_remote_post($url, $data);
} else {
Social::log('GET request to: :url', array('url' => $url));
wp_remote_get($url, $data);
}
}
示例2: comments_array
/**
* Pre-processor to the comments.
*
* @wp-filter social_comments_array
* @static
* @param array $comments
* @param int $post_id
* @return array
*/
public static function comments_array(array $comments, $post_id)
{
// pre-load the hashes for broadcasted tweets
$broadcasted_ids = get_post_meta($post_id, '_social_broadcasted_ids', true);
if (empty($broadcasted_ids)) {
$broadcasted_ids = array();
}
global $wpdb;
// we need comments to be keyed by ID, check for Tweet comments
$tweet_comments = $_comments = $comment_ids = array();
foreach ($comments as $key => $comment) {
if (is_object($comment)) {
$_comments['id_' . $comment->comment_ID] = $comment;
if (in_array($comment->comment_type, Social_Service_Twitter::comment_types())) {
$comment_ids[] = $comment->comment_ID;
$tweet_comments['id_' . $comment->comment_ID] = $comment;
}
} else {
// social items
$_comments[$key] = $comment;
}
}
// if no tweet comments, get out now
if (!count($tweet_comments)) {
return $comments;
}
// use our keyed array
$comments = $_comments;
unset($_comments);
$social_map = array();
// key = social id, value = comment_ID
$hash_map = array();
// key = hash, value = comment_ID
$broadcasted_social_ids = array();
$broadcast_retweets = array();
// array of comments
if (isset($broadcasted_ids['twitter'])) {
foreach ($broadcasted_ids['twitter'] as $account_id => $broadcasted) {
foreach ($broadcasted as $id => $data) {
$broadcasted_social_ids[] = $id;
// if we don't have a message saved for a tweet, try to get it so that we can use it next time
if (empty($data['message'])) {
$url = Social::wp39_nonce_url(home_url('index.php?social_controller=aggregation&social_action=retrieve_twitter_content&broadcasted_id=' . $id . '&post_id=' . $post_id), 'retrieve_twitter_content');
wp_remote_get(str_replace('&', '&', $url), array('timeout' => 0.01, 'blocking' => false));
} else {
// create a hash from the broadcast so we can match retweets to it
$hash = self::build_hash($data['message']);
// This is stored as broadcasted and not the ID so we can easily store broadcasted retweets
// instead of attaching retweets to non-existent comments.
$hash_map[$hash] = 'broadcasted';
}
}
}
}
// Load the comment meta
$results = $wpdb->get_results("\n\t\t\tSELECT meta_key, meta_value, comment_id\n\t\t\t FROM {$wpdb->commentmeta}\n\t\t\t WHERE comment_id IN (" . implode(',', $comment_ids) . ")\n\t\t\t AND (\n\t\t\t meta_key = 'social_in_reply_to_status_id'\n\t\t\t OR meta_key = 'social_status_id'\n\t\t\t OR meta_key = 'social_raw_data'\n\t\t\t OR meta_key = 'social_profile_image_url'\n\t\t\t OR meta_key = 'social_comment_type'\n\t\t\t)\n\t\t");
// Set up social data for twitter comments
foreach ($tweet_comments as $key => &$comment) {
$comment->social_items = array();
// Attach meta
foreach ($results as $result) {
if ($comment->comment_ID == $result->comment_id) {
switch ($result->meta_key) {
case 'social_raw_data':
$comment->social_raw_data = json_decode(base64_decode($result->meta_value));
break;
case 'social_status_id':
$social_map[$result->meta_value] = $result->comment_id;
default:
$comment->{$result->meta_key} = $result->meta_value;
}
}
}
// Attach hash
if (isset($comment->social_raw_data) and isset($comment->social_raw_data->text)) {
$text = trim($comment->social_raw_data->text);
} else {
$text = trim($comment->comment_content);
}
$comment->social_hash = self::build_hash($text);
if (!isset($hash_map[$comment->social_hash])) {
$hash_map[$comment->social_hash] = $comment->comment_ID;
}
}
// merge data so that $comments has the data we've set up
$comments = array_merge($comments, $tweet_comments);
// set-up replies and retweets
foreach ($tweet_comments as $key => &$comment) {
if (is_object($comment)) {
// set reply/comment parent
if (!empty($comment->social_in_reply_to_status_id) and isset($social_map[$comment->social_in_reply_to_status_id])) {
//.........这里部分代码省略.........
示例3: _e
?>
</p>
<?php
if (Social::option('cron') === '0') {
?>
<div class="social-callout">
<h3 class="social-title"><?php
_e('CRON Setup', 'social');
?>
</h3>
<dl class="social-kv">
<dt><?php
_e('CRON API Key', 'social');
?>
<small>(<a href="<?php
echo esc_url(Social::wp39_nonce_url(admin_url('options-general.php?page=social.php&social_controller=settings&social_action=regenerate_api_key'), 'regenerate_api_key'));
?>
" rel="social_api_key" id="social_regenerate_api_key"><?php
_e('regenerate', 'social');
?>
</a>)</small></dt>
<dd>
<code class="social_api_key"><?php
echo esc_html(Social::option('system_cron_api_key'));
?>
</code>
</dd>
</dl>
<p><?php
_e('For your system CRON to run correctly, make sure it is pointing towards a URL that looks something like the following:', 'social');
?>
示例4: _e
if (Social::option('aggregate_comments')) {
?>
<div class="social-meta-box-block cf-clearfix">
<h4>
<?php
_e('Manual Refresh', 'social');
?>
<span id="social-next-run">(<?php
echo sprintf(__('Next automatic run <span>%s</span>', 'social'), $next_run);
?>
)</span>
</h4>
<p class="submit" style="clear:both;float:none;padding:0;">
<a href="<?php
echo esc_url(Social::wp39_nonce_url(admin_url('options-general.php?social_controller=aggregation&social_action=run&post_id=' . $post->ID), 'run'));
?>
" id="run_aggregation" class="button" style="float:left;margin-bottom:10px;"><?php
_e('Find Social Comments', 'social');
?>
</a>
<img src="<?php
echo esc_url(admin_url('images/wpspin_light.gif'));
?>
" style="float:left;position:relative;top:4px;left:5px;display:none;" id="run_aggregation_loader" />
</p>
</div><!-- .social-meta-box-block -->
<?php
}
?>