Plugin Directory

Changeset 2739184


Ignore:
Timestamp:
06/08/2022 10:54:58 AM (4 years ago)
Author:
pixelsandthings
Message:

Updated for PHP 8.0 Compatibility.

Location:
fetch-some-tweets
Files:
44 added
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • fetch-some-tweets/trunk/Readme.txt

    r2572401 r2739184  
    33Tags: twitter, twitter feed, json, php
    44Donate link: paypal.me/pixelsandthings
    5 Requires at least: 4.0
    6 Tested up to: 5.8
    7 Requires PHP: 7.0
     5Requires at least: 5.5
     6Tested up to: 6.0
     7Requires PHP: 7.4
    88Stable tag: trunk
    99License: GPL-2.0+
     
    6969= V1.3.61 =
    7070* Fixed issues with uninstallation.
     71
     72= V1.4 =
     73* Upgraded Twitter OAuth Library & made to be compatible with PHP 8.0.
     74
    7175== Upgrade Notice ==
  • fetch-some-tweets/trunk/fetch-some-tweets.php

    r2572401 r2739184  
    99    Plugin Name:       Fetch Some Tweets
    1010    Plugin URI:        http://www.pixelsandthings.co.uk
    11     Description:       JSON Driven PHP Twitter Feed - Twitter API 1.1
    12     Version:           1.3.5
     11    Description:       JSON Driven PHP Twitter Feed via Twitter API
     12    Version:           1.4
    1313    Author:            Pixels & Things
    1414    Author URI:        https://www.pixelsandthings.co.uk
     
    3232----------------------------------------------------------------------------- */
    3333
    34 define( 'PLUGIN_NAME_VERSION', '1.2' );
     34define( 'PLUGIN_NAME_VERSION', '1.3' );
    3535
    3636
     
    3939----------------------------------------------------------------------------- */
    4040
    41 require_once 'twitterOauth/autoload.php';
     41if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
     42    require __DIR__ . '/vendor/autoload.php';
     43}
     44
    4245use Abraham\TwitterOAuth\TwitterOAuth;
    4346
     
    272275        // Key & Tokens
    273276        $options = get_option( 'fst_settings' );
    274         $consumer_key = $options['fst_text_field_0'];
    275         $consumer_secret = $options['fst_text_field_1'];
    276         $access_token = $options['fst_text_field_2'];
    277         $access_token_secret = $options['fst_text_field_3'];
     277       
     278        if(isset($options['fst_text_field_0'])):
     279            $consumer_key = $options['fst_text_field_0'];
     280        endif;
     281
     282        if(isset($options['fst_text_field_1'])):
     283            $consumer_secret = $options['fst_text_field_1'];
     284        endif;
     285       
     286        if(isset($options['fst_text_field_2'])):
     287            $access_token = $options['fst_text_field_2'];
     288        endif;
     289
     290        if(isset($options['fst_text_field_3'])):
     291            $access_token_secret = $options['fst_text_field_3'];
     292        endif;
    278293
    279294        // User Details
    280         $screen_name = $options['fst_text_field_4'];
    281         $tweet_count = $options['fst_text_field_5'];
     295        if(isset($options['fst_text_field_4'])):
     296            $screen_name = $options['fst_text_field_4'];
     297        endif;
     298
     299        if(isset($options['fst_text_field_5'])):
     300            $tweet_count = $options['fst_text_field_5'];
     301        endif;
    282302
    283303        // Timeline Options
    284         $include_retweets = $options['fst_text_field_6'];
    285         $exclude_replies = $options['fst_text_field_7'];
     304        if(isset($options['fst_text_field_6'])):
     305            $include_retweets = $options['fst_text_field_6'];
     306        endif;
     307
     308        if(isset($options['fst_text_field_7'])):
     309            $exclude_replies = $options['fst_text_field_7'];
     310        endif;
    286311
    287312        // Connect to Twitter API - https://github.com/abraham/twitteroauth
     
    363388                    // Tweet Status
    364389                    $retweet = $tweet->retweeted;
    365                     $quoted_retweet = $tweet->quoted_status;
     390
     391                    if(isset($tweet->quoted_status)):
     392                        $quoted_retweet = $tweet->quoted_status;
     393                    endif;
     394
    366395                    $reply = $tweet->in_reply_to_status_id;
    367396
     
    410439
    411440                                // Tweet Type - Tweet, Retweet, Quoted Retweet or Reply
    412                                 if( $retweet ){
     441                                if( isset( $retweet ) ){
    413442                                    $tweet_user_timeline .= '<span class="tweet-type">Retweet</span> <span class="seperator"> - </span>';
    414                                 } elseif( $quoted_retweet ){
     443                                } elseif( isset( $quoted_retweet ) ){
    415444                                    $tweet_user_timeline .= '<span class="tweet-type">Quoted Retweet</span> <span class="seperator"> - </span>';
    416                                 } elseif( $reply ){
     445                                } elseif( isset( $reply ) ){
    417446                                    $tweet_user_timeline .= '<span class="tweet-type">Reply</span> <span class="seperator"> - </span>';
    418447                                } else {
Note: See TracChangeset for help on using the changeset viewer.