コード例 #1
0
ファイル: Address.php プロジェクト: uxmsdevs/sharecount
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $relationId) {
             if (!($role = Addresses::find($relationId))) {
                 continue;
             }
             $role->delete();
         }
         Flash::success('URL has been deleted successfully.');
     }
     return $this->listRefresh();
 }
コード例 #2
0
ファイル: ShareCount.php プロジェクト: uxmsdevs/sharecount
 /**
  * Gets number of shares on Google+
  *
  * @return int|bool
  */
 private function fetchGoogleplus()
 {
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, "https://clients6.google.com/rpc");
     curl_setopt($curl, CURLOPT_POST, true);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . $this->urlData['url'] . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
     $curl_results = curl_exec($curl);
     curl_close($curl);
     $json = json_decode($curl_results, true);
     $this->count_gp = isset($json[0]['result']['metadata']['globalCounts']['count']) ? intval($json[0]['result']['metadata']['globalCounts']['count']) : 0;
     $googleObj = Addresses::find($this->property('webpage'));
     $googleObj->count_gp = $this->count_gp;
     $googleObj->save();
     return $this->count_gp;
 }