本文整理汇总了PHP中FD::input方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::input方法的具体用法?PHP FD::input怎么用?PHP FD::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::input方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Responsible to display the generic login form.
*
* @since 1.0
* @access public
*/
public function display($tpl = null)
{
$my = FD::user();
// If user is already logged in, they should not see this page.
if ($my->id > 0) {
return $this->redirect(FRoute::dashboard(array(), false));
}
// Add page title
FD::page()->title(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_TITLE'));
// Add breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_BREADCRUMB'));
// Facebook codes.
$facebook = FD::oauth('Facebook');
$config = FD::config();
$loginMenu = $config->get('general.site.login');
// Get any callback urls.
$return = FD::getCallback();
// If return value is empty, always redirect back to the dashboard
if (!$return) {
// Determine if there's a login redirection
$urlFromCaller = FD::input()->getVar('return', '');
if ($urlFromCaller) {
$return = $urlFromCaller;
} else {
if ($loginMenu != 'null') {
$return = FRoute::getMenuLink($loginMenu);
} else {
$return = FRoute::dashboard(array(), false);
}
$return = base64_encode($return);
}
} else {
$return = base64_encode($return);
}
if ($config->get('registrations.enabled')) {
$profileId = $config->get('registrations.mini.profile', 'default');
if ($profileId === 'default') {
$profileId = Foundry::model('profiles')->getDefaultProfile()->id;
}
$options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
$fieldsModel = Foundry::model('fields');
$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);
$this->set('fields', $fields);
}
}
$this->set('return', $return);
$this->set('facebook', $facebook);
return parent::display('site/login/default');
}
示例2: loadStoryForm
public function loadStoryForm()
{
FD::checkToken();
FD::requireLogin();
FD::language()->loadAdmin();
$categoryid = FD::input()->getInt('id', 0);
$category = FD::table('EventCategory');
$category->load($categoryid);
$db = FD::db();
$sql = $db->sql();
$sql->select('#__social_fields', 'a');
$sql->column('a.*');
$sql->column('d.element');
$sql->leftjoin('#__social_fields_steps', 'b');
$sql->on('a.step_id', 'b.id');
$sql->leftjoin('#__social_clusters_categories', 'c');
$sql->on('b.uid', 'c.id');
$sql->leftjoin('#__social_apps', 'd');
$sql->on('a.app_id', 'd.id');
$sql->where('b.type', SOCIAL_TYPE_CLUSTERS);
$sql->where('c.id', $category->id);
$sql->where('d.group', SOCIAL_FIELDS_GROUP_EVENT);
$sql->where('d.type', SOCIAL_APPS_TYPE_FIELDS);
$sql->where('d.element', array('startend', 'title', 'description'), 'in');
$db->setQuery($sql);
$result = $db->loadObjectList();
$theme = FD::themes();
foreach ($result as $row) {
$field = FD::table('Field');
$field->bind($row);
$params = $field->getParams();
if ($row->element === 'startend') {
$dateFormat = $params->get('date_format', 'DD-MM-YYYY');
if ($params->get('allow_time', true)) {
$dateFormat .= ' ' . $params->get('time_format', 'hh:mm A');
}
if ($params->get('allow_timezone', true)) {
$theme->set('timezones', $this->getTimezones());
}
$theme->set('dateFormat', $dateFormat);
$theme->set('allowTimezone', $params->get('allow_timezone', 1));
$theme->set('allowTime', $params->get('allow_time', 1));
$theme->set('yearfrom', $params->get('yearfrom'));
$theme->set('yearto', $params->get('yearto'));
$theme->set('disallowPast', $params->get('disallow_past', 0));
$theme->set('minuteStepping', $params->get('minute_stepping', 15));
}
if ($row->element === 'title') {
$theme->set('titlePlaceholder', $field->get('title'));
}
if ($row->element === 'description') {
$theme->set('descriptionPlaceholder', $field->get('description'));
}
}
FD::ajax()->resolve($theme->output('apps/user/events/story/panel.form'));
}
示例3: getStates
public function getStates()
{
$country = FD::input()->getString('country');
$region = FD::table('Region');
$region->load(array('type' => SOCIAL_REGION_TYPE_COUNTRY, 'name' => $country, 'state' => SOCIAL_STATE_PUBLISHED));
$states = $region->getChildren(array('ordering' => $this->params->get('sort')));
$data = new stdClass();
foreach ($states as $state) {
$data->{$state->code} = $state->name;
}
FD::ajax()->resolve($data);
}
示例4: calculateTotalRecur
public function calculateTotalRecur()
{
$in = FD::input();
$start = $in->getString('start');
$timezone = $in->getString('timezone');
$end = $in->getString('end');
$type = $in->getString('type');
$daily = $in->getVar('daily', array());
$allday = $in->getBool('allday', false);
$eventId = $in->getString('eventId');
$changed = $in->getInt('changed');
$showWarningMessages = $in->getInt('showWarningMessages');
if (!empty($timezone) && $timezone !== 'UTC') {
$dtz = new DateTimeZone($timezone);
// This is to reverse the time back to UTC
$start = JFactory::getDate($start, $dtz)->toSql();
}
$eventStart = FD::date($start, false);
$result = FD::model('Events')->getRecurringSchedule(array('eventStart' => $eventStart, 'end' => $end, 'type' => $type, 'daily' => $daily));
$schedule = array();
$tf = FD::config()->get('events.timeformat', '12h');
foreach ($result as $time) {
$schedule[] = FD::date($time)->format(JText::_($allday ? 'COM_EASYSOCIAL_DATE_DMY' : 'COM_EASYSOCIAL_DATE_DMY' . ($tf == '12h' ? '12H' : '24H')));
}
if (empty($schedule) && $type != 'none') {
FD::ajax()->reject(JText::_('FIELD_EVENT_RECURRING_NO_RECURRING_EVENT_WILL_BE_CREATED'));
}
$theme = FD::themes();
$total = count($schedule);
$limit = FD::config()->get('events.recurringlimit', 0);
if (!empty($limit) && $limit != 0 && $total > $limit) {
$msg = JText::sprintf('FIELD_EVENT_RECURRING_VALIDATION_MAX_RECURRING_LIMIT', $total, $limit);
return FD::ajax()->reject($msg);
}
$theme->set('schedule', $schedule);
$theme->set('type', $type);
$hasChildren = !empty($eventId) && FD::model('Events')->getTotalEvents(array('state' => SOCIAL_STATE_PUBLISHED, 'parent_id' => $eventId)) > 0;
$theme->set('hasChildren', $hasChildren);
if ($type == 'daily') {
$theme->set('days', array(JText::_('SUNDAY'), JText::_('MONDAY'), JText::_('TUESDAY'), JText::_('WEDNESDAY'), JText::_('THURSDAY'), JText::_('FRIDAY'), JText::_('SATURDAY')));
$theme->set('daily', $daily);
}
$theme->set('changed', $changed);
$theme->set('showWarningMessages', $showWarningMessages);
$html = $theme->output('fields/event/recurring/summary');
FD::ajax()->resolve($html);
}
示例5: reject
public function reject()
{
$id = FD::input()->getInt('relid');
$ajax = FD::ajax();
$user = FD::user();
$relation = $this->table('relations');
$state = $relation->load($id);
if (!$state) {
return $ajax->reject(JText::_('PLG_FIELDS_RELATIONSHIP_NOT_FOUND'));
}
if (!$relation->isTarget()) {
return $ajax->reject(JText::_('PLG_FIELDS_RELATIONSHIP_NOT_TARGET_TO_PERFORM_ACTION'));
}
$state = $relation->reject();
if (!$state) {
return $ajax->reject(JText::_('PLG_FIELDS_RELATIONSHIP_REJECT_ERROR'));
}
return $ajax->resolve();
}
示例6: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($eventId = null, $docType = null)
{
// Load up the event
$event = FD::event($eventId);
// Get the event params
$params = $event->getParams();
// Load up the events model
$model = FD::model('Events');
$type = FD::input()->getString('type', 'going');
$options = array();
if ($type === 'going') {
$options['state'] = SOCIAL_EVENT_GUEST_GOING;
}
if ($params->get('allowmaybe') && $type === 'maybe') {
$options['state'] = SOCIAL_EVENT_GUEST_MAYBE;
}
if ($params->get('allownotgoingguest') && $type === 'notgoing') {
$options['state'] = SOCIAL_EVENT_GUEST_NOT_GOING;
}
if ($event->isClosed() && $type === 'pending') {
$options['state'] = SOCIAL_EVENT_GUEST_PENDING;
}
if ($type === 'admin') {
$options['admin'] = 1;
}
$this->set('type', $type);
$guests = $model->getGuests($event->id, $options);
$pagination = $model->getPagination();
$this->set('event', $event);
$this->set('guests', $guests);
$eventAlias = $event->getAlias();
$appAlias = $this->app->getAlias();
$permalinks = array('going' => '', 'notgoing' => '', 'maybe' => '', 'admin' => '', 'pending' => '');
// Avoid using $filter because it is a FRoute reserved word
foreach ($permalinks as $key => &$value) {
$value = FRoute::events(array('layout' => 'item', 'id' => $eventAlias, 'appId' => $appAlias, 'type' => $key));
}
$this->set('permalinks', $permalinks);
$myGuest = $event->getGuest();
$this->set('myGuest', $myGuest);
echo parent::display('events/default');
}
示例7: display
public function display($groupId = null, $docType = null)
{
$group = FD::group($groupId);
// Check if the viewer is allowed here.
if (!$group->canViewItem()) {
return $this->redirect($group->getPermalink(false));
}
$params = $this->app->getParams();
$this->set('group', $group);
$model = FD::model('Events');
$start = FD::input()->getInt('start', 0);
// Get the events
$events = $model->getEvents(array('state' => SOCIAL_STATE_PUBLISHED, 'ordering' => 'start', 'limit' => 5, 'limitstart' => $start, 'start-after' => FD::date()->toSql(true), 'group_id' => $group->id, 'type' => 'all'));
$pagination = $model->getPagination();
$pagination->setVar('option', 'com_easysocial');
$pagination->setVar('view', 'groups');
$pagination->setVar('layout', 'item');
$pagination->setVar('id', $group->getAlias());
$pagination->setVar('appId', $this->app->getAlias());
$this->set('events', $events);
$this->set('pagination', $pagination);
// Parameters to work with site/event/default.list
$this->set('filter', 'all');
$this->set('delayed', false);
$this->set('showSorting', false);
$this->set('showDistanceSorting', false);
$this->set('showPastFilter', false);
$this->set('showDistance', false);
$this->set('hasLocation', false);
$this->set('includePast', false);
$this->set('ordering', 'start');
$this->set('isGroupOwner', true);
$guestApp = FD::table('App');
$guestApp->load(array('type' => SOCIAL_TYPE_APPS, 'group' => SOCIAL_TYPE_EVENT, 'element' => 'guests'));
$this->set('guestApp', $guestApp);
echo parent::display('groups/default');
}
示例8: onBeforeStorySave
public function onBeforeStorySave(&$template, &$stream, &$content)
{
$params = $this->getParams();
// Determine if we should attach ourselves here.
if (!$params->get('story_event', true)) {
return;
}
$in = FD::input();
$title = $in->getString('event_title');
$description = $in->getString('event_description');
$categoryid = $in->getInt('event_category');
$start = $in->getString('event_start');
$end = $in->getString('event_end');
$timezone = $in->getString('event_timezone');
// If no category id, then we don't proceed
if (empty($categoryid)) {
return;
}
// Perhaps in the future we use FD::model('Event')->createEvent() instead.
// For now just hardcode it here to prevent field triggering and figuring out how to punch data into the respective field data because the form is not rendered through field trigger.
$my = FD::user();
$event = FD::event();
$event->title = $title;
$event->description = $description;
// Set a default params for this event first
$event->params = '{"photo":{"albums":true},"news":true,"discussions":true,"allownotgoingguest":false,"allowmaybe":true,"guestlimit":0}';
$event->type = SOCIAL_EVENT_TYPE_PUBLIC;
$event->creator_uid = $my->id;
$event->creator_type = SOCIAL_TYPE_USER;
$event->category_id = $categoryid;
$event->cluster_type = SOCIAL_TYPE_EVENT;
$event->alias = FD::model('Events')->getUniqueAlias($title);
$event->created = FD::date()->toSql();
$event->key = md5($event->created . $my->password . uniqid());
$event->state = SOCIAL_CLUSTER_PENDING;
if ($my->isSiteAdmin() || !$my->getAccess()->get('events.moderate')) {
$event->state = SOCIAL_CLUSTER_PUBLISHED;
}
// Trigger apps
FD::apps()->load(SOCIAL_TYPE_USER);
$dispatcher = FD::dispatcher();
$triggerArgs = array(&$event, &$my, true);
// @trigger: onEventBeforeSave
$dispatcher->trigger(SOCIAL_TYPE_USER, 'onEventBeforeSave', $triggerArgs);
$state = $event->save();
// Notifies admin when a new event is created
if ($event->state === SOCIAL_CLUSTER_PENDING || !$my->isSiteAdmin()) {
FD::model('Events')->notifyAdmins($event);
}
// Set the meta for start end timezone
$meta = $event->meta;
$meta->cluster_id = $event->id;
$meta->start = FD::date($start)->toSql();
$meta->end = FD::date($end)->toSql();
$meta->timezone = $timezone;
$meta->store();
// Recreate the event object
$event = FD::event($event->id);
// Create a new owner object
$event->createOwner($my->id);
// @trigger: onEventAfterSave
$triggerArgs = array(&$event, &$my, true);
$dispatcher->trigger(SOCIAL_TYPE_USER, 'onEventAfterSave', $triggerArgs);
// Due to inconsistency, we don't use SOCIAL_TYPE_EVENT.
// Instead we use "events" because app elements are named with 's', namely users, groups, events.
$template->context_type = 'events';
$template->context_id = $event->id;
$template->cluster_access = $event->type;
$template->cluster_type = $event->cluster_type;
$template->cluster_id = $event->id;
$params = array('event' => $event);
$template->setParams(FD::json()->encode($params));
}
示例9: getEditComment
public function getEditComment()
{
$id = FD::input()->getInt('id');
$comment = FD::table('comments');
$comment->load($id);
$tags = FD::model('Tags')->getTags($id, 'comments');
$overlay = $comment->comment;
$counter = 0;
$tmp = array();
foreach ($tags as $tag) {
if ($tag->type === 'entity' && $tag->item_type === SOCIAL_TYPE_USER) {
$user = FD::user($tag->item_id);
$replace = '<span data-value="user:' . $tag->item_id . '" data-type="entity">' . $user->getName() . '</span>';
}
if ($tag->type === 'hashtag') {
$replace = '<span data-value="' . $tag->title . '" data-type="hashtag">' . "#" . $tag->title . '</span>';
}
$tmp[$counter] = $replace;
$replace = '[si:mentions]' . $counter . '[/si:mentions]';
$overlay = JString::substr_replace($overlay, $replace, $tag->offset, $tag->length);
$counter++;
}
$overlay = FD::string()->escape($overlay);
foreach ($tmp as $i => $v) {
$overlay = str_ireplace('[si:mentions]' . $i . '[/si:mentions]', $v, $overlay);
}
$theme = FD::themes();
$theme->set('comment', $comment->comment);
$theme->set('overlay', $overlay);
$contents = $theme->output('site/comments/editForm');
$this->getCurrentView()->call(__FUNCTION__, $contents);
}
示例10: route
/**
* Builds the URLs for apps view
*
* @since 1.0
* @access public
* @param array An array of request arguments
* @param bool Determines if the url should be xhtml compliant
* @return url The string of the URL
*/
public function route($options = array(), $xhtml = true)
{
$url = self::$base . '&view=' . $this->name;
// Custom options
$ssl = $options['ssl'];
$tokenize = $options['tokenize'];
$external = $options['external'];
$tmpl = $options['tmpl'];
$sef = $options['sef'];
$layout = isset($options['layout']) ? $options['layout'] : '';
// check if the current request is from feed page or not.
// if yes, let set the external to always true.
$pageFormat = FD::input()->get('format', '', 'var');
if (!$external && $pageFormat == 'feed') {
$external = true;
}
// Determines if this is a request to the controller
$controller = $options['controller'];
$data = array();
unset($options['ssl'], $options['tokenize'], $options['external'], $options['tmpl'], $options['controller'], $options['sef']);
if ($options) {
foreach ($options as $key => $value) {
$data[] = $key . '=' . $value;
}
}
$query = $options;
$options = implode('&', $data);
$join = !empty($options) ? '&' : '';
$url = $url . $join . $options;
// Try to get the url from the adapter
$overrideUrl = '';
// Set temporary data
$query['view'] = $this->name;
$query['option'] = 'com_easysocial';
// Ensure that all query values are lowercased
$query = array_map(array('JString', 'strtolower'), $query);
// Let's find for a suitable menu
$view = $this->name;
$layout = isset($query['layout']) ? $query['layout'] : '';
$id = isset($query['id']) ? (int) $query['id'] : '';
// For photos and albums, we want to fetch menu from "All Albums"
if ($view == 'photos' || $view == 'albums') {
$view = 'albums';
$layout = 'all';
$id = '';
}
$menuId = FRoute::getItemId($view, $layout, $id);
if ($menuId) {
$menu = JFactory::getApplication()->getMenu()->getItem($menuId);
if ($menu) {
$current = $menu->query;
if (isset($current['id']) && !empty($current['id'])) {
$current['id'] = (int) $current['id'];
}
if (isset($query['id'])) {
$query['id'] = (int) $query['id'];
}
$hasDiff = array_diff($query, $current);
// // If there's no difference in both sets of query, we can safely assume that there's already
// // a menu for this link
if (empty($hasDiff)) {
$overrideUrl = 'index.php?Itemid=' . $menuId;
}
//$overrideUrl = 'index.php?Itemid=' . $menuId;
}
}
// If there are no overriden url's, we append our own item id.
if ($overrideUrl) {
$url = $overrideUrl;
} else {
// If there is no getUrl method, we want to get the default item id.
if ($menuId) {
$url .= '&Itemid=' . $menuId;
} else {
$url .= '&Itemid=' . FRoute::getItemId($view, $layout);
}
}
return FRoute::_($url, $xhtml, array(), $ssl, $tokenize, $external, $tmpl, $controller, $sef);
}