Exemplo n.º 1
0
<?php

require_once 'SocialCount.php';
if (!SocialCount::REQUIRE_LOCAL_URL || SocialCount::isLocalUrl($_GET['url'])) {
    try {
        $social = new SocialCount($_GET['url']);
        $social->addNetwork(new Twitter());
        $social->addNetwork(new Facebook());
        $social->addNetwork(new GooglePlus());
        // $social->addNetwork(new ShareThis());
        $social->addNetwork(new Pinterest());
        echo $social->toJSON();
    } catch (Exception $e) {
        echo '{"error": "' . $e->getMessage() . '"}';
    }
} else {
    echo '{"error": "URL not authorized (' . $_SERVER['HTTP_HOST'] . ')"}';
}
Exemplo n.º 2
0
$config = CJLib::get_cjconfig();
$task = JRequest::getCmd('task', '');
$secret = JRequest::getCmd('secret', null);
$component = 'com_cjlib';
if ($task == 'process' && !empty($secret) && strcmp($config['cron_secret'], $secret) == 0) {
    $emails = (int) $config['cron_emails'];
    $delay = (int) $config['cron_delay'];
    $sent = CJFunctions::send_messages_from_queue($emails, $delay, false);
    if (!empty($sent)) {
        echo json_encode($sent);
    }
} else {
    if ($task = 'socialcounts') {
        require_once CJLIB_PATH . DS . 'jquery' . DS . 'social' . DS . 'socialcounts.php';
        $url = base64_decode(JFactory::getApplication()->input->getString('url'));
        if (!SocialCount::REQUIRE_LOCAL_URL || SocialCount::isLocalUrl($url)) {
            try {
                $social = new SocialCount($url);
                $social->addNetwork(new Twitter());
                $social->addNetwork(new Facebook());
                $social->addNetwork(new GooglePlus());
                // $social->addNetwork(new ShareThis());
                echo $social->toJSON();
            } catch (Exception $e) {
                echo '{"error": "' . $e->getMessage() . '"}';
            }
        } else {
            echo '{"error": "URL not authorized."}';
        }
    }
}