Add ad card support

master
Skylar Ittner 5 years ago
parent 00a3598e92
commit d46d0164ea

@ -79,7 +79,25 @@ foreach (Colors::$colors as $c) {
<div class="row" id="grid">
<?php
// Show ad card if enabled in settings
$count = 0;
$adshown = false;
foreach ($notes as $note) {
$count++;
if ($count >= 2 && !$adshown && $SETTINGS['ads_enabled'] && !(new User($_SESSION['uid']))->hasPermission($SETTINGS['noads_permission'])) {
$adshown = true;
?>
<style nonce="<?php echo $SECURE_NONCE; ?>"><?php echo $SETTINGS['ad_css']; ?></style>
<div class="grid__brick col-12 col-sm-6 col-md-6 col-lg-4 pb-4 pt-1">
<div class="card">
<?php echo $SETTINGS['ad_html']; ?>
<div class="card-body text-muted p-0 m-2">
<?php echo $SETTINGS['ad_footer']; ?>
</div>
</div>
</div>
<?php
}
?>
<div class="grid__brick col-12 col-sm-6 col-md-6 col-lg-4 pb-4 pt-1">
<div class="card notecard" data-color="<?php echo $note->getColor(); ?>" id="notecard_<?php echo $note->getID(); ?>" data-note="<?php echo $note->getID(); ?>">

@ -38,7 +38,7 @@ if ($_SESSION['mobile'] === TRUE) {
. "object-src 'none'; "
. "img-src * data:; "
. "media-src 'self'; "
. "frame-src 'none'; "
. "frame-src *; "
. "font-src 'self'; "
. "connect-src *; "
. "style-src 'self' 'unsafe-inline'; "
@ -49,7 +49,7 @@ if ($_SESSION['mobile'] === TRUE) {
. "object-src 'none'; "
. "img-src * data:; "
. "media-src 'self'; "
. "frame-src 'none'; "
. "frame-src *; "
. "font-src 'self'; "
. "connect-src *; "
. "style-src 'self' 'nonce-$SECURE_NONCE'; "

@ -49,6 +49,16 @@ $SETTINGS = [
// HTML to show when the quota is reached. "{{notecount}}" and "{{notelimit}}"
// will be replaced with the number of notes the user has and the note_limit.
"quota_msg_content" => "",
// Enable ads to show in the notes view
"ads_enabled" => false,
// Permission needed to hide ads
"noads_permission" => "",
// Ad card HTML content
"ad_html" => "<p>Ad goes here...</p>",
// Extra CSS rules for the ad
"ad_css" => "",
// HTML to display below the ad.
"ad_footer" => "",
// List of background colors available for users to pick from.
"note_colors" => [
// Pastel colors

Loading…
Cancel
Save