add files

This commit is contained in:
Andrey Kuvshinov
2025-07-09 21:21:17 +03:00
commit 8fc8cbae32
596 changed files with 207566 additions and 0 deletions

22
popularnode.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
/*
Template Name: Popular node
*/
$posts = json_decode(get_option('ppp_options'));
$ratios = array_slice(array_map(function($obj){$obj->rate = get_post_meta($obj->id,'popular_hide', true) == 1 ? 0 : get_post_meta($obj->id,'popular_ratio', true); return $obj;}, $posts), 0, 10);
$rates = array();
foreach ($ratios as $item){
$rate = 100 * $item->rate/array_sum(array_map(function($obj){return $obj->rate;}, $ratios));
$rates[$item->id] = $rate;
}
$count = (int)get_option('popularnode_count');
$count = $count+1;
update_option('popularnode_count', $count);
wp_redirect(get_permalink(chance($rates)), 301);
exit;
?>