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


PHP Komento::mergeOptions方法代码示例

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


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

示例1: getTotalPopularComments

 function getTotalPopularComments($component = 'all', $cid = 'all', $options = array())
 {
     // define default values
     $defaultOptions = array('start' => 0, 'limit' => 10, 'userid' => 'all', 'sticked' => 'all', 'published' => 1, 'minimumlikes' => 0, 'random' => 0);
     $querySelect = '';
     $queryWhere = array();
     $queryGroup = '';
     $queryOrder = '';
     $queryLimit = '';
     // take the input values and clear unexisting keys
     $options = Komento::mergeOptions($defaultOptions, $options);
     $querySelect = 'SELECT comments.*, COUNT(actions.comment_id) AS likes FROM ' . $this->db->nameQuote('#__komento_comments') . ' AS comments';
     $querySelect .= ' LEFT JOIN ' . $this->db->nameQuote('#__komento_actions') . ' AS actions ON comments.id = actions.comment_id';
     if ($component !== 'all') {
         $queryWhere[] = 'comments.component = ' . $this->db->quote($component);
     }
     if ($cid !== 'all') {
         if (is_array($cid)) {
             $cid = implode(',', $cid);
         }
         if (empty($cid)) {
             $queryWhere[] = 'comments.cid = 0';
         } else {
             $queryWhere[] = 'comments.cid IN (' . $cid . ')';
         }
     }
     if ($options['userid'] !== 'all') {
         $queryWhere[] = 'comments.created_by = ' . $this->db->quote($options['userid']);
     }
     if ($options['published'] !== 'all') {
         $queryWhere[] = 'comments.published = ' . $this->db->quote($options['published']);
     }
     if ($options['sticked'] !== 'all') {
         $queryWhere[] = 'comments.sticked = ' . $this->db->quote(1);
     }
     $queryWhere[] = 'actions.type = ' . $this->db->quote('likes');
     if (count($queryWhere) > 0) {
         $queryWhere = ' WHERE ' . implode(' AND ', $queryWhere);
     } else {
         $queryWhere = '';
     }
     $queryGroup = ' GROUP BY actions.comment_id';
     if ($options['minimumlikes'] > 0) {
         $queryGroup .= ' HAVING likes >= ' . $options['minimumlikes'];
     }
     $query = 'SELECT COUNT(1) FROM (' . $querySelect . $queryWhere . $queryGroup . ') AS x';
     $this->db->setQuery($query);
     return $this->db->loadResult();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:49,代码来源:comments.php

示例2: addJomSocialActivity

	public static function addJomSocialActivity( $options = array() )
	{
		$defaultOptions = array(
			'comment'		=> '',
			'title'			=> '',
			'content'		=> '',
			'cmd'			=> '',
			'actor'			=> '',
			'target'		=> 0,
			'app'			=> '',
			'cid'			=> '',
			'comment_id'	=> '',
			'comment_type'	=> '',
			'like_id'		=> '',
			'like_type'		=> ''

		);

		$options = Komento::mergeOptions( $defaultOptions, $options );

		$jsCoreFile	= JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
		$config		= Komento::getConfig();

		if( !JFile::exists( $jsCoreFile ) )
		{
			return false;
		}
		require_once( $jsCoreFile );

		$obj				= (object) $options;

		// add JomSocial activities
		CFactory::load ( 'libraries', 'activities' );
		CActivityStream::add( $obj );
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:35,代码来源:activity.php

示例3: getCommentCount

 function getCommentCount($options = array())
 {
     $query = 'SELECT COUNT(1) FROM `#__easyblog_comment`';
     $defaultOptions = array('post_id' => 'all');
     $options = Komento::mergeOptions($defaultOptions, $options);
     $queryWhere = array();
     if (!empty($options['post_id']) && $options['post_id'] !== 'all') {
         $options['post_id'] = (array) $options['post_id'];
         $queryWhere[] = $this->_db->namequote('post_id') . ' IN (' . implode(',', $options['post_id']) . ')';
     }
     if (count($queryWhere) > 0) {
         $query .= ' WHERE ' . implode(' AND ', $queryWhere);
     }
     $this->_db->setQuery($query);
     return $this->_db->loadResult();
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:16,代码来源:migrators.php


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