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


PHP FD::call方法代码示例

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


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

示例1: getPrivacyItem

 /**
  * Retrieves the privacy object
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPrivacyItem($uid, $type, $ownerId, $command)
 {
     static $cached = array();
     // Build the index for cached item
     $index = $uid . $type . $ownerId . $command;
     $key = $uid . '.' . $type;
     if (isset($cached[$index])) {
         return $cached[$index];
     }
     $db = FD::db();
     $result = array();
     static $items = array();
     if (isset($items[$index])) {
         $result = $items[$index];
     } else {
         if (isset(self::$_privacyitems[$key])) {
             if (self::$_privacyitems[$key]) {
                 $result = clone self::$_privacyitems[$key];
             }
         } else {
             if ($uid) {
                 $query = 'select a.' . $db->nameQuote('id') . ', a.' . $db->nameQuote('value') . ' as ' . $db->nameQuote('default') . ', a.' . $db->nameQuote('options') . ', ';
                 $query .= 'b.' . $db->nameQuote('user_id') . ', b.' . $db->nameQuote('uid') . ', b.' . $db->nameQuote('type') . ', b.' . $db->nameQuote('value') . ',';
                 $query .= 'b.' . $db->nameQuote('id') . ' as ' . $db->nameQuote('pid');
                 $query .= ' from ' . $db->nameQuote('#__social_privacy') . ' as a';
                 $query .= '		inner join ' . $db->nameQuote('#__social_privacy_items') . ' as b on a.' . $db->nameQuote('id') . ' = b.' . $db->nameQuote('privacy_id');
                 $query .= ' where b.' . $db->nameQuote('uid') . ' = ' . $db->Quote($uid);
                 $query .= ' and b.' . $db->nameQuote('type') . ' = ' . $db->Quote($type);
                 $query .= ' and a.' . $db->nameQuote('state') . ' = ' . $db->Quote(SOCIAL_STATE_PUBLISHED);
                 if ($ownerId) {
                     $query .= ' and b.' . $db->nameQuote('user_id') . ' = ' . $db->Quote($ownerId);
                 }
                 // var_dump( $ownerId );
                 // echo $query;
                 // echo '<br /><br />';
                 $db->setQuery($query);
                 $result = $db->loadObject();
                 $items[$index] = $result;
             }
         }
     }
     // If we still can't find a result, then we need to load from the default items
     if (!$result || !isset($result->id)) {
         // Retrieve the core values
         $defaultValue = $this->getPrivacyDefaultValues($command, $ownerId);
         $result = clone $defaultValue;
         $result->uid = $uid;
         $result->type = $type;
         $result->user_id = $ownerId;
         $result->value = isset($result->default) ? $result->default : '';
         $result->pid = '0';
     }
     if (!isset($result->options)) {
         $result->options = '';
     }
     $default = FD::call('Privacy', 'toKey', $result->value);
     $options = FD::json()->decode($result->options);
     $result->option = array();
     if ($options) {
         foreach ($options->options as $key => $option) {
             $result->option[$option] = $default == $option ? '1' : '0';
         }
     }
     // get the custom user id.
     $result->custom = array();
     if ($result->value == SOCIAL_PRIVACY_CUSTOM) {
         if ($result->pid) {
             $result->custom = $this->getPrivacyCustom($result->pid);
         } else {
             if ($result->mapid) {
                 $result->custom = $this->getPrivacyCustom($result->mapid, SOCIAL_PRIVACY_TYPE_USER);
             }
         }
     }
     // This is where we define whether the privacy item is editable or not.
     $my = FD::user();
     $result->editable = false;
     if ($result->user_id && $result->user_id == $my->id) {
         $result->editable = true;
     }
     $cached[$index] = $result;
     return $cached[$index];
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:91,代码来源:privacy.php

示例2: uploadPhoto

 public function uploadPhoto($log_usr = 0, $type = null)
 {
     // Get current logged in user.
     $my = FD::user($log_usr);
     // Get user access
     $access = FD::access($my->id, SOCIAL_TYPE_USER);
     // Load up the photo library
     $lib = FD::photo($log_usr, $type);
     // Define uploader options
     $options = array('name' => 'file', 'maxsize' => $lib->getUploadFileSizeLimit());
     // Get uploaded file
     $file = FD::uploader($options)->getFile();
     // Load the iamge object
     $image = FD::image();
     $image->load($file['tmp_name'], $file['name']);
     // Detect if this is a really valid image file.
     if (!$image->isValid()) {
         return "invalid image";
     }
     // Load up the album's model.
     $albumsModel = FD::model('Albums');
     // Create the default album if necessary
     $album = $albumsModel->getDefaultAlbum($log_usr, $type, SOCIAL_ALBUM_STORY_ALBUM);
     // Bind photo data
     $photo = FD::table('Photo');
     $photo->uid = $log_usr;
     $photo->type = $type;
     $photo->user_id = $my->id;
     $photo->album_id = $album->id;
     $photo->title = $file['name'];
     $photo->caption = '';
     $photo->state = 1;
     $photo->ordering = 0;
     // Set the creation date alias
     $photo->assigned_date = FD::date()->toMySQL();
     // Trigger rules that should occur before a photo is stored
     $photo->beforeStore($file, $image);
     // Try to store the photo.
     $state = $photo->store();
     // Load the photos model
     $photosModel = FD::model('Photos');
     // Get the storage path for this photo
     $storage = FD::call('Photos', 'getStoragePath', array($album->id, $photo->id));
     // Get the photos library
     $photoLib = FD::get('Photos', $image);
     $paths = $photoLib->create($storage);
     // Create metadata about the photos
     if ($paths) {
         foreach ($paths as $type => $fileName) {
             $meta = FD::table('PhotoMeta');
             $meta->photo_id = $photo->id;
             $meta->group = SOCIAL_PHOTOS_META_PATH;
             $meta->property = $type;
             $meta->value = $storage . '/' . $fileName;
             $meta->store();
             // We need to store the photos dimension here
             list($width, $height, $imageType, $attr) = getimagesize(JPATH_ROOT . $storage . '/' . $fileName);
             // Set the photo dimensions
             $meta = FD::table('PhotoMeta');
             $meta->photo_id = $photo->id;
             $meta->group = SOCIAL_PHOTOS_META_WIDTH;
             $meta->property = $type;
             $meta->value = $width;
             $meta->store();
             $meta = FD::table('PhotoMeta');
             $meta->photo_id = $photo->id;
             $meta->group = SOCIAL_PHOTOS_META_HEIGHT;
             $meta->property = $type;
             $meta->value = $height;
             $meta->store();
         }
     }
     // After storing the photo, trigger rules that should occur after a photo is stored
     //$photo->afterStore( $file , $image );
     //$sphoto = new SocialPhotos($photo_obj->id);
     return $photo;
 }
开发者ID:bellodox,项目名称:com_api-plugins,代码行数:77,代码来源:share.php

示例3: getResourcesSettings

 public function getResourcesSettings()
 {
     $config = FD::config();
     $assets = FD::get('Assets');
     $themes = FD::get('Themes');
     $locations = $assets->locations();
     // Build a deterministic cache
     $settings = array("language" => JFactory::getLanguage()->getTag(), "template" => array("site" => $config->get('theme.site', 'wireframe'), "admin" => $config->get('theme.admin', 'default')), "view" => array(), "modified" => filemtime($this->resourceManifestFile));
     // Determine if there are template overrides
     if (JFolder::exists($locations['site_override'])) {
         $settings["template"]["site_override"] = FD::call('Assets', 'getJoomlaTemplate', array('site'));
     }
     if (JFolder::exists($locations['admin_override'])) {
         $settings["template"]["admin_override"] = FD::call('Assets', 'getJoomlaTemplate', array('admin'));
     }
     // Get manifest
     $manifest = $this->getResourcesManifest();
     if (isset($manifest[0]->view) && $manifest[0]->view) {
         foreach ($manifest[0]->view as $view) {
             $original = $view;
             $view = 'themes:/' . $view;
             $path = FD::resolve($view . '.ejs');
             // If the file still does not exist, we'll skip this
             if (!JFile::exists($path)) {
                 continue;
             }
             $settings["view"][] = array("path" => str_ireplace(JPATH_ROOT, '', $path), "modified" => filemtime($path));
         }
     }
     // Build hash
     $settings["id"] = md5(serialize($settings));
     return $settings;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:compiler.php

示例4: resolve

 /**
  * Resolve a given POSIX path.
  *
  * <code>
  * <?php
  * // This would translate to administrator/components/com_easysocial/themes/CURRENT_THEME/users/default.php
  * FD::resolve( 'themes:/admin/users/default' );
  *
  * // This would translate to components/com_easysocial/themes/CURRENT_THEME/dashboard/default.php
  * FD::resolve( 'themes:/site/dashboard/default' );
  * ?>
  * </code>
  *
  * @since	1.0
  * @access	public
  * @param	string		The posix path to lookup for.
  * @return	string		The translated path
  */
 public static function resolve($path)
 {
     if (strpos($path, ':/') === false) {
         return false;
     }
     $parts = explode(':/', $path);
     // Get the protocol.
     $protocol = $parts[0];
     // Get the real path.
     $path = $parts[1];
     switch ($protocol) {
         case 'modules':
             return FD::call('Modules', 'resolve', $path);
             break;
         case 'themes':
             return FD::call('Themes', 'resolve', $path);
             break;
         case 'ajax':
             return FD::call('Ajax', 'resolveNamespace', $path);
             break;
         case 'emails':
             return FD::call('Mailer', 'resolve', $path);
             break;
         case 'fields':
         case 'admin':
         case 'apps':
         case 'site':
             $key = 'SOCIAL_' . strtoupper($protocol);
             $basePath = constant($key);
             return $basePath . '/' . $path;
             break;
     }
     return false;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:52,代码来源:foundry.php

示例5: uploadStory

 /**
  * Posting photos via story
  *
  * @since   1.0
  * @access  public
  */
 public function uploadStory()
 {
     // Check for request forgeries
     FD::checkToken();
     // Only registered users should be allowed to upload photos
     FD::requireLogin();
     // Get the current view
     $view = $this->getCurrentView();
     // Get current logged in user.
     $my = FD::user();
     // Get user access
     $access = FD::access($my->id, SOCIAL_TYPE_USER);
     // Get the uid and type
     $uid = $this->input->get('uid', 0, 'int');
     $type = $this->input->get('type', '', 'cmd');
     // Load up the photo library
     $lib = FD::photo($uid, $type);
     // Determines if the person exceeded their upload limit
     if ($lib->exceededUploadLimit()) {
         $view->setMessage($lib->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Determines if the person exceeded their daily upload limit
     if ($lib->exceededDailyUploadLimit()) {
         $view->setMessage($lib->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Define uploader options
     $options = array('name' => 'file', 'maxsize' => $lib->getUploadFileSizeLimit());
     // Get uploaded file
     $file = FD::uploader($options)->getFile();
     // If there was an error getting uploaded file, stop.
     if ($file instanceof SocialException) {
         $view->setMessage($file, SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Load the iamge object
     $image = FD::image();
     $image->load($file['tmp_name'], $file['name']);
     // Detect if this is a really valid image file.
     if (!$image->isValid()) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PHOTOS_INVALID_FILE_PROVIDED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Load up the album's model.
     $albumsModel = FD::model('Albums');
     // Create the default album if necessary
     $album = $albumsModel->getDefaultAlbum($uid, $type, SOCIAL_ALBUM_STORY_ALBUM);
     // Bind photo data
     $photo = FD::table('Photo');
     $photo->uid = $uid;
     $photo->type = $type;
     $photo->user_id = $my->id;
     $photo->album_id = $album->id;
     $photo->title = $file['name'];
     $photo->caption = '';
     $photo->ordering = 0;
     // Set the creation date alias
     $photo->assigned_date = FD::date()->toMySQL();
     // Trigger rules that should occur before a photo is stored
     $photo->beforeStore($file, $image);
     // Try to store the photo.
     $state = $photo->store();
     if (!$state) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PHOTOS_UPLOAD_ERROR_STORING_DB'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Load the photos model
     $photosModel = FD::model('Photos');
     // Get the storage path for this photo
     $storage = FD::call('Photos', 'getStoragePath', array($album->id, $photo->id));
     // Get the photos library
     $photoLib = FD::get('Photos', $image);
     $paths = $photoLib->create($storage);
     // Create metadata about the photos
     if ($paths) {
         foreach ($paths as $type => $fileName) {
             $meta = FD::table('PhotoMeta');
             $meta->photo_id = $photo->id;
             $meta->group = SOCIAL_PHOTOS_META_PATH;
             $meta->property = $type;
             $meta->value = $storage . '/' . $fileName;
             $meta->store();
             // We need to store the photos dimension here
             list($width, $height, $imageType, $attr) = getimagesize(JPATH_ROOT . $storage . '/' . $fileName);
             // Set the photo dimensions
             $meta = FD::table('PhotoMeta');
             $meta->photo_id = $photo->id;
             $meta->group = SOCIAL_PHOTOS_META_WIDTH;
             $meta->property = $type;
             $meta->value = $width;
             $meta->store();
             $meta = FD::table('PhotoMeta');
             $meta->photo_id = $photo->id;
//.........这里部分代码省略.........
开发者ID:ppantilla,项目名称:bbninja,代码行数:101,代码来源:photos.php


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