Generate a Facebook facepile.

@param array $params Various Facebook URL parameters
@param bool $useFacebookPageAsUrl
@return string
481206
public function facebookFacepile(array $params = array(), $useFacebookPageAsUrl = false) {
        $this->_needsFacebookInit = true;
        $params = new Garp_Util_Configuration($params);
        $params->setDefault(
            'href', array_key_exists('href', $params) && $params['href'] ?
                $params['href'] :
                $this->_getCurrentUrl()
        )
            ->setDefault('max_rows', 1)
            ->setDefault('width', 450)
            ->setDefault('colorscheme', 'light');

        if ($useFacebookPageAsUrl) {
            $this->_setFacebookPageUrlAsHref($params);
        }

        $html = '<fb:facepile ' . $this->_renderHtmlAttribs($params) . '></fb:facepile>';
        return $html;
    }
513249
public function query_db($pagesize, $useinitialsbar = true) {
        list($twhere, $tparams) = $this->get_sql_where();

        $total = user_get_total_participants($this->course->id, $this->currentgroup, $this->accesssince,
            $this->roleid, $this->enrolid, $this->status, $this->search, $twhere, $tparams);

        $this->pagesize($pagesize, $total);

        $sort = $this->get_sql_sort();
        if ($sort) {
            $sort = 'ORDER BY ' . $sort;
        }

        $rawdata = user_get_participants($this->course->id, $this->currentgroup, $this->accesssince,
            $this->roleid, $this->enrolid, $this->status, $this->search, $twhere, $tparams, $sort, $this->get_page_start(),
            $this->get_page_size());
        $this->rawdata = [];
        foreach ($rawdata as $user) {
            $this->rawdata[$user->id] = $user;
        }
        $rawdata->close();

        if ($this->rawdata) {
            $this->allroleassignments = get_users_roles($this->context, array_keys($this->rawdata),
                    true, 'c.contextlevel DESC, r.sortorder ASC');
        } else {
            $this->allroleassignments = [];
        }

        // Set initial bars.
        if ($useinitialsbar) {
            $this->initialbars(true);
        }
    }
92149
protected function _setFacebookPageUrlAsHref(Garp_Util_Configuration $params) {
        $ini = Zend_Registry::get('config');
        if (!$ini->organization->facebook) {
            throw new Exception("Missing url: organization.facebook in application.ini");
        }
        $params['href'] = $ini->organization->facebook;
    }
1265137
public function api(FacebookSession $fbsession, $method, $call)
	{
		try 
		{
		  $facebookResponse = (new FacebookRequest($fbsession, $method, $call))->execute();

		  return $graphObject = $facebookResponse->getGraphObject();
		} 
		catch (FacebookRequestException $ex)
		{
		  throw new FacebookException($ex->getMessage());
		}
		catch (\Exception $ex)
		{
		  throw new FacebookException($ex->getMessage());
		}
	}
708936
public function linkedinShareButton(array $params = array()) {
        $html = '<script type="in/share" ';
        if (!empty($params['url'])) {
            $html .= 'data-url="' . $this->view->escape($params['url']) . '" ';
        }
        if (!empty($params['counter'])) {
            $html .= 'data-counter="' . $this->view->escape($params['counter']) . '" ';
        }
        $html .= '></script>';

        // Add the LinkedIn Javascript to the stack
        // Must be rendered in the view using "$this->script()->render()"
        $this->view->script()->src('http://platform.linkedin.com/in.js');
        return $html;
    }
497747
public static function create(UrlGenerator $generator, SessionInterface $session, array $options)
    {
        $config['app_id'] = $options['app-id'];
        $config['app_secret'] = $options['secret'];
        $config['default_graph_version'] = $options['default-graph-version'];

        $facebook = new \Facebook\Facebook($config);

        return new static($facebook, $generator, $session);
    }
827184
final public function buildUrl(string $url, array $parameters = []) : string
    {
        if (! $this->builder) {
            throw new \RuntimeException('No URL builder has been registered');
        }

        return $this->builder->buildUrl($url, $parameters);
    }
153153
protected function createComponentOnPageSocialModal() : object
    {
        $control = $this->IOnPage_SocialModal->create();

        $control->onSave[] = function () use ($control)
        {
            $control->redrawControl('socialForm');
        };

        $control->onRemoveImage[] = function () use ($control)
        {
            $control->redrawControl('socialForm');
        };

        return $control;
    }
684599
public function makePageSnapshot(PageInterface $page)
    {
        foreach ($page->getLayoutBlock() as $layoutBlock) {
            $layoutBlockContent = $this->registry->getManagerForClass($layoutBlock->getClassType())->getRepository($layoutBlock->getClassType())->find(
                $layoutBlock->getObjectId()
            );
            $layoutBlock->takeSnapshot($this->serializer->serialize($layoutBlockContent, 'json'));
        }

        $pageSnapshotClass = $this->pageSnapshotManager->getClassName();

        /** @var \Networking\InitCmsBundle\Model\PageSnapshotInterface $pageSnapshot */
        $pageSnapshot = new $pageSnapshotClass($page);
        $pageSnapshot->setVersionedData($this->serializer->serialize($page, 'json'))
            ->setPage($page);

        if ($oldPageSnapshot = $page->getSnapshot()) {
            $snapshotContentRoute = $oldPageSnapshot->getContentRoute();
        } else {
            $contentRouteClass = $this->contentRouteManager->getClassName();
            /** @var \Networking\InitCmsBundle\Model\ContentRouteInterface $snapshotContentRoute */
            $snapshotContentRoute = new $contentRouteClass();
        }

        $pageSnapshot->setContentRoute($snapshotContentRoute);
        $pageSnapshot->setPath(self::getPageRoutePath($page->getPath()));

        $om = $this->registry->getManagerForClass($pageSnapshotClass);
        $om->persist($pageSnapshot);
        $om->flush();

        $snapshotContentRoute->setPath(self::getPageRoutePath($page->getPath()));
        $snapshotContentRoute->setObjectId($pageSnapshot->getId());

        if ($oldPageSnapshot && ($oldPageSnapshot->getPath() != self::getPageRoutePath($page->getPath()))) {
            $this->phpCache->clean();
        }

        $om = $this->registry->getManagerForClass(get_class($snapshotContentRoute));
        $om->persist($snapshotContentRoute);
        $om->flush();
    }
