コード例 #1
0
ファイル: data.php プロジェクト: ktharmabalan/gmail
                 if (isset($_GET['messageId'])) {
                     $messageId = $_GET['messageId'];
                     $result = attachment_get($service, $userId, $messageId, $id);
                 }
             }
             break;
         case 'profile':
             if ($method == "get") {
                 $result = profile_get($service, $userId);
             }
             break;
         default:
             break;
     }
     if ($result != null) {
         printPre($result);
     }
 } else {
     if (isset($_GET['send'])) {
         /*
             $data = strtr($part, array(
                 '-' => '+',
                 '_' => '/'
             ));
             $decoded = base64_decode($data);
         
             $encoded = base64_encode($data->saveHTML());
             $encoded = strtr($encoded, array(
                 '+' => '+',
                 '/' => '_'
             ));
コード例 #2
0
ファイル: functions.php プロジェクト: ktharmabalan/gmail
function getThreadList($service, $maxResults, $method = "")
{
    $user = '******';
    $pageToken = NULL;
    $opt_param = array();
    $opt_param['includeSpamTrash'] = false;
    // $opt_param['maxResults'] = $maxResults;
    // $opt_param['maxResults']       = 5;
    $opt_param['labelIds'] = ['INBOX'];
    // $opt_param['labelIds']         = ['INBOX', 'CATEGORY_PERSONAL'];
    $threadsResponse = $service->users_threads->listUsersThreads($user, $opt_param);
    if ($threadsResponse->getThreads()) {
        $threadObject = null;
        if ($method == "simple") {
            // $threadObject = array();
            $threadObject = new ThreadList();
            foreach ($threadsResponse->getThreads() as $thread) {
                $threadObject->addThread(new ThreadsSimple($thread->getId(), html_entity_decode($thread->getSnippet())));
                // array_push($threadObject, new ThreadsSimple($thread->getId(), html_entity_decode($thread->getSnippet())));
            }
        } else {
            if ($method == "minimal") {
                $threadObject = array();
                foreach ($threadsResponse->getThreads() as $thread) {
                    // $messageResponse = $service->users_messages->
                    $threadItem = thread_get($service, $user, $thread->getId());
                    printPre($threadItem);
                }
            } else {
                if ($method == "full") {
                    listThreads($service, $maxResults);
                } else {
                    if ($method == "allthreads") {
                        $threadObject = new ThreadList();
                        foreach ($threadsResponse->getThreads() as $thread) {
                            // $messageResponse = $service->users_messages->
                            $threadItem = thread_get($service, $user, $thread->getId());
                            // $threadObject->addThread(new ThreadItem($threadItem));
                            printPre($threadItem);
                        }
                    }
                }
            }
        }
        if ($threadObject != null) {
            printPre($threadObject);
        }
    }
}