File: /www/wwwroot/www.scdc-marine.com/wp-content/themes/heku-cms/HekuClass/View/News.php
<?php
namespace Heku\HekuClass\View;
/**
* @package Heku\HekuClass\Templates
* @subpackage Classes/News
* @author Heku Daleconan <http://www.daleconan.com>
* @copyright Copyright (c) 2022-2023, Heku Daleconan
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/
class News {
/**
* 类实现单例模式,类的独生子女
*/
private static $instance;
/**
* 依赖注入的接口 Instance 方法
* 目标是 保证 init() 初始化方法 只执行一次
*
* @return self 唯一实例化的本类
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self;
self::$instance->init();
}
return self::$instance;
}
private function init() {
// // 产品单页面,产品轮播图片,视频,和右侧 产品属性,型号,宣传语等 信息排版
// add_action('product_img_line',array($this,'product_img_html'), 10);
}
// /**
// * 输出缓存的 product_img html 否则直接返回执行结果
// */
// public function product_img_html(){
// echo self::product_img();
// }
// public function product_img(){
// $html = '<div id="product_img_line">
// <div class="container clearfix">
// <div class="product-img-left wow slideInUp ">
// <!-- star heku-top-img -->
// ' . self::product_img_carousel() . '
// <!-- end heku-top-img -->
// </div>
// <div class="product-summary-right wow slideInUp">
// <!-- star heku-top-summary -->
// ' . self::product_quality_right() . '
// <!-- end heku-top-summary -->
// </div>
// </div>
// </div>';
// return apply_filters('product_img_filter', $html );
// }
// public function product_sidebar(){
// // $html ='
// // <div class="mt-4 toc-sidebar ">
// // <h3 class="toc-header"><i class="joe-font joe-icon-xiaoxi" title="文章目录"></i>文章目录</h3>
// // <div class="toc-container"></div>
// // </div>';
// // return apply_filters('heku_top_sidebar_html', $html );
// }
// /**
// * 页面 Carousel_Banner
// * @return string 顶部的 Carousel_Banner HTML代码
// */
// public static function product_img_carousel(){
// $banner_group = get_post_meta( get_the_ID(), 'wiki_test_file_list', true );
// // var_dump( get_the_ID() );
// $html = '<div id="Carousel_Product_Img" class="carousel slide carousel-slider" data-ride="carousel" >
// <ol class="carousel-indicators product-img-indicators justify-content-start">
// <!-- / start product-img-indicators call -->';
// if(!empty($banner_group)){
// $num = 0;
// foreach ($banner_group as $key => $value) {
// if(isset($value)){
// $html .= '
// <li data-target="#Carousel_Product_Img" data-slide-to="' . $num . '" class="col '. ( ( $num == '0' )? 'active' : '') .'" style="background:url(' . $value . ') no-repeat center;background-size: cover;"></li>';
// }
// $num ++;
// }
// }
// $html .= '
// <!-- / end product-img-indicators call -->
// </ol>
// <div id="viewer" class="carousel-inner product-img-inner heku-img-box heku-img-radius">
// <!-- / start product-img-inner call -->';
// if(!empty($banner_group)){
// $num = 0;
// foreach ($banner_group as $key => $value) {
// if(isset($value)){
// $sss = get_post_meta($key,"_wp_attachment_image_alt" );
// $html .= '
// <div class="carousel-item product-img-bg '. ( ( $num == '0' )? 'active' : '') .'" data-interval="4000">';
// if($sss){
// //var_dump($sss);
// $html .= '
// <div class="product-img-video" >
// <video autoplay="autoplay" loop="loop" muted="true" type="video/mp4" poster="'. $value .'" >
// <source src="'. get_post_meta($key,"_wp_attachment_image_alt" )[0] .'">
// </video>
// </div>';
// }else{
// $html .= '
// <img class=" " data-original="' . $value . '" src="' . $value . '" alt="" >';
// }
// $html .= '
// </div>';
// $num ++;
// }
// }
// }
// $html .= '
// <!-- / end product-img-inner call -->
// <div class="carousel-control-prev">
// <a href="#Carousel_Product_Img" role="button" data-slide="prev">
// <span class="carousel-control-prev-icon"></span>
// </a>
// </div>
// <div class="carousel-control-next">
// <a href="#Carousel_Product_Img" role="button" data-slide="next">
// <span class="carousel-control-next-icon"></span>
// </a>
// </div>
// </div>
// </div>';
// wp_enqueue_script( 'heku-viewer', HEKU_THEME_URI . '/Assets/js/viewer.min.js' );
// $custom_inline_script = '// 产品轮播图片 点击放大, 元素框:id:viewer 高清图源:data-original
// window.addEventListener("DOMContentLoaded", function () {
// var product_galley = document.getElementById("viewer");
// var product_viewer = new Viewer(product_galley, {
// url: "data-original",
// toolbar:{
// oneToOne: false,
// play: false,
// prev: function() {
// product_viewer.prev(true);
// },
// next: function() {
// product_viewer.next(true);
// },
// },
// title:false,
// });
// });';
// wp_add_inline_script( 'heku-viewer', $custom_inline_script, 'after' );
// return $html;
// }
// /**
// * 页面 Carousel_Banner
// * @return string 顶部的 Carousel_Banner HTML代码
// */
// public static function product_quality_right(){
// $product_model = get_post_meta( get_the_ID(), 'product_model', true );
// $html = '<div class="product-summary-title"><span>' . get_the_title() . '</span></div>
// <div class="product-summary-model">' . $product_model . '</div>
// <div class="product-summary-detail">
// <ul>
// <li>体积小、重量轻、精度高;</li>
// <li>全部采用工业器件,性能稳定可靠;</li>
// <li>RS485 接口,兼容 modbus RTU 协议。</li>
// <li>符合 CE 认证 EN61326。</li>
// </ul>
// </div>
// <div class="product-summary-btn">
// <a class="heku-btn heku-btn-white shangqiao" href="javascript:;">询价</a><a class="heku-btn heku-btn-white" href="#footer_contact_row">样品申请</a>
// </div>';
// return $html;
// }
// public function get_related_posts($post_id){
// }
}