HEX
Server: nginx/1.16.1
System: Linux VM-0-14-centos 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64
User: www (1000)
PHP: 8.3.31
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/1.scey.cn/wp-content/themes/Leading/admin/pages/Leading-home.php
<?php

add_action('admin_head',function(){?>

<?php if(!class_exists( 'WooCommerce' )){?>
	<style type="text/css">#index_modular_type option[value=shop]{ display:none; }</style>
<?php }?>
	<style type="text/css">
	
		#label_modular_post_type_0{display:none}
		#label_modular_post_type_cat{margin-left:-14px}

		<?php for ($i=1; $i<=6; $i++) { ?>

		#label_post_modular_type_<?php echo $i; ?>{background-image:url(<?php echo get_stylesheet_directory_uri().'/static/images/set/post-'.$i.'.png';?>);border: 1px solid #e8e5e5;margin: 0 0 15px 0;width:150px;height:90px;font-size:0;background-repeat:no-repeat;background-size:100% 100%;-moz-background-size:100% 100%; display: inline-block;}
		#post_modular_type_<?php echo $i; ?>:checked{border:3px solid #f33;width:150px;height:90px;display:block;margin-top:0;background-image:url(<?php echo get_stylesheet_directory_uri().'/static/images/set/post-'.$i.'.png';?>);border-radius:0;background-repeat:no-repeat;background-size:100% 100%;-moz-background-size:100% 100%}
		#post_modular_type_<?php echo $i; ?>,#post_modular_type_<?php echo $i; ?>:checked:before{display:none}

		<?php } ?>

	</style>

	<script type="text/javascript">
	jQuery(function($){

		$('body').on('change', 'select#index_modular_type', function(){
				$('#tr_partner').hide();
				$('#tr_img_slide').hide();
				$('#tr_modular_title').hide();
				$('#tr_modular_sub_title').hide();
				$('#tr_modular_cat_id').hide();
				$('#tr_modular_post_number').hide();
				$('#tr_post_modular_type').hide();
				$('#tr_modular_code').hide();
				$('#tr_number').hide();
				$('#tr_partner_background').hide();
				$('#tr_partner_img').hide();
				$('#tr_about_text').hide();
				$('#tr_about_background').hide();
				$('#tr_about_img').hide();
				$('#tr_about_type').hide();
				$('#tr_about_url').hide();
				$('#tr_modular_post_id').hide();
				$('#tr_modular_post_type').hide();
				$('#tr_modular_sub_menu').hide();
				$('#tr_modular_sub_menu_type').hide();
			if($(this).val() == 'slide'){
				$('#tr_img_slide').show();
			}else if($(this).val() == 'code'){
				$('#tr_modular_code').show();
			}else if($(this).val() == 'shop'){
				$('#tr_modular_title').show();
				$('#tr_modular_sub_title').show();
				$('#tr_modular_post_number').show();
			}else if($(this).val() == 'partner'){
				$('#tr_partner').show();
				$('#tr_modular_title').show();
				$('#tr_modular_sub_title').show();
			}else if($(this).val() == 'number'){
				$('#tr_modular_title').show();
				$('#tr_modular_sub_title').show();
				$('#tr_number').show();
				$('#tr_partner_background').show();
				$('#tr_partner_img').show();
			}else if($(this).val() == 'about'){
				$('#tr_modular_title').show();
				$('#tr_about_text').show();
				$('#tr_about_background').show();
				$('#tr_about_img').show();
				$('#tr_about_type').show();
				$('#tr_about_url').show();
			}else{
				$('#tr_modular_title').show();
				$('#tr_modular_sub_title').show();
				$('#tr_post_modular_type').show();
				$('#tr_modular_post_type').show();
				$('#tr_modular_sub_menu').show();
				$('#tr_modular_sub_menu_type').show();

				$('body').on('change', '#tr_modular_post_type input', function(){
						$('#tr_modular_post_id').hide();
						$('#tr_modular_cat_id').hide();
						$('#tr_modular_post_number').hide();
					if ($(this).is(':checked')) {
						if($(this).val() == 'cat'){
							$('#tr_modular_cat_id').show();
							$('#tr_modular_post_number').show();
							
						}
						if($(this).val() == 'post'){
							$('#tr_modular_post_id').show();
						}
					}			
				});
				//【优化选中显示】
				if(document.getElementById("modular_post_type_post").checked){
					$('#tr_modular_post_id').show();
				}else if(document.getElementById("modular_post_type_cat").checked){
					$('#tr_modular_cat_id').show();
					$('#tr_modular_post_number').show();
				}else{
					$('#tr_modular_post_id').hide();
					$('#tr_modular_cat_id').hide();
					$('#tr_modular_post_number').hide();
				}
				
			}
		});

		$('body').on('list_table_action_success', function(event, response){
			$('body select#index_modular_type').change();
		});

	});
	</script>

	<?php
});



