本文整理汇总了PHP中Foundry::language方法的典型用法代码示例。如果您正苦于以下问题:PHP Foundry::language方法的具体用法?PHP Foundry::language怎么用?PHP Foundry::language使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundry
的用法示例。
在下文中一共展示了Foundry::language方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: getCommentCount
/**
* Returns the comment counter
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function getCommentCount($blog)
{
if (!$this->exists()) {
return;
}
Foundry::language()->load('com_easysocial', JPATH_ROOT);
$url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id);
$comments = Foundry::comments($blog->id, 'blog', SOCIAL_APPS_GROUP_USER, $url);
return $comments->getCount();
}
示例3: categoryForm
/**
* Displays the category form for groups
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function categoryForm($tpl = null)
{
// Perhaps this is an edited category
$id = JRequest::getInt('id');
$category = FD::table('GroupCategory');
$category->load($id);
// Set the structure heading here.
if ($category->id) {
$this->setHeading($category->get('title'));
$this->setDescription(JText::_('COM_EASYSOCIAL_TOOLBAR_TITLE_EDIT_GROUP_CATEGORY_DESC'));
} else {
$this->setHeading(JText::_('COM_EASYSOCIAL_TOOLBAR_TITLE_CREATE_GROUP_CATEGORY'));
$this->setDescription(JText::_('COM_EASYSOCIAL_TOOLBAR_TITLE_CREATE_GROUP_CATEGORY_DESC'));
// By default the published state should be published.
$category->state = SOCIAL_STATE_PUBLISHED;
}
// Set page icon.
$this->setIcon('ies-folder-3');
// Load front end's language file
Foundry::language()->loadSite();
JToolbarHelper::apply('applyCategory', JText::_('COM_EASYSOCIAL_TOOLBAR_TITLE_BUTTON_SAVE'), false, false);
JToolbarHelper::save('saveCategory', JText::_('COM_EASYSOCIAL_TOOLBAR_TITLE_BUTTON_SAVE_AND_CLOSE'));
JToolbarHelper::save2new('saveCategoryNew', JText::_('COM_EASYSOCIAL_TOOLBAR_TITLE_BUTTON_SAVE_AND_NEW'));
JToolbarHelper::divider();
JToolbarHelper::cancel('cancel', JText::_('COM_EASYSOCIAL_TOOLBAR_TITLE_BUTTON_CANCEL'));
$activeTab = JRequest::getWord('activeTab', 'settings');
$createAccess = '';
// Set properties for the template.
$this->set('activeTab', $activeTab);
$this->set('category', $category);
if ($category->id) {
$options = array('type' => SOCIAL_APPS_TYPE_FIELDS, 'group' => SOCIAL_TYPE_GROUP, 'state' => SOCIAL_STATE_PUBLISHED);
// Get the available custom fields for groups
$appsModel = FD::model('Apps');
$defaultApps = $appsModel->getApps($options);
// Get the steps for this id
$stepsModel = FD::model('Steps');
$steps = $stepsModel->getSteps($category->id, SOCIAL_TYPE_CLUSTERS);
// Get the fields for this id
$fieldsModel = FD::model('Fields');
$fields = $fieldsModel->getCustomFields(array('uid' => $category->id, 'state' => 'all', 'group' => SOCIAL_TYPE_GROUP));
// Empty array to pass to the trigger.
$data = array();
// Get the fields sample output
$lib = FD::fields();
$lib->trigger('onSample', SOCIAL_TYPE_GROUP, $fields, $data, array($lib->getHandler(), 'getOutput'));
// Create a temporary storage
$tmpFields = array();
// Group the fields to each workflow properly
if ($steps) {
foreach ($steps as $step) {
$step->fields = array();
if (!empty($fields)) {
foreach ($fields as $field) {
if ($field->step_id == $step->id) {
$step->fields[] = $field;
}
$tmpFields[$field->app_id] = $field;
}
}
}
}
// We need to know the amount of core apps and used core apps
// 1.3 Update, we split out unique apps as well
$coreAppsCount = 0;
$usedCoreAppsCount = 0;
$uniqueAppsCount = 0;
$usedUniqueAppsCount = 0;
// hide the apps if it is a core app and it is used in the field
if ($defaultApps) {
foreach ($defaultApps as $app) {
$app->hidden = false;
// If app is core, increase the coreAppsCount counter
if ($app->core) {
$coreAppsCount++;
}
// If app is NOT core and unique, increase the coreAppsCount counter
// This is because core apps are definitely unique, so we do not want to include core apps here
if (!$app->core && $app->unique) {
$uniqueAppsCount++;
}
// Test if this app has already been assigned to the $tmpFields
if (isset($tmpFields[$app->id]) && $app->core) {
$usedCoreAppsCount++;
$app->hidden = true;
}
// Test if this app is NOT core and unique and has already been assigned
// This is because core apps are definitely unique, so we do not want to include core apps here
if (isset($tmpFields[$app->id]) && !$app->core && $app->unique) {
$usedUniqueAppsCount++;
$app->hidden = true;
}
//.........这里部分代码省略.........
示例4: onPrepareStream
/**
* Responsible to generate the stream contents.
*
* @since 1.0
* @access public
* @param object $params A standard object with key / value binding.
*
* @return none
*/
public function onPrepareStream(SocialStreamItem &$item)
{
// Load up the config object
$config = FD::config();
if ($item->context != 'badges' || !$config->get('badges.enabled')) {
return;
}
// Check if the app should be able to generate the stream.
$params = $this->getParams();
if (!$params->get('stream_achieved', true)) {
return;
}
// Get the actor
$actor = $item->actor;
// check if the actor is ESAD profile or not, if yes, we skip the rendering.
if (!$actor->hasCommunityAccess()) {
$item->title = '';
return;
}
// Test if stream item is allowed
if (!$this->onStreamValidatePrivacy($item)) {
return;
}
// Try to get the badge object from the params
$raw = $item->params;
$badge = FD::table('Badge');
$badge->load($item->contextId);
// lets load 3rd party component's language file if this is not a core badge
if ($badge->extension && $badge->extension != 'com_easysocial') {
Foundry::language()->load($badge->extension, JPATH_ROOT);
}
// Set the display mode to be full.
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
$item->color = '#FEBC9D';
$item->fonticon = 'ies-crown';
$item->label = FD::_('APP_USER_BADGES_STREAM_TOOLTIP', true);
// Format the likes for the stream
$likes = FD::likes();
$likes->get($item->contextId, $item->context, $item->verb . '.' . $item->actor->id, SOCIAL_APPS_GROUP_USER, $item->uid);
$item->likes = $likes;
// Apply comments on the stream
$comments = FD::comments($item->contextId, $item->context, $item->verb . '.' . $item->actor->id, SOCIAL_APPS_GROUP_USER, array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item->uid))), $item->uid);
$item->comments = $comments;
$this->set('badge', $badge);
$this->set('actor', $actor);
$item->title = parent::display('streams/' . $item->verb . '.title');
$item->content = parent::display('streams/' . $item->verb . '.content');
return true;
}
示例5: getItems
/**
* Returns an array of folders / albums in a given folder since jomsocial only stores user images here.
*
* @access public
* @param string $path The path that contains the items.
* @param int $depth The depth level to search for child items.
*/
public function getItems($uri)
{
if (!$this->exists()) {
return false;
}
// load easysocial language files.
Foundry::language()->load('com_easysocial', JPATH_ROOT);
// Determines if we are trying to view a single album or all albums
$parts = explode(':', $uri);
$viewAll = count($parts) == 1;
// Let's build the photos URL now.
$items = EBMM::filegroup();
// Viewing of all albums
if ($viewAll) {
$model = FD::model('Albums');
$result = $model->getAlbums($this->my->id, SOCIAL_TYPE_USER);
if ($result) {
foreach ($result as $row) {
$items['folder'][] = $this->decorateFolder($row);
}
}
// Folder
$folder = new stdClass();
$folder->place = 'easysocial';
$folder->title = JText::_('COM_EASYBLOG_MM_PLACE_EASYSOCIAL');
$folder->url = 'easysocial';
$folder->uri = 'easysocial';
$folder->key = 'easysocial';
$folder->type = 'folder';
$folder->icon = EasyBlogMediaManager::$icons['place/easysocial'];
$folder->root = true;
$folder->scantime = 0;
$folder->contents = $items;
$folder->total = count($items['folder']);
} else {
// Get the album id it is trying to view
$albumId = (int) $parts[1];
$album = FD::table('Album');
$album->load($albumId);
// Render the photos model
$model = FD::model('Photos');
$options = array('album_id' => $albumId, 'pagination' => false);
// Get the photos
$photos = $model->getPhotos($options);
if ($photos) {
foreach ($photos as $photo) {
$items['image'][] = $this->decorateImage($photo, $album);
}
}
// Folder
$folder = new stdClass();
$folder->place = 'easysocial';
$folder->title = JText::_($album->get('title'));
$folder->url = 'easysocial';
$folder->uri = 'easysocial';
$folder->key = 'easysocial';
$folder->type = 'folder';
$folder->icon = EBMM::$icons['place/easysocial'];
$folder->root = true;
$folder->scantime = 0;
$folder->contents = $items;
$folder->total = count($items);
}
return $folder;
}
示例6: init
/**
* Initializes EasySocial
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function init()
{
static $loaded = false;
if( $this->exists() && !$loaded )
{
require_once( $this->file );
$document = JFactory::getDocument();
if( $document->getType() == 'html' )
{
// We also need to render the styling from EasySocial.
$doc = Foundry::document();
$doc->init();
$page = Foundry::page();
$page->processScripts();
}
Foundry::language()->loadSite();
$loaded = true;
}
return $loaded;
}