Daniel Stockman's Facebox v1.2.2 .使用方法: [idl id="自定义值" t="要显示的链接文字"] 下载链接列表 [/idl]. 或是图片弹窗[idl img="file.jpg"]图片地址[/idl]. . Version: 1.0.0 Author: 99839 Author URI: 99839 */ class WP_Facebox { var $opts; var $site; var $home; var $root; // plugin root dir var $ver = 2; /* Utilities */ function header() { if ( $this->ver == 1 ) { echo << \n HTML; } elseif ( $this->ver == 2 ) { echo << \n HTML; } } function invoke_header() { $selectors = array(); if ( $this->opts['do_default'] ) $selectors[] = "a[rel*='facebox']"; if ( $this->opts['do_gallery'] ) $selectors[] = ".gallery-item a"; $selectors = implode(', ', $selectors); if ( !empty($selectors) ) echo "\n"; } function rel_replace( $content ) { $pattern = "/(.*?)<\/a>/i"; $replacement = '$7'; $content = preg_replace($pattern, $replacement, $content); return $content; } function filter_gallery_link( $link, $id ) { // By default, the gallery shortcode creates permalinks to the attachment // Facebox, however, expects a direct link to the resource // wp_get_attachment_url does this for us // I <3 filters return wp_get_attachment_url( $id ); } /* Init / Constructor */ function init() { $this->home = get_option('home'); $this->site = get_option('siteurl'); $this->root = $this->site . '/wp-content/plugins/wp-facebox-download'; if ( $this->ver == 1) { wp_register_script( 'facebox', "{$this->root}/facebox.js", array('jquery'), '1.2' ); } elseif ( $this->ver == 2) { wp_register_script( 'facebox', "{$this->root}/facebox2.js", array('jquery'), '2.0' ); } if ( $this->opts['loadscript'] ) { wp_enqueue_script( 'facebox' ); add_action( 'wp_print_scripts', array(&$this, 'header') ); add_action( 'wp_head', array(&$this, 'invoke_header') ); // turn gallery permalinks into direct links add_filter( 'attachment_link', array(&$this, 'filter_gallery_link'), 11, 2 ); } if ( $this->opts['autofilter'] ) { add_filter( 'the_content', array(&$this, 'rel_replace') ); } } function WP_Facebox() { // constructor // TODO: implement admin options interface for these values // For the time being, turn off options by replacing 1 with 0 $this->opts = array( 'autofilter' => 1, 'do_default' => 1, 'do_gallery' => 1, 'loadscript' => 1 ); // don't disable 'loadscript', unless you're only after the header output $this->init(); } } // make those julienne fries, baby $wp_facebox = new WP_Facebox(); function lightbox_99dl($atts, $content = null) { extract(shortcode_atts(array( 'id' => '', 'img' => '', 't' => '', ), $atts)); if ($id) { return '