cat_ID; endforeach; $needle = explode(',', $options['global_settings']['lightbox_gallery_categories']); foreach ( $needle as $val ) : if ( in_array($val, $cats ) ) : $flag = true; break; endif; endforeach; elseif ( $options['global_settings']['lightbox_gallery_pages'] && is_page() ) : $needle = explode(',', $options['global_settings']['lightbox_gallery_pages']); foreach ( $needle as $val ) : if ( trim($val) == $wp_query->queried_object_id ) : $flag = true; break; endif; endforeach; else : if ( $wp_query->posts ) : for($i=0;$iposts);$i++) : if ( preg_match('/\[gallery([^\]]+)?\]/', $wp_query->posts[$i]->post_content) || preg_match('/]*>/',$wp_query->posts[$i]->post_content) ) : $flag = true; break; endif; endfor; endif; endif; if ( !is_admin() && $flag ) { if ( !$options['global_settings']['lightbox_gallery_disable_lightbox_gallery_css'] ) : if (@file_exists(TEMPLATEPATH.'/lightbox-gallery.css')) { echo ''."\n"; } else { echo ''."\n"; } endif; if ( !$options['global_settings']['lightbox_gallery_disable_lightbox_css'] ) : echo ''."\n"; endif; if ( !$options['global_settings']['lightbox_gallery_disable_tooltip_css'] ) : echo ''."\n"; endif; } } function add_lightbox_gallery_jquery() { global $wp_query; $options = get_option('lightbox_gallery_data'); if ( !defined('WP_PLUGIN_DIR') ) $plugin_dir = str_replace( ABSPATH, '', dirname(__FILE__) ); else $plugin_dir = dirname( plugin_basename(__FILE__) ); $flag = false; if ( $options['global_settings']['lightbox_gallery_categories'] && (is_category() || is_single() ) ) : $categories = get_the_category(); $cats = array(); foreach( $categories as $val ) : $cats[] = $val->cat_ID; endforeach; $needle = explode(',', $options['global_settings']['lightbox_gallery_categories']); foreach ( $needle as $val ) : if ( in_array($val, $cats ) ) : $flag = true; break; endif; endforeach; elseif ( $options['global_settings']['lightbox_gallery_pages'] && (is_page() ) ) : $needle = explode(',', $options['global_settings']['lightbox_gallery_pages']); foreach ( $needle as $val ) : if ( trim($val) == $wp_query->queried_object_id ) : $flag = true; break; endif; endforeach; else : if ( $wp_query->posts ) : for($i=0;$iposts);$i++) : if ( preg_match('/\[gallery([^\]]+)?\]/', $wp_query->posts[$i]->post_content) || preg_match('/]*>/',$wp_query->posts[$i]->post_content) ) : $flag = true; break; endif; endfor; endif; endif; if ( !is_admin() && $flag ) { wp_enqueue_script( 'jquery'); wp_enqueue_script( 'dimensions', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.dimensions.js', array('jquery') ); wp_enqueue_script( 'bgiframe', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.bgiframe.js', array('jquery') ) ; wp_enqueue_script( 'lightbox', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.lightbox.js', array('jquery') ); wp_enqueue_script( 'tooltip', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.tooltip.js', array('jquery') ); if (@file_exists(TEMPLATEPATH.'/lightbox-gallery.js')) { $template = get_template(); wp_enqueue_script( 'lightbox-gallery', '/wp-content/themes/' . $template . '/lightbox-gallery.js', array('jquery') ); } else { wp_enqueue_script( 'lightbox-gallery', '/' . PLUGINDIR . '/' . $plugin_dir . '/lightbox-gallery.js', array('jquery') ); } } } function lightbox_gallery_plugin_action_links($links, $file){ static $this_plugin; if( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__); if( $file == $this_plugin ){ $settings_link = '' . __('Settings') . ''; $links = array_merge( array($settings_link), $links); } return $links; } function lightbox_gallery_admin_menu() { add_options_page(__('Lightbox Gallery', 'lightbox-gallery'), __('Lightbox Gallery', 'lightbox-gallery'), 8, basename(__FILE__), 'lightbox_gallery_admin'); } function lightbox_gallery_admin() { $options = get_option('lightbox_gallery_data'); if($_POST["lightbox_gallery_global_settings_submit"]) : unset($options['global_settings']); foreach($_POST as $key => $val) : if($key != "lightbox_gallery_global_settings_submit") : if ( is_array($val) ) $options['global_settings'][$key] = $val; else $options['global_settings'][$key] = stripslashes($val); endif; endforeach; update_option('lightbox_gallery_data', $options); $message = __('Options updated.', 'lightbox-gallery'); elseif ($_POST['lightbox_gallery_delete_options_submit']) : delete_option('lightbox_gallery_data'); $options = get_option('lightbox_gallery_data'); $message = __('Options deleted.', 'lightbox-gallery'); endif; ?>




:

:

:
/>

:
/>

:
/>

:
/>

:

:
thumbnail medium large full

:
thumbnail medium large full



'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => $columns, 'size' => $size, 'lightboxsize' => $lightboxsize, 'meta' => 'false', 'class' => 'gallery1', 'nofollow' => false, 'from' => '', 'num' => '', 'page' => $wp_query->query_vars['page'], 'before' => '', 'link_before' => '', 'link_after' => '', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'pagenavi' => 1 ), $attr)); $id = intval($id); $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); if ( empty($attachments) ) return ''; $total = count($attachments)-$from; if ( !$page ) $page = 1; if ( is_numeric($from) && !$num ) : $attachments = array_splice($attachments, $from); elseif ( is_numeric($page) && is_numeric($num) && $num>0 ) : if ( $total%$num == 0 ) $numpages = (int)($total/$num); else $numpages = (int)($total/$num)+1; $attachments = array_splice($attachments, ($page-1)*$num+$from, $num); endif; if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $id => $attachment ) $output .= wp_get_attachment_link($id, $size, true) . "\n"; return $output; } $listtag = tag_escape($listtag); $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; if ( !$options['global_settings']['lightbox_gallery_disable_column_css'] ) : $column_css = ""; endif; $output = apply_filters('gallery_style', $column_css."'; $output .= wp_link_pages_for_lightbox_gallery(array('before' => $before, 'after' => $after, 'link_before' => $link_before, 'link_after' => $link_after, 'next_or_number' => $next_or_number, 'nextpagelink' => $nextpagelink, 'previouspagelink' => $previouspagelink, 'pagelink' => $pagelink, 'page' => $page, 'numpages' => $numpages, 'pagenavi' => $pagenavi)); return $output; } function wp_link_pages_for_lightbox_gallery($args = '') { global $post; $defaults = array( 'echo' => 0, 'page' => 1, 'numpages' => 1 ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); if ( !$pagenavi ) return; if ( $numpages > $page ) $more = 1; $output = ''; if ( $numpages > 1 ) { if ( 'number' == $next_or_number ) { $output .= $before; for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { $j = str_replace('%',"$i",$pagelink); $output .= ' '; if ( ($i != $page) || ((!$more) && ($page==1)) ) { if ( 1 == $i ) { $output .= ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= ''; else $output .= ''; } } else { $output .= ''; } $output .= $link_before; $output .= $j; $output .= $link_after; if ( ($i != $page) || ((!$more) && ($page==1)) ) $output .= ''; else $output .= ''; } $output .= $after; } else { if ( $more ) { $output .= $before; $i = $page - 1; if ( $i && $more ) { $output .= ''; if ( 1 == $i ) { $output .= '' . $link_before. $previouspagelink . $link_after . ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= '' . $link_before. $previouspagelink . $link_after . ''; else $output .= '' . $link_before. $previouspagelink . $link_after . ''; } $output .= ''; } $i = $page + 1; if ( $i <= $numpages && $more ) { $output .= ''; if ( 1 == $i ) { $output .= '' . $link_before. $nextpagelink . $link_after . ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= '' . $link_before. $nextpagelink . $link_after . ''; else $output .= '' . $link_before. $nextpagelink . $link_after . ''; } $output .= ''; } $output .= $after; } } } if ( $echo ) echo $output; return $output; } ?>