Exemple #1
0
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $profileBuilder = new ITPrismIntegrateProfileBuilder($options);
  * $profileBuilder->build();
  *
  * $profile = $profileBuilder->getProfile();
  * </code>
  */
 public function build()
 {
     $type = JArrayHelper::getValue($this->config, "social_platform");
     $userId = JArrayHelper::getValue($this->config, "user_id");
     switch ($type) {
         case "socialcommunity":
             jimport("socialcommunity.init");
             /** @var  $params Joomla\Registry\Registry */
             $params = JComponentHelper::getParams("com_socialcommunity");
             $path = $params->get("images_directory", "/images/profiles");
             jimport("itprism.integrate.profile.socialcommunity");
             $profile = ITPrismIntegrateProfileSocialCommunity::getInstance($userId);
             $profile->setPath($path);
             break;
         case "gravatar":
             jimport("itprism.integrate.profile.gravatar");
             $profile = ITPrismIntegrateProfileGravatar::getInstance($userId);
             break;
         case "kunena":
             jimport("itprism.integrate.profile.kunena");
             $profile = ITPrismIntegrateProfileKunena::getInstance($userId);
             break;
         case "jomsocial":
             // Register JomSocial Router
             if (!class_exists("CRoute")) {
                 JLoader::register("CRoute", JPATH_SITE . "/components/com_community/libraries/core.php");
             }
             jimport("itprism.integrate.profile.jomsocial");
             $profile = ITPrismIntegrateProfileJomSocial::getInstance($userId);
             break;
         case "easysocial":
             jimport("itprism.integrate.profile.easysocial");
             $profile = ITPrismIntegrateProfileEasySocial::getInstance($userId);
             break;
         default:
             $profile = null;
             break;
     }
     $this->profile = $profile;
 }
 /**
  * @param $userId
  * @param $type
  *
  * @return ITPrismIntegrateInterfaceProfile|null
  */
 public static function getSocialProfile($userId, $type)
 {
     $profile = null;
     switch ($type) {
         case "socialcommunity":
             if (!defined("SOCIALCOMMUNITY_PATH_COMPONENT_SITE")) {
                 define("SOCIALCOMMUNITY_PATH_COMPONENT_SITE", JPATH_SITE . DIRECTORY_SEPARATOR . "components" . DIRECTORY_SEPARATOR . "com_socialcommunity");
             }
             JLoader::register("SocialCommunityHelperRoute", SOCIALCOMMUNITY_PATH_COMPONENT_SITE . DIRECTORY_SEPARATOR . "helpers" . DIRECTORY_SEPARATOR . "route.php");
             jimport("itprism.integrate.profile.socialcommunity");
             $profile = ITPrismIntegrateProfileSocialCommunity::getInstance($userId);
             // Set path to pictures
             /** @var  $params Joomla\Registry\Registry */
             $params = JComponentHelper::getParams("com_socialcommunity");
             $path = $params->get("images_directory", "images/profiles") . "/";
             $profile->setPath($path);
             break;
         case "gravatar":
             jimport("itprism.integrate.profile.gravatar");
             $profile = ITPrismIntegrateProfileGravatar::getInstance($userId);
             break;
         case "kunena":
             jimport("itprism.integrate.profile.kunena");
             $profile = ITPrismIntegrateProfileKunena::getInstance($userId);
             break;
         case "jomsocial":
             jimport("itprism.integrate.profile.jomsocial");
             $profile = ITPrismIntegrateProfileJomSocial::getInstance($userId);
             break;
         case "easysocial":
             jimport("itprism.integrate.profile.easysocial");
             $profile = ITPrismIntegrateProfileEasySocial::getInstance($userId);
             break;
         default:
             break;
     }
     return $profile;
 }