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


PHP FD::makeObject方法代码示例

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


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

示例1: install

 /**
  * Given a path to the file, install the points.
  *
  * @since	1.0
  * @access	public
  * @param	string		The path to the .points file.
  * @return	bool		True if success false otherwise.
  */
 public function install($file)
 {
     // Import platform's file library.
     jimport('joomla.filesystem.file');
     // Convert the contents to an object
     $alerts = FD::makeObject($file);
     $result = array();
     if ($alerts) {
         foreach ($alerts as $alert) {
             $table = FD::table('Alert');
             $exists = $table->load(array('element' => $alert->element, 'rule' => $alert->rule));
             if (!$exists) {
                 $table->element = $alert->element;
                 $table->rule = $alert->rule;
                 $table->created = FD::date()->toSql();
                 if (!isset($alert->value)) {
                     $table->email = true;
                     $table->system = true;
                 } else {
                     $table->email = $alert->value->email;
                     $table->system = $alert->value->system;
                 }
             }
             $table->app = isset($alert->app) ? $alert->app : false;
             $table->field = isset($alert->field) ? $alert->field : false;
             $table->group = isset($alert->group) ? $alert->group : false;
             $table->extension = isset($alert->extension) ? $alert->extension : false;
             $table->core = isset($alert->core) ? $alert->core : 0;
             $table->app = isset($alert->app) ? $alert->app : 0;
             $table->field = isset($alert->field) ? $alert->field : 0;
             $result[] = $table->store();
         }
     }
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:43,代码来源:alert.php

示例2: main

 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     // For country field
     $sql->select('#__social_fields_data', 'a')->column('a.*')->leftjoin('#__social_fields', 'b')->on('b.id', 'a.field_id')->leftjoin('#__social_apps', 'c')->on('c.id', 'b.app_id')->where('a.datakey', '')->where('c.type', 'fields')->where('c.element', 'country');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     $json = FD::json();
     // Load up the list of countries
     $file = SOCIAL_ADMIN_DEFAULTS . '/countries.json';
     $list = FD::makeObject($file);
     foreach ($result as $row) {
         if ($json->isJsonString($row->data)) {
             $data = $json->decode($row->data);
             // Split json object into each individual row
             foreach ($data as $k => $v) {
                 if (!empty($v)) {
                     $table = $this->getTable($row->field_id, $row->uid, $row->type, $k);
                     $country = $list->{$v};
                     $table->data = $country;
                     $table->raw = $country;
                     $table->store();
                 }
             }
         }
         // Remove the row with empty key
         $sql->clear();
         $sql->delete('#__social_fields_data')->where('id', $row->id);
         $db->setQuery($sql);
         $db->query();
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:UpdateCountryFieldData.php

示例3: 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

示例4: main

 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_fields_data', 'a');
     $sql->column('a.id');
     $sql->column('a.data');
     $sql->leftjoin('#__social_fields', 'b');
     $sql->on('a.field_id', 'b.id');
     $sql->leftjoin('#__social_apps', 'c');
     $sql->on('b.app_id', 'c.id');
     $sql->where('c.type', 'fields');
     $sql->where('c.element', 'address');
     $sql->where('a.datakey', '');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     $json = FD::json();
     // Load up the list of countries
     $file = SOCIAL_ADMIN_DEFAULTS . '/countries.json';
     $list = FD::makeObject($file);
     foreach ($result as $row) {
         if (!$json->isJsonString($row->data)) {
             continue;
         }
         $data = $json->decode($row->data);
         if ($data->city) {
             $data->city = str_replace('`', '\'', $data->city);
         }
         if ($data->state) {
             $data->state = str_replace('`', '\'', $data->state);
         }
         if ($data->zip) {
             $data->zip = str_replace('`', '\'', $data->zip);
         }
         if (!empty($data->country) && strlen($data->country) === 2 && isset($list->{$data->country})) {
             $data->country = $list->{$data->country};
         }
         // Recreate the json string
         $string = $json->encode($data);
         // Recreate the raw data
         unset($data->latitude);
         unset($data->longitude);
         $raw = implode(array_values((array) $data), ' ');
         $raw = str_replace('`', '\'', $raw);
         $sql->clear();
         $sql->update('#__social_fields_data');
         $sql->set('data', $string);
         $sql->set('raw', $raw);
         $sql->where('id', $row->id);
         $db->setQuery($sql);
         $db->query();
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:54,代码来源:UpdateAddressCountriesToLongName.php

示例5: installCoreRules

 /**
  * Installs the core rules
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function installCoreRules()
 {
     $file = SOCIAL_ADMIN_DEFAULTS . '/alerts.json';
     // Convert the contents to an object
     $alerts = FD::makeObject($file);
     if ($alerts) {
         foreach ($alerts as $element => $rules) {
             $registry = $this->getRegistry($element);
             foreach ($rules as $item) {
                 $registry->register($item->key, $item->value->email, $item->value->system, array('core' => $item->value->core));
             }
         }
     }
     return true;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:23,代码来源:alert.php

示例6: getNews

 /**
  * Retrieve updates from news update servers.
  *
  * @since	1.0
  * @access	public
  * @param	string	The name of the app.
  * @return	Array	An array of news objects.
  *
  * @author	Mark Lee <mark@stackideas.com>
  */
 public function getNews($app = 'easysocial')
 {
     switch ($app) {
         // This is the core news item.
         case 'easysocial':
             $url = SOCIAL_SERVICE_NEWS;
             break;
     }
     $connector = FD::get('Connector');
     $connector->addUrl($url);
     $connector->connect();
     // Get the json contents
     $contents = $connector->getResult($url);
     // Convert the json string to an object.
     $obj = FD::makeObject($contents);
     return $obj;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:27,代码来源:news.php

示例7: main

 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_config');
     $sql->column('value');
     $sql->where('type', 'site');
     $db->setQuery($sql);
     $value = $db->loadResult();
     $obj = FD::makeObject($value);
     $default = FD::makeObject(SOCIAL_ADMIN_DEFAULTS . '/site.json');
     $obj->avatars->default = $default->avatars->default;
     $obj->covers->default = $default->covers->default;
     $string = FD::makeJSON($obj);
     $sql->clear();
     $sql->update('#__social_config');
     $sql->set('value', $string);
     $sql->where('type', 'site');
     $db->setQuery($sql);
     $db->query();
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:22,代码来源:UpdateConfigAvatarCoverDefaultPath.php

示例8: onProfileCompleteCheck

 /**
  * Checks if this field is filled in.
  *
  * @author Jason Rey <jasonrey@stackideas.com>
  * @since  1.3
  * @access public
  * @param  array        $data   The post data.
  * @param  SocialUser   $user   The user being checked.
  */
 public function onProfileCompleteCheck($user)
 {
     if (!FD::config()->get('user.completeprofile.strict') && !$this->isRequired()) {
         return true;
     }
     if (empty($this->value)) {
         return false;
     }
     $obj = FD::makeObject($this->value);
     if (empty($obj->first) && empty($user->name)) {
         return false;
     }
     return true;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:23,代码来源:joomla_fullname.php

示例9: execute

 /**
  * Processes likes notifications
  *
  * @since   1.2
  * @access  public
  * @param   string
  * @return
  */
 public function execute(&$item)
 {
     // Get likes participants
     $model = FD::model('Likes');
     $users = $model->getLikerIds($item->uid, $item->context_type);
     // Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
     $users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
     // Convert the names to stream-ish
     $names = FD::string()->namesToNotifications($users);
     // When someone likes on the photo that you have uploaded in a event
     if ($item->context_type == 'photos.event.share') {
         $this->notificationPhotos($names, $users, $item);
         return;
     }
     // When someone likes your post in a event
     if ($item->context_type == 'story.event.create') {
         // Get the owner of the stream item since we need to notify the person
         $stream = FD::table('Stream');
         $stream->load($item->uid);
         // Get the event from the stream
         $event = FD::event($stream->cluster_id);
         // Set the content
         if ($event) {
             $item->image = $event->getAvatar();
         }
         // We need to generate the notification message differently for the author of the item and the recipients of the item.
         if ($stream->actor_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
             $langString = FD::string()->computeNoun('APP_EVENT_STORY_USER_LIKES_YOUR_POST', count($users));
             $item->title = JText::sprintf($langString, $names, $event->getName());
             return $item;
         }
         // This is for 3rd party viewers
         $langString = FD::string()->computeNoun('APP_EVENT_STORY_USER_LIKES_USERS_POST', count($users));
         $item->title = JText::sprintf($langString, $names, FD::user($stream->actor_id)->getName(), $event->getName());
         return;
     }
     if ($item->context_type == 'links.create') {
         // Get the owner of the stream item since we need to notify the person
         $stream = FD::table('Stream');
         $stream->load($item->uid);
         // Get the event from the stream
         $event = FD::event($stream->cluster_id);
         // Set the content
         if ($event) {
             $item->image = $event->getAvatar();
         }
         // Get the link object
         $model = FD::model('Stream');
         $links = $model->getAssets($item->uid, SOCIAL_TYPE_LINKS);
         if ($links) {
             $link = FD::makeObject($links[0]->data);
             $item->content = $link->link;
             $item->image = $link->image;
         }
         // We need to generate the notification message differently for the author of the item and the recipients of the item.
         if ($stream->actor_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
             $langString = FD::string()->computeNoun('APP_EVENT_STORY_USER_LIKES_YOUR_LINK', count($users));
             $item->title = JText::sprintf($langString, $names, $event->getName());
             return $item;
         }
         // This is for 3rd party viewers
         $langString = FD::string()->computeNoun('APP_EVENT_STORY_USER_LIKES_USERS_LINK', count($users));
         $item->title = JText::sprintf($langString, $names, FD::user($stream->actor_id)->getName(), $event->getName());
         return;
     }
     return $item;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:75,代码来源:notification.likes.php

示例10: load

 public function load($data)
 {
     $obj = FD::makeObject($data);
     if ($obj) {
         foreach ($obj as $key => $value) {
             $this->helper->set($key, $value);
         }
         // exit;
     }
     return true;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:11,代码来源:registry.php

示例11: load

 /**
  * Loads the form data
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function load($data = null)
 {
     $this->form = FD::makeObject($data);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:12,代码来源:form.php

示例12: load

 public function load($data)
 {
     if (empty($data)) {
         return false;
     }
     $data = FD::makeObject($data);
     if (!$data) {
         return false;
     }
     $json = FD::json();
     foreach ($data as $key => $val) {
         if ($key == 'daily') {
             $val = FD::makeArray($val);
         }
         $this->{$key} = $val;
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:18,代码来源:recurring.php

示例13: renderForm

 /**
  * Render's application parameters form.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	string	HTML codes.
  *
  * @author	Mark Lee <mark@stackideas.com>
  */
 public function renderForm($type = 'form', $params = null, $prefix = '', $tabs = false)
 {
     // Get the manifest path.
     $file = $this->getManifestPath($type);
     if ($file === false) {
         return false;
     }
     $registry = FD::makeObject($file);
     // Check for custom callbacks
     foreach ($registry as &$section) {
         foreach ($section->fields as &$field) {
             if (isset($field->callback)) {
                 $callable = FD::apps()->getCallable($field->callback);
                 if (!$callable) {
                     continue;
                 }
                 $field->options = call_user_func_array($callable, array($this));
             }
         }
     }
     // Get the parameter object.
     $form = FD::get('Form');
     $form->load($registry);
     if ($params) {
         $form->bind($params);
     } else {
         // Bind the stored data with the params.
         $form->bind($this->params);
     }
     // Get the HTML output.
     return $form->render($tabs, false, '', $prefix);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:42,代码来源:app.php

示例14: createDefaultItems

 /**
  * Responsible to create the default custom fields for a profile.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function createDefaultItems($categoryId, $categoryType, $nodeType)
 {
     // $categoryId is the id on the category
     // $categoryType is the type of the category, eg: profiles, clusters
     // $nodeType is the unit within the category instead of the category representation, eg: user, group, event
     // This is because while events and groups is considered clusters, they have different sets of "default fields" to init
     $path = SOCIAL_ADMIN_DEFAULTS . '/fields/' . $nodeType . '.json';
     if (!JFile::exists($path)) {
         return false;
     }
     $defaults = FD::makeObject($path);
     // If there's a problem decoding the file, log some errors here.
     if (!$defaults) {
         $this->setError('Empty default object');
         return false;
     }
     // Init sequence
     $sequence = 1;
     // Init uniquekeys
     $uniqueKeys = array();
     // Let's go through each of the default items.
     foreach ($defaults as $step) {
         // Create default step for this profile.
         $stepTable = FD::table('FieldStep');
         $stepTable->bind($step);
         // Set the sequence
         $stepTable->sequence = $sequence++;
         // Map the correct uid and type.
         $stepTable->uid = $categoryId;
         $stepTable->type = $categoryType;
         // Set the state
         $stepTable->state = isset($step->state) ? $step->state : SOCIAL_STATE_PUBLISHED;
         // Set this to show in registration by default
         $stepTable->visible_registration = isset($step->visible_registration) ? $step->visible_registration : SOCIAL_STATE_PUBLISHED;
         // Set this to show in edit by default
         $stepTable->visible_edit = isset($step->visible_edit) ? $step->visible_edit : SOCIAL_STATE_PUBLISHED;
         // Set this to show in display by default
         $stepTable->visible_display = isset($step->visible_display) ? $step->visible_display : SOCIAL_STATE_PUBLISHED;
         // Try to store the default steps.
         $state = $stepTable->store();
         if (!$state || !$step->fields) {
             continue;
         }
         // Now we need to create all the fields that are in the current step
         // Init ordering
         $ordering = 0;
         foreach ($step->fields as $field) {
             $appTable = FD::table('App');
             $state = $appTable->load(array('element' => $field->element, 'group' => $nodeType, 'type' => SOCIAL_APPS_TYPE_FIELDS));
             // If the app doesn't exist, we shouldn't add it.
             if ($state && ($appTable->state == SOCIAL_STATE_PUBLISHED || $appTable->core == SOCIAL_STATE_PUBLISHED)) {
                 $fieldTable = FD::table('Field');
                 $fieldTable->bind($field);
                 // Set the ordering
                 $fieldTable->ordering = $ordering++;
                 // Ensure that the main items are being JText correctly.
                 $fieldTable->title = $field->title;
                 $fieldTable->description = $field->description;
                 $fieldTable->default = isset($field->default) ? $field->default : '';
                 // Set the app id.
                 $fieldTable->app_id = $appTable->id;
                 // Set the step.
                 $fieldTable->step_id = $stepTable->id;
                 // Set this to show title by default
                 $fieldTable->display_title = isset($field->display_title) ? $field->display_title : SOCIAL_STATE_PUBLISHED;
                 // Set this to show description by default
                 $fieldTable->display_description = isset($field->display_description) ? $field->display_description : SOCIAL_STATE_PUBLISHED;
                 // Set this to be published by default.
                 $fieldTable->state = isset($field->state) ? $field->state : SOCIAL_STATE_PUBLISHED;
                 // Set this to be searchable by default.
                 $fieldTable->searchable = isset($field->searchable) ? $field->searchable : SOCIAL_STATE_PUBLISHED;
                 // Set this to be required by default.
                 $fieldTable->required = isset($field->required) ? $field->required : SOCIAL_STATE_PUBLISHED;
                 // Set this to show in registration by default
                 $fieldTable->visible_registration = isset($field->visible_registration) ? $field->visible_registration : SOCIAL_STATE_PUBLISHED;
                 // Set this to show in edit by default
                 $fieldTable->visible_edit = isset($field->visible_edit) ? $field->visible_edit : SOCIAL_STATE_PUBLISHED;
                 // Set this to show in display by default
                 $fieldTable->visible_display = isset($field->visible_display) ? $field->visible_display : SOCIAL_STATE_PUBLISHED;
                 // Check if the default items has a params.
                 if (isset($field->params)) {
                     $fieldTable->params = FD::json()->encode($field->params);
                 }
                 // Store the field item.
                 $fieldTable->store();
                 // Generate unique key for this field after store (this is so that we have the field id)
                 $keys = !empty($uniqueKeys[$stepTable->id][$fieldTable->id]) ? $uniqueKeys[$stepTable->id][$fieldTable->id] : null;
                 $fieldTable->generateUniqueKey($keys);
                 // Store the unique key into list of unique keys to prevent querying for keys unnecessarily
                 $uniqueKeys[$stepTable->id][$fieldTable->id][] = $fieldTable->unique_key;
                 // We store again to save the unique key
                 $fieldTable->store();
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:fields.php

示例15: execute

 /**
  * Processes comment notifications
  *
  * @since   1.2
  * @access  public
  * @param   string
  * @return
  */
 public function execute(SocialTableNotification &$item)
 {
     // Get the group item
     $group = FD::group($item->context_ids);
     // Get the actor
     $actor = FD::user($item->actor_id);
     // Format the title
     if ($item->context_type == 'story.group.create') {
         $item->title = JText::sprintf('APP_GROUP_STORY_USER_POSTED_IN_GROUP', $actor->getName(), $group->getName());
         $item->image = $group->getAvatar();
         // Ensure that the content is properly formatted
         $item->content = JString::substr(strip_tags($item->content), 0, 80) . JText::_('COM_EASYSOCIAL_ELLIPSES');
         return $item;
     }
     if ($item->context_type == 'links.group.create') {
         $model = FD::model('Stream');
         $links = $model->getAssets($item->uid, SOCIAL_TYPE_LINKS);
         if (!$links) {
             return;
         }
         $link = FD::makeObject($links[0]->data);
         $item->image = $link->image;
         $item->content = $link->link;
         $item->title = JText::sprintf('APP_GROUP_STORY_USER_SHARED_LINK_IN_GROUP', $actor->getName(), $group->getName());
     }
     // Someone shared a file in a group
     if ($item->context_type == 'file.group.uploaded') {
         // Get the file object
         $file = FD::table('File');
         $file->load($item->context_ids);
         $group = FD::group($item->uid);
         $item->title = JText::sprintf('APP_GROUP_STORY_USER_SHARED_FILE_IN_GROUP', $actor->getName(), $group->getName());
         $item->content = $file->name;
         if ($file->hasPreview()) {
             $item->image = $file->getPreviewURI();
         }
         return;
     }
     // Someone shared a photo in a group
     if ($item->context_type == 'photos.group.share') {
         // Based on the stream id, we need to get the stream item id.
         $stream = FD::table('Stream');
         $stream->load($item->uid);
         // Get child items
         $streamItems = $stream->getItems();
         // Since we got all the child of stream, we can get the correct count
         $count = count($streamItems);
         if ($count <= 1) {
             $photo = FD::table('Photo');
             $photo->load($streamItems[0]->id);
             $item->title = JText::sprintf('APP_GROUP_STORY_USER_SHARED_SINGLE_PHOTO_IN_GROUP', $actor->getName(), $group->getName());
             $item->image = $photo->getSource();
             $item->content = '';
             return;
         }
         $item->title = JText::sprintf('APP_GROUP_STORY_USER_SHARED_MULTIPLE_PHOTOS_IN_GROUP', $actor->getName(), $count, $group->getName());
         $item->content = '';
         return;
     }
     return $item;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:69,代码来源:notification.updates.php


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