本文整理汇总了PHP中Komento::import方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::import方法的具体用法?PHP Komento::import怎么用?PHP Komento::import使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Komento
的用法示例。
在下文中一共展示了Komento::import方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 );
}
}
示例2: shorten
public function shorten()
{
$link = JRequest::getVar( 'url', '' );
if( $link != '' )
{
Komento::import( 'helper', 'social' );
$shortenlink = KomentoSocialHelper::shortenUrl( $link );
echo $shortenlink;
}
exit;
}
示例3: __construct
function __construct()
{
$mainframe = JFactory::getApplication();
$db = Komento::getDBO();
$this->limit = $mainframe->getUserStateFromRequest('com_komento.reports.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$this->limitstart = $mainframe->getUserStateFromRequest('com_komento.reports.limitstart', 'limitstart', 0, 'int');
$this->filter_publish = $mainframe->getUserStateFromRequest('com_komento.reports.filter_publish', 'filter_publish', '*', 'string');
$this->filter_component = $mainframe->getUserStateFromRequest('com_komento.reports.filter_component', 'filter_component', '*', 'string');
$this->order = $mainframe->getUserStateFromRequest('com_komento.reports.filter_order', 'filter_order', 'created', 'cmd');
$this->order_dir = $mainframe->getUserStateFromRequest('com_komento.reports.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
$this->search = $mainframe->getUserStateFromRequest('com_komento.reports.search', 'search', '', 'string');
Komento::import('helper', 'string');
$this->search = KomentoStringHelper::escape(trim(JString::strtolower($this->search)));
parent::__construct();
}
示例4: display
function display($tpl = null)
{
//initialise variables
$document = JFactory::getDocument();
$user = JFactory::getUser();
$mainframe = JFactory::getApplication();
$components = array();
$result = Komento::getHelper('components')->getAvailableComponents();
if (Komento::joomlaVersion() >= '1.6') {
if (!$user->authorise('komento.manage.comments', 'com_komento')) {
$mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$mainframe->close();
}
}
//Load pane behavior
jimport('joomla.html.pane');
$commentId = JRequest::getVar('commentid', '');
$comment = Komento::getTable('Comments');
$comment->load($commentId);
$this->comment = $comment;
// Set default values for new entries.
if (empty($comment->created)) {
Komento::import('helper', 'date');
$date = KomentoDateHelper::getDate();
$now = KomentoDateHelper::toFormat($date);
$comment->created = $now;
$comment->published = true;
}
// Set all non published comments to unpublished
if ($comment->published != 1) {
$comment->published = 0;
}
// @task: Translate each component with human readable name.
foreach ($result as $item) {
$components[] = JHTML::_('select.option', $item, Komento::loadApplication($item)->getComponentName());
}
$this->assignRef('comment', $comment);
$this->assignRef('components', $components);
parent::display($tpl);
}
示例5: process
/**
* Process comments data
**/
public static function process($row, $admin = 0)
{
if (isset($row->processed) && $row->processed) {
return $row;
}
Komento::setCurrentComponent($row->component);
$config = Komento::getConfig();
$konfig = Komento::getKonfig();
$user = JFactory::getUser()->id;
$commentsModel = Komento::getModel('comments');
Komento::import('helper', 'date');
// Duplicate created date first before lapsed time messing up the original date
$row->unformattedDate = $row->created;
// get number of child for each comment
$row->childs = $commentsModel->getTotalChilds($row->id);
// set url to proper url
if (!empty($row->url)) {
// Add 'http://' if not present
$row->url = 0 === strpos($row->url, 'http') ? $row->url : 'http://' . $row->url;
}
// 1. Load article and article details
$application = Komento::loadApplication($row->component)->load($row->cid);
if ($application === false) {
$application = Komento::getErrorApplication($row->component, $row->cid);
}
// set component title
$row->componenttitle = $application->getComponentName();
// set content title
$row->contenttitle = $application->getContentTitle();
// get permalink
$row->pagelink = $application->getContentPermalink();
$row->permalink = $row->pagelink . '#kmt-' . $row->id;
// set parentlink
if ($row->parent_id != 0) {
$row->parentlink = $row->pagelink . '#kmt-' . $row->parent_id;
}
// to be reassign
$row->shortlink = $row->permalink;
// set extension object
// use this to check if application is able to load article details
// if row->extension is false, means error loading article details
$row->extension = $application;
if ($admin == 0) {
// frontend
$actionsModel = Komento::getModel('actions');
$socialHelper = Komento::getHelper('social');
// parse comments HTML
$row->comment = self::parseComment($row->comment);
// author's object
$row->author = Komento::getProfile($row->created_by);
// don't convert for guest
if ($row->created_by != 0 && $row->created_by != $row->author->id) {
if ($config->get('enable_orphanitem_convert')) {
KomentoCommentHelper::convertOrphanitem($row->id);
}
}
if ($row->created_by != 0) {
switch ($config->get('name_type')) {
case 'username':
// force username
$row->name = $row->author->getUsername();
break;
case 'name':
$row->name = $row->author->getName();
break;
case 'default':
default:
// default name to profile if name is null
if (empty($row->name)) {
$row->name = $row->author->getName();
}
break;
}
} else {
if (empty($row->name)) {
$row->name = JText::_('COM_KOMENTO_GUEST');
} else {
if ($config->get('guest_label')) {
$row->name = JText::_('COM_KOMENTO_GUEST') . ' - ' . $row->name;
}
}
}
// set datetime
if ($config->get('enable_lapsed_time')) {
$row->created = KomentoDateHelper::getLapsedTime($row->unformattedDate);
} else {
$dateformat = $config->get('date_format');
$row->created = KomentoDateHelper::toFormat(KomentoDateHelper::dateWithOffSet($row->created), $dateformat);
// $row->created = Komento::getDate( $row->created )->toFormat( $dateformat );
}
// get actions likes
$row->likes = $actionsModel->countAction('likes', $row->id);
// get user liked
$row->liked = $actionsModel->liked($row->id, $user);
// get user reported
$row->reported = $actionsModel->reported($row->id, $user);
} else {
//.........这里部分代码省略.........
示例6: getSql
public static function getSql()
{
Komento::import('class', 'sql');
$sql = new KomentoSql();
return $sql;
}
示例7: defined
<?php
/**
* @package Komento
* @copyright Copyright (C) 2012 Stack Ideas Private Limited. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*
* Komento is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Restricted access');
Komento::import( 'helper', 'file' );
class KomentoFileHelper
{
public function upload( $fileItem, $fileName = '', $storagePath = '', $published = 1 )
{
// $fileItem['name'] = filename
// $fileItem['type'] = mime
// $fileItem['tmp_name'] = temporary source
// $fileItem['size'] = size
if( empty( $fileItem ) )
{
return false;
}
示例8: getData
function getData($options = array())
{
$mainframe = JFactory::getApplication();
$view = JRequest::getVar('view');
// define default values
$defaultOptions = array('no_tree' => 0, 'component' => '*', 'published' => '*', 'userid' => '', 'parent_id' => 0, 'no_search' => 0, 'no_child' => 0);
// take the input values and clear unexisting keys
$options = Komento::mergeOptions($defaultOptions, $options);
$querySelect = '';
$querySelectCount = '';
$queryWhere = array();
$queryOrder = '';
$queryLimit = '';
$queryTotal = '';
$filter_publish = $mainframe->getUserStateFromRequest('com_komento.' . $view . '.filter_publish', 'filter_publish', $options['published'], 'string');
$filter_component = $mainframe->getUserStateFromRequest('com_komento.' . $view . '.filter_component', 'filter_component', $options['component'], 'string');
$filter_order = $mainframe->getUserStateFromRequest('com_komento.' . $view . '.filter_order', 'filter_order', 'created', 'string');
$filter_order_Dir = $mainframe->getUserStateFromRequest('com_komento.' . $view . '.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
$search = $mainframe->getUserStateFromRequest('com_komento.' . $view . '.search', 'search', '', 'string');
$limit = $mainframe->getUserStateFromRequest('com_komento.' . $view . '.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest('com_komento.' . $view . '.limitstart', 'limitstart', 0, 'int');
Komento::import('helper', 'string');
$search = KomentoStringHelper::escape(trim(JString::strtolower($search)));
// clear search if nosearch = 1
// for view parent purposes during search
if ($options['no_search']) {
$search = '';
}
/*if( $options['no_tree'] == 0 )
{
// $querySelect = 'SELECT x.*, COUNT(y.id) - 1 AS childs FROM ' . $this->db->namequote('#__komento_comments') . ' AS x';
// $querySelect .= ' INNER JOIN ' . $this->db->namequote('#__komento_comments') . ' AS y';
// $querySelect .= ' ON x.component = y.component';
// $querySelect .= ' AND x.cid = y.cid';
// $querySelect .= ' AND x.lft BETWEEN y.lft AND y.rgt';
$querySelect = 'SELECT * FROM ' . $this->db->nameQuote( '#__komento_comments' );
}
else
{
$querySelect = 'SELECT x.*, y.depth FROM (';
$querySelect .= ' SELECT a.*, COUNT(a.id) - 1 AS childs FROM ' . $this->db->namequote('#__komento_comments') . ' AS a';
$querySelect .= ' INNER JOIN ' . $this->db->namequote('#__komento_comments') . ' AS b';
$querySelect .= ' WHERE a.component = b.component';
$querySelect .= ' AND a.cid = b.cid';
$querySelect .= ' AND b.lft BETWEEN a.lft AND a.rgt';
$querySelect .= ' GROUP BY a.id) AS x';
$querySelect .= ' LEFT JOIN (';
$querySelect .= ' SELECT a.*, COUNT(c.id) - 1 AS depth FROM ' . $this->db->namequote('#__komento_comments') . ' AS a';
$querySelect .= ' INNER JOIN ' . $this->db->namequote('#__komento_comments') . ' AS c';
$querySelect .= ' WHERE a.component = c.component';
$querySelect .= ' AND a.cid = c.cid';
$querySelect .= ' AND a.lft BETWEEN c.lft AND c.rgt';
$querySelect .= ' GROUP BY a.id) AS y ON x.id = y.id';
}*/
$querySelect = 'SELECT * FROM ' . $this->db->nameQuote('#__komento_comments');
$querySelectCount = 'SELECT COUNT(1) FROM ' . $this->db->nameQuote('#__komento_comments');
// filter by component
if ($filter_component != '*') {
$queryWhere[] = $this->db->nameQuote('component') . ' = ' . $this->db->quote($filter_component);
}
// filter by publish state
if ($filter_publish != '*') {
$queryWhere[] = $this->db->nameQuote('published') . ' = ' . $this->db->quote($filter_publish);
}
/*
// filter by user
// not implemented yet
$filter_user = $mainframe->getUserStateFromRequest( 'com_komento.comments.filter_user', 'filter_user', '*', 'string' );
if($filter_user != '*')
{
$queryWhereForA[] = 'a.created_by = ' . $this->db->quote($filter_user);
}
*/
if ($search) {
$queryWhere[] = 'LOWER( ' . $this->db->nameQuote('comment') . ' ) LIKE \'%' . $search . '%\' ';
} else {
if ($options['no_tree'] == 0) {
$queryWhere[] = $this->db->nameQuote('parent_id') . ' = ' . $this->db->quote($options['parent_id']);
}
}
if (count($queryWhere) > 0) {
$queryWhere = ' WHERE ' . implode(' AND ', $queryWhere);
} else {
$queryWhere = '';
}
$queryOrder = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
if ($options['parent_id'] == 0 && $limit != 0) {
$queryLimit = ' LIMIT ' . $limitstart . ',' . $limit;
}
$queryTotal = $querySelectCount . $queryWhere;
// set pagination
$this->db->setQuery($queryTotal);
$this->_total = $this->db->loadResult();
jimport('joomla.html.pagination');
$this->_pagination = new JPagination($this->_total, $limitstart, $limit);
// actual query
$query = $querySelect . $queryWhere . $queryOrder . $queryLimit;
$this->db->setQuery($query);
$result = $this->db->loadObjectList();
//.........这里部分代码省略.........
示例9: defined
*
* Komento is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<?php // KURO THEME
Komento::trigger( 'onBeforeProcessComment', array( 'component' => $row->component, 'cid' => $row->cid, 'comment' => &$row ) );
// Process data
Komento::import( 'helper', 'comment' );
$row = KomentoCommentHelper::process( $row );
Komento::trigger( 'onAfterProcessComment', array( 'component' => $row->component, 'cid' => $row->cid, 'comment' => &$row ) );
// Construct classes for this row
$classes = array();
$classes[] = 'kmt-item';
// Usergroup CSS classes
if( $row->author->guest )
{
$classes[] = $system->config->get( 'layout_css_public' );
}
else
示例10: prepareData
private function prepareData( $type = 'new', $options )
{
Komento::import( 'helper', 'date' );
$data = array();
if( $type === 'confirm' )
{
$subscribeTable = Komento::getTable( 'subscription' );
$subscribeTable->load( $options['subscribeId'] );
$profile = Komento::getProfile( $subscribeTable->userid );
}
else
{
$profile = Komento::getProfile( $options['comment']->created_by );
$data['contentTitle'] = $options['comment']->contenttitle;
$data['contentPermalink'] = $options['comment']->pagelink;
$data['commentAuthorName'] = $options['comment']->name;
$data['commentAuthorAvatar'] = $profile->getAvatar();
}
$config = Komento::getConfig();
switch( $type )
{
case 'confirm':
$data['confirmLink'] = rtrim( JURI::root() , '/' ) . '/index.php?option=com_komento&task=confirmSubscription&id=' . $options['subscribeId'];
break;
case 'pending':
case 'moderate':
$hashkeys = Komento::getTable( 'hashkeys' );
$hashkeys->uid = $options['comment']->id;
$hashkeys->type = 'comment';
$hashkeys->store();
$key = $hashkeys->key;
$data['approveLink'] = rtrim( JURI::root() , '/' ) . '/index.php?option=com_komento&task=approveComment&token=' . $key;
$data['commentContent'] = JFilterOutput::cleanText($options['comment']->comment);
$date = KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate );
$date = KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) );
$data['commentDate'] = $date;
break;
case 'report':
$action = Komento::getTable( 'actions' );
$action->load( $options['actionId'] );
$actionUser = $action->action_by;
$data['actionUser'] = Komento::getProfile( $actionUser );
$data['commentPermalink'] = $data['contentPermalink'] . '#kmt-' . $options['comment']->id;
$data['commentContent'] = JFilterOutput::cleanText($options['comment']->comment);
$date = KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate );
$date = KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) );
$data['commentDate'] = $date;
break;
case 'reply':
case 'comment':
case 'new':
default:
$data['commentPermalink'] = $data['contentPermalink'] . '#kmt-' . $options['comment']->id;
$data['commentContent'] = JFilterOutput::cleanText($options['comment']->comment);
$date = KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate );
$date = KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) );
$data['commentDate'] = $date;
$data['unsubscribe'] = rtrim( JURI::root(), '/' ) . '/index.php?option=com_komento&task=unsubscribe&id=';
break;
}
return $data;
}
示例11: save
public function save($data)
{
$component = $data['target_component'];
unset($data['target_component']);
$cid = $data['target_id'];
unset($data['target_id']);
$type = $data['target_type'];
unset($data['target_type']);
Komento::import('helper', 'acl');
$defaultset = KomentoACLHelper::getEmptySet(true);
foreach ($defaultset as $key => $value) {
if (isset($data[$key])) {
$defaultset->{$key} = $data[$key] ? true : false;
}
}
$table = Komento::getTable('Acl');
$table->compositeLoad($cid, $type, $component);
$json = Komento::getJSON();
$table->rules = $json->encode($defaultset);
return $table->store();
}
示例12: shortenLink
function shortenLink()
{
$link = JRequest::getVar( 'url' );
if( $link != '' )
{
Komento::import( 'helper', 'social' );
$link = KomentoSocialHelper::shortenUrl( $link );
}
$ajax = Komento::getAjax();
$ajax->success( $link );
$ajax->send();
}