| Current Path : /var/www/iplanru/data/www/www.i-plan.ru/components/com_poll/helpers/ |
| Current File : /var/www/iplanru/data/www/www.i-plan.ru/components/com_poll/helpers/poll.php |
<?php
// No direct access
defined( '_JEXEC' ) or die;
/**
* Component helper
* @author kirdinyuri
*/
class PollHelper
{
public function setDocument( $title = '', $basepath, $metadesc = '', $metakey = '' )
{
$doc = JFactory::getDocument();
//$doc->addScript( $basepath . '/components/com_poll/assets/scripts/poll.js' );
//$doc->addStyleSheet( $basepath . '/components/com_poll/assets/styles/poll.css' );
$app = JFactory::getApplication();
if ( empty( $title ) ) {
$title = $app->get( 'sitename' );
} elseif ( $app->get( 'sitename_pagetitles', 0 ) == 1 ) {
$title = JText::sprintf( 'JPAGETITLE', $app->get( 'sitename' ), $title );
} elseif ( $app->get( 'sitename_pagetitles', 0 ) == 2 ) {
$title = JText::sprintf( 'JPAGETITLE', $title, $app->get( 'sitename' ) );
}
$doc->setTitle( $title );
if ( trim( $metadesc ) ) {
$doc->setDescription( $metadesc );
}
if ( trim( $metakey ) ) {
$doc->setMetaData( 'keywords', $metakey );
}
}
public function setCookies()
{
$inputCookie = JFactory::getApplication()->input->cookie;
$chash = $inputCookie->get($name = 'chash', $defaultValue = null);
if($chash=='')
{
$inputCookie->set($name = 'chash', $value = md5(date("Y-m-d H:i:s")), $expire = 0, '/');
$chash = $inputCookie->get($name = 'chash', $defaultValue = null);
}
return $chash;
}
}