本文整理汇总了PHP中Foundry::isJoomla25方法的典型用法代码示例。如果您正苦于以下问题:PHP Foundry::isJoomla25方法的具体用法?PHP Foundry::isJoomla25怎么用?PHP Foundry::isJoomla25使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundry
的用法示例。
在下文中一共展示了Foundry::isJoomla25方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onUserLogin
/**
* Triggered when user logs into the site
*
* @since 1.0
* @access public
* @return
*/
public function onUserLogin($user, $options = array())
{
// Include main file.
jimport('joomla.filesystem.file');
$path = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
if (!JFile::exists($path)) {
return;
}
// Include the foundry engine
require_once $path;
// Load the language string.
Foundry::language()->load('plg_user_easysocial', JPATH_ADMINISTRATOR);
// Check if Foundry exists
if (!Foundry::exists()) {
Foundry::language()->loadSite();
echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING');
return;
}
if (isset($user['status']) && $user['status'] && $user['type'] == 'Joomla') {
//successful logged in.
$my = JUser::getInstance();
if ($id = intval(JUserHelper::getUserId($user['username']))) {
$my->load($id);
}
$config = Foundry::config();
$app = Foundry::table('App');
$app->load(array('element' => 'users', 'group' => SOCIAL_TYPE_USER));
$appParams = $app->getParams();
$addStream = false;
if ($appParams->get('stream_login', true)) {
$addStream = true;
}
// do not add stream when user login from backend.
$mainframe = JFactory::getApplication();
// If this is the admin area, skip this.
if ($mainframe->isAdmin()) {
return;
}
// Only proceed if we need to add the stream
if ($addStream) {
$model = Foundry::model('Users');
// Get the last login time the user previously logged in.
$lastLogin = $model->getLastLogin($my->id);
if ($lastLogin) {
$lastLogin->count = Foundry::isJoomla25() ? $lastLogin->count + 1 : $lastLogin->count;
if ($lastLogin->count >= 2 && $lastLogin->limit < $lastLogin->time) {
$addStream = false;
}
}
}
if ($addStream) {
$myUser = Foundry::user($my->id);
$stream = Foundry::stream();
$template = $stream->getTemplate();
$template->setActor($my->id, SOCIAL_TYPE_USER);
$template->setContext($my->id, SOCIAL_TYPE_USERS);
$template->setVerb('login');
// Set the stream to be public
$template->setAccess('core.view');
// Add the new template.
$stream->add($template);
}
}
}