• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FD类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getElementSource

 private function getElementSource()
 {
     $element = $this->item->context;
     $uid = $this->item->contextId;
     // photos has the special threatment. if the item is a aggregated item, then the context is album and the uid is albumid.
     if ($element == 'photos') {
         if (count($this->item->contextIds) > 1) {
             $photo = FD::table('Photo');
             $photo->load($uid);
             $element = 'albums';
             $uid = $photo->album_id;
         }
     }
     if ($element == 'story' || $element == 'links') {
         $uid = $this->item->uid;
     }
     if ($element == 'badges') {
         $tbl = FD::table('StreamItem');
         $tbl->load(array('uid' => $this->item->uid));
         $element = SOCIAL_TYPE_ACTIVITY;
         $uid = $tbl->id;
     }
     $obj = new stdClass();
     $obj->element = $element;
     $obj->uid = $uid;
     return $obj;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:27,代码来源:comments.php


示例2: isValid

 /**
  * Validates the username.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	JSON	A jsong encoded string.
  *
  * @author	Jason Rey <[email protected]>
  */
 public function isValid()
 {
     // Render the ajax lib.
     $ajax = FD::getInstance('Ajax');
     // Get the userid
     $userid = JRequest::getInt('userid', 0);
     // Get the event
     $event = JRequest::getString('event');
     // Set the current username
     $current = '';
     if (!empty($userid)) {
         $user = FD::user($userid);
         $current = $user->username;
     }
     // Get the provided username that the user has typed.
     $username = JRequest::getVar('username', '');
     // Username is required, check if username is empty
     if (JString::strlen($username) < $this->params->get('min')) {
         return $ajax->reject(JText::sprintf('PLG_FIELDS_JOOMLA_USERNAME_MIN_CHARACTERS', $this->params->get('min')));
     }
     // Test if username is allowed (by pass for adminedit).
     if ($event !== 'onAdminEdit' && !SocialFieldsUserJoomlaUsernameHelper::allowed($username, $this->params)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_ALLOWED'));
     }
     // Test if username exists.
     if (SocialFieldsUserJoomlaUsernameHelper::exists($username, $current)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_AVAILABLE'));
     }
     // Test if the username is valid
     if (!SocialFieldsUserJoomlaUsernameHelper::isValid($username, $this->params)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_IS_INVALID'));
     }
     $text = JText::_('PLG_FIELDS_JOOMLA_USERNAME_AVAILABLE');
     return $ajax->resolve($text);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:45,代码来源:ajax.php


示例3: createCover

 /**
  * Some desc
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function createCover($file, $inputName)
 {
     // Load our own image library
     $image = FD::image();
     // Generates a unique name for this image.
     $name = $file['name'];
     // Load up the file.
     $image->load($file['tmp_name'], $name);
     // Ensure that the image is valid.
     if (!$image->isValid()) {
         // @TODO: Add some logging here.
         echo JText::_('PLG_FIELDS_AVATAR_VALIDATION_INVALID_IMAGE');
         exit;
     }
     // Get the storage path
     $storage = SocialFieldsUserCoverHelper::getStoragePath($inputName);
     // Create a new avatar object.
     $photos = FD::get('Photos', $image);
     // Create avatars
     $sizes = $photos->create($storage);
     // We want to format the output to get the full absolute url.
     $base = basename($storage);
     $result = array();
     foreach ($sizes as $size => $value) {
         $row = new stdClass();
         $row->title = $file['name'];
         $row->file = $value;
         $row->path = JPATH_ROOT . '/media/com_easysocial/tmp/' . $base . '/' . $value;
         $row->uri = rtrim(JURI::root(), '/') . '/media/com_easysocial/tmp/' . $base . '/' . $value;
         $result[$size] = $row;
     }
     return $result;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:41,代码来源:ajax.php


示例4: getItems

 public function getItems($options = array())
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_clusters_nodes', 'a');
     $sql->column('a.*');
     $eventid = isset($options['eventid']) ? $options['eventid'] : 0;
     $sql->where('cluster_id', $eventid);
     if (isset($options['state'])) {
         $sql->where('state', $state);
     }
     if (isset($options['admin'])) {
         $sql->where('admin', $options['admin']);
     }
     $ordering = $this->getState('ordering');
     if (!empty($ordering)) {
         $direction = $this->getState('direction');
         if ($ordering == 'username') {
             $sql->leftjoin('#__users', 'b');
             $sql->on('a.uid', 'b.id');
             $sql->order('b.username', $direction);
         } elseif ($ordering == 'name') {
             $sql->leftjoin('#__users', 'b');
             $sql->on('a.uid', 'b.id');
             $sql->order('b.name', $direction);
         } else {
             $sql->order($ordering, $direction);
         }
     }
     $this->setTotal($sql->getTotalSql());
     $result = $this->getData($sql->getSql());
     $guests = $this->bindTable('EventGuest', $result);
     return $guests;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:eventguests.php


示例5: main

 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     // First we get the core.view privacy id
     $sql->select('#__social_privacy')->column('id')->where('type', 'core')->where('rule', 'view');
     $db->setQuery($sql);
     $origId = $db->loadResult();
     // Then we cache a copy of all the new field rules and the id
     $sql->clear();
     $sql->select('#__social_privacy')->column('id')->column('rule')->where('type', 'field');
     $db->setQuery($sql);
     $rules = $db->loadObjectList('rule');
     // Then we get all the privacy items with this id and type = 'field'
     $sql->clear();
     $sql->select('#__social_privacy_items', 'a')->column('a.*')->column('c.element')->leftjoin('#__social_fields', 'b')->on('b.id', 'a.uid')->leftjoin('#__social_apps', 'c')->on('b.app_id', 'c.id')->where('(')->where('a.type', 'field')->where('a.type', 'field.datetime.year', '=', 'OR')->where(')');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     // Based on the element, we need to find the new id to map it to the rule
     foreach ($result as $row) {
         if (isset($rules[$row->element])) {
             $table = FD::table('privacyitems');
             $table->bind($row);
             $table->privacy_id = $rules[$row->element]->id;
             $table->store();
         }
     }
     // field.datetime.year need to change to year
     $sql->clear();
     $sql->update('#__social_privacy_items')->set('type', 'year')->where('type', 'field.datetime.year');
     $db->setQuery($sql);
     $db->query();
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:UpdateFieldPrivacyRules.php


示例6: 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;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:60,代码来源:report.php


示例7: getResult

 public function getResult($queries = array())
 {
     $this->setQueries($queries);
     // There is 2 parts to this
     // nearbysearch
     // textsearch
     $nearbysearchUrl = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json';
     $textsearchUrl = 'https://maps.googleapis.com/maps/api/place/textsearch/json';
     $nearbysearchOptions = array('location' => $this->queries['location'], 'radius' => $this->queries['radius'], 'key' => $this->queries['key'], 'keyword' => $this->queries['keyword']);
     $textsearchOptions = array('query' => $this->queries['query'], 'key' => $this->queries['key']);
     $connector = FD::connector();
     $connector->setMethod('GET');
     $connector->addUrl($nearbysearchUrl . '?' . http_build_query($nearbysearchOptions));
     if (!empty($this->queries['query'])) {
         $connector->addUrl($textsearchUrl . '?' . http_build_query($textsearchOptions));
     }
     $connector->execute();
     $results = $connector->getResults();
     $venues = array();
     foreach ($results as $result) {
         $obj = json_decode($result->contents);
         foreach ($obj->results as $row) {
             $obj = new SocialLocationData();
             $obj->latitude = $row->geometry->location->lat;
             $obj->longitude = $row->geometry->location->lng;
             $obj->name = $row->name;
             $obj->address = isset($row->formatted_address) ? $row->formatted_address : '';
             $obj->fulladdress = !empty($obj->address) ? $obj->name . ', ' . $obj->address : '';
             $venues[$row->id] = $obj;
         }
     }
     $venues = array_values($venues);
     return $venues;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:places.php


示例8: 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($userId = null, $docType = null)
 {
     // Require user to be logged in
     FD::requireLogin();
     $id = JRequest::getVar('schedule_id');
     // Get the user that's being accessed.
     $user = FD::user($userId);
     $calendar = FD::table('Calendar');
     $calendar->load($id);
     if (!$calendar->id || !$id) {
         FD::info()->set(false, JText::_('APP_CALENDAR_CANVAS_INVALID_SCHEDULE_ID'), SOCIAL_MSG_ERROR);
         return $this->redirect(FD::profile(array('id' => $user->getAlias()), false));
     }
     $my = FD::user();
     $privacy = FD::privacy($my->id);
     $result = $privacy->validate('apps.calendar', $calendar->id, 'view', $user->id);
     if (!$result) {
         FD::info()->set(false, JText::_('APP_CALENDAR_NO_ACCESS'), SOCIAL_MSG_ERROR);
         JFactory::getApplication()->redirect(FRoute::dashboard());
     }
     FD::page()->title($calendar->title);
     // Render the comments and likes
     $likes = FD::likes();
     $likes->get($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER);
     // Apply comments on the stream
     $comments = FD::comments($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::albums(array('layout' => 'item', 'id' => $id))));
     $params = $this->app->getParams();
     $this->set('params', $params);
     $this->set('likes', $likes);
     $this->set('comments', $comments);
     $this->set('calendar', $calendar);
     $this->set('user', $user);
     echo parent::display('canvas/item/default');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:41,代码来源:view.html.php


示例9: fetch

 /**
  * Does a remote call to the server to fetch contents of a given url.
  *
  * @since	1.0
  * @access	public
  */
 public function fetch()
 {
     // Check for request forgeries!
     $urls = $this->input->get('urls', array(), 'array');
     // Result placeholder
     $result = array();
     if (!$urls) {
         $this->view->setMessage('COM_EASYSOCIAL_CRAWLER_INVALID_URL_PROVIDED', SOCIAL_MSG_ERROR);
         return $this->view->call(__FUNCTION__);
     }
     // Get the crawler
     $crawler = FD::get('crawler');
     foreach ($urls as $url) {
         // Generate a hash for the url
         $hash = md5($url);
         $link = FD::table('Link');
         $exists = $link->load(array('hash' => $hash));
         // If it doesn't exist, store it.
         if (!$exists) {
             $crawler->crawl($url);
             // Get the data from our crawler library
             $data = $crawler->getData();
             // Now we need to cache the link so that the next time, we don't crawl it again.
             $link->hash = $hash;
             $link->data = json_encode($data);
             $link->store();
         }
         $result[$url] = json_decode($link->data);
     }
     return $this->view->call(__FUNCTION__, $result);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:37,代码来源:crawler.php


示例10: load

 public function load($path)
 {
     // Locate for the manifest file in the folder.
     $files = FD::get('Folders')->files($path, '.xml', self::RECURSIVE_SEARCH, self::RETRIEVE_FULL_PATH);
     $this->source = $path;
     if (!count($files)) {
         // Throw errors
         FD::get('Errors')->set('installer.xml', self::XML_NOT_FOUND);
         return false;
     }
     // Load through the list of manifest files to perform the installation.
     foreach ($files as $file) {
         $xml = JFactory::getXML($file);
         if (!$xml) {
             FD::get('Errors')->set('installer', self::XML_NOT_VALID);
             unset($xml);
             continue;
         }
         $this->type = (string) $xml->attributes()->type;
         if ($xml->getName() != 'social' || !in_array($this->type, $this->allowed)) {
             FD::get('Errors')->set('installer', self::XML_NOT_VALID);
             unset($parser);
             continue;
         }
         $this->parser = JFactory::getXMLParser('Simple');
         $this->parser->loadFile($file);
         // Set the path of the current xml file.
         $this->path = $file;
         // Retrieves the element
         $this->element = $this->parser->document->getElementByPath('element')->data();
         unset($xml);
         return true;
     }
     return false;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:joomla17.php


示例11: 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($uid = null, $docType = null)
 {
     $group = FD::group($uid);
     $editor = JFactory::getEditor();
     // Only allow group admin to create or edit news
     if (!$group->isAdmin() && !$this->my->isSiteAdmin()) {
         FD::info()->set(false, JText::_('COM_EASYSOCIAL_GROUPS_ONLY_MEMBER_ARE_ALLOWED'), SOCIAL_MSG_ERROR);
         return $this->redirect($group->getPermalink(false));
     }
     $id = JRequest::getInt('newsId');
     $news = FD::table('GroupNews');
     $news->load($id);
     FD::page()->title(JText::_('APP_GROUP_NEWS_FORM_UPDATE_PAGE_TITLE'));
     // Determine if this is a new record or not
     if (!$id) {
         $news->comments = true;
         FD::page()->title(JText::_('APP_GROUP_NEWS_FORM_CREATE_PAGE_TITLE'));
     }
     // Get app params
     $params = $this->app->getParams();
     $this->set('params', $params);
     $this->set('news', $news);
     $this->set('editor', $editor);
     $this->set('group', $group);
     echo parent::display('canvas/form');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:33,代码来源:view.html.php


示例12: createStream

 public function createStream($verb)
 {
     // Create a new stream item for this discussion
     $stream = FD::stream();
     // Get the stream template
     $tpl = $stream->getTemplate();
     // Someone just joined the event
     $tpl->setActor($this->created_by, SOCIAL_TYPE_USER);
     // Set the params to cache the event data
     $registry = FD::registry();
     $registry->set('news', $this);
     // Set the context
     $tpl->setContext($this->id, 'news');
     $event = FD::event($this->cluster_id);
     // Set the cluster
     $tpl->setCluster($this->cluster_id, SOCIAL_TYPE_EVENT, $event->type);
     // Set the verb
     $tpl->setVerb($verb);
     // Set the params
     $tpl->setParams($registry);
     if ($this->_stream_date) {
         $tpl->setDate($this->_stream_date);
     }
     $tpl->setAccess('core.view');
     // Add the stream
     $stream->add($tpl);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:27,代码来源:eventnews.php


示例13: getItems

 public function getItems()
 {
     $db = FD::db();
     $query = 'SELECT * FROM ' . $db->nameQuote('#__social_toolbar') . ' WHERE ' . $db->nameQuote('state') . '=' . $db->Quote(SOCIAL_STATE_PUBLISHED);
     $db->setQuery($query);
     return $db->loadObjectList();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:7,代码来源:toolbar.php


示例14: onDisplay

 public function onDisplay($user)
 {
     $regDate = FD::date($user->registerDate);
     $format = 'd M Y';
     switch ($this->params->get('date_format')) {
         case 2:
         case '2':
             $format = 'M d Y';
             break;
         case 3:
         case '3':
             $format = 'Y d M';
             break;
         case 4:
         case '4':
             $format = 'Y M d';
             break;
     }
     // linkage to advanced search page.
     // place the code here so that the timezone wont kick in. we search the date using GMT value.
     $field = $this->field;
     if ($field->searchable) {
         $date = $regDate->toFormat('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     $this->set('date', $regDate->toFormat($format));
     return $this->display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:joomla_joindate.php


示例15: route

 /**
  * Redirects a notification item to the intended location
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function route()
 {
     // The user needs to be logged in to access notifications
     FD::requireLogin();
     // Check for user profile completeness
     FD::checkCompleteProfile();
     $id = JRequest::getInt('id');
     $table = FD::table('Notification');
     $table->load($id);
     if (!$id || !$table->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Check if the user is allowed to view this notification item.
     $my = FD::user();
     if ($table->target_id != $my->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Mark the notification item as read
     $table->markAsRead();
     // Ensure that all &amp; are replaced with &
     $url = str_ireplace('&amp;', '&', $table->url);
     $this->redirect(FRoute::_($url, false));
     $this->close();
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:34,代码来源:view.html.php


示例16: execute

 public function execute($item, $calendar)
 {
     $model = FD::model('comments');
     $users = $model->getParticipants($item->uid, $item->context_type);
     // Include the notification actor
     $users[] = $item->actor_id;
     // Exclude the current user
     $users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
     $names = FD::string()->namesToNotifications($users);
     $plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
     $content = '';
     if (count($users) == 1 && !empty($item->content)) {
         $content = JString::substr(strip_tags($item->content), 0, 30);
         if (JString::strlen($item->content) > 30) {
             $content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
         }
     }
     $item->content = $content;
     if ($calendar->user_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
         $item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_YOUR_EVENT' . $plurality, $names);
         return $item;
     }
     if ($calendar->user_id == $item->actor_id && count($users) == 1) {
         $item->title = JText::sprintf('APP_USER_CALENDAR_OWNER_COMMENTED_ON_EVENT' . FD::user($calendar->user_id)->getGendarLang(), $names);
         return $item;
     }
     $item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_USER_EVENT' . $plurality, $names, FD::user($calendar->user_id)->getName());
     return $item;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:29,代码来源:notification.comments.php


示例17: auth

 /**
  * Allows remote user to authenticate via a normal http request and returns with an authentication code.
  *
  * @since	1.2.8
  * @access	public
  * @param	string
  * @return
  */
 public function auth()
 {
     $username = JRequest::getVar('username');
     $password = JRequest::getVar('password');
     $data = array('username' => $username, 'password' => $password);
     $app = JFactory::getApplication();
     $state = $app->login($data);
     if ($state === false) {
         $this->set('code', 403);
         $this->set('message', JText::_('Invalid username or password provided'));
         return parent::display();
     }
     // Get the user's id based on the username.
     $model = FD::model('Users');
     $id = $model->getUserId('username', $username);
     if (!$id) {
         $this->set('code', 403);
         $this->set('message', JText::_('Unable to locate the user id with the given username.'));
         return parent::display();
     }
     $user = FD::user($id);
     // User logs in successfully. Generate an authentication code for the user
     $user->auth = md5($user->password . JFactory::getDate()->toSql());
     $user->store();
     $this->set('auth', $user->auth);
     $this->set('code', 200);
     $this->set('id', $user->id);
     return parent::display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:37,代码来源:view.json.php


示例18: fetch

 /**
  * Does a remote call to the server to fetch contents of a given url.
  *
  * @since	1.0
  * @access	public
  */
 public function fetch()
 {
     // Check for request forgeries!
     $urls = JRequest::getVar('urls');
     // Ensure that the urls are in an array
     FD::makeArray($urls);
     // Get the current view.
     $view = $this->getCurrentView();
     // Result placeholder
     $result = array();
     if (!$urls || empty($urls)) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_CRAWLER_INVALID_URL_PROVIDED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     $crawler = FD::get('Crawler');
     foreach ($urls as $url) {
         $hash = md5($url);
         $link = FD::table('Link');
         $exists = $link->load(array('hash' => $hash));
         // If it doesn't exist, store it.
         if (!$exists) {
             $crawler->crawl($url);
             $data = $crawler->getData();
             $link->hash = $hash;
             $link->data = FD::json()->encode($data);
             // Store the new link
             $link->store();
         }
         $result[$url] = FD::json()->decode($link->data);
     }
     return $view->call(__FUNCTION__, $result);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:38,代码来源:crawler.php


示例19: execute

 /**
  *
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function execute($item)
 {
     // Get the badge
     $badge = FD::table('Badge');
     $badge->load($item->uid);
     // Break the namespace
     list($element, $group, $verb, $owner) = explode('.', $item->context_type);
     // Get the permalink of the achievement item which is the stream item
     $streamItem = FD::table('StreamItem');
     $streamItem->load(array('context_type' => $element, 'verb' => $verb, 'actor_type' => $group, 'actor_id' => $owner));
     // Get comment participants
     $model = FD::model('Comments');
     $users = $model->getParticipants($item->uid, $item->context_type);
     $users[] = $item->actor_id;
     $users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
     // Convert the names to stream-ish
     $names = FD::string()->namesToNotifications($users);
     // Get the badge image
     $item->image = $badge->getAvatar();
     $plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
     // We need to generate the notification message differently for the author of the item and the recipients of the item.
     if ($owner == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
         $item->title = JText::sprintf('APP_USER_BADGES_USER_COMMENTED_ON_YOUR_ACHIEVEMENT' . $plurality, $names, $badge->get('title'));
         return $item;
     }
     if ($owner == $item->actor_id && count($users) == 1) {
         $item->title = JText::sprintf('APP_USER_BADGES_OWNER_COMMENTED_ON_ACHIEVEMENT' . FD::user($owner)->getGenderLang(), $names, $badge->get('title'));
         return $item;
     }
     // This is for 3rd party viewers
     $item->title = JText::sprintf('APP_USER_BADGES_USER_COMMENTED_ON_USERS_ACHIEVEMENT' . $plurality, $names, FD::user($stream->actor_id)->getName(), $badge->get('title'));
     return $item;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:41,代码来源:notification.comments.php


示例20: profileHeaderB

 public function profileHeaderB($key, $user, $field)
 {
     // Get the data
     $data = $field->data;
     if (!$data) {
         return;
     }
     $my = FD::user();
     $privacyLib = FD::privacy($my->id);
     if (!$privacyLib->validate('core.view', $field->id, SOCIAL_TYPE_FIELD, $user->id)) {
         return;
     }
     $obj = FD::makeObject($data);
     $theme = FD::themes();
     $hide = true;
     foreach ($obj as $k => &$v) {
         $v = $theme->html('string.escape', $v);
         if (!empty($v)) {
             $hide = false;
         }
     }
     if ($hide) {
         return true;
     }
     $params = $field->getParams();
     // Convert country to full text
     if (!empty($obj->country)) {
         $obj->country_code = $obj->country;
         $obj->country = SocialFieldsUserAddressHelper::getCountryName($obj->country, $params->get('data_source'));
     }
     $theme->set('value', $obj);
     $theme->set('params', $field->getParams());
     echo $theme->output('fields/user/address/widgets/display');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:view.html.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FDB类代码示例发布时间:2022-05-23
下一篇:
PHP FC_SQL类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap