Guenni007

Enfold

Sep 27th, 2021 (edited)
1,130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.89 KB | None | 0 0
  1. <?php
  2. /*
  3.  * ----------------------------------------------------------------------
  4.  *
  5.  *                          Borlabs Cookie
  6.  *                      developed by Borlabs
  7.  *
  8.  * ----------------------------------------------------------------------
  9.  *
  10.  * Copyright 2018-2021 Borlabs - Benjamin A. Bornschein. All rights reserved.
  11.  * This file may not be redistributed in whole or significant part.
  12.  * Content of this file is protected by international copyright laws.
  13.  *
  14.  * ----------------- Borlabs Cookie IS NOT FREE SOFTWARE -----------------
  15.  *
  16.  * @copyright Borlabs - Benjamin A. Bornschein, https://borlabs.io
  17.  * @author Benjamin A. Bornschein, Borlabs ben@borlabs.io
  18.  *
  19.  */
  20.  
  21. namespace BorlabsCookie\Cookie\Frontend\ThirdParty\Themes;
  22.  
  23. use BorlabsCookie\Cookie\Frontend\ContentBlocker;
  24. use BorlabsCookie\Cookie\Frontend\JavaScript;
  25. use BorlabsCookie\Cookie\Frontend\Shortcode;
  26.  
  27. class Enfold
  28. {
  29.     private static $instance;
  30.  
  31.     public static function getInstance()
  32.     {
  33.         if (null === self::$instance) {
  34.             self::$instance = new self;
  35.         }
  36.  
  37.         return self::$instance;
  38.     }
  39.  
  40.     /**
  41.      * __construct function.
  42.      *
  43.      * @access public
  44.      * @return void
  45.      */
  46.     public function __construct()
  47.     {
  48.     }
  49.  
  50.     public function __clone()
  51.     {
  52.         trigger_error('Cloning is not allowed.', E_USER_ERROR);
  53.     }
  54.  
  55.     public function __wakeup()
  56.     {
  57.         trigger_error('Unserialize is forbidden.', E_USER_ERROR);
  58.     }
  59.  
  60.     /**
  61.      * modifyVideoOutput function.
  62.      *
  63.      * @access public
  64.      * @param mixed $output
  65.      * @param mixed $atts
  66.      * @param mixed $content
  67.      * @param mixed $shortcodename
  68.      * @param mixed $meta
  69.      * @param mixed $video_html_raw
  70.      * @return void
  71.     */
  72.  
  73.     public function modifyVideoOutput($output, $atts, $content, $shortcodename, $meta, $video_html_raw)
  74.     {
  75.         if (!empty($atts['src'])) {
  76.  
  77.             $style = [];
  78.  
  79.             if (!empty($atts['format']) && $atts['format'] == 'custom') {
  80.                 $height = intval($atts['height']);
  81.                 $width = intval($atts['width']);
  82.                 $ratio = (100 / $width) * $height;
  83.                 $style[] = "padding-bottom:" . $ratio . "%";
  84.             }
  85.  
  86.             if (!empty($atts['mobile_image'])) {
  87.                 $style[] = "background-image: url('" . $atts['mobile_image'] . "')";
  88.             }
  89.  
  90.             if (!empty($atts['conditional_play']) && $atts['conditional_play'] === 'lightbox') {
  91.                 // Nothing for now - can not be supported
  92.             } else {
  93.                 $output = '<div class="avia-video avia-video-' . $atts['format'] . '" style="' . implode(';', $style) . '" itemprop="video" itemtype="https://schema.org/VideoObject" data-original_url="' . $atts['src'] . '">' . $video_html_raw . '</div>';
  94.             }
  95.         }
  96.  
  97.         return $output;
  98.     }
  99. }
  100.  
Add Comment
Please, Sign In to add comment