diff -r 2f6f6f7551ca -r 32102edaa81b web/wp-content/plugins/slideshow-jquery-image-gallery/classes/SlideshowPluginSlideInserter.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/slideshow-jquery-image-gallery/classes/SlideshowPluginSlideInserter.php Mon Nov 19 18:26:13 2012 +0100 @@ -0,0 +1,225 @@ + 0){ + foreach($settings as $key => $setting) + if(strtolower(substr($key, 0, strlen($search))) == strtolower($search)) + unset($settings[$key]); + } + update_post_meta($_POST['postId'], 'settings', $settings); + + die; + } + + /** + * This function is registered in the SlideshowPluginAjax class + * and prints the results from the search query + */ + static function printSearchResults(){ + // Numberposts and offset + $numberPosts = 10; + $offset = 0; + if(isset($_POST['offset'])) + $offset = $_POST['offset']; + + // Get attachments with a title alike the search string, needs to be filtered + add_filter('posts_where', array(__CLASS__, 'printSearchResultsWhereFilter')); + $attachments = get_posts(array( + 'numberposts' => $numberPosts + 1, + 'offset' => $offset, + 'orderby' => 'post_date', + 'order' => 'DESC', + 'post_type' => 'attachment', + 'suppress_filters' => false + )); + remove_filter('posts_where', array(__CLASS__, 'printSearchResultsWhereFilter')); + + // Check if there are enough attachments to print a 'Load more images' button + $loadMoreResults = false; + if(count($attachments) > $numberPosts){ + array_pop($attachments); + $loadMoreResults = true; + } + + // Print results to the screen + if(count($attachments) > 0){ + foreach($attachments as $attachment){ + $image = wp_get_attachment_image_src($attachment->ID); + if(!$image[3]) $image[0] = SlideshowPluginMain::getPluginUrl() . '/images/SlideshowPluginPostType/no-img.png'; + echo '
' . $attachment->post_content . '
+