本文整理汇总了PHP中CFactory::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP CFactory::getConfig方法的具体用法?PHP CFactory::getConfig怎么用?PHP CFactory::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactory
的用法示例。
在下文中一共展示了CFactory::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActivityContentHTML
static function getActivityContentHTML($act)
{
// Ok, the activity could be an upload OR a wall comment. In the future, the content should
// indicate which is which
$html = '';
$param = new CParameter($act->params);
$action = $param->get('action', false);
$count = $param->get('count', false);
$config = CFactory::getConfig();
switch ($action) {
case CAdminstreamsAction::TOP_USERS:
$model = CFactory::getModel('user');
$members = $model->getPopularMember($count);
$html = '';
//Get Template Page
$tmpl = new CTemplate();
$html = $tmpl->set('members', $members)->fetch('activity.members.popular');
return $html;
break;
case CAdminstreamsAction::TOP_PHOTOS:
$model = CFactory::getModel('photos');
$photos = $model->getPopularPhotos($count, 0);
$tmpl = new CTemplate();
$html = $tmpl->set('photos', $photos)->fetch('activity.photos.popular');
return $html;
break;
case CAdminstreamsAction::TOP_VIDEOS:
$model = CFactory::getModel('videos');
$videos = $model->getPopularVideos($count);
$tmpl = new CTemplate();
$html = $tmpl->set('videos', $videos)->fetch('activity.videos.popular');
return $html;
break;
}
}
示例2: getThumbnail
public function getThumbnail($obj)
{
$config = CFactory::getConfig();
$file = $obj->thumb;
// Site origin
if (JString::substr($file, 0, 4) == 'http') {
$uri = $file;
return $uri;
}
// Remote storage
if ($obj->storage != 'file') {
$storage = CStorage::getStorage($obj->storage);
$uri = $storage->getURI($file);
return $uri;
}
// Default thumbnail
if (empty($file) || !JFile::exists(JPATH_ROOT . '/' . $file)) {
$template = new CTemplateHelper();
$asset = $template->getTemplateAsset('video_thumb.png', 'images');
$uri = $asset->url;
return $uri;
}
// Strip cdn path if exists.
// Note: At one point, cdn path was stored along with the thumbnail path
// in the db which is the mistake we are trying to rectify here.
$file = str_ireplace($config->get('videocdnpath'), '', $file);
// CDN or local
$baseUrl = $config->get('videobaseurl') or $baseUrl = JURI::root();
$uri = str_replace('\\', '/', rtrim($baseUrl, '/') . '/' . ltrim($file, '/'));
return $uri;
}
示例3: 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();
}
}
示例4: _displayEditLayout
public function _displayEditLayout($tpl)
{
// Load frontend language file.
$lang = JFactory::getLanguage();
$lang->load('com_community', JPATH_ROOT);
// Set the titlebar text
JToolBarHelper::title(JText::_('COM_COMMUNITY_GROUPS'), 'groups');
// Add the necessary buttons
JToolBarHelper::back('Back', 'index.php?option=com_community&view=groups');
JToolBarHelper::divider();
JToolBarHelper::save();
$group = JTable::getInstance('Group', 'CTable');
$group->load(JRequest::getInt('groupid'));
$post = JRequest::get('POST');
$group->bind($post);
$categories = $this->get('Categories');
$config = CFactory::getConfig();
$editorType = $config->get('allowhtml') ? $config->get('htmleditor', 'none') : 'none';
$editor = new CEditor($editorType);
$this->assignRef('categories', $categories);
$this->assignRef('group', $group);
$this->assignRef('editor', $editor);
$document = JFactory::getDocument();
JHTML::_('behavior.modal', 'a.modal');
$this->url = 'index.php?option=com_users&view=users&layout=modal&tmpl=component&field=jform_user_id_to';
parent::display($tpl);
}
示例5: 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;
}
}
}
}
}
示例6: isSingular
public static function isSingular($num)
{
$config = CFactory::getConfig();
$singularnumbers = $config->get('singularnumber');
$singularnumbers = explode(',', $singularnumbers);
return in_array($num, $singularnumbers);
}
示例7: onProfileDisplay
function onProfileDisplay()
{
$config = CFactory::getConfig();
$this->loadUserParams();
$uri = JURI::base();
//$user = CFactory::getActiveProfile();
$user = CFactory::getRequestUser();
$document = JFactory::getDocument();
$css = $uri . 'plugins/community/groups/style.css';
$document->addStyleSheet($css);
$view = $this->params->get('fabrik_view');
$id = $this->params->get('fabrik_view_id');
$rowid = $this->params->get('fabrik_row_id');
$usekey = $this->params->get('fabrik_usekey');
$layout = $this->params->get('fabrik_layout');
$additional = $this->params->get('fabrik_additional');
$element = $this->params->get('fabrik_element');
if (!empty($view) && !empty($id)) {
$cache = JFactory::getCache('plgCommunityFabrik');
$cache->setCaching($this->params->get('cache', 1));
$className = 'plgCommunityFabrik';
$callback = array($className, '_getFabrikHTML');
$content = $cache->call($callback, $view, $id, $rowid, $usekey, $layout, $element, $additional, $this->userparams, $user->id);
} else {
$content = "<div class=\"icon-nopost\"><img src='" . JURI::base() . "components/com_community/assets/error.gif' alt=\"\" /></div>";
$content .= "<div class=\"content-nopost\">" . JText::_('Fabrik view details not set.') . "</div>";
}
return $content;
}
示例8: _displayEditLayout
function _displayEditLayout($tpl)
{
// Load frontend language file.
$lang =& JFactory::getLanguage();
$lang->load('com_community', JPATH_ROOT);
$userId = JRequest::getVar('id', '', 'REQUEST');
$user = CFactory::getUser($userId);
// Set the titlebar text
JToolBarHelper::title($user->username, 'users');
// Add the necessary buttons
JToolBarHelper::back('Back', 'index.php?option=com_community&view=users');
JToolBarHelper::divider();
JToolBarHelper::cancel('removeavatar', JText::_('CC REMOVE AVATAR'));
JToolBarHelper::save();
$model = CFactory::getModel('Profile');
$profile = $model->getEditableProfile($user->id, $user->getProfileType());
$config =& CFactory::getConfig();
$params = $user->getParams();
$userDST = $params->get('daylightsavingoffset');
$offset = !empty($userDST) ? $userDST : $config->get('daylightsavingoffset');
$counter = -4;
$options = array();
for ($i = 0; $i <= 8; $i++, $counter++) {
$options[] = JHTML::_('select.option', $counter, $counter);
}
$offsetList = JHTML::_('select.genericlist', $options, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $offset);
$user->profile =& $profile;
$this->assignRef('user', $user);
$this->assignRef('params', $user->getParameters(true));
$this->assignRef('offsetList', $offsetList);
parent::display($tpl);
}
示例9: 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();
}
}
示例10: getInfo
/**
get field value of $userId accordimg to $fieldCode
*/
public function getInfo($userId, $fieldCode)
{
// Run Query to return 1 value
$db = JFactory::getDBO();
$query = 'SELECT b.* FROM ' . $db->nameQuote('#__community_fields') . ' AS a ' . 'INNER JOIN ' . $db->nameQuote('#__community_fields_values') . ' AS b ' . 'ON b.' . $db->nameQuote('field_id') . '=a.' . $db->nameQuote('id') . ' ' . 'AND b.' . $db->nameQuote('user_id') . '=' . $db->Quote($userId) . ' ' . 'INNER JOIN ' . $db->nameQuote('#__community_users') . ' AS c ' . 'ON c.' . $db->nameQuote('userid') . '= b.' . $db->nameQuote('user_id') . 'WHERE a.' . $db->nameQuote('fieldcode') . ' =' . $db->Quote($fieldCode);
$db->setQuery($query);
$result = $db->loadObject();
$field = JTable::getInstance('FieldValue', 'CTable');
$field->bind($result);
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
$config = CFactory::getConfig();
// @rule: Only trigger 3rd party apps whenever they override extendeduserinfo configs
if ($config->getBool('extendeduserinfo')) {
CFactory::load('libraries', 'apps');
$apps = CAppPlugins::getInstance();
$apps->loadApplications();
$params = array();
$params[] = $fieldCode;
$params[] =& $field->value;
$apps->triggerEvent('onGetUserInfo', $params);
}
// Respect privacy settings.
if (!XIPT_JOOMLA_15) {
$my = CFactory::getUser();
CFactory::load('libraries', 'privacy');
if (!CPrivacy::isAccessAllowed($my->id, $userId, 'custom', $field->access)) {
return false;
}
}
return $field->value;
}
示例11: 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;
}
}
示例12: exceedDaily
public static function exceedDaily($view, $userId = null, $returnRemaining = false)
{
$my = CFactory::getUser($userId);
// Guests shouldn't be even allowed here.
if ($my->id == 0) {
return true;
}
$view = JString::strtolower($view);
// We need to include the model first before using ReflectionClass so that the model file is included.
$model = CFactory::getModel($view);
// Since the model will always return a CCachingModel which is a proxy,
// for the real model, we can't really test what type of object it is.
$modelClass = 'CommunityModel' . ucfirst($view);
$reflection = new ReflectionClass($modelClass);
if (!$reflection->implementsInterface('CLimitsInterface')) {
return false;
}
$config = CFactory::getConfig();
$total = $model->getTotalToday($my->id);
$max = $config->getInt('limit_' . $view . '_perday');
if ($returnRemaining) {
return $max - $total;
}
return $total >= $max && $max != 0;
}
示例13: onProfileDisplay
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_events', JPATH_ADMINISTRATOR);
$config = CFactory::getConfig();
if (!$config->get('enableevents')) {
return JText::_('PLG_EVENTS_EVENT_DISABLED');
}
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$user = CFactory::getRequestUser();
$caching = $this->params->get('cache', 1);
$model = CFactory::getModel('Events');
$my = CFactory::getUser();
$this->loadUserParams();
//CFactory::load( 'helpers' , 'event' );
$event = JTable::getInstance('Event', 'CTable');
$handler = CEventHelper::getHandler($event);
$events = $model->getEvents(null, $user->id, $this->params->get('sorting', 'latest'), null, true, false, null, null, $handler->getContentTypes(), $handler->getContentId(), $this->userparams->get('count', 5));
if ($this->params->get('hide_empty', 0) && !count($events)) {
return '';
}
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$creatable = $my->canCreateEvents();
$cache = JFactory::getCache('plgCommunityEvents');
$cache->setCaching($caching);
$callback = array($this, '_getEventsHTML');
$content = $cache->call($callback, true, $events, $user, $config, $model->getEventsCount($user->id), $creatable);
return $content;
}
示例14: array
public static function &getFields()
{
$model = CFactory::getModel('profile');
$filters = array('searchable' => '1');
$fields = $model->getAllFields($filters);
JFactory::getLanguage()->load(COM_USER_NAME, JPATH_ROOT);
// we need to get the user name / email seprately as these data did not
// exists in custom profile fields.
$config = CFactory::getConfig();
$nameOptGroup = new stdClass();
$nameOptGroup->type = "group";
$nameOptGroup->published = 1;
$nameOptGroup->name = JText::_('COM_COMMUNITY_ADVANCEDSEARCH_NAME');
$nameOptGroup->visible = 1;
$fields[JText::_('COM_COMMUNITY_ADVANCEDSEARCH_NAME')] = $nameOptGroup;
$obj = new stdClass();
$obj->type = "text";
$obj->searchable = true;
$obj->published = 1;
$obj->name = JText::_('COM_COMMUNITY_ADVANCEDSEARCH_NAME');
$obj->visible = 1;
$obj->fieldcode = "username";
$fields[$nameOptGroup->name]->fields[] = $obj;
if ($config->get('privacy_search_email') != 2) {
$obj = new stdClass();
$obj->type = "email";
$obj->searchable = true;
$obj->published = 1;
$obj->name = JText::_('COM_COMMUNITY_ADVANCEDSEARCH_EMAIL');
$obj->visible = 1;
$obj->fieldcode = "useremail";
$fields[$nameOptGroup->name]->fields[] = $obj;
}
return $fields;
}
示例15: onProfileDisplay
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_mygoogleads', JPATH_ADMINISTRATOR);
$config = CFactory::getConfig();
$config = CFactory::getConfig();
$this->loadUserParams();
$uri = JURI::base();
$user = CFactory::getRequestUser();
$document = JFactory::getDocument();
$css = $uri . 'plugins/community/mygoogleads/mygoogleads/style.css';
$document->addStyleSheet($css);
$googleCode = $this->userparams->get('googleCode');
$content = '';
if (!empty($googleCode)) {
$mainframe = JFactory::getApplication();
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyGoogleAds');
$cache->setCaching($caching);
$callback = array('plgCommunityMyGoogleAds', '_getGoogleAdsHTML');
$content = $cache->call($callback, $googleCode, $user->id);
} else {
// $content = "<div class=\"icon-nopost\"><img src=\"".JURI::base()."components/com_community/assets/error.gif\" alt=\"\" /></div>";
$content .= "<div class=\"content-nopost\">" . JText::_('PLG_GOOGLE_ADS_NOT_SET') . "</div>";
}
return $content;
}