本文整理汇总了PHP中FD::config方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::config方法的具体用法?PHP FD::config怎么用?PHP FD::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
// Define Joomla's app
$this->app = JFactory::getApplication();
$this->input = $this->app->input;
// Load configuration object.
$config = FD::config();
$jConfig = FD::jconfig();
// Define the current logged in user or guest
if (is_null(self::$user)) {
self::$user = FD::user();
}
// Define the current logged in user's access.
if (is_null(self::$userAccess)) {
self::$userAccess = FD::access();
}
if (is_null(self::$tmplMode)) {
self::$tmplMode = $this->input->get('tmpl', '', 'default');
}
// Get the current access
$this->my = self::$user;
$this->access = self::$userAccess;
// Define our own configuration
$this->config = $config;
// Define template's own configuration
if (is_null(self::$templateConfig)) {
self::$templateConfig = $this->getConfig();
}
$this->template = self::$templateConfig;
// Define Joomla's configuration so the world can use it.
$this->jConfig = $jConfig;
// Determine if the current request has tmpl=xxx
$this->tmpl = self::$tmplMode;
}
示例2: item
/**
* Default method to display the registration page.
*
* @since 1.0
* @access public
* @author Mark Lee <mark@stackideas.com>
*/
function item($tpl = null)
{
// Check for user profile completeness
FD::checkCompleteProfile();
$config = FD::config();
if (!$config->get('badges.enabled')) {
return $this->redirect(FRoute::dashboard(array(), false));
}
// Get id of badge
$id = JRequest::getInt('id');
$badge = FD::table('Badge');
$badge->load($id);
if (!$id || !$badge->id) {
FD::info()->set(JText::_('COM_EASYSOCIAL_BADGES_INVALID_BADGE_ID_PROVIDED'), SOCIAL_MSG_ERROR);
$this->redirect(FRoute::badges());
$this->close();
}
// Load the badge language
$badge->loadLanguage();
// Set the page title
FD::page()->title($badge->get('title'));
// Set the page breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_BADGES'), FRoute::badges());
FD::page()->breadcrumb($badge->get('title'));
// Get the badges model
$options = array('start' => 0, 'limit' => FD::themes()->getConfig()->get('achieverslimit', 50));
$achievers = $badge->getAchievers($options);
$totalAchievers = $badge->getTotalAchievers();
$this->set('totalAchievers', $totalAchievers);
$this->set('achievers', $achievers);
$this->set('badge', $badge);
parent::display('site/badges/default.item');
}
示例3: __construct
public function __construct($client, $callback = '')
{
// Get the path to the consumer file.
$file = dirname(__FILE__) . '/clients/' . strtolower($client) . '/consumer.php';
jimport('joomla.filesystem.file');
// If file doesn't exist, just quit.
if (!JFile::exists($file)) {
return false;
}
if (empty($callback)) {
$callback = rtrim(JURI::root(), '/') . JRoute::_('index.php?option=com_easysocial&controller=oauth&task=grant&client=' . $client, false);
}
require_once $file;
// All adapters classes should have the same naming convention
$consumerClass = 'SocialConsumer' . ucfirst($client);
if (!class_exists($consumerClass)) {
return false;
}
$config = FD::config();
// All oauth clients should have a key and secret.
$key = $config->get('oauth.' . strtolower($client) . '.app');
$secret = $config->get('oauth.' . strtolower($client) . '.secret');
// Let's try to create instance of consumer.
$this->client = new $consumerClass($key, $secret, $callback);
}
示例4: __construct
public function __construct()
{
$this->app = JFactory::getApplication();
$this->input = $this->app->input;
$this->config = FD::config();
parent::__construct();
}
示例5: create_report
public function create_report()
{
$app = JFactory::getApplication();
$msg = $app->input->get('message', '', 'STRING');
$title = $app->input->get('user_title', '', 'STRING');
$item_id = $app->input->get('itemId', 0, 'INT');
$log_user = $this->plugin->get('user')->id;
$data = array();
$data['message'] = $msg;
$data['uid'] = $item_id;
$data['type'] = 'stream';
$data['title'] = $title;
$data['extension'] = 'com_easysocial';
//build share url use for share post through app
$sharing = FD::get('Sharing', array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item_id, 'external' => true, 'xhtml' => true)), 'display' => 'dialog', 'text' => JText::_('COM_EASYSOCIAL_STREAM_SOCIAL'), 'css' => 'fd-small'));
$url = $sharing->url;
$data['url'] = $url;
// Get the reports model
$model = FD::model('Reports');
// Determine if this user has the permissions to submit reports.
$access = FD::access();
// Determine if this user has exceeded the number of reports that they can submit
$total = $model->getCount(array('created_by' => $log_user));
if ($access->exceeded('reports.limit', $total)) {
$final_result['message'] = "Limit exceeds";
$final_result['status'] = true;
return $final_result;
}
// Create the report
$report = FD::table('Report');
$report->bind($data);
// Set the creator id.
$report->created_by = $log_user;
// Set the default state of the report to new
$report->state = 0;
// Try to store the report.
$state = $report->store();
// If there's an error, throw it
if (!$state) {
$final_result['message'] = "Can't save report";
$final_result['status'] = true;
return $final_result;
}
// @badge: reports.create
// Add badge for the author when a report is created.
$badge = FD::badges();
$badge->log('com_easysocial', 'reports.create', $log_user, JText::_('COM_EASYSOCIAL_REPORTS_BADGE_CREATED_REPORT'));
// @points: reports.create
// Add points for the author when a report is created.
$points = FD::points();
$points->assign('reports.create', 'com_easysocial', $log_user);
// Determine if we should send an email
$config = FD::config();
if ($config->get('reports.notifications.moderators')) {
$report->notify();
}
$final_result['message'] = "Report logged successfully!";
$final_result['status'] = true;
return $final_result;
}
示例6: onRegister
/**
* Displays the field input for user when they register their account.
*
* @since 1.0
* @access public
* @param array The post data
* @param SocialTableRegistration
* @return string The html output.
*/
public function onRegister(&$post)
{
$config = FD::config();
$value = isset($post['group_type']) ? $post['group_type'] : $this->params->get('default');
$this->set('value', $value);
return $this->display();
}
示例7: onPrepareStoryPanel
public function onPrepareStoryPanel($story)
{
if ($story->clusterType != SOCIAL_TYPE_GROUP) {
return;
}
$params = $this->getParams();
// Determine if we should attach ourselves here.
if (!$params->get('story_event', true)) {
return;
}
if (!FD::config()->get('events.enabled')) {
return;
}
// Create plugin object
$plugin = $story->createPlugin('event', 'panel');
// Get the theme class
$theme = FD::themes();
// Get the available event category
$categories = FD::model('EventCategories')->getCreatableCategories(FD::user()->getProfile()->id);
$theme->set('categories', $categories);
$plugin->button->html = $theme->output('apps/user/events/story/panel.button');
$plugin->content->html = $theme->output('apps/user/events/story/panel.content');
$script = FD::get('Script');
$plugin->script = $script->output('apps:/user/events/story');
return $plugin;
}
示例8: onPrepareActivityLog
/**
* Responsible to generate the activity contents.
*
* @since 1.0
* @access public
* @param object $params A standard object with key / value binding.
*
* @return none
*/
public function onPrepareActivityLog(SocialStreamItem &$item, $includePrivacy = true)
{
if ($item->context != 'shares') {
return;
}
// Get the context id.
$id = $item->contextId;
// Get the actor
$actor = $item->actor;
// Set the actor for the themes.
$this->set('actor', $actor);
// Load the profiles table.
$share = FD::table('Share');
$state = $share->load($id);
if (!$state) {
return false;
}
$source = explode('.', $share->element);
$element = $source[0];
$group = $source[1];
$config = FD::config();
$file = dirname(__FILE__) . '/helpers/' . $element . '.php';
if (JFile::exists($file)) {
require_once $file;
// Get class name.
$className = 'SocialSharesHelper' . ucfirst($element);
// Instantiate the helper object.
$helper = new $className($item, $share);
$item->content = $helper->getContent();
$item->title = $helper->getTitle();
}
$item->display = SOCIAL_STREAM_DISPLAY_MINI;
}
示例9: request
/**
* Displays the registration request
*
* @since 1.3
* @access public
* @param string
* @return
*/
public function request()
{
$id = $this->input->getInt('id');
$table = JTable::getInstance('Module');
$table->load($id);
FD::language()->load('mod_easysocial_registration_requester', JPATH_SITE);
$params = FD::registry($table->params);
$profileId = $params->get('profile_id');
// If there's no profile id, then we automatically assign the default profile id
if (empty($profileId)) {
$profileModel = FD::model('profiles');
$defaultProfile = $profileModel->getDefaultProfile();
$profileId = $defaultProfile->id;
}
$fieldsModel = FD::model('fields');
$options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
$fields = $fieldsModel->getCustomFields($options);
if (!empty($fields)) {
FD::language()->loadAdmin();
$fieldsLib = FD::fields();
$session = JFactory::getSession();
$registration = FD::table('Registration');
$registration->load($session->getId());
$data = $registration->getValues();
$args = array(&$data, &$registration);
$fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
}
$theme = FD::themes();
$theme->set('params', $params);
$theme->set('config', FD::config());
$theme->set('fields', $fields);
$output = $theme->output('site/registration/dialog.request');
return $this->ajax->resolve($output);
}
示例10: display
public function display()
{
// Get the configuration objects
$config = FD::config();
$jConfig = FD::config('joomla');
// Get the stream library
$stream = FD::stream();
$stream->get();
// Get the result in an array form
$result = $stream->toArray();
// Set the document properties
$doc = JFactory::getDocument();
$doc->link = FRoute::dashboard();
FD::page()->title(JText::_('COM_EASYSOCIAL_STREAM_FEED_TITLE'));
$doc->setDescription(JText::sprintf('COM_EASYSOCIAL_STREAM_FEED_DESC', $jConfig->getValue('sitename')));
if ($result) {
$useEmail = $jConfig->getValue('feed_email');
foreach ($result as $row) {
$item = new JFeedItem();
$item->title = $row->title;
$item->link = FRoute::stream(array('id' => $row->uid));
$item->description = $row->content;
$item->date = $row->created->toMySQL();
$item->author = $row->actor->getName();
if ($useEmail != 'none') {
$item->authorEmail = $jConfig->getValue('mailfrom');
if ($useEmail == 'author') {
$item->authorEmail = $row->actor->email;
}
}
$doc->addItem($item);
}
}
}
示例11: upload
/**
* Uploads the given file to a temporary location on the site.
*
* @since 1.0
* @access public
* @param string
* @return string The path to the uploaded item.
*/
public function upload($file, $hash, $userId)
{
// Check if file exists on the server
if (!isset($file['tmp_name']) || empty($file)) {
$this->setError(JText::_('COM_EASYSOCIAL_UPLOADER_FILE_NOT_FOUND'));
return false;
}
// Lets figure out the storage path.
$config = FD::config();
// Test if the folder exists for this upload type.
$path = JPATH_ROOT . '/' . FD::cleanPath($config->get('uploader.storage.container'));
if (!FD::makeFolder($path)) {
$this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_CREATE_DESTINATION_FOLDER', $path));
return false;
}
// Let's finalize the storage path.
$storage = $path . '/' . $userId;
if (!FD::makeFolder($storage)) {
$this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_CREATE_DESTINATION_FOLDER', $storage));
return false;
}
// Once the script reaches here, we assume everything is good now.
// Copy the files over.
jimport('joomla.filesystem.file');
$absolutePath = $storage . '/' . $hash;
if (!JFile::copy($file['tmp_name'], $absolutePath)) {
$this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_COPY_TO_DESTINATION_FOLDER', $absolutePath));
return false;
}
return $absolutePath;
}
示例12: hasActivityLog
public function hasActivityLog()
{
$config = FD::config();
if (!$config->get('followers.enabled')) {
return false;
}
return true;
}
示例13: isEnabled
/**
* Determines if this feature is enabled
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function isEnabled()
{
$config = FD::config();
if ($config->get('followers.enabled')) {
return true;
}
return false;
}
示例14: __construct
public function __construct()
{
// key is optional for this case
$key = FD::config()->get('location.maps.api');
if (!empty($key)) {
$this->setQuery('key', $key);
}
}
示例15: sidebarBottom
/**
* Display groups as a widget
*
* @since 1.2
* @access public
* @param Socialuser
* @return
*/
public function sidebarBottom($user)
{
$config = FD::config();
$params = $this->getParams();
if ($params->get('widget_profile', true) && $config->get('groups.enabled')) {
echo $this->getGroups($user, $params);
}
}