Exemplo n.º 1
0
$socialPlatform = $componentParams->get("integration_social_platform");
$imageSize = $params->get("image_size", "small");
$imageLink = $params->get("image_link", true);
$profileImage = null;
$profileLink = null;
$profileLocation = null;
$profileCountryCode = null;
if (!empty($socialPlatform)) {
    $config = array("social_platform" => $socialPlatform, "user_id" => $profile["user_id"]);
    $socialProfileBuilder = new Prism\Integration\Profile\Builder($config);
    $socialProfileBuilder->build();
    $socialProfile = $socialProfileBuilder->getProfile();
    if (!empty($socialProfile)) {
        $profileImage = $socialProfile->getAvatar($imageSize);
        $profileLink = $socialProfile->getLink();
        $profileLocation = $socialProfile->getLocation();
        $profileCountryCode = $socialProfile->getCountryCode();
    }
}
$proofVerified = false;
if ($params->get("display_account_state", 0) and JComponentHelper::isEnabled("com_identityproof")) {
    jimport("IdentityProof.init");
    $proof = new IdentityProof\User(JFactory::getDbo());
    $proof->load(array("user_id" => $profile["user_id"]));
    if ($proof->isVerified()) {
        $proofVerified = true;
    }
}
if (!empty($socialProfile)) {
    require JModuleHelper::getLayoutPath('mod_crowdfundingprofile', $params->get('layout', 'default'));
}
Exemplo n.º 2
0
 /**
  * @param string    $context
  * @param object    $item
  * @param Joomla\Registry\Registry    $params
  * @param int $page
  *
  * @return null|string
  */
 public function onContentAfterDisplay($context, &$item, &$params, $page = 0)
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     if ($app->isAdmin()) {
         return null;
     }
     $doc = JFactory::getDocument();
     /**  @var $doc JDocumentHtml */
     // Check document type
     $docType = $doc->getType();
     if (strcmp("html", $docType) != 0) {
         return null;
     }
     if (strcmp("com_crowdfunding.details", $context) != 0) {
         return null;
     }
     $user = JFactory::getUser($item->user_id);
     // Load language
     $this->loadLanguage();
     if ($this->params->get("display_location", 0) or $this->params->get("display_map", 0)) {
         $location = $this->getLocation($item->location_id);
     }
     // Social Profile Integration
     $componentParams = JComponentHelper::getParams("com_crowdfunding");
     /** @var  $componentParams Joomla\Registry\Registry */
     // Check for verified user account.
     $proofVerified = false;
     if ($this->params->get("display_account_state", 0) and JComponentHelper::isEnabled("com_identityproof")) {
         jimport("IdentityProof.init");
         $proof = new IdentityProof\User(JFactory::getDbo());
         $proof->load(array("user_id" => $user->get("id")));
         if ($proof->isVerified()) {
             $proofVerified = true;
         }
     }
     // Get profile
     $socialPlatform = $componentParams->get("integration_social_platform");
     if (!empty($socialPlatform)) {
         // Get social profile
         $config = array("social_platform" => $socialPlatform, "user_id" => $user->get("id"));
         $profileBuilder = new Prism\Integration\Profile\Builder($config);
         $profileBuilder->build();
         $socialProfile = $profileBuilder->getProfile();
         $profileLink = $socialProfile->getLink();
         // Prepare the avatar
         $socialAvatar = $socialProfile->getAvatar($this->params->get("image_size", "small"));
         $socialLocation = $socialProfile->getLocation();
         if ($socialProfile->getCountryCode()) {
             $socialLocation .= ", " . $socialProfile->getCountryCode();
         }
     } else {
         // Set default values
         $profileLink = "";
         $socialAvatar = $params->get("integration_avatars_default", "/media/com_crowdfunding/images/no-profile.png");
         $socialLocation = "";
     }
     // END Social Profile Integration
     // Preparing HTML output
     // Prepare map
     $mapCode = "";
     if ($this->params->get("display_map", 0) and !empty($location)) {
         $mapCode = $this->getMapCode($doc, $location);
     }
     // Prepare output
     // Get the path for the layout file
     $path = JPluginHelper::getLayoutPath('content', 'crowdfundinginfo', 'default');
     // Render the login form.
     ob_start();
     include $path;
     $html = ob_get_clean();
     return $html;
 }