本文整理汇总了PHP中Komento类的典型用法代码示例。如果您正苦于以下问题:PHP Komento类的具体用法?PHP Komento怎么用?PHP Komento使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Komento类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tmpl = null)
{
$mainframe = JFactory::getApplication();
$commentsModel = Komento::getModel( 'comments' );
$cid = JRequest::getVar( 'cid', 'all' );
$filter['component'] = $mainframe->getUserStateFromRequest( 'com_komento.pending.filter_component', 'filter-component', 'all', 'string' );
$filter['sort'] = $mainframe->getUserStateFromRequest( 'com_komento.pending.filter_sort', 'filter-sort', 'latest', 'string' );
$filter['search'] = trim( JString::strtolower( $mainframe->getUserStateFromRequest( 'com_komento.pending.filter_search', 'filter-search', '', 'string' ) ) );
$options = array(
'limit' => 0,
'sort' => $filter['sort'],
'search' => $filter['search'],
'published' => 2,
'threaded' => 0
);
$comments = $commentsModel->getComments( $filter['component'], $cid, $options );
$pagination = $commentsModel->getPagination();
$components = $commentsModel->getUniqueComponents();
$theme = Komento::getTheme();
$theme->set( 'components', $components );
$theme->set( 'pagination', $pagination );
$theme->set( 'comments', $comments );
$theme->set( 'filter', $filter );
echo $theme->fetch('dashboard/pending.php');
}
示例2: getResource
public function getResource()
{
$resources = JRequest::getVar('resource');
$component = JRequest::getCmd('kmtcomponent');
Komento::setCurrentComponent($component);
if (!is_array($resources)) {
header('Content-type: text/x-json; UTF-8');
echo '[]';
exit;
}
foreach ($resources as &$resource) {
$resource = (object) $resource;
switch ($resource->type) {
case 'language':
$resource->content = JText::_(strtoupper($resource->name));
break;
case 'view':
$template = Komento::getTheme();
$out = $template->fetch($resource->name . '.ejs');
if ($out !== false) {
$resource->content = $out;
}
break;
}
}
Komento::getClass('json', 'KomentoJson');
header('Content-type: text/x-json; UTF-8');
$json = new KomentoJson();
echo $json->encode($resources);
exit;
}
示例3: purge
public function purge()
{
$db = Komento::getDBO();
$query = 'DELETE FROM ' . $db->nameQuote('#__komento_mailq');
$db->setQuery($query);
$db->Query();
}
示例4: getRule
public function getRule()
{
$component = Komento::getCurrentComponent();
$ip = KomentoIpHelper::getIP();
$rules = Komento::getModel( 'ipfilter' )->getRule( $component, $ip );
}
示例5: getColumnsState
function getColumnsState()
{
$columns = array('comment', 'published', 'link', 'edit', 'component', 'article', 'date', 'author', 'email', 'homepage', 'ip', 'latitude', 'longitude', 'address', 'id');
$columnsConfig = Komento::getConfig('com_komento_pending_columns', false);
$html = $this->renderColumnsConfiguration($columns, $columnsConfig);
return $html;
}
示例6: toFormat
public function toFormat( $format='%Y-%m-%d %H:%M:%S' )
{
if( Komento::joomlaVersion() >= '3.0' )
{
if( JString::stristr( $format, '%' ) !== false )
{
Komento::import( 'helper', 'date' );
$format = KomentoDateHelper::strftimeToDate( $format );
}
return $this->date->format( $format, true );
}
else
{
// There is no way to have cross version working, except for detecting % in the format
if( JString::stristr( $format , '%' ) === false )
{
if( Komento::isJoomla15() )
{
// forced fallback for Joomla 15 if format doesn't have %
$format = '%c';
}
else
{
return $this->date->format( $format , true );
}
}
return $this->date->toFormat( $format, true );
}
}
示例7: getAjaxTemplate
public function getAjaxTemplate()
{
$files = JRequest::getVar('names', '');
if (empty($files)) {
return false;
}
// Ensure the integrity of each items submitted to be an array.
if (!is_array($files)) {
$files = array($files);
}
$result = array();
foreach ($files as $file) {
$template = Komento::getTheme();
$out = $template->fetch($file . '.ejs');
$obj = new stdClass();
$obj->name = $file;
$obj->content = $out;
$result[] = $obj;
}
Komento::getClass('json', 'KomentoJson');
header('Content-type: text/x-json; UTF-8');
$json = new KomentoJson();
echo $json->encode($result);
exit;
}
示例8: bootstrap
/**
* This renders the necessary bootstrap data into the html headers.
*/
public function bootstrap()
{
static $isRendered = false;
$doc = JFactory::getDocument();
if( !$isRendered && $doc->getType() == 'html' )
{
// @task: Include dependencies from foundry.
require_once( JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'foundry' . DIRECTORY_SEPARATOR . '3.1' . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'configuration.php' );
$config = Komento::getConfig();
$environment = JRequest::getVar( 'komento_environment' , $config->get( 'komento_environment' ) );
$folder = 'scripts';
// @task: Let's see if we should load the dev scripts.
if( $environment == 'development' )
{
$folder = 'scripts_';
}
$doc->addScript( rtrim( JURI::root() , '/' ) . '/media/com_komento/' . $folder . '/abstract.js' );
$isRendered = true;
}
return $isRendered;
}
示例9: doSave
private function doSave()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$mainframe = JFactory::getApplication();
if (!JRequest::getMethod() == 'POST') {
$mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_INVALID_REQUEST', 'error'));
return false;
}
// Unset unecessary post data.
$post = JRequest::get('POST');
unset($post['task']);
unset($post['option']);
unset($post['c']);
$token = Komento::_('getToken');
unset($post[$token]);
// check the target component
if (!$post['target_component']) {
$mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_MISSING_TARGET_COMPONENT'));
return false;
}
// rememeber user's choice
// $mainframe->setUserState('com_komento.acl.component', $post['target_component']);
// Save post data
$model = Komento::getModel('Acl', true);
if (!$model->save($post)) {
$mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_ERROR', 'error'));
return false;
}
$mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_SUCCESS', 'message'));
// Clear the component's cache
$cache = JFactory::getCache('com_komento');
$cache->clean();
return true;
}
示例10: loadForm
public static function loadForm( $id, $component, $options = array() )
{
$theme = Komento::getTheme();
$html = $theme->fetch( 'comment/form.php' );
echo $html;
}
示例11: loadComposite
public function loadComposite($component, $ip)
{
$sql = Komento::getSql();
$sql->select('#__komento_ipfilter')->where('component', $component)->where('ip', $ip);
$data = $sql->loadObject();
return parent::bind($data);
}
示例12: clear
/**
* Delete the outdated entries.
*/
public function clear()
{
$db = Komento::getDBO();
$date = Komento::getDate();
$query = 'DELETE FROM ' . $db->nameQuote('#__komento_captcha') . ' WHERE ' . $db->nameQuote('created') . ' <= DATE_SUB( ' . $db->Quote($date->toMySQL()) . ', INTERVAL 12 HOUR )';
$db->setQuery($query);
$db->query();
return true;
}
示例13: getCount
/**
* Renders the comment count for Komento
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getCount(EasyBlogPost $post)
{
if (!$this->exists()) {
return;
}
$model = Komento::getModel('Comments');
$count = $model->getCount('com_easyblog', $post->id);
return $count;
}
示例14: preview
function preview()
{
$id = JRequest::getInt('id');
$table = Komento::getTable('mailq');
$table->load($id);
$ajax = Komento::getAjax();
$ajax->success($table->body, $table->type);
$ajax->send();
}
示例15: getTotal
function getTotal()
{
// Lets load the content if it doesn't already exist
if (empty($this->_total)) {
$sql = Komento::getSql();
$sql->select('#__komento_comments', 'a')->column('a.id', 'id', 'count distinct')->rightjoin('#__komento_actions', 'b')->on('a.id', 'b.comment_id')->where('b.type', 'report');
$this->_total = $sql->loadResult();
}
return $this->_total;
}