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/www.sceybwg.com/wp-content/themes/Modular/template/module-page/theme-gallery.php
<?php
/**
 * Template: 相册/图集
 * @Author: 大胡子
 * @Email:  dahuzi@xintheme.com
 * @Link:   www.xintheme.com
 * @Date:   2023-08-01 07:27:28
 * @Last Modified by:   dahuzi
 * @Last Modified time: 2024-09-06 16:12:41
 */

if(is_array($module_content)){?>
<div class="section">
    <div class="container">
        <?php
        if( !empty($module_setting['title_display']) ){?>
        <div class="section-title <?php echo $wow_style;?>">
            <?php
            if( !empty($module_title) ){
            echo '<strong>'.$module_title.'</strong>';
            }
            if( !empty($module_desc) ){
            echo '<p>'.$module_desc.'</p>';
            }
            ?>
        </div>
        <?php }

        //只有一个的时候 不显示TAB菜单
        if( !empty($module_content) && count((array)$module_content)>1 ){?>
        <div class="module-tab-menu <?php echo $wow_style;?>">
            <ul>
                <?php
                foreach ($module_content as $key => $value) {
                    $tab_title = $value['tab_title'];
                    $selected = ($key == 0) ? 'selected' : '';
                    if( !empty($tab_title) ){
                        echo ' <li class="'.$selected.'">'.$tab_title.'</li>';
                    }
                }?>
            </ul>
        </div>
        <?php }?>
        <div class="module-tab-box <?php echo $wow_style;?>">
            <?php
            foreach ($module_content as $key => $value) {
                $style = ($key != 0) ? ' style="display:none"' : '';

                //TAB标题
                $tab_title = $value['tab_title'];
                $md5_key = md5( $tab_title );

                //图集/相册
                $gallery_item = $value['gallery_item'];

                //图片链接方式
                $gallery_target = $value['gallery_target'];

                //图片标题
                $img_title = $value['img_title'] ?? '';

                ?>
                <div class="tab-item <?php echo $module_setting['list_style'];?>"<?php echo $style;?>>
                    <?php
                    if(is_array($gallery_item)){
                        foreach ($gallery_item as $img) {
                            // 移除 URL 中的查询参数
                            $image_url = strtok($img, '?');
                            //获取图片ID
                            $attachment_id = attachment_url_to_postid($image_url);
                            //通过图片ID获取图片的标题
                            $image_title = get_the_title($attachment_id);
                            //通过图片ID获取图片的跳转链接
                            $image_link = get_post_meta($attachment_id, 'gallery_link_url', true);
                            //通过图片ID获取图片的替代文本
                            $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);

                            echo '<div class="item-box">';
                            echo '<div class="item-img">';
                            echo '<img loading="lazy" src="'.$img.'" alt="'.$image_alt.'" />';
                            echo '</div>';
                            if( $img_title != 'hide' ){
                                echo '<div class="item-title">';
                                echo '<h3>'.$image_title.'</h3>';
                                echo '</div>';
                            }
                            if( $gallery_target == 'fancybox'){
                                echo '<a href="'.$img.'" class="item-url" data-fancybox="images-'.$md5_key.'"></a>';
                            }elseif( !empty($image_link) ){
                                $item_target = isset($gallery_target) && $gallery_target == '_blank' ? 'target="_blank"' : '';
                                echo '<a href="'.$image_link.'" class="item-url" '.$item_target.'></a>';
                            }
                            echo '</div>';
                        }
                    }?>
                </div>
            <?php }?>
        </div>
    </div>
</div>
<?php }?>

<?php
//echo wpjam_print_r( $module_setting );
//echo wpjam_print_r( $module_content );
//echo wpjam_print_r( $module_style );