1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-12 18:46:20 +02:00

Merge pull request #8 from e107inc/master

.
This commit is contained in:
rica-carv
2016-04-19 19:08:53 +01:00
4 changed files with 19 additions and 51 deletions

View File

@ -24,12 +24,18 @@ You may report any bugs or feature requests on GitHub (https://github.com/e107in
* Please submit 1 pull-request for each Github #issue you may work on. * Please submit 1 pull-request for each Github #issue you may work on.
* Make sure that only the lines you have changed actually show up in a file-comparison (diff) ie. some text-editors alter every line so this should be avoided. * Make sure that only the lines you have changed actually show up in a file-comparison (diff) ie. some text-editors alter every line so this should be avoided.
* Make sure you are using rebase on your local .git/config file.
ie. [branch "master"]
rebase = true`
### Donations ### Donations
If you like e107 and wish to help it to improve - please consider making a small donation. If you like e107 and wish to help it to improve - please consider making a small donation.
Bitcoin address: 18C7W2YvkzSjvPoW1y46PjkTdCr9UzC3F7 * Bitcoin address: 18C7W2YvkzSjvPoW1y46PjkTdCr9UzC3F7
* Paypal: donate (at) e107.org
### Support
* http://e107help.org
### License ### License

View File

@ -857,7 +857,7 @@ class e_parse_shortcode
} }
if(preg_match('/^([A-Z_]*):(.*)/', $matches[1], $newMatch)) if(preg_match('/^([A-Z_]*\d?):(.*)/', $matches[1], $newMatch))
{ {
$fullShortcodeKey = $newMatch[0]; $fullShortcodeKey = $newMatch[0];
$code = $newMatch[1]; $code = $newMatch[1];

View File

@ -120,7 +120,7 @@ define ('EPL_ADLAN_101',"No plugins installed - [x].");
define ('EPL_ADLAN_102',"This Wizard will build an admin area for your plugin and generate a plugin.xml meta file. Before you start:"); define ('EPL_ADLAN_102',"This Wizard will build an admin area for your plugin and generate a plugin.xml meta file. Before you start:");
define ('EPL_ADLAN_103',"Create a new writable folder in the [x] directory eg. [b]myplugin[/b]"); define ('EPL_ADLAN_103',"Create a new writable folder in the [x] directory eg. [b]myplugin[/b]");
// define ('EPL_ADLAN_104',"If your plugin will use sql tables, create a new file in this folder and name it the same as the directory but with [b]_sql.php[/b] as a sufix eg. [b]myplugin_sql.php[/b]"); // define ('EPL_ADLAN_104',"If your plugin will use sql tables, create a new file in this folder and name it the same as the directory but with [b]_sql.php[/b] as a sufix eg. [b]myplugin_sql.php[/b]");
define ('EPL_ADLAN_105',"Create your table in phpMyAdmin in the same database as e107 and with the same table prefix."); define ('EPL_ADLAN_105',"Create your table using phpMyAdmin in the same database as e107 and with the same table prefix. eg. [b]e107_myplugin[/b]");
define ('EPL_ADLAN_106',"Select your plugin's folder to begin."); define ('EPL_ADLAN_106',"Select your plugin's folder to begin.");
define ('EPL_ADLAN_107',"Build an admin-area and xml file for:"); define ('EPL_ADLAN_107',"Build an admin-area and xml file for:");
define ('EPL_ADLAN_108',"Check language files:"); define ('EPL_ADLAN_108',"Check language files:");

View File

@ -8,9 +8,6 @@
* *
* Banner shortcode * Banner shortcode
* *
*/
/**
* e107 Banner management plugin * e107 Banner management plugin
* *
* Handles the display and sequencing of banners on web pages, including counting impressions * Handles the display and sequencing of banners on web pages, including counting impressions
@ -22,46 +19,27 @@
class banner_shortcodes extends e_shortcode class banner_shortcodes extends e_shortcode
{ {
// $parm now can be array, old campaign $parm still allowed....
function sc_banner($parm='') function sc_banner($parm='')
{ {
// $parm now can be array, old campaign $parm still allowed....
$sql = e107::getDb(); $sql = e107::getDb();
$tp = e107::getParser(); $tp = e107::getParser();
mt_srand ((double) microtime() * 1000000); mt_srand ((double) microtime() * 1000000);
$seed = mt_rand(1,2000000000); $seed = mt_rand(1,2000000000);
$time = time(); $time = time();
$campaign = (is_array($parm)?$parm['campaign']:$parm);
if(is_array($parm))
{
$parms = eHelper::scParams($parm);
$campaign = $parms['campaign'];
}
else
{
$campaign = $parm;
}
$query = " (banner_startdate=0 OR banner_startdate <= {$time}) AND (banner_enddate=0 OR banner_enddate > {$time}) AND (banner_impurchased=0 OR banner_impressions<=banner_impurchased)".($campaign ? " AND banner_campaign='".$tp->toDB($campaign)."'" : '')." $query = " (banner_startdate=0 OR banner_startdate <= {$time}) AND (banner_enddate=0 OR banner_enddate > {$time}) AND (banner_impurchased=0 OR banner_impressions<=banner_impurchased)".($campaign ? " AND banner_campaign='".$tp->toDB($campaign)."'" : '')."
AND banner_active IN (".USERCLASS_LIST.") "; AND banner_active IN (".USERCLASS_LIST.") ";
if($tags = e107::getRegistry('core/form/related')) if($tags = e107::getRegistry('core/form/related'))
{ {
$tags_regexp = "'(^|,)(".str_replace(",", "|", $tags).")(,|$)'"; $tags_regexp = "'(^|,)(".str_replace(",", "|", $tags).")(,|$)'";
$query .= " AND banner_keywords REGEXP ".$tags_regexp; $query .= " AND banner_keywords REGEXP ".$tags_regexp;
} }
$query .= " ORDER BY RAND($seed) LIMIT 1"; $query .= " ORDER BY RAND($seed) LIMIT 1";
if($sql->select('banner', 'banner_id, banner_image, banner_clickurl, banner_description', $query)) if($sql->select('banner', 'banner_id, banner_image, banner_clickurl, banner_description', $query))
{ {
$row = $sql->fetch(); $row = $sql->fetch();
return $this->renderBanner($row, $parm); return $this->renderBanner($row, $parm);
} }
else else
{ {
@ -74,11 +52,6 @@ class banner_shortcodes extends e_shortcode
{ {
$sql = e107::getDb('banner'); $sql = e107::getDb('banner');
$tp = e107::getParser(); $tp = e107::getParser();
if(is_array($parm))
{
$parms = eHelper::scParams($parm);
}
if(!$row['banner_image']) if(!$row['banner_image'])
{ {
return "<a href='".e_HTTP.'banner.php?'.$row['banner_id']."' rel='external'>no image assigned to this banner</a>"; return "<a href='".e_HTTP.'banner.php?'.$row['banner_id']."' rel='external'>no image assigned to this banner</a>";
@ -109,7 +82,6 @@ class banner_shortcodes extends e_shortcode
break; break;
default: default:
if($row['banner_image'][0] == '{') if($row['banner_image'][0] == '{')
{ {
$src = $row['banner_image']; $src = $row['banner_image'];
@ -119,31 +91,21 @@ class banner_shortcodes extends e_shortcode
$src = e_IMAGE_ABS.'banners/'.$row['banner_image']; $src = e_IMAGE_ABS.'banners/'.$row['banner_image'];
$style = "'border:0'"; $style = "'border:0'";
} }
$class = vartrue($parms['class']) ? $parms['class'] : "e-banner img-responsive img-rounded"; // Somehow, can't use vartrue core function when referencing $parm['class'], gives bug....
$ban_ret = $tp->toImage($src, array('class'=>$class, 'alt'=>$row['banner_clickurl'], 'style'=>$style)); $ban_ret = $tp->toImage($src, array('class'=>($parm['class'] == ''?"e-banner img-responsive img-rounded":$parm['class']) , 'alt'=>$row['banner_clickurl'], 'style'=>$style));
break; break;
} }
$start = "<a class='e-tip' href='".e_HTTP.'banner.php?'.$row['banner_id']."' rel='external' title=\"".$tp->toAttribute(varset($row['banner_tooltip'],''))."\">";
$tooltip = varset($row['banner_tooltip'],'');
$start = "<a class='e-tip' href='".e_HTTP.'banner.php?'.$row['banner_id']."' rel='external' title=\"".$tp->toAttribute($tooltip)."\">";
$item = $ban_ret;
$end = '</a>'; $end = '</a>';
$text = $start.$ban_ret.$end;
$text = $start.$item.$end;
if(!empty($row['banner_description'])) if(!empty($row['banner_description']))
{ {
$text .= "<div class='e-banner-description'>".$start.$tp->toHtml($row['banner_description'], true).$end. "</div>"; $text .= "<div class='e-banner-description'>".$start.$tp->toHtml($row['banner_description'], true).$end. "</div>";
} }
return $text; return $text;
} }
} }
?> ?>