当前位置: 首页>>代码示例>>PHP>>正文


PHP Komento::setCurrentComponent方法代码示例

本文整理汇总了PHP中Komento::setCurrentComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::setCurrentComponent方法的具体用法?PHP Komento::setCurrentComponent怎么用?PHP Komento::setCurrentComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Komento的用法示例。


在下文中一共展示了Komento::setCurrentComponent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:foundry.php

示例2: display

 public function display($tpl = null)
 {
     $konfig = Komento::getKonfig();
     $id = JRequest::getInt('id', 0);
     // @task: If profiles are disabled, do not show the profile here.
     if (!$konfig->get('profile_enable')) {
         $app = JFactory::getApplication();
         $app->redirect('index.php', JText::_('COM_KOMENTO_PROFILE_SYSTEM_DISABLED'));
         $app->close();
     }
     $profileModel = Komento::getModel('Profile');
     $activityModel = Komento::getModel('Activity');
     $commentsModel = Komento::getModel('Comments');
     $actionsModel = Komento::getModel('Actions');
     $count = new stdClass();
     $user = JFactory::getUser();
     if ($id === 0 && $user->id > 0) {
         $id = $user->id;
     }
     // Block non-exists profile
     if (!$profileModel->exists($id)) {
         echo JText::_('COM_KOMENTO_PROFILE_NOT_FOUND');
         return;
     }
     // TODO: Block custom profile id
     // ..
     $profile = Komento::getProfile($id);
     // $activities		= $activityModel->getUserActivities( $profile->id );
     $count->totalComments = $commentsModel->getTotalComment($profile->id);
     $count->likesReceived = $actionsModel->getLikesReceived($profile->id);
     $count->likesGiven = $actionsModel->getLikesGiven($profile->id);
     // Set Pathway
     // Check if Komento profile menu item exist before setting profile pathway
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     $item = $menu->getActive();
     if (empty($item) || $item->query['view'] != 'profile') {
         $this->setPathway(JText::_('COM_KOMENTO_PROFILE'), '');
     }
     $this->setPathway($profile->getName(), '');
     // Set browser title
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_KOMENTO_USER_PROFILE') . ' - ' . $profile->getName());
     // set component to com_komento
     Komento::setCurrentComponent('com_komento');
     $theme = Komento::getTheme();
     $theme->set('profile', $profile);
     $theme->set('count', $count);
     // $theme->set( 'activities', $activities );
     echo $theme->fetch('profile/profile.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:51,代码来源:view.html.php

示例3: __construct

 function __construct()
 {
     $component = JRequest::getCmd('component', '');
     $cid = JRequest::getInt('cid', 0);
     $id = JRequest::getInt('id', 0);
     if ($component == '' && $cid == 0 && $id != 0) {
         $tmp = Komento::getTable('comments');
         $tmp->load($id);
         $component = $tmp->component;
         $cid = $tmp->cid;
     }
     if ($component) {
         Komento::setCurrentComponent($component);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:15,代码来源:view.ajax.php

示例4: upload

	public function upload()
	{
		$component	= JRequest::getString( 'component' );
		Komento::setCurrentComponent( $component );

		$profile	= Komento::getProfile();
		$config		= Komento::getConfig();

		// acl stuffs here
		if( !$config->get( 'upload_enable' ) || !$profile->allow( 'upload_attachment' ) )
		{
			echo json_encode( array( 'status' => 'notallowed' ) ); exit;
		}

		$file	= JRequest::getVar( 'file', '', 'FILES', 'array' );

		// check for file size if runtime HTML4 is used
		if( $file['size'] > ( $config->get( 'upload_max_size' ) * 1024 * 1024 ) )
		{
			echo json_encode( array( 'status' => 'exceedfilesize' ) ); exit;
		}

		// $file['name'] = filename
		// $file['type'] = mime
		// $file['tmp_name'] = temporary source
		// $file['size'] = size

		$id = Komento::getHelper( 'file' )->upload( $file );

		$result = array(
			'status'	=> 1,
			'id'		=> 0
		);

		if( $id === false )
		{
			$result['status'] = 0;
		}
		else
		{
			$result['id'] = $id;
		}

		// do not return
		// echo json string instead and exit

		echo json_encode( $result ); exit;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:48,代码来源:file.php

示例5: 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;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:16,代码来源:view.html.php

示例6: 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 {
//.........这里部分代码省略.........
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:comment.php

示例7: allow

	public static function allow( $type, $comment = '', $component = '', $cid = '' )
	{
		// for complicated acl situations
		// $type = ['edit', 'delete', 'publish', 'unpublish', 'stick', 'delete_attachment'];

		if( !empty( $comment ) && ( empty( $component ) || empty( $cid ) ) )
		{
			if( !is_object( $comment ) )
			{
				$comment = Komento::getComment( $comment );
			}

			$component = $comment->component;
			$cid = $comment->cid;
		}

		if( empty( $component ) || empty( $cid ) )
		{
			return false;
		}

		$profile		= Komento::getProfile();
		$application	= Komento::loadApplication( $component )->load( $cid );

		Komento::setCurrentComponent( $component );

		switch( $type )
		{
			case 'edit':
				if( $profile->id != 0 && ($profile->allow( 'edit_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_edit_comment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'edit_own_comment' ))))
				{
					return true;
				}
				break;
			case 'delete':
				if( $profile->id != 0 && ($profile->allow( 'delete_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_delete_comment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'delete_own_comment' ))))
				{
					return true;
				}
				break;
			case 'publish':
				if( $profile->allow( 'publish_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_publish_comment' ) ) )
				{
					return true;
				}
				break;
			case 'unpublish':
				if( $profile->allow( 'unpublish_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_unpublish_comment' ) ) )
				{
					return true;
				}
				break;
			case 'stick':
				if( $profile->allow( 'stick_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_stick_comment' ) ) )
				{
					return true;
				}
				break;
			case 'like':
				if( $profile->allow( 'like_comment' ) )
				{
					return true;
				}
				break;
			case 'report':
				if( $profile->allow( 'report_comment' ) )
				{
					return true;
				}
				break;
			case 'delete_attachment':
				if( $profile->allow( 'delete_all_attachment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_delete_attachment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'delete_own_attachment' ) ) )
				{
					return true;
				}
				break;
		}

		return false;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:80,代码来源:acl.php

示例8: approveComment

 public function approveComment()
 {
     $id = JRequest::getInt('commentId', '');
     $comment = Komento::getComment($id);
     Komento::setCurrentComponent($comment->component);
     $acl = Komento::getHelper('acl');
     $type = 'message';
     $message = '';
     if (!$acl->allow('publish', $comment)) {
         $type = 'error';
         $message = JText::_('COM_KOMENTO_NOT_ALLOWED');
         $this->setRedirect('index.php?option=com_komento', $message, $type);
         return false;
     }
     $model = Komento::getModel('comments');
     if ($model->publish($id)) {
         $message = JText::_('COM_KOMENTO_COMMENTS_COMMENT_PUBLISHED');
     } else {
         $message = JText::_('COM_KOMENTO_COMMENTS_COMMENT_PUBLISH_ERROR');
         $type = 'error';
     }
     $this->setRedirect('index.php?option=com_komento', $message, $type);
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:24,代码来源:controller.php

示例9: defined

* 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');
?>

<div class="kmt-mod modKomentoComments kmt-mod-comments<?php 
echo $params->get('moduleclass_sfx');
?>
">
	<?php 
foreach ($comments as $row) {
    // initialise current row component
    Komento::setCurrentComponent($row->component);
    $config = Komento::getConfig();
    $row = Komento::getHelper('comment')->process($row);
    //convert <br /> to \n
    $row->comment = str_replace("<br />", "\n", $row->comment);
    $row->comment = strip_tags($row->comment);
    // trim comment length
    if (JString::strlen($row->comment) > $params->get('maxcommentlength')) {
        $row->comment = JString::substr($row->comment, 0, $params->get('maxcommentlength')) . '...';
    }
    // convert back \n to <br />
    $row->comment = str_replace("\n", "<br/>", $row->comment);
    $row->comment = str_replace("<br/><br/>", "<br/>", $row->comment);
    // trim title length
    if (JString::strlen($row->contenttitle) > $params->get('maxtitlelength')) {
        $row->contenttitle = JString::substr($row->contenttitle, 0, $params->get('maxtitlelength')) . '...';
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:default.php


注:本文中的Komento::setCurrentComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。