Пример #1
0
 /**
  * Retrieves the actual video
  *
  * @param array $params An object containing the module parameters
  * @return The code for embedding the video
  * @access public
  */
 function getVideo($params, $mod)
 {
     $code = '';
     $res = null;
     $app =& JFactory::getApplication();
     if (JPluginHelper::importPlugin('content', 'avreloaded')) {
         $w = $params->get('pwidth', 320);
         $h = $params->get('pheight', 240);
         $header = $params->get('header_text', '');
         $footer = $params->get('footer_text', '');
         $plcode = preg_replace('#\\s+#', ' ', $params->get('mediacode', ''));
         $plcode = modAvReloadedHelper::_removeParam('popup', $plcode);
         $popup = $params->get('popup', 0);
         switch ($popup) {
             case 0:
                 $res = $app->triggerEvent('onAvReloadedGetVideo', array($plcode));
                 // There should be exacty ONE return value in the result, because
                 // this is a custom event type!
                 if (is_array($res) && count($res) == 1) {
                     $code = $header . $res[0] . $footer;
                 }
                 break;
             case 1:
             case 2:
                 $plid = 'modavr_' . $mod->id;
                 $plcode = modAvReloadedHelper::_injectParam('popup', 'true', $plcode);
                 $plcode = modAvReloadedHelper::_injectParam('width', $w, $plcode);
                 $plcode = modAvReloadedHelper::_injectParam('height', $h, $plcode);
                 $res = $app->triggerEvent('onAvReloadedGetVideoAndID', array($plcode));
                 // There should be exacty ONE return value in the result, because
                 // this is a custom event type!
                 if (is_array($res) && count($res) == 1) {
                     $linktxt = $params->get('linktxt', '');
                     $menus =& JSite::getMenu();
                     $amenu =& $menus->getActive();
                     $itemid = $amenu->id;
                     if ($linktxt != '') {
                         $plid = $res[0][1];
                         $code .= $header . $res[0][0] . '<a href="#" onclick="return AvrPopup(event,' . "'" . $plid . "','" . ($popup == 1 ? 'window' : 'lightbox') . "'" . ');">' . $linktxt . '</a>' . $footer;
                     } else {
                         $code .= $header . $footer;
                     }
                 }
                 break;
         }
     }
     return $code;
 }
Пример #2
0
<?php

/**
 * AllVideos Reloaded Module Entry Point
 *
 * @version		$Id: mod_avreloaded.php 947 2008-06-09 17:29:02Z Fritz Elfert $
 * @copyright	Copyright (C) 2008 Fritz Elfert. All rights reserved.
 * @license		GNU/GPLv2
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
// Include the syndicate functions only once
require_once dirname(__FILE__) . DS . 'helper.php';
$video = modAvReloadedHelper::getVideo($params, $module);
require JModuleHelper::getLayoutPath('mod_avreloaded');