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


PHP CFactory::load方法代码示例

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


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

示例1: getFieldHTML

 function getFieldHTML($field, $required)
 {
     $html = '';
     $selectedElement = 0;
     $class = $field->required == 1 ? ' required validate-custom-radio' : '';
     $elementSelected = 0;
     $elementCnt = 0;
     for ($i = 0; $i < count($field->options); $i++) {
         $option = $field->options[$i];
         $selected = $option == $field->value ? ' checked="checked"' : '';
         if (empty($selected)) {
             $elementSelected++;
         }
         $elementCnt++;
     }
     $cnt = 0;
     CFactory::load('helpers', 'string');
     $class = !empty($field->tips) ? 'jomTips tipRight' : '';
     $html .= '<div class="' . $class . '" style="display: inline-block;" title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '">';
     for ($i = 0; $i < count($field->options); $i++) {
         $option = $field->options[$i];
         $selected = $option == $field->value ? ' checked="checked"' : '';
         $html .= '<label class="lblradio-block">';
         $html .= '<input type="radio" name="field' . $field->id . '" value="' . $option . '"' . $selected . '  class="radio ' . $class . '" style="margin: 0 5px 0 0;" />';
         $html .= JText::_($option) . '</label>';
     }
     $html .= '<span id="errfield' . $field->id . 'msg" style="display: none;">&nbsp;</span>';
     $html .= '</div>';
     return $html;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:30,代码来源:radio.php

示例2: onProfileStatusUpdate

 /**
  * Method is called during the status update triggers. 
  **/
 public function onProfileStatusUpdate($userid, $oldMessage, $newMessage)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     if ($config->get('fbconnectpoststatus')) {
         CFactory::load('libraries', 'facebook');
         $facebook = new CFacebook();
         if ($facebook) {
             $fbuserid = $facebook->getUser();
             $connectModel = CFactory::getModel('Connect');
             $connectTable =& JTable::getInstance('Connect', 'CTable');
             $connectTable->load($fbuserid);
             // Make sure the FB session match the user session
             if ($connectTable->userid == $my->id) {
                 /**
                  * Check post status to facebook settings
                  */
                 //echo "posting to facebook"; exit;
                 $targetUser = CFactory::getUser($my->id);
                 $userParams = $targetUser->getParams();
                 if ($userParams->get('postFacebookStatus')) {
                     $result = $facebook->postStatus($newMessage);
                     //print_r($result); exit;
                 }
             }
         }
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:31,代码来源:profile.trigger.php

示例3: deletegroupmembers

 function deletegroupmembers($data)
 {
     require_once JPATH_SITE . '/components/com_community/libraries/core.php';
     CFactory::load('libraries', 'apps');
     $error_messages = array();
     $success_messages = array();
     $response = NULL;
     $validated = true;
     if ("" == $data['groupid'] || 0 == $data['groupid']) {
         $validated = false;
         $error_messages[] = array("id" => 1, "fieldname" => "groupid", "message" => "Groupid cannot be blank");
     }
     if (false == array_key_exists('memberids', $data) || 0 == sizeof($data['memberids'])) {
         $validated = false;
         $error_messages[] = array("id" => 1, "fieldname" => "memberids", "message" => "Memberids cannot be blank");
     }
     if (true == $validated) {
         $model =& CFactory::getModel('groups');
         $group =& JTable::getInstance('Group', 'CTable');
         $group->id = $data['groupid'];
         $group->ownerid = $data['ownerid'];
     }
     if ($data['ownerid'] == $data['memberids']) {
         $validated = false;
         $error_messages[] = array("id" => 1, "fieldname" => "ownerid/memberid", "message" => "owner id and member id are same.please update 'ownwrid or memberid' fields in request");
     } else {
         $groupMember =& JTable::getInstance('GroupMembers', 'CTable');
         $memberId = $data['memberids'];
         $groupId = $data['groupid'];
         $groupMember->load($memberId, $groupId);
         $data = new stdClass();
         $data->groupid = $groupId;
         $data->memberid = $memberId;
         $data = new stdClass();
         $data->groupid = $groupId;
         $data->memberid = $memberId;
         $model->removeMember($data);
         $db =& JFactory::getDBO();
         $query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__community_groups_members') . ' ' . 'WHERE groupid=' . $db->Quote($groupId) . ' ' . 'AND approved=' . $db->Quote('1');
         $db->setQuery($query);
         $membercount = $db->loadResult();
         $members = new stdClass();
         $members->id = $groupId;
         $members->membercount = $membercount;
         $db->updateObject('#__community_groups', $members, 'id');
         //add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('group.member.remove', $memberId);
     }
     if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
         $res = array();
         foreach ($error_messages as $key => $error_message) {
             $res[] = $error_message;
         }
         $response = array("id" => 0, 'errors' => $res);
     } else {
         $response = array('id' => $memberId);
     }
     return $response;
 }
开发者ID:beingsane,项目名称:Joomla-REST-API,代码行数:60,代码来源:group_members_delete.php

示例4: send

 /**
  * Do a batch send
  */
 function send($total = 100)
 {
     $mailqModel = CFactory::getModel('mailq');
     $userModel = CFactory::getModel('user');
     $mails = $mailqModel->get($total);
     $jconfig = JFactory::getConfig();
     $mailer = JFactory::getMailer();
     $config = CFactory::getConfig();
     $senderEmail = $jconfig->getValue('mailfrom');
     $senderName = $jconfig->getValue('fromname');
     if (empty($mails)) {
         return;
     }
     CFactory::load('helpers', 'string');
     foreach ($mails as $row) {
         // @rule: only send emails that is valid.
         // @rule: make sure recipient is not blocked!
         $userid = $userModel->getUserFromEmail($row->recipient);
         $user = CFactory::getUser($userid);
         if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) {
             $mailer->setSender(array($senderEmail, $senderName));
             $mailer->addRecipient($row->recipient);
             $mailer->setSubject($row->subject);
             $tmpl = new CTemplate();
             $raw = isset($row->params) ? $row->params : '';
             $params = new JParameter($row->params);
             $base = $config->get('htmlemail') ? 'email.html' : 'email.text';
             if ($config->get('htmlemail')) {
                 $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body);
                 $mailer->IsHTML(true);
             } else {
                 //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags.
                 $row->body = CStringHelper::escape(strip_tags($row->body));
             }
             $tmpl->set('content', $row->body);
             $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template'));
             $tmpl->set('sitename', $config->get('sitename'));
             $row->body = $tmpl->fetch($base);
             // Replace any occurences of custom variables within the braces scoe { }
             if (!empty($row->body)) {
                 preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER);
                 foreach ($matches as $val) {
                     $replaceWith = $params->get($val[1], null);
                     //if the replacement start with 'index.php', we can CRoute it
                     if (strpos($replaceWith, 'index.php') === 0) {
                         $replaceWith = CRoute::getExternalURL($replaceWith);
                     }
                     if (!is_null($replaceWith)) {
                         $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body);
                     }
                 }
             }
             unset($tmpl);
             $mailer->setBody($row->body);
             $mailer->send();
         }
         $mailqModel->markSent($row->id);
         $mailer->ClearAllRecipients();
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:63,代码来源:mailq.php

