Ejemplo n.º 1
0
 /**
  * Create an object
  *
  * <code>
  * $userId = 1;
  *
  * $profile = Prism\Integration\Profile\SocialCommunity::getInstance(\JFactory::getDbo(), $userId);
  * </code>
  *
  * @param  \JDatabaseDriver $db
  * @param  int $id
  *
  * @return SocialCommunity|null
  */
 public static function getInstance(\JDatabaseDriver $db, $id)
 {
     if (!isset(self::$instances[$id])) {
         $item = new SocialCommunity($db);
         $item->load($id);
         self::$instances[$id] = $item;
     }
     return self::$instances[$id];
 }
Ejemplo n.º 2
0
 /**
  * Create an object
  *
  * <code>
  * $userId = 1;
  *
  * $profile = Prism\Integration\Profile\SocialCommunity::getInstance(\JFactory::getDbo(), $userId);
  * </code>
  *
  * @param  \JDatabaseDriver $db
  * @param  int $id
  *
  * @return SocialCommunity|null
  */
 public static function getInstance(\JDatabaseDriver $db, $id)
 {
     if (!array_key_exists($id, self::$instances)) {
         $item = new SocialCommunity($db);
         $item->load($id);
         self::$instances[$id] = $item;
     }
     return self::$instances[$id];
 }
Ejemplo n.º 3
0
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $profileBuilder = new Prism\Integration\Profile\Builder($options);
  * $profileBuilder->build();
  *
  * $profile = $profileBuilder->getProfile();
  * </code>
  */
 public function build()
 {
     $type = ArrayHelper::getValue($this->config, 'social_platform');
     $userId = ArrayHelper::getValue($this->config, 'user_id');
     switch ($type) {
         case 'socialcommunity':
             jimport('socialcommunity.init');
             /** @var  $params Registry */
             $params = \JComponentHelper::getParams('com_socialcommunity');
             $path = $params->get('images_directory', '/images/profiles');
             $profile = new SocialCommunity(\JFactory::getDbo());
             $profile->load($userId);
             $profile->setPath($path);
             break;
         case 'gravatar':
             $profile = new Gravatar(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case 'kunena':
             $profile = new Kunena(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case 'jomsocial':
             // Register JomSocial Router
             if (!class_exists('CRoute')) {
                 \JLoader::register('CRoute', JPATH_SITE . '/components/com_community/libraries/core.php');
             }
             $profile = new JomSocial(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case 'easysocial':
             $profile = new EasySocial(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case 'easyprofile':
             $profile = new EasyProfile(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case 'communitybuilder':
             $profile = new CommunityBuilder(\JFactory::getDbo());
             $profile->load($userId);
             break;
         default:
             $profile = null;
             break;
     }
     $this->profile = $profile;
 }
Ejemplo n.º 4
0
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $profileBuilder = new Prism\Integration\Profile\Builder($options);
  * $profileBuilder->build();
  *
  * $profile = $profileBuilder->getProfile();
  * </code>
  */
 public function build()
 {
     $type = ArrayHelper::getValue($this->config, "social_platform");
     $userId = ArrayHelper::getValue($this->config, "user_id");
     switch ($type) {
         case "socialcommunity":
             jimport("socialcommunity.init");
             /** @var  $params Registry */
             $params = \JComponentHelper::getParams("com_socialcommunity");
             $path = $params->get("images_directory", "/images/profiles");
             $profile = new SocialCommunity(\JFactory::getDbo());
             $profile->load($userId);
             $profile->setPath($path);
             break;
         case "gravatar":
             $profile = new Gravatar(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case "kunena":
             $profile = new Kunena(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case "jomsocial":
             // Register JomSocial Router
             if (!class_exists("CRoute")) {
                 \JLoader::register("CRoute", JPATH_SITE . "/components/com_community/libraries/core.php");
             }
             $profile = new JomSocial(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case "easysocial":
             $profile = new EasySocial(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case "easyprofile":
             $profile = new EasyProfile(\JFactory::getDbo());
             $profile->load($userId);
             break;
         case "communitybuilder":
             $profile = new CommunityBuilder(\JFactory::getDbo());
             $profile->load($userId);
             break;
         default:
             $profile = null;
             break;
     }
     $this->profile = $profile;
 }