diff -r 2f6f6f7551ca -r 32102edaa81b web/wp-content/plugins/slideshow-jquery-image-gallery/classes/SlideshowPluginShortcode.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/slideshow-jquery-image-gallery/classes/SlideshowPluginShortcode.php Mon Nov 19 18:26:13 2012 +0100 @@ -0,0 +1,135 @@ + 0) + foreach(self::$postIds as $postId){ + $updatedContent = preg_replace("/" . self::$bookmark . "/", SlideshowPlugin::prepare($postId), $content, 1); + + if(is_string($updatedContent)) + $content = $updatedContent; + } + + // Reset postIds, so a shortcode in a next post can be used + self::$postIds = array(); + + return $content; + } + + /** + * Hooked on the admin's 'media_buttons' hook, outputs the shortcode inserter media button + * + * @since 2.1.16 + */ + static function shortcodeInserter(){ + // Get slideshows + $slideshows = new WP_Query(array( + 'post_type' => SlideshowPluginPostType::$postType, + 'orderby' => 'post_date', + 'order' => 'DESC' + )); + + include(SlideshowPluginMain::getPluginPath() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . __CLASS__ . DIRECTORY_SEPARATOR . 'shortcode-inserter.php'); + } + + /** + * Enqueues the shortcode inserter script + * + * @since 2.1.16 + */ + static function shortcodeInserterScript(){ + wp_enqueue_script( + 'slideshow-shortcode-inserter', + SlideshowPluginMain::getPluginUrl() . '/js/' . __CLASS__ . '/shortcode-inserter.js', + array('jquery') + ); + + wp_localize_script( + 'slideshow-shortcode-inserter', + 'SlideshowShortcodeInserter', + array( + 'undefinedSlideshowMessage' => __('No slideshow selected.', 'slideshow-plugin'), + 'shortcode' => SlideshowPluginShortcode::$shortCode + ) + ); + } +} \ No newline at end of file