function output_shortcode_variable() { if (foogallery_gallery_shortcode_tag() != FOOGALLERY_CPT_GALLERY) { ?> <script type="text/javascript"> window.FOOGALLERY_SHORTCODE = '<?php echo foogallery_gallery_shortcode_tag(); ?> '; </script> <?php } }
/** * Build up the FooGallery shortcode regex * * @return string */ function foogallery_gallery_shortcode_regex() { $tag = foogallery_gallery_shortcode_tag(); return '\\[' . '(\\[?)' . "({$tag})" . '(?![\\w-])' . '(' . '[^\\]\\/]*' . '(?:' . '\\/(?!\\])' . '[^\\]\\/]*' . ')*?' . ')' . '(?:' . '(\\/)' . '\\]' . '|' . '\\]' . '(?:' . '(' . '[^\\[]*+' . '(?:' . '\\[(?!\\/\\2\\])' . '[^\\[]*+' . ')*+' . ')' . '\\[\\/\\2\\]' . ')?' . ')' . '(\\]?)'; // 6: Optional second closing bracket for escaping shortcodes: [[tag]] }
function get_galleries_html_for_modal() { $galleries = foogallery_get_all_galleries(); ob_start(); foreach ($galleries as $gallery) { $img_src = $gallery->featured_image_src(array(200, 200)); $images = $gallery->image_count(); ?> <li class="foogallery-pile"> <div class="foogallery-gallery-select" data-foogallery-id="<?php echo $gallery->ID; ?> " style="background: url('<?php echo $img_src; ?> ') no-repeat"> <div class="foogallery-gallery-select-inner" > <?php $title = empty($gallery->name) ? sprintf(__('%s #%s', 'foogallery'), foogallery_plugin_name(), $gallery->ID) : $gallery->name; ?> <h3><?php echo $title; ?> </h3> <span><?php echo $images; ?> </span> <code>[<?php echo foogallery_gallery_shortcode_tag(); ?> id="<?php echo $gallery->ID; ?> "]</code> </div> </div> </li> <?php } ?> <li class="foogallery-pile"> <div class="foogallery-gallery-select foogallery-add-gallery"> <a href="<?php echo esc_url(foogallery_admin_add_gallery_url()); ?> " target="_blank" class="thumbnail" style="display: table;"> <span></span> <div class="foogallery-gallery-select-inner" > <h3><?php _e('Add New Gallery', 'foogallery'); ?> </h3> </div> </a> </div> </li> <?php return ob_get_clean(); }
function init_shortcode() { add_shortcode(foogallery_gallery_shortcode_tag(), array($this, 'render_foogallery_shortcode')); }
<div class="changelog"> <div class="feature-section"> <img src="<?php echo FOOGALLERY_URL . 'assets/screenshots/admin-insert-shortcode.jpg'; ?> " class="foogallery-help-screenshot"/> <h2><?php _e('Show Off Your Gallery', 'foogallery'); ?> </h2> <h4><?php printf(__('The <em>[%s]</em> Short Code', 'foogallery'), foogallery_gallery_shortcode_tag()); ?> </h4> <p><?php _e('Simply copy the shortcode code from the gallery listing page and paste it into your posts or pages.', 'foogallery'); ?> </p> <h4><?php _e('Visual Editor Button', 'foogallery'); ?> </h4> <p><?php printf(__('Or to make life even easier, you can insert a gallery using the Add %s button inside the WordPress visual editor.', 'foogallery'), foogallery_plugin_name()); ?> </p>