Exemplo n.º 1
0
 /**
  * Home page - Main Panel
  *
  */
 public function ajaxGetSocialCountAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     require_once realpath(APPLICATION_PATH . '/../library/Function/SocialCount.php');
     $social = new SocialCount($_SERVER['HTTP_REFERER']);
     $social->addNetwork(new Twitter());
     $social->addNetwork(new Facebook());
     $social->addNetwork(new GooglePlus());
     echo $social->toJSON();
 }
 public function testSocialCountValidJson()
 {
     $social = new SocialCount(self::TEST_URL);
     $social->addNetwork(new Twitter());
     $social->addNetwork(new Facebook());
     $social->addNetwork(new GooglePlus());
     $social->addNetwork(new ShareThis());
     $json = $social->toJSON();
     $this->assertNotNull($json);
     $this->assertNotEquals("{}", $json);
 }
Exemplo n.º 3
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'] . ')"}';
}