當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Twitter::update方法代碼示例

本文整理匯總了PHP中Twitter::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::update方法的具體用法?PHP Twitter::update怎麽用?PHP Twitter::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Twitter的用法示例。


在下文中一共展示了Twitter::update方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: twit_post

function twit_post($p, $o, $res = '')
{
    list($p, $o) = ajxp($res, $p, $o);
    require_once 'plug/tiers/Twitter.php';
    $t = new Twitter();
    $t->update(utf8_encode($p));
    return divc('txtalert', nms(34) . ' ' . nms(79));
}
開發者ID:philum,項目名稱:cms,代碼行數:8,代碼來源:twit.php

示例2: trim

<?php

require_once 'config.php';
require_once 'Twitter.php';
require_once 'functions.php';
$nct_file = 'nextCoffeeTweet.txt';
$nct = trim(file_get_contents(dirname(__FILE__) . '/' . $nct_file));
$now = time();
if ($nct == '') {
    file_put_contents(dirname(__FILE__) . '/' . $nct_file, calculateNextCoffeeTweet($now));
    die;
}
if ((int) $nct < $now) {
    $twitter = new Twitter();
    $twitter->setCredentials($config['username'], $config['password']);
    file_put_contents(dirname(__FILE__) . '/' . $nct_file, calculateNextCoffeeTweet($now));
    $tweet = sprintf('O HAI! Um %s Uhr ist es Zeit für die nächste Kaffeepause!', date('H:i', time() + 300));
    $twitter->update($tweet, 'xml', array('lat' => $config['lat'], 'long' => $config['long']));
}
開發者ID:nhellenbart,項目名稱:lulzkaffeebot,代碼行數:19,代碼來源:sendCoffeeTweet.php

