Attachments - Version 1.0

Version Description

  • First stable release

=

Download this release

Release Info

Developer jchristopher
Plugin Icon wp plugin Attachments
Version 1.0
Comparing to
See all releases

Version 1.0

attachments.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Attachments
4
+ Plugin URI: http://mondaybynoon.com/wordpress/attachments
5
+ Description: Allows the addition of attachment groups consisting of any number of files
6
+ Version: 1.0
7
+ Author: Jonathan Christopher
8
+ Author URI: http://jchristopher.me
9
+ */
10
+
11
+
12
+ /* Copyright 2009 Jonathan Christopher (email : jonathandchr@gmail.com)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License as published by
16
+ the Free Software Foundation; either version 2 of the License, or
17
+ (at your option) any later version.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU General Public License for more details.
23
+
24
+ You should have received a copy of the GNU General Public License
25
+ along with this program; if not, write to the Free Software
26
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
+ */
28
+
29
+ global $wpdb;
30
+
31
+ // =========
32
+ // = HOOKS =
33
+ // =========
34
+ add_action('admin_menu', 'attachments_init');
35
+ add_action('admin_head', 'attachments_init_js');
36
+ add_action('save_post', 'attachments_save');
37
+
38
+
39
+
40
+
41
+
42
+ // =============
43
+ // = FUNCTIONS =
44
+ // =============
45
+
46
+
47
+ function cmp($a, $b)
48
+ {
49
+ return strcmp($a["order"], $b["order"]);
50
+ }
51
+
52
+ function attachments_add()
53
+ {?>
54
+
55
+ <div id="attachments-inner">
56
+
57
+ <ul id="attachments-actions">
58
+ <li id="attachments-browse"><a href="#" class="button button-highlighted browse-attachments">Browse</a></li>
59
+ <li id="attachments-add-new"><a href="media-upload.php?post_id=-1257080594&amp;type=image&amp;TB_iframe=true&amp;width=640&amp;height=523" class="button thickbox">Add New</a></li>
60
+ </ul>
61
+
62
+ <div id="attachments-list">
63
+ <input type="hidden" name="attachments_nonce" id="attachments_nonce" value="<?=wp_create_nonce( plugin_basename(__FILE__) )?>" />
64
+ <ul>
65
+ <?php
66
+ if( !empty($_GET['post']) )
67
+ {
68
+ $existing_attachments = unserialize(get_post_meta(intval($_GET['post']), '_attachments', true));
69
+ if( count($existing_attachments) > 0 )
70
+ {
71
+ usort($existing_attachments, "cmp");
72
+ $attachment_index = 0;
73
+ foreach ($existing_attachments as $attachment) : $attachment_index++; ?>
74
+ <li class="attachments-file">
75
+ <h2>
76
+ <a href="#" class="attachment-handle">
77
+ <span class="attachment-handle-icon"><img src="<?=WP_PLUGIN_URL?>/attachments/images/handle.gif" alt="Drag" /></span>
78
+ </a>
79
+ <span class="attachment-name"><?=$attachment['name']?></span>
80
+ <span class="attachment-delete"><a href="#">Delete</a></span>
81
+ </h2>
82
+ <div class="attachments-fields">
83
+ <div class="textfield" id="field_attachment_title_<?=$attachment_index?>">
84
+ <label for="attachment_title_<?=$attachment_index?>">Title</label>
85
+ <input type="text" id="attachment_title_<?=$attachment_index?>" name="attachment_title_<?=$attachment_index?>" value="<?=$attachment['title']?>" size="20" />
86
+ </div>
87
+ <div class="textfield" id="field_attachment_caption_<?=$attachment_index?>">
88
+ <label for="attachment_caption_<?=$attachment_index?>">Caption</label>
89
+ <input type="text" id="attachment_caption_<?=$attachment_index?>" name="attachment_caption_<?=$attachment_index?>" value="<?=$attachment['caption']?>" size="20" />
90
+ </div>
91
+ </div>
92
+ <div class="attachments-data">
93
+ <input type="hidden" name="attachment_name_<?=$attachment_index?>" id="attachment_name_<?=$attachment_index?>" value="<?=$attachment['name']?>" />
94
+ <input type="hidden" name="attachment_location_<?=$attachment_index?>" id="attachment_location_<?=$attachment_index?>" value="<?=$attachment['location']?>" />
95
+ <input type="hidden" name="attachment_id_<?=$attachment_index?>" id="attachment_id_<?=$attachment_index?>" value="<?=$attachment['id']?>" />
96
+ <input type="hidden" class="attachment_order" name="attachment_order_<?=$attachment_index?>" id="attachment_order_<?=$attachment_index?>" value="<?=$attachment['order']?>" />
97
+ </div>
98
+ <div class="attachment-thumbnail">
99
+ <span class="attachments-thumbnail">
100
+ <?=wp_get_attachment_image( $attachment['id'], array(80, 60), true );?>
101
+ </span>
102
+ </div>
103
+ </li>
104
+ <?php endforeach;
105
+ }
106
+ }
107
+ ?>
108
+ </ul>
109
+ </div>
110
+
111
+ </div>
112
+
113
+ <?php }
114
+
115
+
116
+
117
+ /**
118
+ * Creates meta box on all post and page pages
119
+ *
120
+ * @return void
121
+ * @author Jonathan Christopher
122
+ */
123
+
124
+ function attachments_meta_box()
125
+ {
126
+ // for posts
127
+ add_meta_box( 'attachments_list', __( 'Attachments', 'attachments_textdomain' ), 'attachments_add', 'post', 'normal' );
128
+
129
+ // for pages
130
+ add_meta_box( 'attachments_list', __( 'Attachments', 'attachments_textdomain' ), 'attachments_add', 'page', 'normal' );
131
+ }
132
+
133
+
134
+
135
+ function attachments_init_js()
136
+ {
137
+ echo '<script type="text/javascript" charset="utf-8">';
138
+ echo ' var attachments_base = "' . WP_PLUGIN_URL . '/attachments"; ';
139
+ echo ' var attachments_media = ""; ';
140
+ echo ' Shadowbox.init({ skipSetup:true, onClose:attachments_update }); ';
141
+ echo '</script>';
142
+ }
143
+
144
+
145
+
146
+ function attachments_save($post_id)
147
+ {
148
+ // verify this came from the our screen and with proper authorization,
149
+ // because save_post can be triggered at other times
150
+ if ( !wp_verify_nonce( $_POST['attachments_nonce'], plugin_basename(__FILE__) )) {
151
+ return $post_id;
152
+ }
153
+
154
+ // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want
155
+ // to do anything
156
+ if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
157
+ return $post_id;
158
+
159
+ // Check permissions
160
+ if ( 'page' == $_POST['post_type'] ) {
161
+ if ( !current_user_can( 'edit_page', $post_id ) )
162
+ return $post_id;
163
+ } else {
164
+ if ( !current_user_can( 'edit_post', $post_id ) )
165
+ return $post_id;
166
+ }
167
+
168
+ // OK, we're authenticated: we need to find and save the data
169
+ $total_attachments = 0;
170
+
171
+ // We'll build our array of attachments
172
+ foreach($_POST as $key => $data) {
173
+
174
+ // Arbitrarily using the location input
175
+ if( substr($key, 0, 20) == 'attachment_location_' )
176
+ {
177
+ $total_attachments++;
178
+ }
179
+
180
+ // If we have attachments, there's work to do
181
+ if( $total_attachments > 0 )
182
+ {
183
+ $attachments_data = array();
184
+ for ($i=1; $i <= $total_attachments; $i++)
185
+ {
186
+ $attachment_index = intval(substr($key, 20, strlen($key)));
187
+ $attachment_details = array(
188
+ 'title' => $_POST['attachment_title_' . $i],
189
+ 'caption' => $_POST['attachment_caption_' . $i],
190
+ 'name' => $_POST['attachment_name_' . $i],
191
+ 'location' => $_POST['attachment_location_' . $i],
192
+ 'id' => $_POST['attachment_id_' . $i],
193
+ 'order' => $_POST['attachment_order_' . $i]
194
+ );
195
+ array_push($attachments_data, $attachment_details);
196
+ }
197
+ }
198
+
199
+ }
200
+
201
+ // Serialization goodness
202
+ $attachments_serialized = serialize($attachments_data);
203
+
204
+ update_post_meta($post_id, '_attachments', $attachments_serialized);
205
+ }
206
+
207
+
208
+
209
+
210
+ function attachments_get_attachments($post_id=null)
211
+ {
212
+ global $post;
213
+
214
+ if($post_id==null)
215
+ {
216
+ $post_id = $post->ID;
217
+ }
218
+
219
+ $existing_attachments = unserialize(get_post_meta($post_id, '_attachments', true));
220
+
221
+ if( count($existing_attachments) > 0 )
222
+ {
223
+ $post_attachments = array();
224
+ usort($existing_attachments, "cmp");
225
+ foreach ($existing_attachments as $attachment)
226
+ {
227
+ array_push($post_attachments, array(
228
+ 'id' => $attachment['id'],
229
+ 'title' => $attachment['title'],
230
+ 'caption' => $attachment['caption'],
231
+ 'location' => $attachment['location']
232
+ ));
233
+ }
234
+ }
235
+
236
+ return $post_attachments;
237
+ }
238
+
239
+
240
+
241
+
242
+
243
+ /**
244
+ * This is the main initialization function, it will check for existing attachments
245
+ * as well as invoke the necessary meta_box
246
+ *
247
+ * @return void
248
+ * @author Jonathan Christopher
249
+ */
250
+
251
+ function attachments_init()
252
+ {
253
+ wp_enqueue_style('shadowbox', WP_PLUGIN_URL . '/attachments/lib/shadowbox/shadowbox.css');
254
+ wp_enqueue_style('attachments', WP_PLUGIN_URL . '/attachments/css/attachments.css');
255
+ wp_enqueue_script('shadowbox', WP_PLUGIN_URL . '/attachments/lib/shadowbox/shadowbox.js');
256
+ wp_enqueue_script('attachments', WP_PLUGIN_URL . '/attachments/js/attachments.js');
257
+
258
+ attachments_meta_box();
259
+ }
css/attachments.css ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ============ */
2
+ /* = META BOX = */
3
+ /* ============ */
4
+ #attachments-inner { padding-top:3px; }
5
+ ul#attachments-actions { overflow:hidden; zoom:1; padding-top:4px; }
6
+ ul#attachments-actions li { width:50%; float:left; }
7
+ li#attachments-add-new { float:right; text-align:right; }
8
+
9
+
10
+ /* ========================== */
11
+ /* = SHADOWBOX FILE LISTING = */
12
+ /* ========================== */
13
+ #attachments-file-list { padding:0 10px 15px 10px; background:#fff; }
14
+ .attachments-file-section { padding:0 0 20px 0; }
15
+ p.attachments-actions { padding:10px 0; }
16
+ #attachments-file-details ul { overflow:hidden; zoom:1; }
17
+ #attachments-file-details li { float:left; }
18
+ #attachments-file-details li { height:60px; margin:0 5px 10px 0; }
19
+ #attachments-file-details li img { display:block; }
20
+ #attachments-file-details li a { display:block; border:3px solid #fff; }
21
+ #attachments-file-details li a:hover { border:3px solid #ccc; }
22
+
23
+ #attachments-file-details li a.attachments-selected { border:3px solid #464646; }
24
+
25
+ /* File listings, not images */
26
+ #attachments-file-details .attachments-alt li { width:290px; }
27
+ #attachments-file-details .attachments-alt span.attachments-thumbnail { display:block; width:70px; float:left; }
28
+ #attachments-file-details .attachments-alt h2.attachments-title-display { display:block; width:220px; float:left; text-decoration:none; font:20px Georgia,"Times New Roman","Bitstream Charter",Times,serif; font-style:italic; font-weight:normal; height:2.4em; overflow:hidden; }
29
+
30
+ #attachments-file-details .attachments-alt li a { display:block; border:0; text-decoration:none; }
31
+ #attachments-file-details .attachments-alt li a.attachments-selected { border:0; }
32
+ #attachments-file-details .attachments-alt li a span.attachments-thumbnail img { border:3px solid #fff; }
33
+ #attachments-file-details .attachments-alt li a.attachments-selected span.attachments-thumbnail img { border:3px solid #464646; }
34
+
35
+
36
+ /* ========================= */
37
+ /* = META BOX FILE LISTING = */
38
+ /* ========================= */
39
+ #attachments-list ul { padding:10px 0; }
40
+ #attachments-list li.attachments-file { overflow:hidden; zoom:1; background:#fff; }
41
+ .attachments-data { display:none; }
42
+ #poststuff li.attachments-file h2 { margin:0; overflow:hidden; zoom:1; }
43
+ #poststuff li.attachments-file h2 a { text-decoration:none; color:inherit; }
44
+ #poststuff li.attachments-file h2 span { display:block; float:left; }
45
+ #poststuff li.attachments-file h2 a span.attachment-handle-icon { padding:9px 0 0 0; cursor:move; }
46
+ #poststuff li.attachments-file h2 span.attachment-name { padding:0 10px; height:2em; overflow:hidden; width:60%; }
47
+ #poststuff li.attachments-file h2 span.attachment-delete { width:60px; text-align:center; padding:0.7em 0 0 0; float:right; margin-right:3px; }
48
+ #poststuff li.attachments-file h2 span.attachment-delete a { font:11px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; color:#21759b; text-decoration:underline; }
49
+ #poststuff li.attachments-file h2 span.attachment-delete a:hover { color:#d54e21; }
50
+
51
+ #attachments-list .attachments-file { overflow:hidden; zoom:1; }
52
+ #attachments-list .attachments-fields { width:80%; float:left; }
53
+ #attachments-list .attachments-thumbnail { width:80px; float:right; text-align:right; padding-right:3px; }
54
+
55
+ .attachments-fields .textfield { overflow:hidden; zoom:1; padding-bottom:10px; }
56
+ .attachments-fields .textfield label { display:block; width:20%; float:left; padding-top:6px; }
57
+ .attachments-fields .textfield input { display:block; width:75%; float:left; }
images/handle.gif ADDED
Binary file
js/attachments.js ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function attachments_update() {
2
+ jQuery('div#attachments_file_list').html(attachments_media);
3
+ }
4
+
5
+ function init_attachments_sortable() {
6
+ jQuery('div#attachments-list ul').sortable({
7
+ containment: 'parent',
8
+ stop: function(e, ui) {
9
+ jQuery('#attachments-list ul li').each(function(i, id) {
10
+ jQuery(this).find('input.attachment_order').val(i+1);
11
+ });
12
+ }
13
+ });
14
+ }
15
+
16
+ jQuery(document).ready(function() {
17
+
18
+ // Hook our Browse button
19
+ jQuery('a.browse-attachments').click(function() {
20
+ jQuery.get(attachments_base + '/media.php', function(data) {
21
+ attachments_media = data;
22
+ Shadowbox.open({
23
+ title: 'Attachments',
24
+ player: 'html',
25
+ content: '<div id="attachments-file-list"><p>Available attachments are listed from your <strong>Media Library</strong>. If you need to upload a new attachment, please close this dialog and use the available <strong>Add New</strong> button.</p><p>Select an attachment by clicking its thumbnail. When you\'re done adding attachments, click <strong>Apply</strong></p><p class="attachments-actions"><a href="#" class="attachments-apply button button-highlighted">Apply</a></p><div id="attachments-file-details">' + data + '</div><p class="attachments-actions"><a href="#" class="attachments-apply button button-highlighted">Apply</a></p></div>',
26
+ width:640,
27
+ height:444
28
+ });
29
+ });
30
+ return false;
31
+ });
32
+
33
+
34
+ // If there are no attachments, let's hide this thing...
35
+ if(jQuery('div#attachments-list li').length == 0) {
36
+ jQuery('#attachments-list').hide();
37
+ }
38
+ else
39
+ {
40
+ init_attachments_sortable();
41
+ }
42
+
43
+
44
+ // Keep track of our browse dialog selections
45
+ jQuery('#attachments-file-details li a').live('click', function() {
46
+ jQuery(this).toggleClass('attachments-selected');
47
+ return false;
48
+ });
49
+
50
+
51
+ // Hook our delete links
52
+ jQuery('span.attachment-delete a').live('click', function() {
53
+ attachment_parent = jQuery(this).parent().parent().parent();
54
+ attachment_parent.slideUp(function() {
55
+ attachment_parent.remove();
56
+ jQuery('#attachments-list ul li').each(function(i, id) {
57
+ jQuery(this).find('input.attachment_order').val(i+1);
58
+ });
59
+ if(jQuery('div#attachments-list li').length == 0) {
60
+ jQuery('#attachments-list').slideUp(function() {
61
+ jQuery('#attachments-list').hide();
62
+ });
63
+ }
64
+ });
65
+ return false;
66
+ });
67
+
68
+
69
+ // Hook the all important Apply button
70
+ jQuery('a.attachments-apply').live('click', function() {
71
+ attachment_index = jQuery('li.attachments-file').length;
72
+ new_attachments = '';
73
+ jQuery('a.attachments-selected').each(function() {
74
+
75
+ attachment_name = jQuery(this).find('span.attachment-file-name').text();
76
+ attachment_location = jQuery(this).find('span.attachment-file-location').text();
77
+ attachment_id = jQuery(this).find('span.attachment-file-id').text();
78
+ attachment_thumbnail = jQuery(this).find('span.attachments-thumbnail').html();
79
+
80
+ attachment_index++;
81
+ new_attachments += '<li class="attachments-file">';
82
+ new_attachments += '<h2><a href="#" class="attachment-handle"><span class="attachment-handle-icon"><img src="' + attachments_base + '/images/handle.gif" alt="Drag" /></span></a><span class="attachment-name">' + attachment_name + '</span><span class="attachment-delete"><a href="#">Delete</a></span></h2>';
83
+ new_attachments += '<div class="attachments-fields">';
84
+ new_attachments += '<div class="textfield" id="field_attachment_title_' + attachment_index + '"><label for="attachment_title_' + attachment_index + '">Title</label><input type="text" id="attachment_title_' + attachment_index + '" name="attachment_title_' + attachment_index + '" value="" size="20" /></div>';
85
+ new_attachments += '<div class="textfield" id="field_attachment_caption_' + attachment_index + '"><label for="attachment_caption_' + attachment_index + '">Caption</label><input type="text" id="attachment_caption_' + attachment_index + '" name="attachment_caption_' + attachment_index + '" value="" size="20" /></div>';
86
+ new_attachments += '</div>';
87
+ new_attachments += '<div class="attachments-data">';
88
+ new_attachments += '<input type="hidden" name="attachment_name_' + attachment_index + '" id="attachment_name_' + attachment_index + '" value="' + attachment_name + '" />';
89
+ new_attachments += '<input type="hidden" name="attachment_location_' + attachment_index + '" id="attachment_location_' + attachment_index + '" value="' + attachment_location + '" />';
90
+ new_attachments += '<input type="hidden" name="attachment_id_' + attachment_index + '" id="attachment_id_' + attachment_index + '" value="' + attachment_id + '" />';
91
+ new_attachments += '<input type="hidden" class="attachment_order" name="attachment_order_' + attachment_index + '" id="attachment_order_' + attachment_index + '" value="' + attachment_index + '" />';
92
+ new_attachments += '</div>';
93
+ new_attachments += '<div class="attachment-thumbnail"><span class="attachments-thumbnail">';
94
+ new_attachments += attachment_thumbnail;
95
+ new_attachments += '</span></div>';
96
+ new_attachments += '</li>';
97
+ });
98
+ jQuery('div#attachments-list ul').append(new_attachments);
99
+ Shadowbox.close();
100
+
101
+ if(jQuery('#attachments-list li').length > 0) {
102
+
103
+ // We've got some attachments
104
+ jQuery('#attachments-list').show();
105
+
106
+ // Cleanup
107
+ jQuery('div#attachments-list ul').sortable('destroy');
108
+
109
+ // Init sortable
110
+ init_attachments_sortable();
111
+
112
+ }
113
+ });
114
+
115
+ });
lib/shadowbox/BUILD ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ This is a custom build of Shadowbox version 3.0b that contains only a
2
+ subset of the features available. It was compiled using the build tool at
3
+ <http://shadowbox-js.com/download.html>. This particular build includes support
4
+ for the following:
5
+
6
+ adapter: jquery
7
+ language: en
8
+ players: html, iframe, img
9
+
10
+ The code was compressed using YUI Compressor <http://developer.yahoo.com/yui/compressor/>.
11
+ Support for CSS selectors is also included via Sizzle.js <http://sizzlejs.com/>.
lib/shadowbox/LICENSE ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright 2007-2009 Michael J. I. Jackson
2
+ http://mjijackson.com
3
+ All rights reserved.
4
+
5
+ Shadowbox.js License version 1.0
6
+
7
+ This license is applicable to version 3.0 of the code and greater until superseded
8
+ by a later version.
9
+
10
+ Shadowbox.js is available for use under the terms of two separate, yet similar
11
+ licenses. The first of these may be exercised by individuals and organizations
12
+ who employ the software for non-commercial uses. This license grants the licensee
13
+ the following privileges:
14
+
15
+ - Use
16
+
17
+ The software, including code, images, and documentation may be used in a web
18
+ site or application that is not used for commercial purposes.
19
+
20
+ - Modification
21
+
22
+ The software, including code, images, and documentation may be modified by the
23
+ user to suit his purpose.
24
+
25
+ The second type of license may be obtained for a fee from the copyright holder and
26
+ removes the non-commercial restriction from the terms of use. This commercial
27
+ license may be obtained for one developer or multiple developers in the same
28
+ organization or company.
29
+
30
+ Under neither license is the licensee permitted to redistribute the source code,
31
+ images, or documentation contained in this project. All redistribution rights
32
+ remain with the copyright holder unless specific prior written permission is
33
+ obtained.
34
+
35
+ Under no circumstance shall this copyright notice or list of conditions be
36
+ modified or removed from the code distribution in either source or binary form.
37
+
38
+ This software is provided by the copyright holder and contributors "as is" and
39
+ any express or implied warranties, including, but not limited to, the implied
40
+ warranties of merchantability and fitness for a particular purpose are disclaimed.
41
+
42
+ In no event shall the copyright holder or contributors be liable for any direct,
43
+ indirect, incidental, special, exemplary, or consequential damages (including, but
44
+ not limited to, procurement of substitute goods or services; loss of use, data, or
45
+ profits; or business interruption) however caused and on any theory of liability,
46
+ whether in contract, strict liability, or tort (including negligence or otherwise)
47
+ arising in any way out of the use of this software, even if advised of the
48
+ possibility of such damage.
lib/shadowbox/README ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Shadowbox.js Readme
2
+
3
+ Shadowbox is an online media viewing application that supports all of the web's
4
+ most popular media publishing formats. Shadowbox is written entirely in
5
+ JavaScript and CSS and is highly customizable. Using Shadowbox, website authors
6
+ can display a wide assortment of media in all major browsers without navigating
7
+ users away from the linking page.
8
+
9
+ You should have received a license with this distribution explaining the terms
10
+ under which Shadowbox may be used. If you did not, you may obtain a copy of the
11
+ license at http://shadowbox-js.com/LICENSE
12
+
13
+ Author: Michael J. I. Jackson <michael@mjijackson.com>
14
+ Copyright: 2007-2009 Michael J. I. Jackson
15
+
16
+ For more information, please see the Shadowbox website at http://shadowbox-js.com/.
lib/shadowbox/libraries/sizzle/LICENSE ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sizzle is released under three licenses: MIT, BSD, and GPL. You may pick the license that best suits your development needs. The text of all three licenses are provided below.
2
+
3
+ MIT License
4
+ ----
5
+
6
+ Copyright (c) 2009 John Resig
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ BSD License
27
+ ----
28
+
29
+ Copyright (c) 2009, John Resig
30
+ All rights reserved.
31
+
32
+ Redistribution and use in source and binary forms, with or without
33
+ modification, are permitted provided that the following conditions are met:
34
+ * Redistributions of source code must retain the above copyright
35
+ notice, this list of conditions and the following disclaimer.
36
+ * Redistributions in binary form must reproduce the above copyright
37
+ notice, this list of conditions and the following disclaimer in the
38
+ documentation and/or other materials provided with the distribution.
39
+ * Neither the name of the <organization> nor the
40
+ names of its contributors may be used to endorse or promote products
41
+ derived from this software without specific prior written permission.
42
+
43
+ THIS SOFTWARE IS PROVIDED BY John Resig ''AS IS'' AND ANY
44
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
45
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
46
+ DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
47
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
48
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
50
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
52
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53
+
54
+ GPL License
55
+ ----
56
+
57
+ The GNU General Public License (GPL)
58
+ Version 2, June 1991
59
+
60
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
61
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
62
+
63
+ Everyone is permitted to copy and distribute verbatim copies
64
+ of this license document, but changing it is not allowed.
65
+
66
+ Preamble
67
+
68
+ The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
69
+
70
+ When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
71
+
72
+ To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
73
+
74
+ For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
75
+
76
+ We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
77
+
78
+ Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
79
+
80
+ Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
81
+
82
+ The precise terms and conditions for copying, distribution and modification follow.
83
+
84
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
85
+
86
+ 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
87
+
88
+ Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
89
+
90
+ 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
91
+
92
+ You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
93
+
94
+ 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
95
+
96
+ a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
99
+
100
+ c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
101
+
102
+ These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
103
+
104
+ Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
105
+
106
+ In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
107
+
108
+ 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
109
+
110
+ a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
111
+
112
+ b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
113
+
114
+ c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
115
+
116
+ The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
117
+
118
+ If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
119
+
120
+ 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
121
+
122
+ 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
123
+
124
+ 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
125
+
126
+ 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
127
+
128
+ If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
129
+
130
+ It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
131
+
132
+ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
133
+
134
+ 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
135
+
136
+ 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
137
+
138
+ Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
139
+
140
+ 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
141
+
142
+ NO WARRANTY
143
+
144
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
145
+
146
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
147
+
148
+ END OF TERMS AND CONDITIONS
lib/shadowbox/libraries/sizzle/sizzle.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*
2
+ * Sizzle CSS Selector Engine - v1.0
3
+ * Copyright 2009, The Dojo Foundation
4
+ * Released under the MIT, BSD, and GPL Licenses.
5
+ * More information: http://sizzlejs.com/
6
+ */
7
+ (function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.selectNode(t);s.collapse(true);e.selectNode(r);e.collapse(true);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.Sizzle=b})();
lib/shadowbox/resources/close.png ADDED
Binary file
lib/shadowbox/resources/next.png ADDED
Binary file
lib/shadowbox/resources/pause.png ADDED
Binary file
lib/shadowbox/resources/play.png ADDED
Binary file
lib/shadowbox/resources/previous.png ADDED
Binary file
lib/shadowbox/shadowbox.css ADDED
@@ -0,0 +1 @@
 
