| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/saint-martin-lg/plugins/pagebuilderck/audio/ |
Upload File : |
<?php
/**
* @copyright Copyright (C) 2015 Cédric KEIFLIN alias ced1870
* https://www.template-creator.com
* https://www.joomlack.fr
* @license GNU/GPL
* */
defined('_JEXEC') or die('Restricted access');
jimport('joomla.event.plugin');
class plgPagebuilderckAudio extends \Joomla\CMS\Plugin\CMSPlugin {
private $context = 'PLG_PAGEBUILDERCK_AUDIO';
private $type = 'audio';
function __construct(&$subject, $params) {
parent::__construct($subject, $params);
}
public function callAssets() {
// load the script in the page in admin and front
$doc = Pagebuilderck\CKFof::getDocument();
PagebuilderckFrontHelper::addStylesheet(Pagebuilderck\CKUri::root(true) . '/plugins/pagebuilderck/audio/assets/audio.css');
$doc->addScript(Pagebuilderck\CKUri::root(true) . '/plugins/pagebuilderck/audio/assets/audio.js');
}
/*
* Construct the Menu Item to drag into the interface
*
* Return Object with item data
*/
public function onPagebuilderckAddItemToMenu() {
$this->callAssets();
// load the language files of the plugin
$this->loadLanguage();
// create the menu item
$menuitem = new stdClass();
$menuitem->type = $this->type;
$menuitem->group = 'multimedia';
$menuitem->title = Pagebuilderck\CKText::_($this->context . '_MENUITEM_TITLE');
$menuitem->description = Pagebuilderck\CKText::_($this->context . '_MENUITEM_DESC');
$menuitem->image = Pagebuilderck\CKUri::root(true) . '/plugins/pagebuilderck/audio/assets/images/audio.svg';
return $menuitem;
}
/*
* Display the html code for the item to be used into the interface
*
* Return String the html code
*/
public function onPagebuilderckLoadItemContentAudio() {
$input = Pagebuilderck\CKFof::getInput();
$id = $input->get('ckid', '', 'string');
// ckstyle and inner classes are needed to get the styles from the interface
?>
<div id="<?php echo $id; ?>" class="cktype" data-type="audio">
<div class="ckstyle">
</div>
<div class="inner pbck_audio">
<div class="pbck-audio">
<div class="pbck-audio-element">
<audio controls src="" >
Your browser does not support the audio element.
</audio>
</div>
<div class="pbck-audio-advanced">
</div>
</div>
</div>
</div>
<?php
}
/*
* Load the interface for the item edition
*
* Return String the html code
*/
public function onPagebuilderckLoadItemOptionsAudio() {
// load the language files of the plugin
$this->loadLanguage();
// load the interface for the options
$tpl = JPATH_SITE . '/plugins/pagebuilderck/audio/layouts/edit_audio.php';
return $tpl;
}
/*
* Display the html code for the item to be used into the frontend page
* @param string the item object from simple_html_dom
*
* Return String the html code
*/
public function onPagebuilderckRenderItemAudio($item) {
if ($item->find('audio')) {
$this->callAssets();
return $item->innertext;
}
// B/C for old players
$attrs = $item->find('.tab_audio');
$params = PagebuilderckFrontHelper::createParamsFromElement($attrs);
$audiosrc = PagebuilderckFrontHelper::getSource($params->get('audiourl'));
$html ='<audio style="width:100%;box-sizing:border-box;max-width:100%;" controls src="' . $audiosrc . '" ' . ($params->get('autoplayyes') == 'checked' ? 'autoplay' : '') . '>'
. 'Your browser does not support the audio element.'
. '</audio>';
$html = preg_replace('#<div class="audiock"[^>]*>(.*?)<\/div>#is', $html, $item->innertext);
return $html;
}
}