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


PHP FD::getInstance方法代码示例

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


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

示例1: isValid

 /**
  * Validates the username.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	JSON	A jsong encoded string.
  *
  * @author	Jason Rey <jasonrey@stackideas.com>
  */
 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

示例2: delete

 /**
  * Delete's the location from the database.
  *
  * @since	1.0
  * @access	public
  */
 public function delete()
 {
     // Check for valid token
     FD::checkToken();
     // Guest users shouldn't be allowed to delete any location at all.
     FD::requireLogin();
     $my = FD::user();
     $id = JRequest::getInt('id');
     $view = FD::getInstance('View', 'Location', false);
     $location = FD::table('Location');
     $location->load($id);
     // If id is invalid throw errors.
     if (!$location->id) {
         $view->setErrors(JText::_('COM_EASYSOCIAL_LOCATION_INVALID_ID'));
     }
     // If user do not own item, throw errors.
     if ($my->id !== $location->user_id) {
         $view->setErrors(JText::_('COM_EASYSOCIAL_LOCATION_ERROR_YOU_ARE_NOT_OWNER'));
     }
     // Try to delete location.
     if (!$location->delete()) {
         $view->setErrors($location->getError());
     }
     return $view->delete();
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:31,代码来源:location.php

示例3: deleteFilter

 public function deleteFilter()
 {
     // Check for request forgeries.
     FD::checkToken();
     // In order to access the dashboard apps, user must be logged in.
     FD::requireLogin();
     $view = FD::view('Stream', false);
     $my = FD::user();
     $id = JRequest::getInt('id', 0);
     if (!$id) {
         FD::getInstance('Info')->set(JText::_('Invalid filter id - ' . $id), 'error');
         $view->setError(JText::_('Invalid filter id.'));
         return $view->call(__FUNCTION__);
     }
     $filter = FD::table('StreamFilter');
     // make sure the user is the filter owner before we delete.
     $filter->load(array('id' => $id, 'uid' => $my->id, 'utype' => 'user'));
     if (!$filter->id) {
         FD::getInstance('Info')->set(JText::_('Filter not found - ' . $id), 'error');
         $view->setError(JText::_('Filter not found. Action aborted.'));
         return $view->call(__FUNCTION__);
     }
     $filter->deleteItem();
     $filter->delete();
     $view->setMessage(JText::_('COM_EASYSOCIAL_STREAM_FILTER_DELETED'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:27,代码来源:stream.php

示例4: load

 /**
  * Loads a set of configuration given the type.
  *
  * @since	1.0
  * @access	public
  * @param	string		The unique type of configuration.
  * @return
  */
 public function load($key)
 {
     // Specifically if the key is 'joomla' , we only want to use JConfig.
     if ($key == 'joomla') {
         $codeName = FD::getInstance('Version')->getCodeName();
         $helper = dirname(__FILE__) . '/helpers/' . $codeName . '.php';
         require_once $helper;
         $className = 'SocialConfig' . $codeName;
         $config = new $className();
     } else {
         // Object construct happens here
         $default = SOCIAL_ADMIN . '/defaults/' . $key . '.json';
         $defaultData = '';
         // Read the default data.
         $defaultData = JFile::read($default);
         $json = FD::json();
         // Load a new copy of Registry
         $config = FD::registry($defaultData);
         if (!defined('SOCIAL_COMPONENT_CLI')) {
             // @task: Now we need to get the user defined configuration that is stored in the database.
             $model = FD::model('Config');
             $storedConfig = $model->getConfig($key);
             // Get stored config
             if ($storedConfig) {
                 $storedConfig = FD::registry($storedConfig->value);
                 // Merge configurations
                 $config->mergeObjects($storedConfig->getRegistry());
             }
         }
     }
     $this->configs[$key] = $config;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:40,代码来源:config.php

示例5: archive

 public function archive()
 {
     $errors = $this->getErrors();
     // @TODO: Process errors here.
     if ($errors) {
     }
     FD::getInstance('AJAX')->success();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:8,代码来源:view.ajax.php

示例6: __construct

 public function __construct()
 {
     $version = FD::getInstance('Version');
     $name = $version->getCodeName();
     $name = strtolower($name);
     require_once dirname(__FILE__) . '/helpers/' . $name . '.php';
     $className = 'SocialInstallerHelper' . ucfirst($name);
     $this->helper = new $className();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:9,代码来源:installer.php

示例7: __construct

 public function __construct()
 {
     $codeName = FD::getInstance('Version')->getCodeName();
     $fileName = strtolower($codeName);
     $helperFile = dirname(__FILE__) . '/helpers/' . $fileName . '.php';
     require_once $helperFile;
     $className = 'SocialDBHelper' . ucfirst($codeName);
     $this->db = new $className();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:9,代码来源:db.php

示例8: renderBookmark

 /**
  * Obtains the application output when a user clicks on a bookmark item.
  *
  * @since	1.0
  * @access	public
  * @param
  *
  * @return
  */
 public function renderBookmark()
 {
     $id = JRequest::getInt('id');
     $app = FD::table('Application');
     $app->load($id);
     $lib = FD::getInstance('Apps');
     $output = $lib->render('bookmark', $app->element, $app->group);
     // Return the JSON output.
     $ajax = FD::getInstance('Ajax');
     $ajax->success($output);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:20,代码来源:view.ajax.php

示例9: initScripts

 /**
  * Initializes javascript on the head of the page.
  *
  * @since	1.0
  * @access	public
  */
 public function initScripts()
 {
     if (self::$scriptsLoaded) {
         return;
     }
     $configuration = FD::getInstance('Configuration');
     $configuration->attach();
     // TODO: Find a better place to define map language code this.
     $document = JFactory::getDocument();
     $document->addCustomTag('<meta name="foundry:location:language" content="' . FD::config()->get('general.location.language', 'en') . '" />');
     self::$scriptsLoaded = true;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:18,代码来源:html.php

示例10: __construct

 /**
  * Class constructor
  *
  * @since	1.0
  * @access	public
  * @param	null
  */
 public function __construct()
 {
     // Determine the code name
     $name = FD::getInstance('Version')->getCodename();
     $file = dirname(__FILE__) . '/helpers/' . strtolower($name) . '.php';
     // If helper is not exist, we need to prevent any fatal errors.
     if (!JFile::exists($file)) {
         return;
     }
     require_once $file;
     $className = 'SocialParser' . ucfirst($name);
     $this->helper = new $className();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:20,代码来源:parser.php

示例11: __construct

 /**
  * Class constructor
  *
  * @since	1.0
  * @access	public
  * @param	string		The registry's raw data.
  */
 public function __construct($data = '')
 {
     // Load our helpers
     $name = FD::getInstance('Version')->getCodename();
     $path = dirname(__FILE__) . '/helpers/' . $name . '.php';
     require_once $path;
     $className = 'SocialRegistry' . ucfirst($name);
     $this->helper = new $className('');
     // Always use our own load methods.
     if (!empty($data)) {
         $this->load($data);
     }
     return $this;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:21,代码来源:registry.php

示例12: getAppContents

 /**
  * Responsible to output the application contents.
  *
  * @since	1.0
  * @access	public
  * @param	SocialAppTable	The application ORM.
  */
 public function getAppContents($app)
 {
     $ajax = FD::ajax();
     // If there's an error throw it back to the caller.
     if ($this->hasErrors()) {
         return $ajax->reject($this->getMessage());
     }
     // Get the current logged in user.
     $my = FD::user();
     // Load the library.
     $lib = FD::getInstance('Apps');
     $contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_EMBED, 'dashboard', $app, array('userId' => $my->id));
     // Return the contents
     return $ajax->resolve($contents);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:22,代码来源:view.ajax.php

示例13: getFields

 /**
  * Retrieves a list of custom fields on the site.
  *
  * @since	1.0
  * @access	public
  */
 public function getFields()
 {
     $lib = FD::fields();
     // TODO: Enforce that group be a type of user , groups only.
     $group = JRequest::getWord('group', SOCIAL_FIELDS_GROUP_USER);
     // Get a list of fields
     $model = FD::model('Apps');
     $fields = $model->getApps(array('type' => SOCIAL_APPS_TYPE_FIELDS));
     // We might need this? Not sure.
     $data = array();
     // Trigger: onSample
     $lib->trigger('onSample', $group, $fields, $data);
     // Once done, pass this back to the view.
     $view = FD::getInstance('View', 'Fields');
     $view->call(__FUNCTION__, $fields);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:22,代码来源:fields.php

示例14: load

 public function load($contents = '', $isFile = false)
 {
     $this->version = FD::getInstance('version')->getVersion();
     $parser = '';
     if ($this->version >= '3.0') {
         $parser = JFactory::getXML($contents, $isFile);
     } else {
         $parser = JFactory::getXMLParser('Simple');
         if ($isFile) {
             $parser->loadFile($contents);
         } else {
             $parser->loadString($contents);
         }
     }
     $this->parser = $parser;
     return $this->parser;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:17,代码来源:xml.php

示例15: attach

 /**
  * Attaches stylesheet on the site.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function attach($minified = null, $allowOverride = true)
 {
     // Get configuration
     $config = FD::getInstance('Configuration');
     $environment = $config->environment;
     $mode = $config->mode;
     // If caller did not specify whether or not
     // to attach compressed stylesheets.
     if (is_null($minified)) {
         // Then decide from configuration mode
         $minified = $mode == 'compressed';
     }
     // Default settings
     $build = false;
     // If we're in a development environment,
     // always cache compile stylesheet and
     // attached uncompressed stylesheets.
     if ($environment == 'development') {
         $build = true;
         // Never attached minified stylesheet while in development mode.
         $minified = false;
         // Only super developers can build admin stylesheets.
         if ($this->location == 'admin') {
             $build = false;
         }
         // Do not build if stylesheet has not been compiled before.
         $cacheFolder = $this->folder('cache');
         if (!JFolder::exists($cacheFolder)) {
             $build = false;
         }
         // Always build for superdevs
         $super = FD::config()->get('general.super');
         if ($super) {
             $build = true;
         }
     }
     // Rebuild stylesheet on page load if necessary
     if ($build) {
         $task = $this->build($environment);
         // This generates build log in the browser console.
         $script = FD::script();
         $script->set('task', $task);
         $script->attach('themes:/admin/stylesheet/log');
     }
     parent::attach($minified, $allowOverride);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:54,代码来源:stylesheet.php


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