Ejemplo n.º 1
0
    public function authAdapters($return_array = false)
    {
        $adapters = $this->wa->getAuthAdapters();
        if ($return_array) {
            return $adapters;
        }
        if (!$adapters) {
            return '';
        }
        $html = '<div class="wa-auth-adapters"><ul>';
        $url = $this->wa->getRootUrl(false, true) . 'oauth.php?app=' . $this->app() . '&provider=';
        foreach ($adapters as $adapter) {
            /**
             * @var waAuthAdapter $adapter
             */
            $html .= '<li><a href="' . $url . $adapter->getId() . '"><img alt="' . $adapter->getName() . '" src="' . $adapter->getIcon() . '">' . $adapter->getName() . '</a></li>';
        }
        $html .= '</ul><p>';
        $html .= _ws("Authorize either by entering your contact information, or through one of the websites listed above.");
        $html .= '</p></div>';
        $html .= <<<HTML
<script>
\$("div.wa-auth-adapters a").click(function () {
    var left = (screen.width - 600) / 2;
    var top = (screen.height - 400) / 2;
    window.open(\$(this).attr('href'),'oauth', "width=600,height=400,left="+left+",top="+top+",status=no,toolbar=no,menubar=no");
    return false;
});
</script>
HTML;
        return $html;
    }