Exemplo n.º 1
0
 /**
  * Make a custom request on the Twitter API
  *
  * @access public
  * @return JSON or XML
  * @param string $method The request method (post, delete, get, put)
  * @param string $twitterMethodUrl The url of the API method (without 'api.twitter.com'),
  * e.g. /1/trends.json
  * @param array() $params The body of the api request. It has to be an valid array()
  */
 public function apiRequest($method, $twitterMethodUrl, $params)
 {
     $request = array();
     $method = strtoupper($method);
     if ($method == 'GET' || $method == 'POST' || $method == 'DELETE' || $method == 'PUT') {
         $request['method'] = $method;
     }
     if (substr($twitterMethodUrl, 0, 1) == '/') {
         $twitterMethodUrl = substr($twitterMethodUrl, 1, strlen($twitterMethodUrl));
     }
     $request['uri'] = array('host' => 'api.twitter.com', 'path' => $twitterMethodUrl);
     $request['auth'] = $this->_authArray();
     if (is_array($params)) {
         $params = array_change_key_case($params);
         if (array_key_exists('status', $params)) {
             if (strlen($params['status']) > 140) {
                 $params['status'] = substr($params['status'], 0, 137) . '...';
             }
         } else {
             if (array_key_exists('text', $params)) {
                 if (strlen($params['text']) > 140) {
                     $params['text'] = substr($params['text'], 0, 137) . '...';
                 }
             }
         }
         if ($method == 'GET') {
             $request['uri']['query'] = $params;
         } else {
             $request['body'] = $params;
         }
     }
     return $this->_Oauth->request($request);
 }
Exemplo n.º 2
0
 /**
  * Gets the count of rows
  *
  * @return boolean value / integer value
  */
 public function rows()
 {
     if ($this->PDO) {
         return !$this->Rs ? FALSE : $this->Rs->rowCount();
     }
     return !$this->Rs ? FALSE : $this->Database->rows();
 }
Exemplo n.º 3
0
Arquivo: db.php Projeto: no2key/MuuCMS
 /**
  * Gets the count of rows
  *
  * @return boolean value / integer value
  */
 public function rows()
 {
     return !$this->Rs ? FALSE : $this->Rs->rowCount();
 }