$testo_tweet = $elem_search->text;
 if (isset($elem_search->retweeted_status)) {
     $testo_tweet = 'RT: ' . $elem_search->retweeted_status->text;
 }
 if (isset($elem_search->coordinates)) {
     $point = \GeoJson\GeoJson::jsonUnserialize($elem_search->coordinates);
 }
 // Entites https://dev.twitter.com/overview/api/entities
 $hashtags = [];
 foreach ($elem_search->entities->hashtags as $ht) {
     // lo # non c'e' se serve va messo
     $hashtags[] = $ht->text;
 }
 $ann = Annotation::on($connection_name)->where('sourceId', $id_tweet)->get();
 if ($ann->count() == 0) {
     $annotation = new Annotation(array('author' => $nick, 'source' => Source::TWITTER, 'sourceId' => $id_tweet, 'text' => $testo_tweet, 'textHtml' => parseTweet($testo_tweet), 'hashtags' => $hashtags));
     $annotation->setConnection($connection_name);
     $annotation->save();
     $result = Parser::parse($testo_tweet);
     if ($result != false) {
         $evaluation = new Evaluation(array('annotation_id' => $annotation->id, 'sessione' => $result->sessione, 'evento' => $result->evento, 'punteggio' => $result->punteggio));
         $evaluation->setConnection($connection_name);
         $evaluation->save();
     }
     $imageCount = 0;
     if (isset($elem_search->entities->media)) {
         foreach ($elem_search->entities->media as $media) {
             $imageCount++;
             $resources[] = $media->media_url;
             $dataImg = file_get_contents($media->media_url);
             $filename = basename($media->media_url);
Exemplo n.º 2
0
    function widget($args, $data)
    {
        $title = apply_filters('widget_title', $data['title']);
        $nbTweets = $data['nbTweets'];
        $consumer_key = $data['consumer_key'];
        $consumer_secret = $data['consumer_secret'];
        $access_token = $data['access_token'];
        $access_token_secret = $data['access_token_secret'];
        extract($args);
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $cache = plugin_dir_path(__FILE__) . 'cache/twitter.txt';
        if (time() - filemtime($cache) > $data['cachetime']) {
            include_once 'class/twitteroauth.php';
            $connect = new TwitterOAuth($data['consumer_key'], $data['consumer_secret'], $data['access_token'], $data['access_token_secret']);
            $tweets = $connect->get('statuses/user_timeline', array('count' => $data['nbTweets']));
            file_put_contents($cache, serialize($tweets));
        } else {
            $tweets = unserialize(file_get_contents($cache));
        }
        if (!$consumer_key || !$consumer_secret || !$access_token || !$access_token_secret) {
            echo "No Tweets Available or bad configuration...";
        } else {
            if (!empty($tweets)) {
                // to use with intents
                echo '<div class="twitter"><i class="icon-twitter icon-3x"></i>';
                global $hercules_add_owl;
                $hercules_add_owl = true;
                $random = hs_gener_random(10);
                echo '<script type="text/javascript">
jQuery(document).ready(function() {

  jQuery("#owl-demo_' . $random . '").owlCarousel({
    autoPlay : 5000,
    stopOnHover : true,
    navigation:false,
    singleItem : true,
    autoHeight : true,
	touchDrag: true,
	scrollPerPage: true
  });

});		
	</script>';
                echo '<div id="owl-demo_' . $random . '" class="owl-carousel">';
                foreach ($tweets as $tweet) {
                    $text = parseTweet($tweet->text);
                    $screen_name = $tweet->user->screen_name;
                    $name = $tweet->user->name;
                    $retweet = $tweet->id_str;
                    $time = date('d M Y', strtotime($tweet->created_at));
                    echo '<div>';
                    echo '<div class="tweet_item">';
                    echo '<div class="tweet_content">';
                    echo '<div class="stream-item-header">';
                    if ($data['fullname']) {
                        echo '<strong class="fullname">' . $name . '</strong>';
                    }
                    if ($data['username']) {
                        echo '<a class="account-group" href="http://twitter.com/' . $screen_name . '" target="_blank"><span class="username"> @' . $screen_name . '</span></a>';
                    }
                    echo '</div>';
                    echo '<div class="tweet_txt">' . $text . '</div>';
                    echo '<div class="clearfix">';
                    ?>
<div class="twitter_intents">
<span><a onClick="window.open('https://twitter.com/intent/tweet?in_reply_to=<?php 
                    echo $retweet;
                    ?>
','Twitter','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" class="reply-tweet" href="https://twitter.com/intent/tweet?in_reply_to=<?php 
                    echo $retweet;
                    ?>
">Reply</a></span>

<span><a onClick="window.open('https://twitter.com/intent/retweet?tweet_id=<?php 
                    echo $retweet;
                    ?>
','Twitter','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" class="retweet" href="https://twitter.com/intent/retweet?tweet_id=<?php 
                    echo $retweet;
                    ?>
">Retweet</a></span>

<span><a onClick="window.open('https://twitter.com/intent/favorite?tweet_id=<?php 
                    echo $retweet;
                    ?>
','Twitter','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" class="favorite-tweet" href="https://twitter.com/intent/favorite?tweet_id=<?php 
                    echo $retweet;
                    ?>
">Favorite</a></span>

</div>
<?php 
                    echo "</div>";
                    echo '
        <p class="timestamp">
            <a href="https://twitter.com/' . $screen_name . '/status/' . $retweet . '" target="_blank">
                ' . $time . '
            </a>
        </p>';
                    echo '</div>';
                    echo '</div>';
                    echo '</div>';
                }
                echo "</div></div>";
            }
        }
        echo $after_widget;
    }
Exemplo n.º 3
0
                         <label>Query: </label>
                         <span>' . $query . '</span>
                     </div>
                     <div class="formField">
                         <label>Résultat depuis $connection, $content= </label>
                         <p><code>' . substr(print_r($content, true), 0, 1000) . '</code> etc ...</p>
                     </div>
                     <div class="formField">
                         <label>Le Résultat: </label>
                         <p>';
 if (!empty($content)) {
     foreach ($content as $tweet) {
         echo '
                             <div class="twitter_status" id="' . $tweet->id_str . '">
                                 <div class="bloc_content">
                                     <p class="status tw_status">' . parseTweet($tweet->text) . '</p>
                                 </div>
                                 <div class="bloc_caption">
                                     <a href="http://twitter.com/' . $tweet->user->screen_name . '">
                                         <img src="' . $tweet->user->profile_image_url . '" alt="@' . $tweet->user->name . '" class="userimg tw_userimg"/>
                                         <span class="username tw_username">@' . $tweet->user->screen_name . '</span>
                                     </a>
                                     <span class="timestamp tw_timestamp">' . date('d M / H:i', strtotime($tweet->created_at)) . '</span>
                                 </div>
                             </div>';
     }
 }
 echo '
                         </p>
                         <div class="visualClear"></div>
                     </div>';
Exemplo n.º 4
0
                </div>
                <?php 
}
?>
                <div class="rect red shegueyClickSheg">
                    <p>Click & Sheg'<br/>Le générateur de sons</p>
                    <a href="clicknsheg.php"><div class="button">Lancer le générateur</div></a>
                </div>
                <?php 
foreach ($tweetsl as $k => $tweet) {
    ?>
                <div class="rect lightgrey shegueyTweet">
                    <div class="tweetCard">
                        <h2>@ShegueyLand</h2>
                        <p><?php 
    echo parseTweet($tweet->text);
    ?>
</p>
                    </div>
                </div>
                <?php 
}
?>
                <div class="rect empty no-mobile no-tablet"></div>
                <div class="rect lightgrey owl-carousel owl-theme shegueySlideGradur">
                    <?php 
$reponse = $bdd->query('SELECT * FROM instagram WHERE type = \'image\' order by RAND() LIMIT 5');
while ($donnees = $reponse->fetch()) {
    $media = $donnees['standard_resolution'];
    $media_caption = $donnees['caption_text'];
    echo '<div><img src="' . $media . '" alt="' . $media_caption . '"></div>';