本文整理汇总了PHP中EasyBlogHelper::uploadAvatar方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::uploadAvatar方法的具体用法?PHP EasyBlogHelper::uploadAvatar怎么用?PHP EasyBlogHelper::uploadAvatar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::uploadAvatar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
//.........这里部分代码省略.........
return $this->execute('edit');
}
// If updating self, load the new user object into the session
if (EasyBlogHelper::getJoomlaVersion() <= '1.5') {
if ($user->get('id') == $my->get('id')) {
// Get an ACL object
$acl = JFactory::getACL();
// Get the user group from the ACL
$grp = $acl->getAroGroup($user->get('id'));
// Mark the user as logged in
$user->set('guest', 0);
$user->set('aid', 1);
// Fudge Authors, Editors, Publishers and Super Administrators into the special access group
if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
$user->set('aid', 2);
}
// Set the usertype based on the ACL group name
$user->set('usertype', $grp->name);
$session = JFactory::getSession();
$session->set('user', $user);
}
} else {
// Update session data if the current user was updated
if ($user->get('id') == $my->get('id')) {
$session = JFactory::getSession();
$session->set('user', $user);
// Force load from database
}
}
$post = JRequest::get('post');
if ($isNew) {
unset($post['id']);
}
$post['permalink'] = $post['user_permalink'];
unset($post['user_permalink']);
if (EasyBlogHelper::isSiteAdmin()) {
$post['description'] = JRequest::getVar('description', '', 'POST', '', JREQUEST_ALLOWRAW);
$post['biography'] = JRequest::getVar('biography', '', 'POST', '', JREQUEST_ALLOWRAW);
}
$blogger = EasyBlogHelper::getTable('Profile', 'Table');
$blogger->load($user->id);
$blogger->bind($post);
$file = JRequest::getVar('Filedata', '', 'Files', 'array');
if (!empty($file['name'])) {
$newAvatar = EasyBlogHelper::uploadAvatar($blogger, true);
$blogger->avatar = $newAvatar;
}
//save params
$userparams = EasyBlogHelper::getRegistry('');
// @rule: Save google profile url
if (isset($post['google_profile_url'])) {
$userparams->set('google_profile_url', $post['google_profile_url']);
}
if (isset($post['show_google_profile_url'])) {
$userparams->set('show_google_profile_url', $post['show_google_profile_url']);
}
$blogger->params = $userparams->toString();
$blogger->store();
JTable::addIncludePath(EBLOG_TABLES);
//save twitter info.
$twitter = EasyBlogHelper::getTable('Oauth', 'Table');
$twitter->loadByUser($user->id, EBLOG_OAUTH_TWITTER);
$twitter->auto = JRequest::getVar('integrations_twitter_auto');
$twitter->message = JRequest::getVar('integrations_twitter_message');
if (!$twitter->store()) {
$mainframe->enqueueMessage(JText::_('COM_EASYBLOG_INTEGRATIONS_TWITTER_ERROR'), 'error');
}
// Map linkedin items
$linkedin = EasyBlogHelper::getTable('Oauth', 'Table');
$linkedin->loadByUser($user->id, EBLOG_OAUTH_LINKEDIN);
$linkedin->auto = JRequest::getVar('integrations_linkedin_auto');
$linkedin->message = JRequest::getVar('integrations_linkedin_message');
$linkedin->private = JRequest::getVar('integrations_linkedin_private');
if (!$linkedin->store()) {
$mainframe->enqueueMessage(JText::_('COM_EASYBLOG_INTEGRATIONS_LINKEDIN_ERROR'), 'error');
}
// store faebook info
$facebook = EasyBlogHelper::getTable('Oauth', 'Table');
$facebook->loadByUser($user->id, EBLOG_OAUTH_FACEBOOK);
$facebook->auto = JRequest::getVar('integrations_facebook_auto');
$facebook->message = '';
if (!$facebook->store()) {
$mainframe->enqueueMessage(JText::_('COM_EASYBLOG_INTEGRATIONS_FACEBOOK_FAILED_UPDATE_INFO_ERROR'), 'error');
}
if ($config->get('integration_google_adsense_enable')) {
// Store adsense data
$adsense = EasyBlogHelper::getTable('Adsense', 'Table');
$adsense->load($user->id);
$adsense->code = $post['adsense_code'];
$adsense->display = $post['adsense_display'];
$adsense->published = $post['adsense_published'];
$adsense->store();
}
// Store feedburner data
$feedburner = EasyBlogHelper::getTable('Feedburner', 'Table');
$feedburner->load($user->id);
$feedburner->url = $post['feedburner_url'];
$feedburner->store();
$this->_saveSuccess($user->id);
}
示例2: _upload
function _upload($profile, $type = 'profile')
{
$newAvatar = $type == 'category' ? EasyBlogHelper::uploadCategoryAvatar($profile) : EasyBlogHelper::uploadAvatar($profile);
return $newAvatar;
}