コード例 #1
0
<?php

/**
 * @package Module Smart Countdown for Joomla! 2.5 - 3.0
 * @version 2.3 mod_smartcountdown.php
 * @author Alex Polonski
 * @copyright (C) 2012-2014 - Alex Polonski
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
// no direct access
defined('_JEXEC') or die;
$params->set('module_id', $module->id);
$params->set('cache', 0);
require_once dirname(__FILE__) . '/helpers/helper.php';
$events_queue = modSmartCountdownHelper::getCountdown($params);
if ($events_queue) {
    // process the fisrt entry in the events queue (for php output)
    $countdown = $events_queue[0];
    JHtml::_('behavior.framework', true);
    $params->set('countdown_mode', $countdown['diff_js'] > 0 ? 'down' : 'up');
    $document = JFactory::getDocument();
    $document->addScript(JURI::root(true) . '/modules/mod_smartcountdown/smartcdpro.js');
    $lang = JFactory::getLanguage('site');
    $tag = strtolower($lang->getTag());
    // Check if language-specific plural js file exists
    // (it must contain a function to set sigular/plural label forms)
    $file_name = 'plural_' . $tag . '.js';
    if (file_exists(dirname(__FILE__) . '/plural_js/' . $file_name)) {
        // use language-specific file
        $document->addScript(JURI::root(true) . '/modules/mod_smartcountdown/plural_js/' . $file_name);
    } else {