diff --git a/e107_core/shortcodes/batch/page_shortcodes.php b/e107_core/shortcodes/batch/page_shortcodes.php index 75d6aa6cd..be293d22a 100644 --- a/e107_core/shortcodes/batch/page_shortcodes.php +++ b/e107_core/shortcodes/batch/page_shortcodes.php @@ -268,7 +268,14 @@ class cpage_shortcodes extends e_shortcode return ""; } - parse_str($parm,$options); + if(is_string($parm)) + { + parse_str($parm,$options); + } + else + { + $options= $parm; + } $buttonText = (empty($this->var['menu_button_text'])) ? LAN_READ_MORE : $this->var['menu_button_text']; $buttonUrl = (empty($this->var['menu_button_url'])) ? $url : $tp->replaceConstants($this->var['menu_button_url']); diff --git a/e107_plugins/gallery/e_shortcode.php b/e107_plugins/gallery/e_shortcode.php index cbfd25a0a..5bffb88bc 100644 --- a/e107_plugins/gallery/e_shortcode.php +++ b/e107_plugins/gallery/e_shortcode.php @@ -38,13 +38,21 @@ class gallery_shortcodes extends e_shortcode function sc_gallery_caption($parm = '') { + $tp = e107::getParser(); + + if($parm === 'text') + { + return $tp->toAttribute($this->var['media_caption']); + } + + e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php'); // Load prettyPhoto settings and files. gallery_load_prettyphoto(); $plugPrefs = e107::getPlugConfig('gallery')->getPref(); $hook = varset($plugPrefs['pp_hook'], 'data-gal'); - $tp = e107::getParser(); + $text = "attFull) . "' " . $hook . "='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]" $text .= $this->var['media_caption']; $text .= ""; @@ -210,6 +218,7 @@ class gallery_shortcodes extends e_shortcode function sc_gallery_portfolio($parms = '') { $ns = e107::getRender(); + $tp = e107::getParser(); $parm = eHelper::scParams($parms); $cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), false); //TODO Separate pref? @@ -219,7 +228,9 @@ class gallery_shortcodes extends e_shortcode $plugPrefs = e107::getPlugConfig('gallery')->getPref(); $orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); - $imageQry = (empty($cat)) ? "gallery_image|gallery_image_1|gallery_1" : 'gallery_' . $cat . '|gallery_image_' . $cat; + $imageQry = (empty($cat) || $cat==1) ? "gallery_image|gallery_image_1|gallery_1" : 'gallery_' . $cat . '|gallery_image_' . $cat; + + $list = e107::getMedia()->getImages($imageQry, 0, $limit, null, $orderBy); @@ -233,12 +244,37 @@ class gallery_shortcodes extends e_shortcode } } + $template = e107::getTemplate('gallery', 'gallery', 'portfolio'); + + if(!empty($template['start'])) + { + $text = $tp->parseTemplate($template['start'],true, $this); + } + else + { + $text = ''; + } + //NOTE: Using tablerender() allows the theme developer to set the number of columns etc using col-xx-xx - $text = ''; + foreach($list as $val) { $this->var = $val; - $text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'), 'gallery_portfolio', true); + + if(empty($template['item'])) + { + $text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'), 'gallery_portfolio', true); + } + else + { + $text .= $tp->parseTemplate($template['item'],true,$this); + } + + } + + if(!empty($template['end'])) + { + $text .= $tp->parseTemplate($template['end'],true, $this); } return $text; diff --git a/e107_plugins/gallery/templates/gallery_template.php b/e107_plugins/gallery/templates/gallery_template.php index 6f4c988a3..7010715f4 100644 --- a/e107_plugins/gallery/templates/gallery_template.php +++ b/e107_plugins/gallery/templates/gallery_template.php @@ -179,3 +179,11 @@ $GALLERY_TEMPLATE['prettyphoto']['social_item'] = ' '; + +/* + +$GALLERY_TEMPLATE['portfolio']['start'] = '<-- start portfolio -->'; +$GALLERY_TEMPLATE['portfolio']['item'] = '{GALLERY_CAPTION=text}'; +$GALLERY_TEMPLATE['portfolio']['end'] = '<-- end portfolio -->'; + +*/