1
+ #sb-container,#sb-wrapper{text-align:left;}#sb-container,#sb-overlay{position:absolute;top:0;left:0;width:100%;margin:0;padding:0;}#sb-container{height:100%;display:none;visibility:hidden;z-index:999;}body>#sb-container{position:fixed;}#sb-overlay{height:expression(document.documentElement.clientHeight+'px');}#sb-container>#sb-overlay{height:100%;}#sb-wrapper{position:relative;}#sb-wrapper img{border:none;}#sb-body{position:relative;margin:0;padding:0;overflow:hidden;border:1px solid #303030;}#sb-body-inner{position:relative;height:100%;}#sb-content.html{height:100%;overflow:auto;}#sb-loading{position:absolute;top:0;width:100%;height:100%;text-align:center;padding-top:10px;}#sb-body,#sb-loading{background-color:#fff;}#sb-title,#sb-info{position:relative;margin:0;padding:0;overflow:hidden;}#sb-title-inner,#sb-info-inner{position:relative;font-family:'Lucida Grande',Tahoma,sans-serif;line-height:16px;}#sb-title,#sb-title-inner{height:26px;}#sb-title-inner{font-size:16px;padding:5px 0;color:#fff;}#sb-info,#sb-info-inner{height:20px;}#sb-info-inner{font-size:12px;color:#fff;}#sb-nav{float:right;height:16px;padding:2px 0;width:45%;}#sb-nav a{display:block;float:right;height:16px;width:16px;margin-left:3px;cursor:pointer;}#sb-nav-close{background-image:url(resources/close.png);background-repeat:no-repeat;}#sb-nav-next{background-image:url(resources/next.png);background-repeat:no-repeat;}#sb-nav-previous{background-image:url(resources/previous.png);background-repeat:no-repeat;}#sb-nav-play{background-image:url(resources/play.png);background-repeat:no-repeat;}#sb-nav-pause{background-image:url(resources/pause.png);background-repeat:no-repeat;}#sb-counter{float:left;padding:2px 0;width:45%;}#sb-counter a{padding:0 4px 0 0;text-decoration:none;cursor:pointer;color:#fff;}#sb-counter a.sb-counter-current{text-decoration:underline;}div.sb-message{font-family:'Lucida Grande',Tahoma,sans-serif;font-size:12px;padding:10px;text-align:center;}div.sb-message a:link,div.sb-message a:visited{color:#fff;text-decoration:underline;}
lib/shadowbox/shadowbox.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(){var ua=navigator.userAgent.toLowerCase(),S={version:"3.0b",adapter:null,cache:[],client:{isIE:ua.indexOf("msie")>-1,isIE6:ua.indexOf("msie 6")>-1,isIE7:ua.indexOf("msie 7")>-1,isGecko:ua.indexOf("gecko")>-1&&ua.indexOf("safari")==-1,isWebkit:ua.indexOf("applewebkit/")>-1,isWindows:ua.indexOf("windows")>-1||ua.indexOf("win32")>-1,isMac:ua.indexOf("macintosh")>-1||ua.indexOf("mac os x")>-1,isLinux:ua.indexOf("linux")>-1},content:null,current:-1,dimensions:null,gallery:[],expando:"shadowboxCacheKey",libraries:{Prototype:"prototype",jQuery:"jquery",MooTools:"mootools",YAHOO:"yui",dojo:"dojo",Ext:"ext"},options:{adapter:null,animate:true,animateFade:true,autoplayMovies:true,continuous:false,ease:function(x){return 1+Math.pow(x-1,3)},enableKeys:true,errors:{fla:{name:"Flash",url:"http://www.adobe.com/products/flashplayer/"},qt:{name:"QuickTime",url:"http://www.apple.com/quicktime/download/"},wmp:{name:"Windows Media Player",url:"http://www.microsoft.com/windows/windowsmedia/"},f4m:{name:"Flip4Mac",url:"http://www.flip4mac.com/wmv_download.htm"}},ext:{img:["png","jpg","jpeg","gif","bmp"],swf:["swf"],flv:["flv","m4v"],qt:["dv","mov","moov","movie","mp4"],wmp:["asf","wm","wmv"],qtwmp:["avi","mpg","mpeg"]},flashParams:{bgcolor:"#000000",allowfullscreen:true},flashVars:{},flashVersion:"9.0.115",handleOversize:"resize",handleUnsupported:"link",language:"en",onChange:null,onClose:null,onFinish:null,onOpen:null,players:["img"],showMovieControls:true,skipSetup:false,slideshowDelay:0,useSizzle:true,viewportPadding:20},path:"",plugins:null,ready:false,regex:{domain:/:\/\/(.*?)[:\/]/,inline:/#(.+)$/,rel:/^(light|shadow)box/i,gallery:/^(light|shadow)box\[(.*?)\]/i,unsupported:/^unsupported-(\w+)/,param:/\s*([a-z_]*?)\s*=\s*(.+)\s*/},applyOptions:function(opts){if(opts){default_options=apply({},S.options);apply(S.options,opts)}},revertOptions:function(){apply(S.options,default_options)},change:function(index){if(!S.gallery){return}if(!S.gallery[index]){if(!S.options.continuous){return}else{index=index<0?S.gallery.length-1:0}}S.current=index;if(typeof slide_timer=="number"){clearTimeout(slide_timer);slide_timer=null;slide_delay=slide_start=0}if(S.options.onChange){S.options.onChange()}loadContent()},close:function(){if(!active){return}active=false;listenKeys(false);if(S.content){S.content.remove();S.content=null}if(typeof slide_timer=="number"){clearTimeout(slide_timer)}slide_timer=null;slide_delay=0;if(S.options.onClose){S.options.onClose()}S.skin.onClose();S.revertOptions()},contentId:function(){return content_id},error:function(msg){if(!S.debug){return}if(typeof window.console!="undefined"&&typeof console.log=="function"){console.log(msg)}else{alert(msg)}},getCurrent:function(){return S.current>-1?S.gallery[S.current]:null},hasNext:function(){return S.gallery.length>1&&(S.current!=S.gallery.length-1||S.options.continuous)},init:function(opts){if(initialized){return}initialized=true;opts=opts||{};init_options=opts;if(opts){apply(S.options,opts)}for(var e in S.options.ext){S.regex[e]=new RegExp(".("+S.options.ext[e].join("|")+")s*$","i")}if(!S.path){var pathre=/(.+\/)shadowbox\.js/i,path;each(document.getElementsByTagName("script"),function(s){path=pathre.exec(s.src);if(path){S.path=path[1];return false}})}if(S.options.adapter){S.adapter=S.options.adapter.toLowerCase()}else{for(var lib in S.libraries){if(typeof window[lib]!="undefined"){S.adapter=S.libraries[lib];break}}if(!S.adapter){S.adapter="base"}}if(S.options.useSizzle&&!window.Sizzle){if(window.jQuery){window.Sizzle=jQuery.find}else{U.include(S.path+"libraries/sizzle/sizzle.js")}}if(!S.lang){U.include(S.path+"languages/shadowbox-"+S.options.language+".js")}each(S.options.players,function(p){if((p=="swf"||p=="flv")&&!window.swfobject){U.include(S.path+"libraries/swfobject/swfobject.js")}if(!S[p]){U.include(S.path+"players/shadowbox-"+p+".js")}});if(!S.lib){U.include(S.path+"adapters/shadowbox-"+S.adapter+".js")}waitDom(waitLibs)},isActive:function(){return active},isPaused:function(){return slide_timer=="paused"},load:function(){if(S.ready){return}S.ready=true;if(S.skin.options){apply(S.options,S.skin.options);apply(S.options,init_options)}S.skin.init();if(!S.options.skipSetup){S.setup()}},next:function(){S.change(S.current+1)},open:function(obj){if(U.isLink(obj)){if(S.inCache(obj)){obj=S.cache[obj[S.expando]]}else{obj=S.buildCacheObj(obj)}}if(obj.constructor==Array){S.gallery=obj;S.current=0}else{if(!obj.gallery){S.gallery=[obj];S.current=0}else{S.current=null;S.gallery=[];each(S.cache,function(c){if(c.gallery&&c.gallery==obj.gallery){if(S.current==null&&c.content==obj.content&&c.title==obj.title){S.current=S.gallery.length}S.gallery.push(c)}});if(S.current==null){S.gallery.unshift(obj);S.current=0}}}obj=S.getCurrent();if(obj.options){S.revertOptions();S.applyOptions(obj.options)}var item,remove,m,format,replace,oe=S.options.errors,msg,el;for(var i=0;i<S.gallery.length;++i){item=S.gallery[i]=apply({},S.gallery[i]);remove=false;if(m=S.regex.unsupported.exec(item.player)){if(S.options.handleUnsupported=="link"){item.player="html";switch(m[1]){case"qtwmp":format="either";replace=[oe.qt.url,oe.qt.name,oe.wmp.url,oe.wmp.name];break;case"qtf4m":format="shared";replace=[oe.qt.url,oe.qt.name,oe.f4m.url,oe.f4m.name];break;default:format="single";if(m[1]=="swf"||m[1]=="flv"){m[1]="fla"}replace=[oe[m[1]].url,oe[m[1]].name]}msg=S.lang.errors[format].replace(/\{(\d+)\}/g,function(m,n){return replace[n]});item.content='<div class="sb-message">'+msg+"</div>"}else{remove=true}}else{if(item.player=="inline"){m=S.regex.inline.exec(item.content);if(m){var el=U.get(m[1]);if(el){item.content=el.innerHTML}else{S.error("Cannot find element with id "+m[1])}}else{S.error("Cannot find element id for inline content")}}else{if(item.player=="swf"||item.player=="flv"){var version=(item.options&&item.options.flashVersion)||S.options.flashVersion;if(!swfobject.hasFlashPlayerVersion(version)){item.width=310;item.height=177}}}}if(remove){S.gallery.splice(i,1);if(i<S.current){--S.current}else{if(i==S.current){S.current=i>0?i-1:i}}--i}}if(S.gallery.length){if(!active){if(typeof S.options.onOpen=="function"&&S.options.onOpen(obj)===false){return}S.skin.onOpen(obj,loadContent)}else{loadContent()}active=true}},pause:function(){if(typeof slide_timer!="number"){return}var time=new Date().getTime();slide_delay=Math.max(0,slide_delay-(time-slide_start));if(slide_delay){clearTimeout(slide_timer);slide_timer="paused";if(S.skin.onPause){S.skin.onPause()}}},play:function(){if(!S.hasNext()){return}if(!slide_delay){slide_delay=S.options.slideshowDelay*1000}if(slide_delay){slide_start=new Date().getTime();slide_timer=setTimeout(function(){slide_delay=slide_start=0;S.next()},slide_delay);if(S.skin.onPlay){S.skin.onPlay()}}},previous:function(){S.change(S.current-1)},setDimensions:function(height,width,max_h,max_w,tb,lr,resizable){var h=height=parseInt(height),w=width=parseInt(width),pad=parseInt(S.options.viewportPadding)||0;var extra_h=2*pad+tb;if(h+extra_h>=max_h){h=max_h-extra_h}var extra_w=2*pad+lr;if(w+extra_w>=max_w){w=max_w-extra_w}var resize_h=height,resize_w=width,change_h=(height-h)/height,change_w=(width-w)/width,oversized=(change_h>0||change_w>0);if(resizable&&oversized&&S.options.handleOversize=="resize"){if(change_h>change_w){w=Math.round((width/height)*h)}else{if(change_w>change_h){h=Math.round((height/width)*w)}}resize_w=w;resize_h=h}S.dimensions={height:h+tb,width:w+lr,inner_h:h,inner_w:w,top:(max_h-(h+extra_h))/2+pad,left:(max_w-(w+extra_w))/2+pad,oversized:oversized,resize_h:resize_h,resize_w:resize_w}},setup:function(links,opts){each(S.findLinks(links),function(link){S.addCache(link,opts)})},teardown:function(links){each(S.findLinks(links),S.removeCache)},findLinks:function(links){if(!links){var links=[],rel;each(document.getElementsByTagName("a"),function(a){rel=a.getAttribute("rel");if(rel&&S.regex.rel.test(rel)){links.push(a)}})}else{var len=links.length;if(len){if(window.Sizzle){if(typeof links=="string"){links=Sizzle(links)}else{if(len==2&&links.push&&typeof links[0]=="string"&&links[1].nodeType){links=Sizzle(links[0],links[1])}}}}else{links=[links]}}return links},inCache:function(link){return typeof link[S.expando]=="number"&&S.cache[link[S.expando]]},addCache:function(link,opts){if(!S.inCache(link)){link[S.expando]=S.cache.length;S.lib.addEvent(link,"click",handleClick)}S.cache[link[S.expando]]=S.buildCacheObj(link,opts)},removeCache:function(link){S.lib.removeEvent(link,"click",handleClick);S.cache[link[S.expando]]=null;delete link[S.expando]},clearCache:function(){each(S.cache,function(obj){S.removeCache(obj.link)});S.cache=[]},buildCacheObj:function(link,opts){var obj={link:link,title:link.getAttribute("title"),options:apply({},opts||{}),content:link.href};if(opts){each(["player","title","height","width","gallery"],function(option){if(typeof obj.options[option]!="undefined"){obj[option]=obj.options[option];delete obj.options[option]}})}if(!obj.player){obj.player=S.getPlayer(obj.content)}var rel=link.getAttribute("rel");if(rel){var match=rel.match(S.regex.gallery);if(match){obj.gallery=escape(match[2])}each(rel.split(";"),function(parameter){match=parameter.match(S.regex.param);if(match){if(match[1]=="options"){eval("apply(obj.options,"+match[2]+")")}else{obj[match[1]]=match[2]}}})}return obj},getPlayer:function(content){var r=S.regex,p=S.plugins,m=content.match(r.domain),same_domain=m&&document.domain==m[1];if(content.indexOf("#")>-1&&same_domain){return"inline"}var q=content.indexOf("?");if(q>-1){content=content.substring(0,q)}if(r.img.test(content)){return"img"}if(r.swf.test(content)){return p.fla?"swf":"unsupported-swf"}if(r.flv.test(content)){return p.fla?"flv":"unsupported-flv"}if(r.qt.test(content)){return p.qt?"qt":"unsupported-qt"}if(r.wmp.test(content)){if(p.wmp){return"wmp"}if(p.f4m){return"qt"}if(S.client.isMac){return p.qt?"unsupported-f4m":"unsupported-qtf4m"}return"unsupported-wmp"}if(r.qtwmp.test(content)){if(p.qt){return"qt"}if(p.wmp){return"wmp"}return S.client.isMac?"unsupported-qt":"unsupported-qtwmp"}return"iframe"}},U=S.util={animate:function(el,p,to,d,cb){var from=parseFloat(S.lib.getStyle(el,p));if(isNaN(from)){from=0}var delta=to-from;if(delta==0){if(cb){cb()}return}var op=p=="opacity";function fn(ease){var to=from+ease*delta;if(op){U.setOpacity(el,to)}else{el.style[p]=to+"px"}}if(!d||(!op&&!S.options.animate)||(op&&!S.options.animateFade)){fn(1);if(cb){cb()}return}d*=1000;var begin=new Date().getTime(),ease=S.options.ease,end=begin+d,time,timer=setInterval(function(){time=new Date().getTime();if(time>=end){clearInterval(timer);fn(1);if(cb){cb()}}else{fn(ease((time-begin)/d))}},10)},apply:function(o,e){for(var p in e){o[p]=e[p]}return o},clearOpacity:function(el){var s=el.style;if(window.ActiveXObject){if(typeof s.filter=="string"&&(/alpha/i).test(s.filter)){s.filter=s.filter.replace(/[\w\.]*alpha\(.*?\);?/i,"")}}else{s.opacity=""}},each:function(obj,fn,scope){for(var i=0,len=obj.length;i<len;++i){if(fn.call(scope||obj[i],obj[i],i,obj)===false){return}}},get:function(id){return document.getElementById(id)},include:function(){var includes={};return function(file){if(includes[file]){return}includes[file]=true;var head=document.getElementsByTagName("head")[0],script=document.createElement("script");script.src=file;head.appendChild(script)}}(),isLink:function(obj){if(!obj||!obj.tagName){return false}var up=obj.tagName.toUpperCase();return up=="A"||up=="AREA"},removeChildren:function(el){while(el.firstChild){el.removeChild(el.firstChild)}},setOpacity:function(el,o){var s=el.style;if(window.ActiveXObject){s.zoom=1;s.filter=(s.filter||"").replace(/\s*alpha\([^\)]*\)/gi,"")+(o==1?"":" alpha(opacity="+(o*100)+")")}else{s.opacity=o}}},apply=U.apply,each=U.each,init_options,initialized=false,default_options={},content_id="sb-content",active=false,slide_timer,slide_start,slide_delay=0;if(navigator.plugins&&navigator.plugins.length){var names=[];each(navigator.plugins,function(p){names.push(p.name)});names=names.join();var f4m=names.indexOf("Flip4Mac")>-1;S.plugins={fla:names.indexOf("Shockwave Flash")>-1,qt:names.indexOf("QuickTime")>-1,wmp:!f4m&&names.indexOf("Windows Media")>-1,f4m:f4m}}else{function detectPlugin(n){try{var axo=new ActiveXObject(n)}catch(e){}return !!axo}S.plugins={fla:detectPlugin("ShockwaveFlash.ShockwaveFlash"),qt:detectPlugin("QuickTime.QuickTime"),wmp:detectPlugin("wmplayer.ocx"),f4m:false}}function waitDom(cb){if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);cb()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);cb()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(S.ready){return}try{document.documentElement.doScroll("left")}catch(error){setTimeout(arguments.callee,0);return}cb()})()}}}if(typeof window.onload=="function"){var oldonload=window.onload;window.onload=function(){oldonload();cb()}}else{window.onload=cb}}function waitLibs(){if(S.lib&&S.lang){S.load()}else{setTimeout(waitLibs,0)}}function handleClick(e){var link;if(U.isLink(this)){link=this}else{link=S.lib.getTarget(e);while(!U.isLink(link)&&link.parentNode){link=link.parentNode}}S.lib.preventDefault(e);if(link){S.open(link);if(S.gallery.length){S.lib.preventDefault(e)}}}function listenKeys(on){if(!S.options.enableKeys){return}S.lib[(on?"add":"remove")+"Event"](document,"keydown",handleKey)}function handleKey(e){var code=S.lib.keyCode(e),handler;switch(code){case 81:case 88:case 27:handler=S.close;break;case 37:handler=S.previous;break;case 39:handler=S.next;break;case 32:handler=typeof slide_timer=="number"?S.pause:S.play}if(handler){S.lib.preventDefault(e);handler()}}function loadContent(){var obj=S.getCurrent();if(!obj){return}var p=obj.player=="inline"?"html":obj.player;if(typeof S[p]!="function"){S.error("Unknown player: "+p)}var change=false;if(S.content){S.content.remove();change=true;S.revertOptions();if(obj.options){S.applyOptions(obj.options)}}U.removeChildren(S.skin.bodyEl());S.content=new S[p](obj);listenKeys(false);S.skin.onLoad(S.content,change,function(){if(!S.content){return}if(typeof S.content.ready!="undefined"){var id=setInterval(function(){if(S.content){if(S.content.ready){clearInterval(id);id=null;S.skin.onReady(contentReady)}}else{clearInterval(id);id=null}},100)}else{S.skin.onReady(contentReady)}});if(S.gallery.length>1){var next=S.gallery[S.current+1]||S.gallery[0];if(next.player=="img"){var a=new Image();a.src=next.content}var prev=S.gallery[S.current-1]||S.gallery[S.gallery.length-1];if(prev.player=="img"){var b=new Image();b.src=prev.content}}}function contentReady(){if(!S.content){return}S.content.append(S.skin.bodyEl(),content_id,S.dimensions);S.skin.onFinish(finishContent)}function finishContent(){if(!S.content){return}if(S.content.onLoad){S.content.onLoad()}if(S.options.onFinish){S.options.onFinish()}if(!S.isPaused()){S.play()}listenKeys(true)}window.Shadowbox=S})();(function(){var g=Shadowbox,f=g.util,q=false,b=[],m=["sb-nav-close","sb-nav-next","sb-nav-play","sb-nav-pause","sb-nav-previous"],o={markup:'<div id="sb-container"><div id="sb-overlay"></div><div id="sb-wrapper"><div id="sb-title"><div id="sb-title-inner"></div></div><div id="sb-body"><div id="sb-body-inner"></div><div id="sb-loading"><a onclick="Shadowbox.close()">{cancel}</a></div></div><div id="sb-info"><div id="sb-info-inner"><div id="sb-counter"></div><div id="sb-nav"><a id="sb-nav-close" title="{close}" onclick="Shadowbox.close()"></a><a id="sb-nav-next" title="{next}" onclick="Shadowbox.next()"></a><a id="sb-nav-play" title="{play}" onclick="Shadowbox.play()"></a><a id="sb-nav-pause" title="{pause}" onclick="Shadowbox.pause()"></a><a id="sb-nav-previous" title="{previous}" onclick="Shadowbox.previous()"></a></div><div style="clear:both"></div></div></div></div></div>',options:{animSequence:"sync",autoDimensions:false,counterLimit:10,counterType:"default",displayCounter:true,displayNav:true,fadeDuration:0.35,initialHeight:160,initialWidth:320,modal:false,overlayColor:"#000",overlayOpacity:0.8,resizeDuration:0.35,showOverlay:true,troubleElements:["select","object","embed","canvas"]},init:function(){var s=o.markup.replace(/\{(\w+)\}/g,function(w,x){return g.lang[x]});g.lib.append(document.body,s);if(g.client.isIE6){f.get("sb-body").style.zoom=1;var u,r,t=/url\("(.*\.png)"\)/;f.each(m,function(w){u=f.get(w);if(u){r=g.lib.getStyle(u,"backgroundImage").match(t);if(r){u.style.backgroundImage="none";u.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src="+r[1]+",sizingMethod=scale);"}}})}var v;g.lib.addEvent(window,"resize",function(){if(v){clearTimeout(v);v=null}if(g.isActive()){v=setTimeout(function(){o.onWindowResize();var w=g.content;if(w&&w.onWindowResize){w.onWindowResize()}},50)}})},bodyEl:function(){return f.get("sb-body-inner")},onOpen:function(u,r){e(false);var t=g.options.autoDimensions&&"height" in u?u.height:g.options.initialHeight,s=g.options.autoDimensions&&"width" in u?u.width:g.options.initialWidth;f.get("sb-container").style.display="block";var v=p(t,s);d(v.inner_h,v.top,false);h(v.width,v.left,false);i(r)},onLoad:function(s,t,r){k(true);j(t,function(){if(!s){return}if(!t){f.get("sb-wrapper").style.display=""}r()})},onReady:function(r){var t=g.content;if(!t){return}var s=p(t.height,t.width,t.resizable);o.resizeContent(s.inner_h,s.width,s.top,s.left,true,function(){l(r)})},onFinish:function(r){k(false,r)},onClose:function(){i();e(true)},onPlay:function(){c("play",false);c("pause",true)},onPause:function(){c("pause",false);c("play",true)},onWindowResize:function(){var t=g.content;if(!t){return}var s=p(t.height,t.width,t.resizable);h(s.width,s.left,false);d(s.inner_h,s.top,false);var r=f.get(g.contentId());if(r){if(t.resizable&&g.options.handleOversize=="resize"){r.height=s.resize_h;r.width=s.resize_w}}},resizeContent:function(s,t,w,v,u,r){var y=g.content;if(!y){return}var x=p(y.height,y.width,y.resizable);switch(g.options.animSequence){case"hw":d(x.inner_h,x.top,u,function(){h(x.width,x.left,u,r)});break;case"wh":h(x.width,x.left,u,function(){d(x.inner_h,x.top,u,r)});break;default:h(x.width,x.left,u);d(x.inner_h,x.top,u,r)}}};function n(){f.get("sb-container").style.top=document.documentElement.scrollTop+"px"}function e(r){if(r){f.each(b,function(s){s[0].style.visibility=s[1]||""})}else{b=[];f.each(g.options.troubleElements,function(s){f.each(document.getElementsByTagName(s),function(t){b.push([t,t.style.visibility]);t.style.visibility="hidden"})})}}function i(r){var s=f.get("sb-overlay"),t=f.get("sb-container"),v=f.get("sb-wrapper");if(r){if(g.client.isIE6){n();g.lib.addEvent(window,"scroll",n)}if(g.options.showOverlay){q=true;s.style.backgroundColor=g.options.overlayColor;f.setOpacity(s,0);if(!g.options.modal){g.lib.addEvent(s,"click",g.close)}v.style.display="none"}t.style.visibility="visible";if(q){var u=parseFloat(g.options.overlayOpacity);f.animate(s,"opacity",u,g.options.fadeDuration,r)}else{r()}}else{if(g.client.isIE6){g.lib.removeEvent(window,"scroll",n)}g.lib.removeEvent(s,"click",g.close);if(q){v.style.display="none";f.animate(s,"opacity",0,g.options.fadeDuration,function(){t.style.display="";v.style.display="";f.clearOpacity(s)})}else{t.style.visibility="hidden"}}}function c(t,r){var s=f.get("sb-nav-"+t);if(s){s.style.display=r?"":"none"}}function k(s,r){var u=f.get("sb-loading"),w=g.getCurrent().player,v=(w=="img"||w=="html");if(s){function t(){f.clearOpacity(u);if(r){r()}}f.setOpacity(u,0);u.style.display="";if(v){f.animate(u,"opacity",1,g.options.fadeDuration,t)}else{t()}}else{function t(){u.style.display="none";f.clearOpacity(u);if(r){r()}}if(v){f.animate(u,"opacity",0,g.options.fadeDuration,t)}else{t()}}}function a(u){var z=g.getCurrent();f.get("sb-title-inner").innerHTML=z.title||"";var C,t,x,D,s;if(g.options.displayNav){C=true;var B=g.gallery.length;if(B>1){if(g.options.continuous){t=s=true}else{t=(B-1)>g.current;s=g.current>0}}if(g.options.slideshowDelay>0&&g.hasNext()){D=!g.isPaused();x=!D}}else{C=t=x=D=s=false}c("close",C);c("next",t);c("play",x);c("pause",D);c("previous",s);var r="";if(g.options.displayCounter&&g.gallery.length>1){var B=g.gallery.length;if(g.options.counterType=="skip"){var y=0,w=B,v=parseInt(g.options.counterLimit)||0;if(v<B&&v>2){var A=Math.floor(v/2);y=g.current-A;if(y<0){y+=B}w=g.current+(v-A);if(w>B){w-=B}}while(y!=w){if(y==B){y=0}r+='<a onclick="Shadowbox.change('+y+');"';if(y==g.current){r+=' class="sb-counter-current"'}r+=">"+(y++)+"</a>"}}else{var r=(g.current+1)+" "+g.lang.of+" "+B}}f.get("sb-counter").innerHTML=r;u()}function j(u,s){var y=f.get("sb-wrapper"),B=f.get("sb-title"),v=f.get("sb-info"),r=f.get("sb-title-inner"),z=f.get("sb-info-inner"),A=parseInt(g.lib.getStyle(r,"height"))||0,x=parseInt(g.lib.getStyle(z,"height"))||0;var w=function(){r.style.visibility=z.style.visibility="hidden";a(s)};if(u){f.animate(B,"height",0,0.35);f.animate(v,"height",0,0.35);f.animate(y,"paddingTop",A,0.35);f.animate(y,"paddingBottom",x,0.35,w)}else{B.style.height=v.style.height="0px";y.style.paddingTop=A+"px";y.style.paddingBottom=x+"px";w()}}function l(u){var s=f.get("sb-wrapper"),w=f.get("sb-title"),v=f.get("sb-info"),z=f.get("sb-title-inner"),y=f.get("sb-info-inner"),x=parseInt(g.lib.getStyle(z,"height"))||0,r=parseInt(g.lib.getStyle(y,"height"))||0;z.style.visibility=y.style.visibility="";if(z.innerHTML!=""){f.animate(w,"height",x,0.35);f.animate(s,"paddingTop",0,0.35)}f.animate(v,"height",r,0.35);f.animate(s,"paddingBottom",0,0.35,u)}function d(u,z,y,r){var A=f.get("sb-body"),x=f.get("sb-wrapper"),w=parseInt(u),v=parseInt(z);if(y){f.animate(A,"height",w,g.options.resizeDuration);f.animate(x,"top",v,g.options.resizeDuration,r)}else{A.style.height=w+"px";x.style.top=v+"px";if(r){r()}}}function h(x,z,y,r){var v=f.get("sb-wrapper"),u=parseInt(x),t=parseInt(z);if(y){f.animate(v,"width",u,g.options.resizeDuration);f.animate(v,"left",t,g.options.resizeDuration,r)}else{v.style.width=u+"px";v.style.left=t+"px";if(r){r()}}}function p(r,u,t){var s=f.get("sb-body-inner");sw=f.get("sb-wrapper"),so=f.get("sb-overlay"),tb=sw.offsetHeight-s.offsetHeight,lr=sw.offsetWidth-s.offsetWidth,max_h=so.offsetHeight,max_w=so.offsetWidth;g.setDimensions(r,u,max_h,max_w,tb,lr,t);return g.dimensions}g.skin=o})();
2
+ if(typeof jQuery=="undefined"){throw"Unable to load Shadowbox adapter, jQuery not found"}if(typeof Shadowbox=="undefined"){throw"Unable to load Shadowbox adapter, Shadowbox not found"}(function(b,a){a.lib={getStyle:function(d,c){return b(d).css(c)},remove:function(c){b(c).remove()},getTarget:function(c){return c.target},getPageXY:function(c){return[c.pageX,c.pageY]},preventDefault:function(c){c.preventDefault()},keyCode:function(c){return c.keyCode},addEvent:function(e,c,d){b(e).bind(c,d)},removeEvent:function(e,c,d){b(e).unbind(c,d)},append:function(d,c){b(d).append(c)}}})(jQuery,Shadowbox);(function(a){a.fn.shadowbox=function(b){return this.each(function(){var d=a(this);var e=a.extend({},b||{},a.metadata?d.metadata():a.meta?d.data():{});var c=this.className||"";e.width=parseInt((c.match(/w:(\d+)/)||[])[1])||e.width;e.height=parseInt((c.match(/h:(\d+)/)||[])[1])||e.height;Shadowbox.setup(d,e)})}})(jQuery);
3
+ if(typeof Shadowbox=="undefined"){throw"Unable to load Shadowbox language file, Shadowbox not found."}Shadowbox.lang={code:"en",of:"of",loading:"loading",cancel:"Cancel",next:"Next",previous:"Previous",play:"Play",pause:"Pause",close:"Close",errors:{single:'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',shared:'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',either:'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'}};
4
+ (function(a){a.html=function(b){this.obj=b;this.height=b.height?parseInt(b.height,10):300;this.width=b.width?parseInt(b.width,10):500};a.html.prototype={append:function(b,e,c){this.id=e;var d=document.createElement("div");d.id=e;d.className="html";d.innerHTML=this.obj.content;b.appendChild(d)},remove:function(){var b=document.getElementById(this.id);if(b){a.lib.remove(b)}}}})(Shadowbox);
5
+ (function(a){a.iframe=function(c){this.obj=c;var b=document.getElementById("sb-overlay");this.height=c.height?parseInt(c.height,10):b.offsetHeight;this.width=c.width?parseInt(c.width,10):b.offsetWidth};a.iframe.prototype={append:function(b,e,d){this.id=e;var c='<iframe id="'+e+'" name="'+e+'" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto"';if(a.client.isIE){c+=' allowtransparency="true"';if(a.client.isIE6){c+=" src=\"javascript:false;document.write('');\""}}c+="></iframe>";b.innerHTML=c},remove:function(){var b=document.getElementById(this.id);if(b){a.lib.remove(b);if(a.client.isGecko){delete window.frames[this.id]}}},onLoad:function(){var b=a.client.isIE?document.getElementById(this.id).contentWindow:window.frames[this.id];b.location.href=this.obj.content}}})(Shadowbox);
6
+ (function(h){var e=h.util,i,k,j="sb-drag-layer",d;function b(){i={x:0,y:0,start_x:null,start_y:null}}function c(m,o,l){if(m){b();var n=["position:absolute","height:"+o+"px","width:"+l+"px","cursor:"+(h.client.isGecko?"-moz-grab":"move"),"background-color:"+(h.client.isIE?"#fff;filter:alpha(opacity=0)":"transparent")].join(";");h.lib.append(h.skin.bodyEl(),'<div id="'+j+'" style="'+n+'"></div>');h.lib.addEvent(e.get(j),"mousedown",g)}else{var p=e.get(j);if(p){h.lib.removeEvent(p,"mousedown",g);h.lib.remove(p)}k=null}}function g(m){h.lib.preventDefault(m);var l=h.lib.getPageXY(m);i.start_x=l[0];i.start_y=l[1];k=e.get(h.contentId());h.lib.addEvent(document,"mousemove",f);h.lib.addEvent(document,"mouseup",a);if(h.client.isGecko){e.get(j).style.cursor="-moz-grabbing"}}function a(){h.lib.removeEvent(document,"mousemove",f);h.lib.removeEvent(document,"mouseup",a);if(h.client.isGecko){e.get(j).style.cursor="-moz-grab"}}function f(o){var q=h.content,p=h.dimensions,n=h.lib.getPageXY(o);var m=n[0]-i.start_x;i.start_x+=m;i.x=Math.max(Math.min(0,i.x+m),p.inner_w-q.width);k.style.left=i.x+"px";var l=n[1]-i.start_y;i.start_y+=l;i.y=Math.max(Math.min(0,i.y+l),p.inner_h-q.height);k.style.top=i.y+"px"}h.img=function(m){this.obj=m;this.resizable=true;this.ready=false;var l=this;d=new Image();d.onload=function(){l.height=m.height?parseInt(m.height,10):d.height;l.width=m.width?parseInt(m.width,10):d.width;l.ready=true;d.onload="";d=null};d.src=m.content};h.img.prototype={append:function(l,o,n){this.id=o;var m=document.createElement("img");m.id=o;m.src=this.obj.content;m.style.position="absolute";m.setAttribute("height",n.resize_h);m.setAttribute("width",n.resize_w);l.appendChild(m)},remove:function(){var l=e.get(this.id);if(l){h.lib.remove(l)}c(false);if(d){d.onload="";d=null}},onLoad:function(){var l=h.dimensions;if(l.oversized&&h.options.handleOversize=="drag"){c(true,l.resize_h,l.resize_w)}},onWindowResize:function(){if(k){var p=h.content,o=h.dimensions,n=parseInt(h.lib.getStyle(k,"top")),m=parseInt(h.lib.getStyle(k,"left"));if(n+p.height<o.inner_h){k.style.top=o.inner_h-p.height+"px"}if(m+p.width<o.inner_w){k.style.left=o.inner_w-p.width+"px"}}}}})(Shadowbox);
7
+ /*
8
+ * Sizzle CSS Selector Engine - v1.0
9
+ * Copyright 2009, The Dojo Foundation
10
+ * Released under the MIT, BSD, and GPL Licenses.
11
+ * More information: http://sizzlejs.com/
12
+ */
13
+ (function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.selectNode(t);s.collapse(true);e.selectNode(r);e.collapse(true);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.Sizzle=b})();
14
+ Shadowbox.options.players=["html","iframe","img"];
15
+ Shadowbox.options.useSizzle=true;
lib/timthumb.php ADDED
@@ -0,0 +1,613 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ TimThumb script created by Tim McDaniels and Darren Hoyt with tweaks by Ben Gillbanks
4
+ http://code.google.com/p/timthumb/
5
+
6
+ MIT License: http://www.opensource.org/licenses/mit-license.php
7
+
8
+ Paramters
9
+ ---------
10
+ w: width
11
+ h: height
12
+ zc: zoom crop (0 or 1)
13
+ q: quality (default is 75 and max is 100)
14
+
15
+ HTML example: <img src="/scripts/timthumb.php?src=/images/whatever.jpg&w=150&h=200&zc=1" alt="" />
16
+ */
17
+
18
+ /*
19
+ $sizeLimits = array(
20
+ "100x100",
21
+ "150x150",
22
+ );
23
+ */
24
+
25
+ define ('CACHE_SIZE', 250); // number of files to store before clearing cache
26
+ define ('CACHE_CLEAR', 5); // maximum number of files to delete on each cache clear
27
+ define ('VERSION', '1.09'); // version number (to force a cache refresh
28
+
29
+ $imageFilters = array(
30
+ "1" => array(IMG_FILTER_NEGATE, 0),
31
+ "2" => array(IMG_FILTER_GRAYSCALE, 0),
32
+ "3" => array(IMG_FILTER_BRIGHTNESS, 1),
33
+ "4" => array(IMG_FILTER_CONTRAST, 1),
34
+ "5" => array(IMG_FILTER_COLORIZE, 4),
35
+ "6" => array(IMG_FILTER_EDGEDETECT, 0),
36
+ "7" => array(IMG_FILTER_EMBOSS, 0),
37
+ "8" => array(IMG_FILTER_GAUSSIAN_BLUR, 0),
38
+ "9" => array(IMG_FILTER_SELECTIVE_BLUR, 0),
39
+ "10" => array(IMG_FILTER_MEAN_REMOVAL, 0),
40
+ "11" => array(IMG_FILTER_SMOOTH, 0),
41
+ );
42
+
43
+ // sort out image source
44
+ $src = get_request("src", "");
45
+ if($src == "" || strlen($src) <= 3) {
46
+ displayError("no image specified");
47
+ }
48
+
49
+ // clean params before use
50
+ $src = cleanSource($src);
51
+ // last modified time (for caching)
52
+ $lastModified = filemtime($src);
53
+
54
+ // get properties
55
+ $new_width = preg_replace("/[^0-9]+/", "", get_request("w", 0));
56
+ $new_height = preg_replace("/[^0-9]+/", "", get_request("h", 0));
57
+ $zoom_crop = preg_replace("/[^0-9]+/", "", get_request("zc", 1));
58
+ $quality = preg_replace("/[^0-9]+/", "", get_request("q", 80));
59
+ $filters = get_request("f", "");
60
+
61
+ if ($new_width == 0 && $new_height == 0) {
62
+ $new_width = 100;
63
+ $new_height = 100;
64
+ }
65
+
66
+ // set path to cache directory (default is ./cache)
67
+ // this can be changed to a different location
68
+ $cache_dir = './cache';
69
+
70
+ // get mime type of src
71
+ $mime_type = mime_type($src);
72
+
73
+ // check to see if this image is in the cache already
74
+ check_cache( $cache_dir, $mime_type );
75
+
76
+ // if not in cache then clear some space and generate a new file
77
+ cleanCache();
78
+
79
+ ini_set('memory_limit', "30M");
80
+
81
+ // make sure that the src is gif/jpg/png
82
+ if(!valid_src_mime_type($mime_type)) {
83
+ displayError("Invalid src mime type: " .$mime_type);
84
+ }
85
+
86
+ // check to see if GD function exist
87
+ if(!function_exists('imagecreatetruecolor')) {
88
+ displayError("GD Library Error: imagecreatetruecolor does not exist");
89
+ }
90
+
91
+ if(strlen($src) && file_exists($src)) {
92
+
93
+ // open the existing image
94
+ $image = open_image($mime_type, $src);
95
+ if($image === false) {
96
+ displayError('Unable to open image : ' . $src);
97
+ }
98
+
99
+ // Get original width and height
100
+ $width = imagesx($image);
101
+ $height = imagesy($image);
102
+
103
+ // don't allow new width or height to be greater than the original
104
+ if( $new_width > $width ) {
105
+ $new_width = $width;
106
+ }
107
+ if( $new_height > $height ) {
108
+ $new_height = $height;
109
+ }
110
+
111
+ // generate new w/h if not provided
112
+ if( $new_width && !$new_height ) {
113
+
114
+ $new_height = $height * ( $new_width / $width );
115
+
116
+ } elseif($new_height && !$new_width) {
117
+
118
+ $new_width = $width * ( $new_height / $height );
119
+
120
+ } elseif(!$new_width && !$new_height) {
121
+
122
+ $new_width = $width;
123
+ $new_height = $height;
124
+
125
+ }
126
+
127
+ // create a new true color image
128
+ $canvas = imagecreatetruecolor( $new_width, $new_height );
129
+ imagealphablending($canvas, false);
130
+ // Create a new transparent color for image
131
+ $color = imagecolorallocatealpha($canvas, 0, 0, 0, 127);
132
+ // Completely fill the background of the new image with allocated color.
133
+ imagefill($canvas, 0, 0, $color);
134
+ // Restore transparency blending
135
+ imagesavealpha($canvas, true);
136
+
137
+ if( $zoom_crop ) {
138
+
139
+ $src_x = $src_y = 0;
140
+ $src_w = $width;
141
+ $src_h = $height;
142
+
143
+ $cmp_x = $width / $new_width;
144
+ $cmp_y = $height / $new_height;
145
+
146
+ // calculate x or y coordinate and width or height of source
147
+
148
+ if ( $cmp_x > $cmp_y ) {
149
+
150
+ $src_w = round( ( $width / $cmp_x * $cmp_y ) );
151
+ $src_x = round( ( $width - ( $width / $cmp_x * $cmp_y ) ) / 2 );
152
+
153
+ } elseif ( $cmp_y > $cmp_x ) {
154
+
155
+ $src_h = round( ( $height / $cmp_y * $cmp_x ) );
156
+ $src_y = round( ( $height - ( $height / $cmp_y * $cmp_x ) ) / 2 );
157
+
158
+ }
159
+
160
+ imagecopyresampled( $canvas, $image, 0, 0, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h );
161
+
162
+ } else {
163
+
164
+ // copy and resize part of an image with resampling
165
+ imagecopyresampled( $canvas, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
166
+
167
+ }
168
+
169
+ if ($filters != "") {
170
+ // apply filters to image
171
+ $filterList = explode("|", $filters);
172
+ foreach($filterList as $fl) {
173
+ $filterSettings = explode(",", $fl);
174
+ if(isset($imageFilters[$filterSettings[0]])) {
175
+
176
+ for($i = 0; $i < 4; $i ++) {
177
+ if(!isset($filterSettings[$i])) {
178
+ $filterSettings[$i] = null;
179
+ }
180
+ }
181
+
182
+ switch($imageFilters[$filterSettings[0]][1]) {
183
+
184
+ case 1:
185
+
186
+ imagefilter($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1]);
187
+ break;
188
+
189
+ case 2:
190
+
191
+ imagefilter($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2]);
192
+ break;
193
+
194
+ case 3:
195
+
196
+ imagefilter($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3]);
197
+ break;
198
+
199
+ default:
200
+
201
+ imagefilter($canvas, $imageFilters[$filterSettings[0]][0]);
202
+ break;
203
+
204
+ }
205
+ }
206
+ }
207
+ }
208
+
209
+ // output image to browser based on mime type
210
+ show_image($mime_type, $canvas, $cache_dir);
211
+
212
+ // remove image from memory
213
+ imagedestroy($canvas);
214
+
215
+ } else {
216
+
217
+ if(strlen($src)) {
218
+ displayError("image " . $src . " not found");
219
+ } else {
220
+ displayError("no source specified");
221
+ }
222
+
223
+ }
224
+
225
+ /**
226
+ *
227
+ */
228
+ function show_image($mime_type, $image_resized, $cache_dir) {
229
+
230
+ global $quality;
231
+
232
+ // check to see if we can write to the cache directory
233
+ $is_writable = 0;
234
+ $cache_file_name = $cache_dir . '/' . get_cache_file();
235
+
236
+ if(touch($cache_file_name)) {
237
+
238
+ // give 666 permissions so that the developer
239
+ // can overwrite web server user
240
+ chmod($cache_file_name, 0666);
241
+ $is_writable = 1;
242
+
243
+ } else {
244
+
245
+ $cache_file_name = NULL;
246
+ header('Content-type: ' . $mime_type);
247
+
248
+ }
249
+
250
+ $quality = floor($quality * 0.09);
251
+
252
+ imagepng($image_resized, $cache_file_name, $quality);
253
+
254
+ if($is_writable) {
255
+ show_cache_file($cache_dir, $mime_type);
256
+ }
257
+
258
+ imagedestroy($image_resized);
259
+
260
+ displayError("error showing image");
261
+
262
+ }
263
+
264
+ /**
265
+ *
266
+ */
267
+ function get_request( $property, $default = 0 ) {
268
+
269
+ if( isset($_REQUEST[$property]) ) {
270
+
271
+ return $_REQUEST[$property];
272
+
273
+ } else {
274
+
275
+ return $default;
276
+
277
+ }
278
+
279
+ }
280
+
281
+ /**
282
+ *
283
+ */
284
+ function open_image($mime_type, $src) {
285
+
286
+ if(stristr($mime_type, 'gif')) {
287
+
288
+ $image = imagecreatefromgif($src);
289
+
290
+ } elseif(stristr($mime_type, 'jpeg')) {
291
+
292
+ @ini_set('gd.jpeg_ignore_warning', 1);
293
+ $image = imagecreatefromjpeg($src);
294
+
295
+ } elseif( stristr($mime_type, 'png')) {
296
+
297
+ $image = imagecreatefrompng($src);
298
+
299
+ }
300
+
301
+ return $image;
302
+
303
+ }
304
+
305
+ /**
306
+ * clean out old files from the cache
307
+ * you can change the number of files to store and to delete per loop in the defines at the top of the code
308
+ */
309
+ function cleanCache() {
310
+
311
+ $files = glob("cache/*", GLOB_BRACE);
312
+
313
+ $yesterday = time() - (24 * 60 * 60);
314
+
315
+ if (count($files) > 0) {
316
+
317
+ usort($files, "filemtime_compare");
318
+ $i = 0;
319
+
320
+ if (count($files) > CACHE_SIZE) {
321
+
322
+ foreach ($files as $file) {
323
+
324
+ $i ++;
325
+
326
+ if ($i >= CACHE_CLEAR) {
327
+ return;
328
+ }
329
+
330
+ if (filemtime($file) > $yesterday) {
331
+ return;
332
+ }
333
+
334
+ unlink($file);
335
+
336
+ }
337
+
338
+ }
339
+
340
+ }
341
+
342
+ }
343
+
344
+ /**
345
+ * compare the file time of two files
346
+ */
347
+ function filemtime_compare($a, $b) {
348
+
349
+ return filemtime($a) - filemtime($b);
350
+
351
+ }
352
+
353
+ /**
354
+ * determine the file mime type
355
+ */
356
+ function mime_type($file) {
357
+
358
+ if (stristr(PHP_OS, 'WIN')) {
359
+ $os = 'WIN';
360
+ } else {
361
+ $os = PHP_OS;
362
+ }
363
+
364
+ $mime_type = '';
365
+
366
+ if (function_exists('mime_content_type')) {
367
+ $mime_type = mime_content_type($file);
368
+ }
369
+
370
+ // use PECL fileinfo to determine mime type
371
+ if (!valid_src_mime_type($mime_type)) {
372
+ if (function_exists('finfo_open')) {
373
+ $finfo = finfo_open(FILEINFO_MIME);
374
+ $mime_type = finfo_file($finfo, $file);
375
+ finfo_close($finfo);
376
+ }
377
+ }
378
+
379
+ // try to determine mime type by using unix file command
380
+ // this should not be executed on windows
381
+ if (!valid_src_mime_type($mime_type) && $os != "WIN") {
382
+ if (preg_match("/FREEBSD|LINUX/", $os)) {
383
+ $mime_type = trim(@shell_exec('file -bi "' . $file . '"'));
384
+ }
385
+ }
386
+
387
+ // use file's extension to determine mime type
388
+ if (!valid_src_mime_type($mime_type)) {
389
+
390
+ // set defaults
391
+ $mime_type = 'image/png';
392
+ // file details
393
+ $fileDetails = pathinfo($file);
394
+ $ext = strtolower($fileDetails["extension"]);
395
+ // mime types
396
+ $types = array(
397
+ 'jpg' => 'image/jpeg',
398
+ 'jpeg' => 'image/jpeg',
399
+ 'png' => 'image/png',
400
+ 'gif' => 'image/gif'
401
+ );
402
+
403
+ if (strlen($ext) && strlen($types[$ext])) {
404
+ $mime_type = $types[$ext];
405
+ }
406
+
407
+ }
408
+
409
+ return $mime_type;
410
+
411
+ }
412
+
413
+ /**
414
+ *
415
+ */
416
+ function valid_src_mime_type($mime_type) {
417
+
418
+ if (preg_match("/jpg|jpeg|gif|png/i", $mime_type)) {
419
+ return true;
420
+ }
421
+
422
+ return false;
423
+
424
+ }
425
+
426
+ /**
427
+ *
428
+ */
429
+ function check_cache($cache_dir, $mime_type) {
430
+
431
+ // make sure cache dir exists
432
+ if (!file_exists($cache_dir)) {
433
+ // give 777 permissions so that developer can overwrite
434
+ // files created by web server user
435
+ mkdir($cache_dir);
436
+ chmod($cache_dir, 0777);
437
+ }
438
+
439
+ show_cache_file($cache_dir, $mime_type);
440
+
441
+ }
442
+
443
+ /**
444
+ *
445
+ */
446
+ function show_cache_file($cache_dir) {
447
+
448
+ $cache_file = $cache_dir . '/' . get_cache_file();
449
+
450
+ if (file_exists($cache_file)) {
451
+
452
+ $gmdate_mod = gmdate("D, d M Y H:i:s", filemtime($cache_file));
453
+
454
+ if(! strstr($gmdate_mod, "GMT")) {
455
+ $gmdate_mod .= " GMT";
456
+ }
457
+
458
+ if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
459
+
460
+ // check for updates
461
+ $if_modified_since = preg_replace("/;.*$/", "", $_SERVER["HTTP_IF_MODIFIED_SINCE"]);
462
+
463
+ if ($if_modified_since == $gmdate_mod) {
464
+ header("HTTP/1.1 304 Not Modified");
465
+ exit;
466
+ }
467
+
468
+ }
469
+
470
+ $fileSize = filesize($cache_file);
471
+
472
+ // send headers then display image
473
+ header("Content-Type: image/png");
474
+ header("Accept-Ranges: bytes");
475
+ header("Last-Modified: " . $gmdate_mod);
476
+ header("Content-Length: " . $fileSize);
477
+ header("Cache-Control: max-age=9999, must-revalidate");
478
+ header("Expires: " . $gmdate_mod);
479
+
480
+ readfile($cache_file);
481
+
482
+ exit;
483
+
484
+ }
485
+
486
+ }
487
+
488
+ /**
489
+ *
490
+ */
491
+ function get_cache_file() {
492
+
493
+ global $lastModified;
494
+ static $cache_file;
495
+
496
+ if(!$cache_file) {
497
+ $cachename = $_SERVER['QUERY_STRING'] . VERSION . $lastModified;
498
+ $cache_file = md5($cachename) . '.png';
499
+ }
500
+
501
+ return $cache_file;
502
+
503
+ }
504
+
505
+ /**
506
+ * check to if the url is valid or not
507
+ */
508
+ function valid_extension ($ext) {
509
+
510
+ if (preg_match("/jpg|jpeg|png|gif/i", $ext)) {
511
+ return TRUE;
512
+ } else {
513
+ return FALSE;
514
+ }
515
+
516
+ }
517
+
518
+ /**
519
+ * tidy up the image source url
520
+ */
521
+ function cleanSource($src) {
522
+
523
+ // remove slash from start of string
524
+ if(strpos($src, "/") == 0) {
525
+ $src = substr($src, -(strlen($src) - 1));
526
+ }
527
+
528
+ // remove http/ https/ ftp
529
+ $src = preg_replace("/^((ht|f)tp(s|):\/\/)/i", "", $src);
530
+ // remove domain name from the source url
531
+ $host = $_SERVER["HTTP_HOST"];
532
+ $src = str_replace($host, "", $src);
533
+ $host = str_replace("www.", "", $host);
534
+ $src = str_replace($host, "", $src);
535
+
536
+ // don't allow users the ability to use '../'
537
+ // in order to gain access to files below document root
538
+
539
+ // src should be specified relative to document root like:
540
+ // src=images/img.jpg or src=/images/img.jpg
541
+ // not like:
542
+ // src=../images/img.jpg
543
+ $src = preg_replace("/\.\.+\//", "", $src);
544
+
545
+ // get path to image on file system
546
+ $src = get_document_root($src) . '/' . $src;
547
+
548
+ return $src;
549
+
550
+ }
551
+
552
+ /**
553
+ *
554
+ */
555
+ function get_document_root ($src) {
556
+
557
+ // check for unix servers
558
+ if(@file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $src)) {
559
+ return $_SERVER['DOCUMENT_ROOT'];
560
+ }
561
+
562
+ // check from script filename (to get all directories to timthumb location)
563
+ $parts = array_diff(explode('/', $_SERVER['SCRIPT_FILENAME']), explode('/', $_SERVER['DOCUMENT_ROOT']));
564
+ $path = $_SERVER['DOCUMENT_ROOT'] . '/';
565
+ foreach ($parts as $part) {
566
+ $path .= $part . '/';
567
+ if (file_exists($path . $src)) {
568
+ return $path;
569
+ }
570
+ }
571
+
572
+ // the relative paths below are useful if timthumb is moved outside of document root
573
+ // specifically if installed in wordpress themes like mimbo pro:
574
+ // /wp-content/themes/mimbopro/scripts/timthumb.php
575
+ $paths = array(
576
+ ".",
577
+ "..",
578
+ "../..",
579
+ "../../..",
580
+ "../../../..",
581
+ "../../../../.."
582
+ );
583
+
584
+ foreach($paths as $path) {
585
+ if(@file_exists($path . '/' . $src)) {
586
+ return $path;
587
+ }
588
+ }
589
+
590
+ // special check for microsoft servers
591
+ if(!isset($_SERVER['DOCUMENT_ROOT'])) {
592
+ $path = str_replace("/", "\\", $_SERVER['ORIG_PATH_INFO']);
593
+ $path = str_replace($path, "", $_SERVER['SCRIPT_FILENAME']);
594
+
595
+ if( @file_exists( $path . '/' . $src ) ) {
596
+ return $path;
597
+ }
598
+ }
599
+
600
+ displayError('file not found ' . $src);
601
+
602
+ }
603
+
604
+ /**
605
+ * generic error message
606
+ */
607
+ function displayError($errorString = '') {
608
+
609
+ header('HTTP/1.1 400 Bad Request');
610
+ die($errorString);
611
+
612
+ }
613
+ ?>
media.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ error_reporting(0);
3
+ require( dirname(__FILE__) . '/../../../wp-config.php' );
4
+
5
+ global $wpdb;
6
+
7
+ $attachment_files = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_modified DESC" );
8
+
9
+
10
+ // ================
11
+ // = IMAGES FIRST =
12
+ // ================
13
+ echo '<div class="attachments-file-section attachments-images">';
14
+ echo '<h2>Images</h2>';
15
+ echo '<ul>';
16
+ foreach ($attachment_files as $post)
17
+ {
18
+ if ( strpos($post->post_mime_type, 'image') !== false )
19
+ {
20
+ echo '<li>';
21
+ echo '<a href="#">';
22
+ echo '<span class="attachments-data">';
23
+ echo '<span class="attachment-file-name">' . $post->post_name . '</span>';
24
+ echo '<span class="attachment-file-location">' . $post->guid . '</span>';
25
+ echo '<span class="attachment-file-id">' . $post->ID . '</span>';
26
+ echo '</span>';
27
+ echo '<span class="attachments-thumbnail">';
28
+ echo wp_get_attachment_image( $post->ID, array(80, 60), true );
29
+ echo '</span>';
30
+ echo '</a>';
31
+ echo '</li>';
32
+ }
33
+ }
34
+ echo '</ul>';
35
+ echo '</div>';
36
+
37
+
38
+
39
+ // ==========
40
+ // = VIDEOS =
41
+ // ==========
42
+ echo '<div class="attachments-file-section attachments-alt attachments-videos">';
43
+ echo '<h2>Videos</h2>';
44
+ echo '<ul>';
45
+ foreach ($attachment_files as $post)
46
+ {
47
+ if ( strpos($post->post_mime_type, 'video') !== false )
48
+ {
49
+ echo '<li>';
50
+ echo '<a href="#">';
51
+ echo '<span class="attachments-data">';
52
+ echo '<span class="attachment-file-name">' . $post->post_name . '</span>';
53
+ echo '<span class="attachment-file-location">' . $post->guid . '</span>';
54
+ echo '<span class="attachment-file-id">' . $post->ID . '</span>';
55
+ echo '</span>';
56
+ echo '<span class="attachments-thumbnail">';
57
+ echo wp_get_attachment_image( $post->ID, array(80, 60), true );
58
+ echo '</span>';
59
+ echo '<h2 class="attachments-title-display">';
60
+ echo $post->post_name;
61
+ echo '</h2>';
62
+ echo '</a>';
63
+ echo '</li>';
64
+ }
65
+ }
66
+ echo '</ul>';
67
+ echo '</div>';
68
+
69
+
70
+
71
+
72
+ // =============
73
+ // = DOCUMENTS =
74
+ // =============
75
+ echo '<div class="attachments-file-section attachments-alt attachments-documents">';
76
+ echo '<h2>Documents</h2>';
77
+ echo '<ul>';
78
+ foreach ($attachment_files as $post)
79
+ {
80
+ if ( strpos($post->post_mime_type, 'application') !== false )
81
+ {
82
+ echo '<li>';
83
+ echo '<a href="#">';
84
+ echo '<span class="attachments-data">';
85
+ echo '<span class="attachment-file-name">' . $post->post_name . '</span>';
86
+ echo '<span class="attachment-file-location">' . $post->guid . '</span>';
87
+ echo '<span class="attachment-file-id">' . $post->ID . '</span>';
88
+ echo '</span>';
89
+ echo '<span class="attachments-thumbnail">';
90
+ echo wp_get_attachment_image( $post->ID, array(80, 60), true );
91
+ echo '</span>';
92
+ echo '<h2 class="attachments-title-display">';
93
+ echo $post->post_name;
94
+ echo '</h2>';
95
+ echo '</a>';
96
+ echo '</li>';
97
+ }
98
+ }
99
+ echo '</ul>';
100
+ echo '</div>';
101
+
102
+
103
+
104
+
105
+ // =========
106
+ // = AUDIO =
107
+ // =========
108
+ echo '<div class="attachments-file-section attachments-alt attachments-audio">';
109
+ echo '<h2>Audio</h2>';
110
+ echo '<ul>';
111
+ foreach ($attachment_files as $post)
112
+ {
113
+ if ( strpos($post->post_mime_type, 'audio') !== false )
114
+ {
115
+ echo '<li>';
116
+ echo '<a href="#">';
117
+ echo '<span class="attachments-data">';
118
+ echo '<span class="attachment-file-name">' . $post->post_name . '</span>';
119
+ echo '<span class="attachment-file-location">' . $post->guid . '</span>';
120
+ echo '<span class="attachment-file-id">' . $post->ID . '</span>';
121
+ echo '</span>';
122
+ echo '<span class="attachments-thumbnail">';
123
+ echo wp_get_attachment_image( $post->ID, array(80, 60), true );
124
+ echo '</span>';
125
+ echo '<h2 class="attachments-title-display">';
126
+ echo $post->post_name;
127
+ echo '</h2>';
128
+ echo '</a>';
129
+ echo '</li>';
130
+ }
131
+ }
132
+ echo '</ul>';
133
+ echo '</div>';
readme.txt ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Attachments ===
2
+ Contributors: jchristopher
3
+ Donate link: http://mondaybynoon.com/donate/
4
+ Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
5
+ Requires at least: 2.8.5
6
+ Tested up to: 2.9
7
+ Stable tag: 1.0
8
+
9
+ Attachments allows you to append any number of items from your WordPress Media Library to Posts and Pages
10
+
11
+ == Description ==
12
+
13
+ Attachments allows you to append any number of items from your WordPress Media Library to Posts and Pages. This plugin *does not* directly interact with your theme, you will need to edit your template files.
14
+
15
+ There is a **screencast available** on the [plugin home page](http://mondaybynoon.com/wordpress-attachments/)
16
+
17
+ == Installation ==
18
+
19
+ 1. Download the plugin and extract the files
20
+ 1. Upload `attachments` to your `~/wp-content/plugins/` directory
21
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
22
+ 1. Update your templates where applicable (see **Usage**)
23
+
24
+ == Frequently Asked Questions ==
25
+
26
+ = Attachments are not showing up in my theme =
27
+
28
+ You will need to edit your theme files where applicable. Please reference the **Usage** instructions
29
+
30
+ = Where are uploads saved? =
31
+
32
+ Attachments uses WordPress' built in Media library for uploads and storage.
33
+
34
+ == Screenshots ==
35
+
36
+ 1. Screenshot coming soon
37
+
38
+ == Changelog ==
39
+
40
+ = 1.0 =
41
+ * First stable release
42
+
43
+ == Usage ==
44
+
45
+ After installing Attachments, you will need to update your template files in order to pull the data to the front end.
46
+
47
+ To pull all Attachments for a Post or Page, fire `attachments_get_attachments()`. There is one optional parameter which can force a Post ID if `attachments_get_attachments()` is fired outside The Loop. If used inside The Loop, all Attachments will be pulled for the current Post or Page.
48
+
49
+ Firing `attachments_get_attachments()` returns an array consisting of all available Attachments. Currently each Attachment has four pieces of data available:
50
+
51
+ * **title** - The attachment Title
52
+ * **caption** - The attachment Caption
53
+ * **id** - The WordPress assigned attachment id (for use with other WordPress media functions)
54
+ * **location** - The attachment URI
55
+
56
+ Here is a basic implementation:
57
+
58
+ `<?php
59
+ $attachments = attachments_get_attachments();
60
+ $total_attachments = count($attachments);
61
+ if( $total_attachments > 0 )
62
+ {
63
+ echo '<ul>';
64
+ for ($i=0; $i < $total_attachments; $i++)
65
+ {
66
+ echo '<li>' . $attachments[$i]['title'] . '</li>';
67
+ echo '<li>' . $attachments[$i]['caption'] . '</li>';
68
+ echo '<li>' . $attachments[$i]['id'] . '</li>';
69
+ echo '<li>' . $attachments[$i]['location'] . '</li>';
70
+ }
71
+ echo '</ul>';
72
+ }
73
+ ?>`
74
+
75
+ You can elaborate on this implementation in any way you see fit.