/
www
/
wwwroot
/
fxdst.com
/
wp-content
/
themes
/
fxdst
/
Upload File
HOME
<?php /* Template Name: Partners Page */ if ( ! defined( 'ABSPATH' ) ) { exit; } get_header(); include( 'templates/header-nav.php' ); $fxdst_partner_links = get_bookmarks(array( 'orderby' => 'rating', 'order' => 'DESC', 'hide_invisible' => 1, 'limit' => -1, )); // Present partners in ecosystem order while preserving the previous order for unknown links. $fxdst_partner_priority = array( 'blog.kuanju.cc' => 10, 'openai.com' => 20, 'github.com' => 30, 'cloudflare.com' => 40, 'cloudbypass.com' => 50, 'vercel.com' => 60, 'supabase.com' => 70, 'stripe.com' => 80, 'web4browser.io' => 90, 'vmlogin.cc' => 100, 'lalimao.com' => 110, 'maskproxy.net' => 120, 'ip.cloudbypass.com' => 130, ); $fxdst_ordered_partner_links = array(); foreach ($fxdst_partner_links as $fxdst_partner_index => $fxdst_partner_link) { $fxdst_partner_link_host = strtolower((string) wp_parse_url($fxdst_partner_link->link_url, PHP_URL_HOST)); $fxdst_partner_link_host = preg_replace('/^www\./', '', $fxdst_partner_link_host); $fxdst_ordered_partner_links[] = array( 'partner' => $fxdst_partner_link, 'rank' => isset($fxdst_partner_priority[$fxdst_partner_link_host]) ? $fxdst_partner_priority[$fxdst_partner_link_host] : 1000, 'index' => $fxdst_partner_index, ); } usort($fxdst_ordered_partner_links, function($left, $right) { return ($left['rank'] <=> $right['rank']) ?: ($left['index'] <=> $right['index']); }); $fxdst_partner_links = array_map(function($item) { return $item['partner']; }, $fxdst_ordered_partner_links); ?> <div class="main-content page"> <?php include( 'templates/header-banner.php' ); ?> <div class="container"> <div class="row mt-5 mt-sm-0"> <div class="col-12 mx-auto"> <div class="panel panel-default fxdst-partners-panel"> <?php get_template_part( 'templates/breadcrumb' ); ?> <header class="fxdst-archive-head"> <span class="fxdst-eyebrow">AI / SaaS / Global Partners</span> <h1><?php echo esc_html(get_the_title()); ?></h1> <p>汇总与方向舵定位相关的合作伙伴、友情链接和推荐资源。</p> </header> <div class="fxdst-partners-layout"> <section class="fxdst-partners-list" aria-label="Partners"> <?php while( have_posts() ): the_post(); ?> <?php if (trim(get_the_content()) !== '') : ?> <div class="fxdst-partners-intro"> <?php the_content(); ?> </div> <?php endif; ?> <?php endwhile; ?> <?php if (!empty($fxdst_partner_links)) : ?> <?php foreach ($fxdst_partner_links as $fxdst_partner) : $fxdst_partner_url = $fxdst_partner->link_url; $fxdst_partner_name = $fxdst_partner->link_name; $fxdst_partner_desc = $fxdst_partner->link_description; $fxdst_partner_icon = $fxdst_partner->link_image; $fxdst_partner_host = strtolower((string) wp_parse_url($fxdst_partner_url, PHP_URL_HOST)); $fxdst_partner_host = preg_replace('/^www\./', '', $fxdst_partner_host); $fxdst_partner_preview_slug = sanitize_title(str_replace('.', '-', $fxdst_partner_host)); $fxdst_partner_preview_path = get_theme_file_path('/images/partners/' . $fxdst_partner_preview_slug . '.webp'); if ($fxdst_partner_preview_slug && file_exists($fxdst_partner_preview_path)) { $fxdst_partner_feature_image = get_theme_file_uri('/images/partners/' . $fxdst_partner_preview_slug . '.webp'); } else { $fxdst_partner_feature_image = 'https://s.wordpress.com/mshots/v1/' . rawurlencode($fxdst_partner_url) . '?w=960&h=540'; } $fxdst_partner_feature_notes = trim($fxdst_partner->link_notes); $fxdst_partner_feature_rss = trim($fxdst_partner->link_rss); $fxdst_partner_feature_rating = (int) $fxdst_partner->link_rating; $fxdst_partner_rel_tokens = preg_split('/\s+/', trim((string) $fxdst_partner->link_rel), -1, PREG_SPLIT_NO_EMPTY); $fxdst_partner_rel_tokens = array_unique(array_merge($fxdst_partner_rel_tokens, array('noopener', 'noreferrer', 'external'))); $fxdst_partner_rel = implode(' ', $fxdst_partner_rel_tokens); if (!$fxdst_partner_icon && $fxdst_partner_url && function_exists('io_get_option') && function_exists('format_url')) { $fxdst_partner_icon = io_get_option('ico_url') . format_url($fxdst_partner_url) . io_get_option('ico_png'); } if (!$fxdst_partner_icon) { $fxdst_partner_icon = get_theme_file_uri('/images/favicon.png'); } $fxdst_partner_terms = wp_get_object_terms((int) $fxdst_partner->link_id, 'link_category'); $fxdst_partner_term = (!is_wp_error($fxdst_partner_terms) && !empty($fxdst_partner_terms)) ? $fxdst_partner_terms[0]->name : '合作伙伴'; $fxdst_qr_url = '//api.qrserver.com/v1/create-qr-code/?size=150x150&margin=10&data=' . rawurlencode($fxdst_partner_url); $fxdst_partner_has_feature = true; ?> <article class="fxdst-partner-row"> <div class="fxdst-partner-logo"> <div class="fxdst-partner-logo-bg" style="background-image:url('<?php echo esc_url($fxdst_partner_icon); ?>')"></div> <img src="<?php echo esc_url($fxdst_partner_icon); ?>" alt="<?php echo esc_attr($fxdst_partner_name); ?>"> </div> <div class="fxdst-partner-body"> <span class="fxdst-partner-badge"><?php echo wp_kses_post($fxdst_partner_term); ?></span> <h2><?php echo esc_html($fxdst_partner_name); ?></h2> <?php if ($fxdst_partner_desc) : ?> <p><?php echo esc_html(wp_trim_words(wp_strip_all_tags($fxdst_partner_desc), 80, '...')); ?></p> <?php endif; ?> <div class="fxdst-partner-actions"> <a class="btn btn-arrow" href="<?php echo esc_url($fxdst_partner_url); ?>" target="_blank" rel="<?php echo esc_attr($fxdst_partner_rel); ?>"><span>访问官网<i class="fa fa-angle-right"></i></span></a> <a href="javascript:" class="btn btn-arrow fxdst-partner-qr" data-toggle="tooltip" data-placement="bottom" title="" data-html="true" data-original-title="<img src='<?php echo esc_url($fxdst_qr_url); ?>' width='150'>"><span>手机查看<i class="fa fa-qrcode"></i></span></a> </div> </div> <aside class="fxdst-partner-feature<?php echo $fxdst_partner_has_feature ? '' : ' fxdst-partner-feature-empty'; ?>"> <?php if ($fxdst_partner_feature_image) : ?> <div class="fxdst-partner-feature-media"> <a href="<?php echo esc_url($fxdst_partner_url); ?>" target="_blank" rel="<?php echo esc_attr($fxdst_partner_rel); ?>" aria-label="<?php echo esc_attr($fxdst_partner_name . ' 官网'); ?>"> <img src="<?php echo esc_url($fxdst_partner_feature_image); ?>" alt="<?php echo esc_attr($fxdst_partner_name . ' 网站首页预览'); ?>" width="960" height="540" loading="lazy" decoding="async"> </a> </div> <?php endif; ?> <?php if ($fxdst_partner_feature_notes || $fxdst_partner_feature_rss || $fxdst_partner_feature_rating > 0) : ?> <div class="fxdst-partner-feature-body"> <?php if ($fxdst_partner_feature_notes) : ?> <p><?php echo esc_html(wp_trim_words(wp_strip_all_tags($fxdst_partner_feature_notes), 80, '...')); ?></p> <?php endif; ?> <div class="fxdst-partner-feature-meta"> <?php if ($fxdst_partner_feature_rss) : ?> <a href="<?php echo esc_url($fxdst_partner_feature_rss); ?>" target="_blank" rel="nofollow noopener noreferrer external"><i class="fa fa-rss"></i> RSS</a> <?php endif; ?> <?php if ($fxdst_partner_feature_rating > 0) : ?> <span><i class="fa fa-star"></i> <?php echo esc_html($fxdst_partner_feature_rating); ?>/10</span> <?php endif; ?> </div> </div> <?php endif; ?> </aside> </article> <?php endforeach; ?> <?php else : ?> <div class="fxdst-blog-empty"> <i class="fa fa-link"></i> <strong>暂无合作伙伴</strong> <p>可以在 WordPress 后台的链接功能中添加后自动显示。</p> </div> <?php endif; ?> </section> </div> </div> </div> </div> </div> <?php get_footer(); ?>