1
0
mirror of https://github.com/e107inc/e107.git synced 2025-05-03 18:59:45 +02:00

Fixes #850 - Gallery missing description when using simple brackets. Fixes #607 - embedded English text.

This commit is contained in:
Cameron 2015-02-01 17:27:05 -08:00
parent 2a4caa6cb7
commit 274069184f
4 changed files with 19 additions and 10 deletions

View File

@ -1857,16 +1857,17 @@ class e_parse extends e_parser
return trim($ret_parser);
}
/**
* Use it on html attributes to avoid breaking markup .
* @example echo "<a href='#' title='".$tp->toAttribute($text)."'>Hello</a>";
*/
function toAttribute($text)
{
// URLs posted without HTML access may have an &amp; in them.
$text = str_replace('&amp;', '&', $text);
// Xhtml compliance.
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
if(!preg_match('/&#|\'|"|\(|\)|<|>/s', $text))
if(!preg_match('/&#|\'|"|<|>/s', $text))
{
$text = $this->replaceConstants($text);
return $text;

View File

@ -33,8 +33,9 @@ margin-left:0;
$prettyPhoto = <<<JS
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto(
$("a[data-gal^='prettyPhoto']").prettyPhoto(
{
hook: 'data-gal',
theme: 'pp_default', /* pp_default , light_rounded , dark_rounded , light_square , dark_square ,facebook */
overlay_gallery: false,
deeplinking: false

View File

@ -32,7 +32,7 @@ class gallery_shortcodes extends e_shortcode
function sc_gallery_caption($parm='')
{
$tp = e107::getParser();
$text = "<a class='gallery-caption' title='".$tp->toAttribute($this->var['media_caption'])."' href='".$tp->thumbUrl($this->var['media_url'], $this->attFull)."' rel='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]"
$text = "<a class='gallery-caption' title='".$tp->toAttribute($this->var['media_caption'])."' href='".$tp->thumbUrl($this->var['media_url'], $this->attFull)."' data-gal='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]"
$text .= $this->var['media_caption'];
$text .= "</a>";
return $text;
@ -96,7 +96,7 @@ class gallery_shortcodes extends e_shortcode
$description .= $tp->toAttribute($this->var['media_description']);
$text = "<a class='".$class."' title=\"".$description."\" href='".$srcFull."' rel='{$rel}' >";
$text = "<a class='".$class."' title=\"".$description."\" href='".$srcFull."' data-gal='{$rel}' >";
$text .= "<img class='".$class."' src='".$tp->thumbUrl($this->var['media_url'],$att)."' alt=\"".$caption."\" />";
$text .= "</a>";

View File

@ -111,7 +111,8 @@ class page_sitelink // include plugin-folder in the name.
'link_order' => '',
'link_parent' => $row['chapter_parent'],
'link_open' => '',
'link_class' => 0
'link_class' => 0,
'link_identifier' => 'page-nav-'.intval($row['chapter_id']) // used for css id.
);
}
@ -130,6 +131,8 @@ class page_sitelink // include plugin-folder in the name.
parse_str($parm,$options);
}
$sql = e107::getDb();
$sublinks = array();
$arr = array();
@ -205,7 +208,9 @@ class page_sitelink // include plugin-folder in the name.
'link_parent' => $row['page_chapter'],
'link_open' => '',
'link_class' => intval($row['page_class']),
'link_active' => (isset($options['cpage']) && $row['page_id'] == $options['cpage'])
'link_active' => (isset($options['cpage']) && $row['page_id'] == $options['cpage']),
'link_identifier' => 'page-nav-'.intval($row['page_id']) // used for css id.
);
}
@ -261,9 +266,11 @@ class page_sitelink // include plugin-folder in the name.
'link_class' => 0,
'link_sub' => (!vartrue($options['book']) && !vartrue($options['auto'])) ? varset($sublinks[$row['chapter_id']]) : '', //XXX always test with docs template in bootstrap before changing.
'link_active' => $row['chapter_parent'] == 0 ? isset($options['cbook']) && $options['cbook'] == $row['chapter_id'] : isset($options['cchapter']) && $options['cchapter'] == $row['chapter_id'],
'link_identifier' => 'page-nav-'.intval($row['chapter_id']) // used for css id.
);
}
$outArray = array();
$parent = vartrue($options['book']) ? intval($options['book']) : 0;