本文整理汇总了PHP中Komento::getErrorApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::getErrorApplication方法的具体用法?PHP Komento::getErrorApplication怎么用?PHP Komento::getErrorApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Komento
的用法示例。
在下文中一共展示了Komento::getErrorApplication方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process($row)
{
Komento::setCurrentComponent($row->component);
// set extension object
$row->extension = Komento::loadApplication($row->component)->load($row->cid);
if ($row->extension === false) {
$row->extension = Komento::getErrorApplication($row->component, $row->cid);
}
// get permalink
$row->pagelink = $row->extension->getContentPermalink();
// set content title
$row->contenttitle = $row->extension->getContentTitle();
// set component title
$row->componenttitle = $row->extension->getComponentName();
return $row;
}
示例2: loadComments
public static function loadComments( $id, $component, $options = array() )
{
$commentsModel = Komento::getModel( 'comments' );
$comments = $commentsModel->getComments( $component, $id, $options );
$commentsModel = Komento::getModel( 'comments' );
$commentCount = $commentsModel->getCount( $component, $id );
if( array_key_exists('raw', $options) )
{
return $comments;
}
// @task: load necessary css and javascript files.
Komento::getHelper( 'Document' )->loadHeaders();
$application = Komento::loadApplication( $component );
if( $application->load( $id ) === false )
{
$application = Komento::getErrorApplication( $component, $id );
}
$theme = Komento::getTheme();
$theme->set( 'component', $component );
$theme->set( 'cid', $id );
$theme->set( 'comments', $comments );
$theme->set( 'options', $options );
$theme->set( 'componentHelper', $application );
$theme->set( 'application', $application );
$theme->set( 'commentCount', $commentCount );
$contentLink = $application->getContentPermalink();
$theme->set( 'contentLink', $contentLink );
$html = $theme->fetch('comment/box.php');
/* [KOMENTO_POWERED_BY_LINK] */
// free version powered by link append (for reference only)
// $html .= '<div style="text-align: center; padding: 20px 0;"><a href="http://stackideas.com">' . JText::_( 'COM_KOMENTO_POWERED_BY_KOMENTO' ) . '</a></div>';
return $html;
}
示例3: process
public function process( $action, $comment )
{
// process all activities and 3rd party integration here
// Due to the possible conflict data of $comment->created containing lapsed time instead of raw date, we use the table object directly instead
if( !( $comment instanceof KomentoTableComments ) )
{
$id = 0;
if( is_int( $comment ) || is_string( $comment ) )
{
$id = $comment;
}
if( $comment instanceof KomentoComment )
{
$id = $comment->id;
}
$comment = Komento::getTable( 'comments' );
$comment->load( $id );
}
if( $action != 'remove' && $comment->published != 1 )
{
return false;
}
$config = Komento::getConfig();
$profile = Komento::getProfile();
$application = Komento::loadApplication( $comment->component )->load( $comment->cid );
if( $application === false)
{
$application = Komento::getErrorApplication( $comment->component, $comment->cid );
}
$pagelink = $application->getContentPermalink();
$permalink = $pagelink . '#' . $comment->id;
$author = $application->getAuthorId();
$title = $application->getContentTitle();
if( $profile->id == 0 )
{
return false;
}
// native activity
if( ( $action == 'comment' && $config->get( 'activities_comment' ) ) || ( $action == 'reply' && $config->get( 'activities_reply' ) ) || ( $action == 'like' && $config->get( 'activities_like' ) ) )
{
$this->addActivity( $action, $comment->id, $comment->created_by );
}
// Add jomsocial activity
if( $action == 'comment' && $config->get( 'jomsocial_enable_comment' ) )
{
$this->addJomSocialActivityComment( $comment );
}
if( $action == 'reply' && $config->get( 'jomsocial_enable_reply' ) )
{
$this->addJomSocialActivityReply( $comment );
}
if( $action == 'like' && $config->get( 'jomsocial_enable_like' ) )
{
$this->addJomSocialActivityLike( $comment, $profile->id );
}
// Add jomsocial userpoints
if( $config->get( 'jomsocial_enable_userpoints' ) )
{
switch( $action )
{
case 'comment':
Komento::addJomSocialPoint( 'com_komento.comment.add' );
Komento::addJomSocialPoint( 'com_komento.comment.add.author', $author );
break;
case 'reply':
Komento::addJomSocialPoint( 'com_komento.comment.reply' );
break;
case 'like':
Komento::addJomSocialPoint( 'com_komento.comment.like' );
Komento::addJomSocialPoint( 'com_komento.comment.liked', $comment->created_by );
break;
case 'unlike':
Komento::addJomSocialPoint( 'com_komento.comment.unlike' );
Komento::addJomSocialPoint( 'com_komento.comment.unliked', $comment->created_by );
break;
case 'report':
Komento::addJomSocialPoint( 'com_komento.comment.report' );
Komento::addJomSocialPoint( 'com_komento.comment.reported', $comment->created_by );
break;
case 'unreported':
Komento::addJomSocialPoint( 'com_komento.comment.unreport' );
Komento::addJomSocialPoint( 'com_komento.comment.unreported', $comment->created_by );
//.........这里部分代码省略.........
示例4: 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 {
//.........这里部分代码省略.........
示例5: getAuthor
public function getAuthor( $type, $options )
{
$config = Komento::getConfig();
if( !$config->get( 'notification_to_author' ) )
{
return array();
}
$application = Komento::loadApplication( $options['component'] )->load( $options['cid'] );
if( $application === false )
{
$application = Komento::getErrorApplication( $options['component'], $options['cid'] );
}
$userid = $application->getAuthorId();
$obj = new stdClass();
$user = JFactory::getUser( $userid );
$obj->id = $user->id;
$obj->fullname = JText::_( $user->name );
$obj->email = $user->email;
return array( $user->email => $obj );
}
示例6: display
function display($tmpl = null)
{
$config = Komento::getConfig();
if (!$config->get('enable_rss')) {
return;
}
require_once KOMENTO_HELPERS . DIRECTORY_SEPARATOR . 'helper.php';
$component = JRequest::getString('component', 'all');
$cid = JRequest::getInt('cid');
$cid = !$cid ? 'all' : $cid;
$userid = JRequest::getInt('userid', null);
if ($component != 'all' && $cid != 'all') {
$application = Komento::loadApplication($component)->load($cid);
if ($application === false) {
$application = Komento::getErrorApplication($component, $cid);
}
$contentTitle = $component != 'all' && $cid != 'all' ? $application->getContentTitle() : '';
}
$username = $userid !== null ? Komento::getProfile($userid)->getName() : '';
$document = JFactory::getDocument();
// to do: get permalink or view name from api/componentlist
if ($component != 'all' && $cid != 'all') {
$document->link = $application->getContentPermalink();
} else {
$document->link = JURI::root();
}
// to do : get article name from api/componentlist
// document title based on request parameter
// integrate settings for rss
// allow all component rss
// allow all article rss
// allow all user rss
// allow all guest rss
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_LATEST_TITLE'));
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_LATEST_TITLE_DESCRIPTION'));
if ($component == 'all') {
if ($cid != 'all') {
// impossible all component and specific article
echo 'Error! Component = all, cid != all.';
exit;
}
// all component all article
if (is_null($userid)) {
// all users/guests
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_ALL_COMMENTS_TITLE'));
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_ALL_COMMENTS_TITLE_DESCRIPTION'));
} else {
if ($userid === 0) {
// for all guest $userid = 0
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_TITLE'));
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_TITLE_DESCRIPTION'));
} else {
// specific user
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_TITLE') . ' : ' . $username);
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_TITLE_DESCRIPTION') . ' : ' . $username);
}
}
} else {
// specific component
if ($cid == 'all') {
// all article
if (is_null($userid)) {
// all users/guests
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FOR_COMPONENT_TITLE') . ' : ' . Komento::loadApplication($component)->getComponentName());
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FOR_COMPONENT_TITLE_DESCRIPTION'));
} else {
if ($userid === 0) {
// for all guest $userid = 0
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_FOR_COMPONENT_TITLE') . ' : ' . Komento::loadApplication($component)->getComponentName());
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_FOR_COMPONENT_TITLE_DESCRIPTION'));
} else {
// specific user
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_FOR_COMPONENT_TITLE') . ' : ' . $username . ' : ' . Komento::loadApplication($component)->getComponentName());
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_FOR_COMPONENT_TITLE_DESCRIPTION') . ' : ' . $username);
}
}
} else {
// specific article
if (is_null($userid)) {
// all users/guests
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FOR_COMPONENT_OF_ARTICLE_TITLE') . ' : ' . Komento::loadApplication($component)->getComponentName() . ' : ' . $contentTitle);
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FOR_COMPONENT_OF_ARTICLE_TITLE_DESCRIPTION'));
} else {
if ($userid === 0) {
// for all guest $userid = 0
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_FOR_COMPONENT_OF_ARTICLE_TITLE') . ' : ' . Komento::loadApplication($component)->getComponentName() . ' : ' . $contentTitle);
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_FOR_COMPONENT_OF_ARTICLE_TITLE_DESCRIPTION'));
} else {
// specific user
$document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_FOR_COMPONENT_TITLE_OF_ARTICLE') . ' : ' . $username . ' : ' . Komento::loadApplication($component)->getComponentName() . ' : ' . $contentTitle);
$document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_FOR_COMPONENT_TITLE_OF_ARTICLE_DESCRIPTION') . ' : ' . $username);
}
}
}
}
$options = array('sort' => 'latest', 'limit' => $config->get('rss_max_items'), 'userid' => $userid === null ? 'all' : $userid, 'threaded' => 0);
$commentsModel = Komento::getModel('comments');
$comments = $commentsModel->getComments($component, $cid, $options);
if (!empty($comments)) {
foreach ($comments as $row) {
//.........这里部分代码省略.........
示例7: publish
function publish( $type = 1 )
{
$id = JRequest::getInt( 'id' );
$affectChild = JRequest::getInt( 'affectChild', 1 );
$ajax = Komento::getAjax();
$commentObj = Komento::getComment( $id );
$commentModel = Komento::getModel( 'comments' );
$acl = Komento::getHelper( 'Acl' );
$application = Komento::loadApplication( $commentObj->component )->load( $commentObj->cid );
if( $application === false )
{
$application = Komento::getErrorApplication( $commentObj->component, $commentObj->cid );
}
if( ( $type == 1 && $acl->allow( 'publish', $commentObj ) ) || ( $type == 0 && $acl->allow( 'unpublish', $commentObj ) ) )
{
if( $affectChild )
{
$childs = $commentModel->getChilds( $id );
if( count( $childs ) > 0 )
{
foreach( $childs as $child )
{
$childObj = Komento::getComment( $child );
if( !$childObj->publish( $type ) )
{
$errors = JText::_( 'COM_KOMENTO_ERROR' );
if( $childObj->getErrors() )
{
$errors = implode( '\n', $childObj->getErrors() );
}
$ajax->fail( $errors );
$ajax->send();
}
}
}
}
if( !$commentObj->publish( $type ) )
{
$errors = JText::_( 'COM_KOMENTO_ERROR' );
if( $commentObj->getErrors() )
{
$errors = implode( '\n', $commentObj->getErrors() );
}
$ajax->fail( $errors );
$ajax->send();
}
$ajax->success();
}
else
{
$ajax->fail( JText::_( 'COM_KOMENTO_ACL_NO_PERMISSION' ) );
}
$ajax->send();
}