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


PHP Foundry::exists方法代码示例

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


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

示例1: onUserAfterSave

 public function onUserAfterSave($user, $isnew, $success, $msg)
 {
     if ($isnew) {
         // Initialise EasySocial's Foundry Framework
         // Include main file.
         jimport('joomla.filesystem.file');
         $path = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php';
         if (!JFile::exists($path)) {
             return false;
         }
         // Include the foundry engine
         require_once $path;
         $success = true;
         // Check if Foundry exists
         if (!Foundry::exists()) {
             Foundry::language()->loadSite();
             echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING');
             return;
         }
         if (!$success) {
             return false;
         }
         // Things that need to do here
         // 1. Insert user record into #__social_users
         // 2. Get the default profile
         // 3. Insert mapping into #__social_profiles_maps
         $userTable = Foundry::table('users');
         $state = $userTable->load($user['id']);
         // If no user is found in #__social_users, then only we insert
         // If user is found, means the registration is coming from EasySocial itself.
         // The purpose here is to insert the user data if the registration is handled by other services
         if (!$state) {
             // Assign the user id
             $userTable->user_id = $user['id'];
             // Filter the username so that it becomes a valid alias
             $alias = JFilterOutput::stringURLSafe($user['username']);
             // Check if the alias exists.
             $userModel = Foundry::model('Users');
             // Keep the original state of the alias
             $tmp = $alias;
             while ($userModel->aliasExists($alias, $user['id'])) {
                 // Generate a new alias for the user.
                 $alias = $tmp . '-' . rand(1, 150);
             }
             $userTable->alias = $alias;
             $userTable->state = $user['block'] === SOCIAL_JOOMLA_USER_BLOCKED ? SOCIAL_USER_STATE_PENDING : SOCIAL_USER_STATE_ENABLED;
             $userTable->type = 'joomla';
             $userTable->store();
             $profileModel = Foundry::model('Profiles');
             $defaultProfile = $profileModel->getDefaultProfile();
             if ($defaultProfile) {
                 $defaultProfile->addUser($user['id']);
             }
             $controller = JRequest::getCmd('controller', '');
             if ($controller != 'registration') {
                 // if this user saving is coming from registration, then we dont add the user into finder. let the registration controller do the job.
                 // Get the user object now
                 $esUser = Foundry::user($user['id']);
                 // Sync the index
                 $esUser->syncIndex();
             }
         }
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:65,代码来源:easysocial.php

示例2: jimport

$input_lng = $jinput->get('lng', '');
$doc = JFactory::getDocument();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$lang = JFactory::getLanguage();
$lang->load('com_geommunity3es', JPATH_SITE, '', false);
$file = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php';
jimport('joomla.filesystem.file');
if (!JFile::exists($file)) {
    return;
}
require_once $file;
// Include main Easysocial engine
$modules = Foundry::modules('mod_easysocial_toolbar');
$modules->loadComponentScripts();
if (!Foundry::exists()) {
    echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING');
    return;
}
$config = Foundry::config();
$naming = $config->get('users.displayName');
// username or realname
if ($naming == 'realname') {
    $naming = 'name';
}
if (JFactory::getApplication()->input->get('option') != 'com_easysocial') {
    $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/base.min.css');
    $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/style.min.css');
    $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/more.min.css');
}
// component params
开发者ID:,项目名称:,代码行数:31,代码来源:


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