add_filter('wpjam_Leading_home_tabs', function(){
	return [
		'slider'	=> ['title'=>'幻灯片',	'function'=>'list',	'list_table_name'=>'leading_banner'],
		'modular'	=> ['title'=>'模块',		'function'=>'list',	'list_table_name'=>'leading_modular'],
	];
});

add_filter('wpjam_leading_banner_list_table', function(){
	return [
		'title'		=>'幻灯片',
		'plural'	=>'leading_banners',
		'singular'	=>'leading_banner',
		'model'		=>'WPJAM_LeadingBanner',
		'fixed'		=>false,
		'sortable'	=>true,
		'ajax'		=>true
	];
});

add_filter('wpjam_leading_modular_list_table', function(){
	return [
		'title'		=>'模块',
		'plural'	=>'leading_modulars',
		'singular'	=>'leading_modular',
		'model'		=>'WPJAM_LeadingModular',
		'fixed'		=>false,
		'sortable'	=>true,
		'ajax'		=>true
	];
});

class WPJAM_LeadingBannerHandler extends WPJAM_Item{
	public function get_items(){
		$items 	= wpjam_get_setting('wpjam_theme', 'banner_slide') ?: [];
		if($items && isset($items[0])){
			$items[count($items)]	= $items[0];
			unset($items[0]);

			$this->update_items($items);
		}
		
		return $this->parse_items($items);
	}

	public function update_items($items){
		return wpjam_update_setting('wpjam_theme', 'banner_slide', $items);
	}
}

class WPJAM_LeadingBanner extends WPJAM_Model{
	private static $handler;

	public static function get_handler(){
		if(is_null(static::$handler)){
			static::$handler	= new WPJAM_LeadingBannerHandler();
		}
		return static::$handler;
	}

	public static function get_fields($action_key='', $item_id=0){
		return [
			'img_src' 		=> ['title'=>'电脑端',	'type'=>'img', 'item_type'=>'url',	'show_admin_column'=>true,	'description'=>'建议尺寸:1920 × 562','size'=>'1920×562'],
			'img_src_mb'	=> ['title'=>'手机端',	'type'=>'img', 'item_type'=>'url',	'show_admin_column'=>true,	'description'=>'建议尺寸:740 × 509',	'size'=>'740×509'],
			'img_url'		=> ['title'=>'跳转链接',	'type'=>'url', 'show_admin_column'=>true],
		];
	}

	public static function item_callback($item){
		$item['img_src']	= $item['img_src'] ? '<img src="'.wpjam_get_thumbnail($item['img_src'], '320x92').'"  width="240" height="70">' : '';
		$item['img_src_mb']	= $item['img_src_mb'] ? '<img src="'.wpjam_get_thumbnail($item['img_src_mb'], '185x127').'"  width="92" height="64">' : '';
		$item['img_url']	= $item['img_url'] ? '<a href="'.$item['img_url'].'">'.$item['img_url'].'</a>' : '';

		return $item;
	}
}

class WPJAM_LeadingModularHandler extends WPJAM_Item{
	public function get_items(){
		$items 	= wpjam_get_setting('wpjam_theme', 'index_modular') ?: [];

		if($items && isset($items[0])){
			$items[count($items)]	= $items[0];
			unset($items[0]);

			$this->update_items($items);
		}
		
		return $this->parse_items($items);
	}

	public function update_items($items){
		return wpjam_update_setting('wpjam_theme', 'index_modular', $items);
	}
}

class WPJAM_LeadingModular extends WPJAM_Model{
	private static $handler;

	public static function get_handler(){
		if(is_null(static::$handler)){
			static::$handler	= new WPJAM_LeadingModularHandler();
		}
		return static::$handler;
	}

