first commit
This commit is contained in:
67
plugins/sensitive_images/hooks/all.php
Normal file
67
plugins/sensitive_images/hooks/all.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
function HookSensitive_imagesAllAdditionaljoins()
|
||||
{
|
||||
global $sensitive_images_field;
|
||||
if ($sensitive_images_field>0)
|
||||
{
|
||||
// If plugin is configured, add the sensitive images field to the array of join fields so it's returned in the results.
|
||||
return array($sensitive_images_field);
|
||||
}
|
||||
}
|
||||
|
||||
function HookSensitive_imagesAllStopblurbleed()
|
||||
{
|
||||
global $sensitive_images_field;
|
||||
if ($sensitive_images_field>0)
|
||||
{
|
||||
// If plugin is configured, prevent bleed of blur outside of the blurred image container
|
||||
return " overflow:hidden;";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function SensitiveImageResultsReplace($collection)
|
||||
{
|
||||
// Blur image in search results and collections bar
|
||||
global $sensitive_images_field, $sensitive_images_blur_level, $result, $n;
|
||||
if ($sensitive_images_field>0 && isset($result[$n]["field" . $sensitive_images_field]))
|
||||
{
|
||||
$sensitive=$result[$n]["field" . $sensitive_images_field];
|
||||
if (strlen($sensitive)>0)
|
||||
{
|
||||
?>
|
||||
<style>
|
||||
<?php echo $collection ? "#CollectionSpace" : "#CentralSpaceResources"; ?> #ResourceShell<?php echo $result[$n]["ref"]; ?>
|
||||
img {filter: blur(<?php echo (int)$sensitive_images_blur_level; ?>px);}
|
||||
|
||||
|
||||
<?php if (!$collection) { ?>#CentralSpaceResources #ResourceShell<?php echo $result[$n]["ref"]; ?>::before
|
||||
{
|
||||
content: '!';
|
||||
z-index: 5;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 40%;
|
||||
transform: translate( -50%, -50% );
|
||||
color: white;
|
||||
font-size: <?php echo $collection ? "20px" : "50px"; ?> !important;
|
||||
}
|
||||
<?php } ?>
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function HookSensitive_imagesSearchResourcethumbtop()
|
||||
{
|
||||
// Blur image in search results
|
||||
SensitiveImageResultsReplace(false);
|
||||
}
|
||||
|
||||
function HookSensitive_imagesCollectionsRendercollectionthumb()
|
||||
{
|
||||
// Blue image in collections bar
|
||||
SensitiveImageResultsReplace(true);
|
||||
}
|
33
plugins/sensitive_images/hooks/view.php
Normal file
33
plugins/sensitive_images/hooks/view.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
function HookSensitive_imagesViewReplacepreviewlink()
|
||||
{
|
||||
global $ref,$sensitive_images_field, $sensitive_images_blur_level, $resource, $image_preview_zoom;
|
||||
if ($sensitive_images_field==0) {return false;} // not configured yet
|
||||
$sensitive=$resource["field" . $sensitive_images_field];
|
||||
$sensitive_images_blur_preview=$sensitive_images_blur_level + 16;
|
||||
if ($sensitive!="")
|
||||
{
|
||||
$image_preview_zoom=false;
|
||||
?>
|
||||
<style>
|
||||
#previewimage {filter: blur(<?php echo (int)$sensitive_images_blur_preview; ?>px);}
|
||||
|
||||
#previewimagewrapper::before
|
||||
{
|
||||
content: '<?php echo escape($sensitive) ?>. Click image to show.';
|
||||
z-index: 5;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate( -50%, -50% );
|
||||
color: white;
|
||||
font-size: 30px !important;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
text-shadow: 0px 1px 4px #000000a6;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user