示例5: __construct

	public function __construct() {
		$this->integration = KunenaIntegration::getInstance ('jomsocial');
		if (! $this->integration || ! $this->integration->isLoaded())
			return;
		CFactory::load('libraries', 'messaging');
		$this->priority = 40;
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:7,代码来源:private.php

示例6: export

 function export($event)
 {
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     if (!$handler->showExport()) {
         echo JText::_('CC ACCESS FORBIDDEN');
         return;
     }
     header('Content-type: text/Calendar');
     header('Content-Disposition: attachment; filename="calendar.ics"');
     $creator = CFactory::getUser($event->creator);
     $offset = $creator->getUtcOffset();
     $date = new JDate($event->startdate);
     $dtstart = $date->toFormat('%Y%m%dT%H%M%S');
     $date = new JDate($event->enddate);
     $dtend = $date->toFormat('%Y%m%dT%H%M%S');
     $url = $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false, true);
     $tmpl = new CTemplate();
     $tmpl->set('dtstart', $dtstart);
     $tmpl->set('dtend', $dtend);
     $tmpl->set('url', $url);
     $tmpl->set('event', $event);
     $raw = $tmpl->fetch('events.ical');
     unset($tmpl);
     echo $raw;
     exit;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:27,代码来源:view.raw.php

示例7: showGroupMiniHeader

 public function showGroupMiniHeader($groupId)
 {
     CMiniHeader::load();
     $option = JRequest::getVar('option', '', 'REQUEST');
     JFactory::getLanguage()->load('com_community');
     CFactory::load('models', 'groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $my = CFactory::getUser();
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$group->published) {
         return '';
     }
     if (!empty($group->id) && $group->id != 0) {
         $isMember = $group->isMember($my->id);
         $config = CFactory::getConfig();
         $tmpl = new CTemplate();
         $tmpl->set('my', $my);
         $tmpl->set('group', $group);
         $tmpl->set('isMember', $isMember);
         $tmpl->set('config', $config);
         $showMiniHeader = $option == 'com_community' ? $tmpl->fetch('groups.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('groups.miniheader') . '</div>';
         return $showMiniHeader;
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:25,代码来源:miniheader.php

示例8: _buildQuery

 public function _buildQuery()
 {
     $db =& JFactory::getDBO();
     $actor = JRequest::getVar('actor', '');
     $archived = JRequest::getInt('archived', 0);
     $app = JRequest::getVar('app', 'none');
     $where = array();
     CFactory::load('helpers', 'user');
     $userId = cGetUserId($actor);
     if ($userId != 0) {
         $where[] = 'actor=' . $db->Quote($userId) . ' ';
     }
     if ($archived != 0) {
         $archived = $archived - 1;
         $where[] = 'archived=' . $db->Quote($archived) . ' ';
     }
     if ($app != 'none') {
         $where[] = 'app=' . $db->Quote($app);
     }
     $query = 'SELECT * FROM ' . $db->nameQuote('#__community_activities');
     if (!empty($where)) {
         for ($i = 0; $i < count($where); $i++) {
             if ($i == 0) {
                 $query .= ' WHERE ';
             } else {
                 $query .= ' AND ';
             }
             $query .= $where[$i];
         }
     }
     $query .= ' ORDER BY created DESC';
     return $query;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:33,代码来源:activities.php

示例9: display

 /**
  * The default method that will display the output of this view which is called by
  * Joomla
  * 
  * @param	string template	Template file name
  **/
 public function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $config =& CFactory::getConfig();
     // Get required data's
     $events = $this->get('Events');
     $categories = $this->get('Categories');
     $pagination = $this->get('Pagination');
     $mainframe =& JFactory::getApplication();
     $filter_order = $mainframe->getUserStateFromRequest("com_community.events.filter_order", 'filter_order', 'a.title', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.events.filter_order_Dir", 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest("com_community.events.search", 'search', '', 'string');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // We need to assign the users object to the groups listing to get the users name.
     for ($i = 0; $i < count($events); $i++) {
         $row =& $events[$i];
         $row->user = JFactory::getUser($row->creator);
         // Truncate the description
         CFactory::load('helpers', 'string');
         $row->description = CStringHelper::truncate($row->description, $config->get('tips_desc_length'));
     }
     $catHTML = $this->_getCategoriesHTML($categories);
     $this->assignRef('events', $events);
     $this->assignRef('categories', $catHTML);
     $this->assignRef('search', $search);
     $this->assignRef('lists', $lists);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:37,代码来源:view.html.php

示例10: onAfterVote

 function onAfterVote($poll, $option_id)
 {
     $user =& JFactory::getUser();
     $points = JPATH_ROOT . '/components/com_community/libraries/core.php';
     $activity = JPATH_ROOT . '/components/com_community/libraries/core.php';
     if ($this->params->get('points', '0') == '1' && file_exists($points)) {
         require_once $points;
         CUserPoints::assignPoint('com_acepolls.vote');
     }
     if ($this->params->get('activity', '0') == '1' && file_exists($activity)) {
         require_once $activity;
         $text = JText::_('COM_ACEPOLLS_ACTIVITY_TEXT');
         $link = JRoute::_('index.php?option=com_acepolls&amp;view=poll&amp;id=' . $poll->id . ":" . $poll->alias . self::getItemid($poll->id));
         $act = new stdClass();
         $act->cmd = 'wall.write';
         $act->actor = $user->id;
         $act->target = 0;
         $act->title = JText::_('{actor} ' . $text . ' <a href="' . $link . '">' . $poll->title . '</a>');
         $act->content = '';
         $act->app = 'wall';
         $act->cid = 0;
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act);
     }
 }
开发者ID:vuchannguyen,项目名称:dayhoc,代码行数:25,代码来源:jomsocial.php

示例11: getAccessLevel

 public static function getAccessLevel($actorId, $targetId)
 {
     $actor = CFactory::getUser($actorId);
     $target = CFactory::getUser($targetId);
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'friends');
     // public guest
     $access = 0;
     // site members
     if ($actor->id > 0) {
         $access = 20;
     }
     // they are friends
     if ($target->id > 0 && CFriendsHelper::isConnected($actor->id, $target->id)) {
         $access = 30;
     }
     // mine, target and actor is the same person
     if ($target->id > 0 && COwnerHelper::isMine($actor->id, $target->id)) {
         $access = 40;
     }
     if (COwnerHelper::isCommunityAdmin()) {
         $access = 40;
     }
     return $access;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:25,代码来源:privacy.php

示例12: onProfileCreate

 function onProfileCreate($user)
 {
     // Upon registering, users should get 4 default photo albums:
     // Fiskeplasser, Fangstrapporter, Turer, and Klekker (Spots/Catches/Trips/Hatches)
     $config = CFactory::getConfig();
     CFactory::load('models', 'photos');
     $albumNames = array('Fiskeplasser', 'Fangstrapporter', 'Turer', 'Klekker');
     foreach ($albumNames as $album_name) {
         $album =& JTable::getInstance('Album', 'CTable');
         $album->creator = $user->id;
         $album->name = $album_name;
         $album->description = "";
         $album->type = "user";
         $album->created = gmdate('Y-m-d H:i:s');
         $params = $user->getParams();
         $album->permissions = $params->get('privacyPhotoView');
         $album->permanent = 1;
         // don't let users delete default albums
         $storage = JPATH_ROOT . DS . $config->getString('photofolder');
         $albumPath = $storage . DS . 'photos' . DS . $user->id . DS;
         $albumPath = JString::str_ireplace(JPATH_ROOT . DS, '', $albumPath);
         $albumPath = JString::str_ireplace('\\', '/', $albumPath);
         $album->path = $albumPath;
         $album->store();
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:26,代码来源:relate.php

示例13: add

 function add($actor, $target, $title, $content, $appname = '', $cid = 0, $params = '', $points = 1, $access = 0)
 {
     jimport('joomla.utilities.date');
     $db =& $this->getDBO();
     $today =& JFactory::getDate();
     $obj = new StdClass();
     $obj->actor = $actor;
     $obj->target = $target;
     $obj->title = $title;
     $obj->content = $content;
     $obj->app = $appname;
     $obj->cid = $cid;
     $obj->params = $params;
     $obj->created = $today->toMySQL();
     $obj->points = $points;
     $obj->access = $access;
     // Trigger for onBeforeStreamCreate event.
     CFactory::load('libraries', 'apps');
     $appsLib =& CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $params = array();
     $params[] =& $obj;
     $result = $appsLib->triggerEvent('onBeforeStreamCreate', $params);
     if (in_array(true, $result) || empty($result)) {
         return $db->insertObject('#__community_activities', $obj);
     }
     return false;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:28,代码来源:activities.php

示例14: onLoginUser

 /**
  * This method should handle any login logic and report back to the subject
  *
  * @access	public
  * @param 	array 	holds the user data
  * @param 	array    extra options
  * @return	boolean	True on success
  * @since	1.5
  */
 function onLoginUser($user, $options)
 {
     CFactory::load('helpers', 'user');
     $id = cGetUserId($user['username']);
     CFactory::setActiveProfile($id);
     return true;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:16,代码来源:jomsocialuser.php

示例15: isAccessAllowed

 /**
  * Return true if actor have access to target's item
  * @param type where the privacy setting should be extracted, {user, group, global, custom}
  * Site super admin waill always have access to all area	 
  */
 static function isAccessAllowed($actorId, $targetId, $type, $userPrivacyParam)
 {
     $actor = CFactory::getUser($actorId);
     $target = CFactory::getUser($targetId);
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'friends');
     // Load User params
     $params =& $target->getParams();
     // guest
     $relation = 10;
     // site members
     if ($actor->id != 0) {
         $relation = 20;
     }
     // friends
     if (CFriendsHelper::isConnected($actorId, $targetId)) {
         $relation = 30;
     }
     // mine, target and actor is the same person
     if (COwnerHelper::isMine($actor->id, $target->id)) {
         $relation = 40;
     }
     // @todo: respect privacy settings
     // If type is 'custom', then $userPrivacyParam will contain the exact
     // permission level
     $permissionLevel = $type == 'custom' ? $userPrivacyParam : $params->get($userPrivacyParam);
     if ($relation < $permissionLevel && !COwnerHelper::isCommunityAdmin($actorId)) {
         return false;
     }
     return true;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:36,代码来源:privacy.php


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