	public static function get_fields($action_key='', $item_id=0){
		$categories	= wpjam_get_terms(['taxonomy'=>'category',	'hide_empty'=>0], 0);


		$categories			= wpjam_flatten_terms($categories);
		$category_options	= [''=>'']+wp_list_pluck($categories, 'name', 'id');

						

		return [

			// 选择模块
			'index_modular_type'	=> ['title'=>'选择模块',	'type'=>'select',	'show_admin_column'=>true,	 'options'=>[
				'post'=>'文章模块',
				'slide'=>'图片轮播',
				'partner'=>'合作伙伴',
				'number'=>'数字滚动',
				'about'=>'关于我们',
				'code'=>'自定义代码',
				'shop'=>'商店模块(WooCommerce)'
			]],

			// 图片轮播
			'img_slide' => ['title'=>'图片轮播', 'type'=>'mu-fields', 'fields'=>[

				'img_src' => ['title'=>'电脑端', 'type'=>'img', 'item_type'=>'url', 'description'=>'建议尺寸:1440 × 374'],
				'img_src_mb' => ['title'=>'手机端', 'type'=>'img', 'item_type'=>'url', 'description'=>'建议尺寸:720 × 360'],
				'img_url' => ['title'=>'跳转链接', 'type'=>'url', 'class'=>'all-options'],

			]],

			// 模块1-6
			'post_modular_type'	=> ['title'=>'列表样式',	'type'=>'radio', 'show_admin_column'=>true, 'options'=>[
				'1'=>'样式-1',
				'2'=>'样式-2',
				'3'=>'样式-3',
				'4'=>'样式-4',
				'5'=>'样式-5',
				'6'=>'样式-6'
			] ],
			'modular_title'	=> ['title'=>'模块标题',	'type'=>'text',	'show_admin_column'=>true, 'class'=>'all-options'],
			'modular_sub_title'	=> ['title'=>'模块副标题', 'type'=>'text', 'show_admin_column'=>true,	 'class'=>'all-options'],
			'modular_sub_menu'	=> ['title'=>'模块子菜单',	'type'=>'textarea',	'description'=>' &lt;li class="cat-item">&lt;a href="http://leading.xintheme.cn"&gt;查看更多&lt;/a&gt;&lt;/li&gt;<br><br>请按以上格式填写,留空则显示默认链接'],
			'modular_sub_menu_type'	=> ['title'=>'子菜单显示位置', 'type'=>'radio', 'options'=>['1'=>'靠左对齐','2'=>'居中显示','3'=>'靠右对齐']],
			
			'modular_post_type'	=> ['title'=>'显示文章', 'type'=>'radio', 'options'=>['0'=>'未选择','cat'=>'指定分类','post'=>'指定文章']],
			
			'modular_cat_id' => ['title'=>'分类', 'type'=>'select',	'show_admin_column'=>true, 'class'=>'all-options','options'=>$category_options],
			'modular_post_number' => ['title'=>'显示数量', 'type'=>'text', 'show_admin_column'=>true, 'class'=>'all-options'],
			'modular_post_id'	=>['title'=>'调用文章', 'type'=>'mu-text', 'data_type'=>'post_type', 'post_type'=>'post', 'class'=>'all-options', 'placeholder'=>'', 'description'=>'请输入文章ID或者关键字进行筛选'],

			// 合作伙伴
			'partner_background' => ['title'=>'背景颜色', 'type'=>'color'],
			'partner_img' => ['title'=>'背景图片', 'type'=>'img', 'item_type'=>'url', 'description'=>'建议尺寸:1920 × 500'],
			'partner' => ['title'=>'图片轮播', 'type'=>'mu-fields', 'fields'=>[

				'partner_img' => ['title'=>'上传Logo', 'type'=>'img', 'item_type'=>'url', 'description'=>'建议尺寸 258*92'],

			]],

			// 数字滚动
			'number' => ['title'=>'数字滚动', 'type'=>'mu-fields', 'total'=>4, 'fields'=>[

				'number_num' => ['title'=>'数值', 'type'=>'text', 'class'=>'all-options'],
				'number_text' => ['title'=>'文本描述', 'type'=>'text', 'class'=>'all-options'],

			]],

			// 关于我们
			'about_text' => ['title'=>'文本描述',	'type'=>'textarea',	'description'=>'每段文字请用p标签包含,例:&lt;p&gt;这是一段文字描述&lt;/p&gt;'],
			'about_background' => ['title'=>'背景颜色', 'type'=>'color'],
			'about_img' => ['title'=>'特色图片', 'type'=>'img', 'item_type'=>'url'],
			'about_type' => ['title'=>'图片位置', 'type'=>'radio', 'show_admin_column'=>true, 'options'=>['left'=>'左侧','right'=>'右侧'] ],
			//暂时隐藏 'about_url' => ['title'=>'跳转链接', 'type'=>'url', 'class'=>'all-options'],

			
			// 添加自定义代码
			'modular_code'	=> ['title'=>'自定义代码',	'type'=>'textarea',	'description'=>'此为空白模块,专为技术人员提供,请贴入你自己的html代码']

		];
	}
}