477656
private function PageRule(Page $page, array $params)
    {
        $lhs = $page->GetUrl();
        foreach ($params as $param)
        {
            $lhs = str_replace('{' . $param . '}', self::PARAM_PATTERN, $lhs);
        }
        
        $rhs = 'index.php';
        $idx = 1;
        
        foreach ($params as $param)
        {
            $rhs .= $idx > 1 ? '&' : '?';
            $rhs .= $param . '=$' . $idx;
            ++$idx;
        }
        $rhs .= '&' . self::PAGE_URL_PARAM . '=' . $page->GetUrl();
        $rule = new RewriteRule($lhs, $rhs);
        $rule->AddFlag(new CommandFlag(FlagType::Qsa()));
        $rule->AddFlag(new CommandFlag(FlagType::L()));
        return $rule;
    }
489483
protected function _restserver($params) {
    // generic application level parameters
    $params['api_key'] = $this->getAppId();
    $params['format'] = 'json-strings';

    $result = json_decode($this->_oauthRequest(
      $this->getApiUrl($params['method']),
      $params
    ), true);

    // results are returned, errors are thrown
    if (is_array($result) && isset($result['error_code'])) {
      throw new FacebookApiException($result);
    }
    return $result;
  }
1109801
public function query_db($pagesize, $useinitialsbar = true) {
        $total = \enrol_lti\helper::count_lti_tools(array('courseid' => $this->courseid));
        $this->pagesize($pagesize, $total);
        $tools = \enrol_lti\helper::get_lti_tools(array('courseid' => $this->courseid), $this->get_page_start(),
            $this->get_page_size());
        $this->rawdata = $tools;
        // Set initial bars.
        if ($useinitialsbar) {
            $this->initialbars($total > $pagesize);
        }
    }
310531
protected function _getFacebookClient() {
        $authVars = $this->_getAuthVars();
        $facebook = Garp_Social_Facebook::getInstance(array(
            'appId'  => $authVars->appId,
            'secret' => $authVars->secret,
            'cookie' => false,
        ));
        return $facebook;
    }
409510
public function createCall($method, $params = array())
	{
		$params = array_values($params);

		if ($this->isAsync())
		{
			$output = "_gaq.push(['{$method}',";
			$output .= substr(json_encode($params), 1, -1);
			$output .= ']);';
		}
		else
		{
			$output = "pageTracker.{$method}(";
			$output .= substr(json_encode($params), 1, -1);
			$output .= ');';
		}

		return $output;
	}
799142
public function query_db($pagesize, $useinitialsbar = true) {
        global $PAGE;

        // Set dummy page total until we fetch full result set.
        $this->pagesize($pagesize, $pagesize + 1);

        $sort = $this->get_sql_sort();

        // Get data requests from the given conditions.
        $datarequests = api::get_data_requests($this->userid, $this->statuses, $this->types,
                $this->creationmethods, $sort, $this->get_page_start(), $this->get_page_size());

        // Count data requests from the given conditions.
        $total = api::get_data_requests_count($this->userid, $this->statuses, $this->types,
                $this->creationmethods);
        $this->pagesize($pagesize, $total);

        $this->rawdata = [];
        $context = \context_system::instance();
        $renderer = $PAGE->get_renderer('tool_dataprivacy');

        $forusers = [];
        foreach ($datarequests as $persistent) {
            $this->datarequests[$persistent->get('id')] = $persistent;
            $exporter = new data_request_exporter($persistent, ['context' => $context]);
            $this->rawdata[] = $exporter->export($renderer);
            $forusers[] = $persistent->get('userid');
        }

        // Fetch the list of all ongoing requests for the users currently shown.
        // This is used to determine whether any non-active request can be resubmitted.
        // There can only be one ongoing request of a type for each user.
        $this->ongoingrequests = api::find_ongoing_request_types_for_users($forusers);

        // Set initial bars.
        if ($useinitialsbar) {
            $this->initialbars($total > $pagesize);
        }
    }
1069791
public function createWebsite(...$params)
    {
        $name      = \array_shift($params);
        $ipAddress = \array_shift($params);
        $https     = \array_shift($params);
        $domains   = \array_shift($params);

        if ($this->version === 1)
        {
            $siteApps = $params;

            return $this->createV1Website($name, $ipAddress, $https, $domains, ...$siteApps);
        }

        $certificate = \array_shift($params);
        $siteApps    = $params;

        return $this->createV2Website($name, $ipAddress, $https, $domains, $certificate, ...$siteApps);

    }
1309853
public static function url($page, array $params = [])
    {
        /*
         * Reuse existing controller or create a new one,
         * assuming that the method is called not during the front-end
         * request processing.
         */
        $controller = Controller::getController() ?: new Controller;

        return $controller->pageUrl($page, $params, true);
    }