/
home
/
assocoweys
/
leucate
/
plugins
/
content
/
edform
/
Upload File
HOME
<?php use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Factory; /** * @version 3.7 * @package Joomla * @subpackage Edocman * @author Tuan Pham Ngoc * @copyright Copyright (C) 2009 - 2021 Ossolution Team * @license GNU/GPL, see LICENSE.php */ // no direct access defined('_JEXEC') or die(); /** * Process Prepare content * * Method is called by the view * * @param object The article object. Note $article->text is also available * @param object The article params * @param int The 'page' number */ class plgContentEdForm extends CMSPlugin { function onContentPrepare($context, &$article, &$params, $limitstart) { if (Factory::getApplication()->getName() != 'site') { return; } if (strpos($article->text, 'edform') === false) { return true; } $regex = "#{edform (\d+)}#s"; $article->text = preg_replace_callback($regex, array($this, '_replaceDocumentForm'), $article->text); return true; } /** * Show donation form based on campaign id * * @param unknown_type $matches */ function _replaceDocumentForm($matches) { error_reporting(0); $documentId = $matches[1]; require_once JPATH_ADMINISTRATOR . '/components/com_edocman/libraries/rad/loader.php'; require_once JPATH_ROOT . '/components/com_edocman/helper/helper.php'; EdocmanHelper::loadLanguage(); $config = array( 'default_controller_class' => 'EDocmanController', 'default_view' => 'dashboard', 'class_prefix' => 'EDocman' ); $request = array('view' => 'document', 'id' => $documentId, 'content_plugin' => 1); $input = new OSInput($request); ob_start(); //Execute the controller OSController::getInstance('com_edocman', $input, $config)->execute(); return ob_get_clean(); } }