示例3: elseif

        $_SESSION['btOauth_Token'] = $arrOutput['oauth_token'];
        $_SESSION['btOauth_Token_Secret'] = $arrOutput['oauth_token_secret'];
        echo "\n\t\t\t\t\t\n\t\t\t<p>Redirecting to Twitter...</p>\n\t\t\t<script type='text/javascript'>\n\t\t\t\n\t\t\t\twindow.location = '" . $twitterObj->authorizeURL . "?oauth_token=" . $arrOutput['oauth_token'] . "';\n\t\t\t\n\t\t\t</script>\n\n\t\t";
    } else {
        echo "\n\t\t\t\n\t\t\t<div class='shadedBox' style='margin-left: auto; margin-right: auto; width: 50%'>\n\t\t\t\t<p class='main' align='center'>\n\t\t\t\t\tUnable to connect account!  Please Try Again.<br><br>\n\t\t\t\t\t<a href='" . $MAIN_ROOT . "members/console.php?cID=" . $_GET['cID'] . "'>Retry</a>\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\n\t\t";
    }
} elseif ($twitterObj->hasTwitter($memberInfo['member_id'])) {
    $dispSuccess = false;
    if ($_POST['submit']) {
        $setShowFeed = $_POST['showfeed'] == 1 ? 1 : 0;
        $setEmbedTweet = $_POST['embedlasttweet'] == 1 ? 1 : 0;
        $setInfoCard = $_POST['showinfo'] == 1 ? 1 : 0;
        $setAllowLogin = $_POST['allowlogin'] == 1 ? 1 : 0;
        $arrColumns = array("showfeed", "embedtweet", "infocard", "allowlogin");
        $arrValues = array($setShowFeed, $setEmbedTweet, $setInfoCard, $setAllowLogin);
        $twitterObj->update($arrColumns, $arrValues);
        $dispSuccess = true;
    }
    // MEMBER ALREADY HAS TWITTER CONNECTED
    $twitterObj->oauthToken = $twitterObj->get_info("oauth_token");
    $twitterObj->oauthTokenSecret = $twitterObj->get_info("oauth_tokensecret");
    $twitterObj->reloadCacheInfo();
    $twitterInfo = $twitterObj->get_info_filtered();
    $checkShowFeed = $twitterInfo['showfeed'] == 1 ? " checked" : "";
    $checkEmbedTweet = $twitterInfo['embedtweet'] == 1 ? " checked" : "";
    $checkInfoCard = $twitterInfo['infocard'] == 1 ? " checked" : "";
    $checkAllowLogin = $twitterInfo['allowlogin'] == 1 ? " checked" : "";
    echo "\n\t\n\t\t<div id='connectedDiv'>\n\t\t\t<form action='" . $MAIN_ROOT . "members/console.php?cID=" . $_GET['cID'] . "' method='post'>\n\t\t\t\t<div class='formDiv'>\n\t\t\t\t\t<table class='formTable'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\t\t\t\t<div class='main dottedLine' style='margin-bottom: 20px; padding-bottom: 3px'>\n\t\t\t\t\t\t\t\t\t<b>Connected:</b>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\n\t\t\t\t\t\t\t\t<div class='shadedBox' style='margin-left: auto; margin-right: auto; width: 50%; overflow: auto'>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t" . $twitterObj->dispCard() . "\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div style='font-style: italic; text-align: center; margin-top: 3px; margin-left: auto; margin-right: auto; position: relative' class='main'>\n\t\t\t\t\t\t\t\t\tLast updated " . getPreciseTime($twitterInfo['lastupdate']) . "\n\t\t\t\t\t\t\t\t\t<p class='largeFont' style='font-style: normal; font-weight: bold' align='center'>\n\t\t\t\t\t\t\t\t\t\t<a style='cursor: pointer' id='btnDisconnect'>DISCONNECT ACCOUNT</a>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><br><br>\n\t\t\t\t\t\t\t\t<div class='main dottedLine' style='margin-bottom: 2px; padding-bottom: 3px'>\n\t\t\t\t\t\t\t\t\t<b>Profile Display Options:</b>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div style='padding-left: 3px; margin-bottom: 15px'>\n\t\t\t\t\t\t\t\t\tUse the form below to set which items from Twitter will show in your profile.\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='formLabel'>Show Feed:</td>\n\t\t\t\t\t\t\t<td class='main'><input type='checkbox' name='showfeed' value='1'" . $checkShowFeed . "></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='formLabel'>Embed Last Tweet:</td>\n\t\t\t\t\t\t\t<td class='main'><input type='checkbox' name='embedlasttweet' value='1'" . $checkEmbedTweet . "></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='formLabel'>Show Info Card: <a href='javascript:void(0)' onmouseover=\"showToolTip('An example of the Info Card is shown in the &quot;Connected&quot; section above.')\" onmouseout='hideToolTip()'>(?)</a></td>\n\t\t\t\t\t\t\t<td class='main'><input type='checkbox' name='showinfo' value='1'" . $checkInfoCard . "></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><br>\n\t\t\t\t\t\t\t\t<div class='main dottedLine' style='margin-bottom: 2px; padding-bottom: 3px'>\n\t\t\t\t\t\t\t\t\t<b>Log In Options:</b>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div style='padding-left: 3px; margin-bottom: 15px'>\n\t\t\t\t\t\t\t\t\tCheck the box below to allow logging into this website through Twitter.\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='formLabel'>Allow Log In:</td>\n\t\t\t\t\t\t\t<td class='main'><input type='checkbox' name='allowlogin' value='1'" . $checkAllowLogin . "></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='main' colspan='2' align='center'><br>\n\t\t\t\t\t\t\t\t<input type='submit' name='submit' value='Save' class='submitButton'>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t<br>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</div>\n\t\t\n\t\t<div id='disconnectDiv' style='display: none'>\n\t\t\t<p class='main' align='center'>\n\t\t\t\tAre you sure you want to disconnect your Twitter account?\n\t\t\t</p>\n\t\t</div>\n\t\t\n\t\t<script type='text/javascript'>\n\t\t\n\t\t\t\$(document).ready(function() {\n\t\t\t\n\t\t\t\t\$('#btnDisconnect').click(function() {\n\t\t\t\t\t\n\t\t\t\t\t\$('#disconnectDiv').dialog({\n\t\t\t\t\t\ttitle: 'Disconnect Twitter',\n\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t'Yes': function() {\n\t\t\t\t\t\t\t\t\$('#connectedDiv').fadeOut(250);\n\t\t\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "plugins/twitter/disconnect.php', { }, function(data) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\$('#connectedDiv').html(data);\n\t\t\t\t\t\t\t\t\t\$('#connectedDiv').fadeIn(250);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'Cancel': function() {\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\t\$('.ui-dialog :button').blur();\n\t\t\t\t\n\t\t\t\t});\n\t\t\t\n\t\t\t});\n\t\t\n\t\t</script>\n\t";
    if ($dispSuccess) {
        echo "\n\t\t\t<div id='successDiv' style='display: none'>\n\t\t\t\t<p align='center' class='main'>\n\t\t\t\t\tTwitter Connect Settings Saved!\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t<script type='text/javascript'>\n\t\t\t\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\n\t\t\t\t\t\$('#successDiv').dialog({\n\t\t\t\t\t\ttitle: 'Twitter Connect',\n\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t'Ok': function() {\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\t\$('.ui-dialog :button').blur();\n\t\t\t\t\n\t\t\t\t});\n\t\t\t\n\t\t\t</script>\n\t\t\n\t\t\n\t\t";
    }
開發者ID:nsystem1,項目名稱:clanscripts,代碼行數:31,代碼來源:twitterconnect.php

示例4: elseif

 function display_twitter_client($tweeter_in_sidbar = false)
 {
     $identities = $this->load_identities();
     $status_timeline = $this->load_timeline();
     $tweeter_has_timeline = $this->get_config('tweeter_history', false) === true;
     if ($_POST['tweeter_timeline']) {
         $pstatus_timeline = $_POST['tweeter_timeline'];
     } else {
         $pstatus_timeline = $this->get_config('tweeter_timeline');
     }
     // Always remember last set identity
     $val_identitiy = $_POST['tweeter_account'];
     $acc_number = '';
     if (empty($val_identitiy) || $val_identitiy == 0) {
         $account_name = $this->get_config('twittername', '');
         $account_pwd = $this->get_config('twitterpwd', '');
         $account_type = $this->get_config('id_service', 'twitter');
     } else {
         $acc_number = (int) $val_identitiy + 1;
         $account_name = $this->get_config('twittername' . $acc_number, '');
         $account_pwd = $this->get_config('twitterpwd' . $acc_number, '');
         $account_type = $this->get_config('id_service' . $acc_number, 'twitter');
     }
     // Display client
     if ($this->get_config('tweeter_show', 'disable') != 'disable') {
         if (isset($_POST['tweeter_submit'])) {
             if (isset($_POST['tweet'], $_POST['shorturl'])) {
                 if ($_POST['shorturl'] !== 'http://' && !empty($_POST['shorturl'])) {
                     $val_short = $this->default_shorturl($_POST['shorturl']);
                     if ($val_short == $_POST['shorturl']) {
                         $val_short = 'ERROR';
                     }
                     $val_tweet = $_POST['tweet'] . $val_short;
                     $val_short = '';
                 } elseif (!empty($_POST['tweet'])) {
                     $update = $_POST['tweet'];
                     // Change encoding of update to UTF-8
                     if (LANG_CHARSET != 'UTF-8' && function_exists("mb_convert_encoding")) {
                         $update = mb_convert_encoding($update, 'UTF-8', LANG_CHARSET);
                     }
                     if ($account_type == "identica") {
                         $api = new Twitter($account_type == 'identica');
                         $twit = $api->update($account_name, $account_pwd, $update);
                     } else {
                         $connection = $this->twitteroa_connect($acc_number);
                         $api = new TwitterOAuthApi($connection);
                         $status = $api->update($update);
                         $twit = true;
                     }
                     if ($twit === true) {
                         $notice = PLUGIN_EVENT_TWITTER_TWEETER_STORED;
                     } else {
                         $val_tweet = $_POST['tweet'];
                         $notice = PLUGIN_EVENT_TWITTER_TWEETER_STOREFAIL . $twit;
                     }
                 }
             }
         } elseif (isset($_POST['tweeter_change_identity'])) {
             $val_tweet = $_POST['tweet'];
             $val_short = $_POST['shorturl'];
         }
         // Create strings of twitter URL length:
         $this->twitter_check_config();
         $http_length_str = str_repeat("=", (int) $this->get_config('twitter_config_http_len'));
         $https_length_str = str_repeat("=", (int) $this->get_config('twitter_config_https_len'));
         // Hide shorten url input, if no url shorter is used!
         if ('raw' == $this->get_config('anounce_url_service', '7ax.de')) {
             echo "<style type=\"text/css\">div#serendipity_admin_tweeter_shorturl {display: none;}</style>";
             @define('PLUGIN_EVENT_TWITTER_TWEETER_SHORTEN_OR_UPDATE', PLUGIN_EVENT_TWITTER_TWEETER_UPDATE);
         } else {
             @define('PLUGIN_EVENT_TWITTER_TWEETER_SHORTEN_OR_UPDATE', PLUGIN_EVENT_TWITTER_TWEETER_SHORTEN . ' / ' . PLUGIN_EVENT_TWITTER_TWEETER_UPDATE);
         }
         // Display the form
         include dirname(__FILE__) . '/tweeter/tweeter_client.inc.php';
     } else {
         return true;
         // if disabled, don't display anything else!
     }
     // Display history
     if ($tweeter_has_timeline) {
         if ($account_type == "identica") {
             $count = $this->get_config('tweeter_history_count', 10);
             $api = new Twitter($account_type == 'identica');
             $statuses = $api->timeline($account_name, $account_pwd, $count);
         } else {
             require_once dirname(__FILE__) . '/twitteroauth/twitteroauth.php';
             if ($_POST['tweeter_timeline']) {
                 $get_connection = "statuses/" . $_POST['tweeter_timeline'];
             } else {
                 $get_connection = "statuses/" . $this->get_config('tweeter_timeline');
             }
             $connection = $this->twitteroa_connect($acc_number);
             $statuses = $connection->get($get_connection);
             $http_code = $connection->http_code;
             $api = new Twitter($account_type == 'identica');
         }
         $buffer = '';
         if (!is_array($statuses)) {
             if (empty($statuses)) {
                 $buffer = '<li><strong>Result from Twitter was empty.</strong><br/>Perhaps down for maintenance?</li>';
//.........這裏部分代碼省略.........
開發者ID:sqall01,項目名稱:additional_plugins,代碼行數:101,代碼來源:serendipity_event_twitter.php

示例5: Twitter

#!/usr/bin/php
<?php 
require_once "/usr/local/boyhappy.se/bandybot/init.php";
$t = new Twitter();
//echo $t->toString();
if ($t->checkForUpdates()) {
    $res = $t->update($t->createMessage());
    echo $res;
}
開發者ID:krillo,項目名稱:bandybot_old,代碼行數:9,代碼來源:updateTwitter.php

示例6: ceil

                    } else {
                        $message = 'in ' . ceil(($next_tweet - time()) / 24 * 3600) . ' Tagen';
                    }
                }
            } else {
                if ($time <= 15 * 60) {
                    $message = 'bald';
                } else {
                    if ($time <= 45 * 60) {
                        $message = 'in ungefähr einer halben Stunde';
                    } else {
                        if ($time <= 90 * 60) {
                            $message = 'in ungefähr einer Stunde';
                        } else {
                            if ($time <= 120 * 60) {
                                $message = 'in 1½ Stunden';
                            } else {
                                $message = 'in ' . ceil($time / 3600) . ' Stunden';
                            }
                        }
                    }
                }
            }
        }
    } else {
        $message = 'lulz lulz lulz!';
    }
    $tweet = '@' . $mention->user->screen_name . ' ' . $message;
    $twitter->update($tweet, 'xml', array('in_reply_to_status_id' => $mention->id, 'lat' => $config['lat'], 'long' => $config['long']));
}
file_put_contents(dirname(__FILE__) . '/lastMention.txt', $since_id);
開發者ID:nhellenbart,項目名稱:lulzkaffeebot,代碼行數:31,代碼來源:checkMentions.php


注:本文中的Twitter::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。