// ================================ // 高速・人気タグランキング(大規模向け) // Redis優先、無ければTransient // ================================ if (!defined('ABSPATH')) exit; // ------------------------ // キャッシュ取得 / 保存 // ------------------------ function tag_ranking_get_cache($key) { if (class_exists('Redis')) { static $redis = null; if ($redis === null) { try { $redis = new Redis(); $redis->connect('127.0.0.1'); } catch (Exception $e) { $redis = false; } } if ($redis) { $val = $redis->get($key); if ($val !== false) { return maybe_unserialize($val); } } } return get_transient($key); } function tag_ranking_set_cache($key, $value, $ttl = 900) { if (class_exists('Redis')) { static $redis = null; if ($redis === null) { try { $redis = new Redis(); $redis->connect('127.0.0.1'); } catch (Exception $e) { $redis = false; } } if ($redis) { $redis->set($key, serialize($value), $ttl); return true; } } return set_transient($key, $value, $ttl); } // ------------------------ // タグ別PV集計(完全順位表を1回だけ作る) // ------------------------ function get_tag_view_count_cached($cat_filter = 0, $limit = 0) { global $wpdb; // ★ キャッシュは cat_filter ごとに1個 $cache_key = 'tag_ranking_cached_' . $cat_filter; $cached = tag_ranking_get_cache($cache_key); if ($cached !== false) { return ($limit > 0) ? array_slice($cached, 0, $limit, true) : $cached; } // ------------------------ // 対象投稿条件 // ------------------------ if ($cat_filter === 81) { $cat_ids = array_merge([81], get_term_children(81, 'category')); $cat_in = implode(',', array_map('intval', $cat_ids)); $cat_sql = "AND c.term_id IN ($cat_in)"; } else { $exclude = array_merge([81], get_term_children(81, 'category')); $ex_in = implode(',', array_map('intval', $exclude)); $cat_sql = "AND c.term_id NOT IN ($ex_in)"; } // ------------------------ // ★ 完全順位表(タグごとに上位10記事) // ------------------------ $sql = " SELECT tag_id, SUM(views) AS total_views FROM ( SELECT t.term_id AS tag_id, IFNULL(pm.meta_value+0,0) AS views, ROW_NUMBER() OVER ( PARTITION BY t.term_id ORDER BY IFNULL(pm.meta_value+0,0) DESC ) AS rn FROM {$wpdb->posts} p INNER JOIN {$wpdb->term_relationships} tr1 ON p.ID = tr1.object_id INNER JOIN {$wpdb->term_taxonomy} tt1 ON tr1.term_taxonomy_id = tt1.term_taxonomy_id INNER JOIN {$wpdb->terms} t ON tt1.term_id = t.term_id INNER JOIN {$wpdb->term_relationships} tr2 ON p.ID = tr2.object_id INNER JOIN {$wpdb->term_taxonomy} tt2 ON tr2.term_taxonomy_id = tt2.term_taxonomy_id INNER JOIN {$wpdb->terms} c ON tt2.term_id = c.term_id LEFT JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID AND pm.meta_key = 'views' WHERE p.post_status = 'publish' AND tt1.taxonomy = 'post_tag' AND tt2.taxonomy = 'category' $cat_sql ) x WHERE rn <= 10 GROUP BY tag_id ORDER BY total_views DESC "; $rows = $wpdb->get_results($sql, ARRAY_A); $result = []; foreach ($rows as $r) { $result[(int)$r['tag_id']] = (int)$r['total_views']; } // ★ 1回だけ保存 tag_ranking_set_cache($cache_key, $result, 900); return ($limit > 0) ? array_slice($result, 0, $limit, true) : $result; } // ------------------------ // サイドバー表示 // ------------------------ function render_tag_ranking($cat_filter = 0, $limit = 10) { $views = get_tag_view_count_cached($cat_filter, $limit); if (empty($views)) return '

ランキング対象タグがありません

'; $terms = get_terms([ 'taxonomy' => 'post_tag', 'include' => array_keys($views), 'hide_empty' => false ]); $map = []; foreach ($terms as $t) { $map[$t->term_id] = $t; } ob_start(); echo '
'; return ob_get_clean(); } // ------------------------ // もっと見るページ(50件ずつ) // ------------------------ function render_tag_ranking_page($cat_filter = 0, $per_page = 50) { $paged = max(1, intval(get_query_var('paged', get_query_var('page', 1)))); $all = get_tag_view_count_cached($cat_filter); if (empty($all)) return '

ランキング対象タグがありません

'; $terms = get_terms([ 'taxonomy' => 'post_tag', 'include' => array_keys($all), 'hide_empty' => false ]); $map = []; foreach ($terms as $t) { $map[$t->term_id] = $t; } $offset = ($paged - 1) * $per_page; $slice = array_slice($all, $offset, $per_page, true); ob_start(); echo '
'; // ページネーション // ページネーション $total_pages = ceil(count($all) / $per_page); if ($total_pages > 1) { echo '
'; echo '
'; } return ob_get_clean(); } // ------------------------ // ショートコード // ------------------------ function tag_ranking_shortcode($atts, $content = null, $tag = '') { $atts = shortcode_atts([ 'cat_filter' => 0, 'limit' => 10, 'per_page' => 50 ], $atts); if ($tag === 'tag_ranking_page') { return render_tag_ranking_page((int)$atts['cat_filter'], (int)$atts['per_page']); } return render_tag_ranking((int)$atts['cat_filter'], (int)$atts['limit']); } add_shortcode('tag_ranking_sidebar', 'tag_ranking_shortcode'); add_shortcode('tag_ranking_page', 'tag_ranking_shortcode'); // ------------------------ // cron(15分更新) // ------------------------ add_filter('cron_schedules', function($schedules){ $schedules['quarter_hour'] = [ 'interval' => 900, 'display' => 'Every 15 Minutes' ]; return $schedules; }); if (!wp_next_scheduled('precache_tag_ranking')) { wp_schedule_event(time(), 'quarter_hour', 'precache_tag_ranking'); } add_action('precache_tag_ranking', function(){ render_tag_ranking(0, 10); render_tag_ranking(81, 10); render_tag_ranking_page(0, 50); render_tag_ranking_page(81, 50); }); 岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 | オナカツ☆

岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】

岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 0

岩本蓮加のグラビアエロ画像をまとめました!Eカップ巨乳おっぱいの谷間やお風呂の美背中などめちゃシコです。

@doguhati サクサクのエビフライをいただく #岩本蓮加 ♬ original sound – センドリー

岩本蓮加のグラビアエロ画像44枚

岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 1
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 2
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 3
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 4
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 5
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 6
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 7
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 8
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 9
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 10
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 11
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 12
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 13
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 14
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 15
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 16
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 17
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 18
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 19
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 20
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 21
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 22
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 23
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 24
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 25
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 26
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 27
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 28
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 29
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 30
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 31
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 32
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 33
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 34
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 35
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 36
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 37
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 38
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 39
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 40
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 41
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 42
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 43
岩本蓮加(二十歳)のグラビアエロ画像【乃木坂46】 44

[dmm_nizigen] [dmm_monthly_standard] [dmm_video_standard]

ただいまバズリ中

コメントをどうぞ