Custom Twitter Feeds - Version 1.1.7

Version Description

  • Fix: Fixed an issue with the Twitter Access Token and Secrets not automatically being saved when initially obtaining them
  • Fix: Fixed an issue with some customization settings not saving occasionally
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Custom Twitter Feeds
Version 1.1.7
Comparing to
See all releases

Code changes from version 1.1.6 to 1.1.7

README.txt CHANGED
@@ -5,7 +5,7 @@ Support Website: http://smashballoon/custom-twitter-feeds/
5
  Tags: Twitter, Twitter feed, Custom Twitter Feed, Twitter feeds, Custom Twitter Feeds, Tweets, Custom Tweets, Tweets feed, Twitter widget, Custom Twitter widget, Twitter plugin, Twitter API, Twitter tweets
6
  Requires at least: 3.0
7
  Tested up to: 4.6
8
- Stable tag: 1.1.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -146,6 +146,10 @@ If you're still having trouble displaying your Tweets after trying the common is
146
  2. Custom Twitter Feeds plugin Settings pages
147
 
148
  == Changelog ==
 
 
 
 
149
  = 1.1.6 =
150
  * Fix: Fixed an issue when creating a Search feed using the built-in Custom Twitter Feeds widget box
151
  * Fix: Fixed an issue with the checkbox that allows you to toggle links on/off in the Tweet text
5
  Tags: Twitter, Twitter feed, Custom Twitter Feed, Twitter feeds, Custom Twitter Feeds, Tweets, Custom Tweets, Tweets feed, Twitter widget, Custom Twitter widget, Twitter plugin, Twitter API, Twitter tweets
6
  Requires at least: 3.0
7
  Tested up to: 4.6
8
+ Stable tag: 1.1.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
146
  2. Custom Twitter Feeds plugin Settings pages
147
 
148
  == Changelog ==
149
+ = 1.1.7 =
150
+ * Fix: Fixed an issue with the Twitter Access Token and Secrets not automatically being saved when initially obtaining them
151
+ * Fix: Fixed an issue with some customization settings not saving occasionally
152
+
153
  = 1.1.6 =
154
  * Fix: Fixed an issue when creating a Search feed using the built-in Custom Twitter Feeds widget box
155
  * Fix: Fixed an issue with the checkbox that allows you to toggle links on/off in the Tweet text
custom-twitter-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Custom Twitter Feeds
4
  Plugin URI: http://smashballoon.com/custom-twitter-feeds
5
  Description: Customizable Twitter feeds for your website
6
- Version: 1.1.6
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  Text Domain: custom-twitter-feeds
@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
 
26
  define( 'CTF_URL', plugin_dir_path( __FILE__ ) );
27
- define( 'CTF_VERSION', '1.1.6' );
28
  define( 'CTF_TITLE', 'Custom Twitter Feeds' );
29
  define( 'CTF_JS_URL', plugins_url( '/js/ctf-scripts.js?ver=' . CTF_VERSION , __FILE__ ) );
30
  define( 'OAUTH_PROCESSOR_URL', 'https://smashballoon.com/ctf-at-retriever/?return_uri=' );
3
  Plugin Name: Custom Twitter Feeds
4
  Plugin URI: http://smashballoon.com/custom-twitter-feeds
5
  Description: Customizable Twitter feeds for your website
6
+ Version: 1.1.7
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  Text Domain: custom-twitter-feeds
24
  */
25
 
26
  define( 'CTF_URL', plugin_dir_path( __FILE__ ) );
27
+ define( 'CTF_VERSION', '1.1.7' );
28
  define( 'CTF_TITLE', 'Custom Twitter Feeds' );
29
  define( 'CTF_JS_URL', plugins_url( '/js/ctf-scripts.js?ver=' . CTF_VERSION , __FILE__ ) );
30
  define( 'OAUTH_PROCESSOR_URL', 'https://smashballoon.com/ctf-at-retriever/?return_uri=' );
inc/CtfAdmin.php CHANGED
@@ -1419,138 +1419,148 @@ class CtfAdmin
1419
 
1420
  public function validate_ctf_options( $input )
1421
  {
1422
- $ctf_options = get_option( 'ctf_options' );
1423
-
1424
- if ( isset( $input['usertimeline_text'] ) ) {
1425
-
1426
- $feed_types = apply_filters( 'ctf_admin_feed_type_list', '' );
1427
- $cron_clear_cache = isset( $input['cron_cache_clear'] ) ? $input['cron_cache_clear'] : 'no';
1428
- $ctf_options['ajax_theme'] = false;
1429
- $ctf_options['have_own_tokens'] = false;
1430
- $ctf_options['use_own_consumer'] = false;
1431
- $ctf_options['preserve_settings'] = false;
1432
-
1433
- foreach ( $input as $key => $val ) {
1434
- if ( $key == 'search_text' || $key == 'usertimeline_text' ) {
1435
- $ctf_options[$key] = apply_filters( 'ctf_admin_validate_' . $key, $val );
1436
- } elseif ( in_array( $key, $feed_types ) ) {
1437
- $ctf_options[$key] = apply_filters( 'ctf_admin_validate_include_replies', $val, $input['type'] );
1438
- } elseif ( $key == 'ajax_theme' || $key == 'use_own_consumer' || $key == 'have_own_tokens' || $key == 'preserve_settings' ) {
1439
- if ( $val != 'on' ) {
1440
- $ctf_options[$key] = false;
 
 
 
 
 
 
1441
  } else {
1442
- $ctf_options[$key] = true;
1443
  }
1444
- } else {
1445
- $ctf_options[$key] = sanitize_text_field( $val );
1446
  }
1447
- }
1448
 
1449
- $ctf_options['includereplies'] = apply_filters( 'ctf_admin_set_include_replies', $ctf_options );
1450
 
1451
- // delete feeds cached in transients
1452
- ctf_clear_cache();
1453
 
1454
- // process force cache to clear on interval
1455
- $cache_time = isset( $input['cache_time'] ) ? (int) $input['cache_time'] : 1;
1456
- $cache_time_unit = isset( $input['cache_time_unit'] ) ? (int) $input['cache_time_unit'] : 3600;
1457
 
1458
- if ( $cron_clear_cache == 'no' ) {
1459
- wp_clear_scheduled_hook( 'ctf_cron_job' );
1460
- } elseif ( $cron_clear_cache == 'yes' ) {
1461
- //Clear the existing cron event
1462
- wp_clear_scheduled_hook( 'ctf_cron_job' );
1463
 
1464
- //Set the event schedule based on what the caching time is set to
1465
- if ( $cache_time_unit == 3600 && $cache_time > 5 ) {
1466
- $ctf_cron_schedule = 'twicedaily';
1467
- } elseif ( $cache_time_unit == 86400 ) {
1468
- $ctf_cron_schedule = 'daily';
1469
- } else {
1470
- $ctf_cron_schedule = 'hourly';
1471
- }
1472
 
1473
- wp_schedule_event( time(), $ctf_cron_schedule, 'ctf_cron_job' );
1474
- }
1475
- } elseif ( isset( $input['class'] ) ) {
1476
 
1477
- $cron_clear_cache = isset( $input['cron_cache_clear'] ) ? $input['cron_cache_clear'] : 'no';
1478
- $checkbox_settings = array( 'width_mobile_no_fixed', 'include_retweeter', 'include_avatar', 'include_author', 'include_text',
1479
- 'include_date', 'include_actions', 'include_twitterlink', 'include_linkbox', 'creditctf', 'showbutton', 'showheader' );
1480
- $checkbox_settings = apply_filters( 'ctf_admin_customize_checkbox_settings', $checkbox_settings );
1481
- $leave_spaces = array( 'headertext', 'translate_minute', 'translate_hour' );
1482
 
1483
- foreach ( $checkbox_settings as $checkbox_setting ) {
1484
- $ctf_options[$checkbox_setting] = false;
1485
- }
1486
 
1487
- foreach ( $input as $key => $val ) {
1488
- if ( in_array( $key, $checkbox_settings ) ) {
1489
- if ( $val != 'on' ) {
1490
- $ctf_options[$key] = false;
1491
- } else {
1492
- $ctf_options[$key] = true;
1493
- }
1494
- } else {
1495
- if ( in_array( $key, $leave_spaces ) ) {
1496
- $ctf_options[$key] = $val;
1497
  } else {
1498
- $ctf_options[$key] = sanitize_text_field( $val );
 
 
 
 
1499
  }
1500
  }
1501
- }
1502
 
1503
- // delete feeds cached in transients
1504
- ctf_clear_cache();
1505
-
1506
- // process force cache to clear on interval
1507
- $cache_time = isset( $input['cache_time'] ) ? (int) $input['cache_time'] : 1;
1508
- $cache_time_unit = isset( $input['cache_time_unit'] ) ? (int) $input['cache_time_unit'] : 3600;
1509
-
1510
- if ( $cron_clear_cache == 'no' ) {
1511
- wp_clear_scheduled_hook( 'ctf_cron_job' );
1512
- } elseif ( $cron_clear_cache == 'yes' ) {
1513
- //Clear the existing cron event
1514
- wp_clear_scheduled_hook( 'ctf_cron_job' );
1515
-
1516
- //Set the event schedule based on what the caching time is set to
1517
- if ( $cache_time_unit == 3600 && $cache_time > 5 ) {
1518
- $ctf_cron_schedule = 'twicedaily';
1519
- } elseif ( $cache_time_unit == 86400 ) {
1520
- $ctf_cron_schedule = 'daily';
1521
- } else {
1522
- $ctf_cron_schedule = 'hourly';
1523
- }
1524
 
1525
- wp_schedule_event( time(), $ctf_cron_schedule, 'ctf_cron_job' );
1526
- }
1527
- } elseif ( isset( $input['showbio'] ) ) {
1528
- $checkbox_settings = array( 'showbio', 'disablelinks', 'linktexttotwitter' );
1529
- $checkbox_settings = apply_filters( 'ctf_admin_style_checkbox_settings', $checkbox_settings );
1530
- $leave_spaces = array( 'headertext' );
1531
 
1532
- foreach ( $checkbox_settings as $checkbox_setting ) {
1533
- $ctf_options[$checkbox_setting] = false;
1534
- }
 
 
1535
 
1536
- foreach ( $input as $key => $val ) {
1537
- if ( in_array( $key, $checkbox_settings ) ) {
1538
- if ( $val != 'on' ) {
1539
- $ctf_options[$key] = false;
 
1540
  } else {
1541
- $ctf_options[$key] = true;
1542
  }
1543
- } else {
1544
- if ( in_array( $key, $leave_spaces ) ) {
1545
- $ctf_options[$key] = $val;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1546
  } else {
1547
- $ctf_options[$key] = sanitize_text_field( $val );
 
 
 
 
1548
  }
1549
  }
1550
  }
1551
- }
1552
 
 
 
 
 
 
 
 
 
 
1553
 
1554
- return $ctf_options;
1555
  }
1556
  }
1419
 
1420
  public function validate_ctf_options( $input )
1421
  {
1422
+ if ( isset( $input['tab'] ) ) {
1423
+ $ctf_options = get_option( 'ctf_options', array() );
1424
+
1425
+ if ( $input['tab'] === 'configure' ) {
1426
+
1427
+ $feed_types = apply_filters( 'ctf_admin_feed_type_list', '' );
1428
+ $cron_clear_cache = isset( $input['cron_cache_clear'] ) ? $input['cron_cache_clear'] : 'no';
1429
+ $ctf_options['ajax_theme'] = false;
1430
+ $ctf_options['have_own_tokens'] = false;
1431
+ $ctf_options['use_own_consumer'] = false;
1432
+ $ctf_options['preserve_settings'] = false;
1433
+ $ctf_options['usertimeline_includereplies'] = false;
1434
+ $ctf_options['hometimeline_includereplies'] = false;
1435
+ $ctf_options['mentionstimeline_includereplies'] = false;
1436
+
1437
+ foreach ( $input as $key => $val ) {
1438
+ if ( $key == 'search_text' || $key == 'usertimeline_text' || $key == 'hashtag_text' ) {
1439
+ $ctf_options[$key] = apply_filters( 'ctf_admin_validate_' . $key, $val );
1440
+ } elseif ( $key == 'ajax_theme' || $key == 'use_own_consumer' || $key == 'have_own_tokens' || $key == 'preserve_settings' ||
1441
+ $key == 'usertimeline_includereplies' || $key == 'hometimeline_includereplies' || $key == 'mentionstimeline_includereplies' ) {
1442
+ if ( $val != 'on' ) {
1443
+ $ctf_options[$key] = false;
1444
+ } else {
1445
+ $ctf_options[$key] = true;
1446
+ }
1447
  } else {
1448
+ $ctf_options[$key] = sanitize_text_field( $val );
1449
  }
 
 
1450
  }
 
1451
 
1452
+ $ctf_options['includereplies'] = apply_filters( 'ctf_admin_set_include_replies', $ctf_options );
1453
 
1454
+ // delete feeds cached in transients
1455
+ ctf_clear_cache();
1456
 
1457
+ // process force cache to clear on interval
1458
+ $cache_time = isset( $input['cache_time'] ) ? (int) $input['cache_time'] : 1;
1459
+ $cache_time_unit = isset( $input['cache_time_unit'] ) ? (int) $input['cache_time_unit'] : 3600;
1460
 
1461
+ if ( $cron_clear_cache == 'no' ) {
1462
+ wp_clear_scheduled_hook( 'ctf_cron_job' );
1463
+ } elseif ( $cron_clear_cache == 'yes' ) {
1464
+ //Clear the existing cron event
1465
+ wp_clear_scheduled_hook( 'ctf_cron_job' );
1466
 
1467
+ //Set the event schedule based on what the caching time is set to
1468
+ if ( $cache_time_unit == 3600 && $cache_time > 5 ) {
1469
+ $ctf_cron_schedule = 'twicedaily';
1470
+ } elseif ( $cache_time_unit == 86400 ) {
1471
+ $ctf_cron_schedule = 'daily';
1472
+ } else {
1473
+ $ctf_cron_schedule = 'hourly';
1474
+ }
1475
 
1476
+ wp_schedule_event( time(), $ctf_cron_schedule, 'ctf_cron_job' );
1477
+ }
1478
+ } elseif ( $input['tab'] === 'customize' ) {
1479
 
1480
+ $cron_clear_cache = isset( $input['cron_cache_clear'] ) ? $input['cron_cache_clear'] : 'no';
1481
+ $checkbox_settings = array( 'width_mobile_no_fixed', 'include_retweeter', 'include_avatar', 'include_author', 'include_text',
1482
+ 'include_date', 'include_actions', 'include_twitterlink', 'include_linkbox', 'creditctf', 'showbutton', 'showheader' );
1483
+ $checkbox_settings = apply_filters( 'ctf_admin_customize_checkbox_settings', $checkbox_settings );
1484
+ $leave_spaces = array( 'headertext', 'translate_minute', 'translate_hour' );
1485
 
1486
+ foreach ( $checkbox_settings as $checkbox_setting ) {
1487
+ $ctf_options[$checkbox_setting] = 0;
1488
+ }
1489
 
1490
+ foreach ( $input as $key => $val ) {
1491
+ if ( in_array( $key, $checkbox_settings ) ) {
1492
+ if ( $val != 'on' ) {
1493
+ $ctf_options[$key] = false;
1494
+ } else {
1495
+ $ctf_options[$key] = true;
1496
+ }
 
 
 
1497
  } else {
1498
+ if ( in_array( $key, $leave_spaces ) ) {
1499
+ $ctf_options[$key] = $val;
1500
+ } else {
1501
+ $ctf_options[$key] = sanitize_text_field( $val );
1502
+ }
1503
  }
1504
  }
 
1505
 
1506
+ // delete feeds cached in transients
1507
+ ctf_clear_cache();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1508
 
1509
+ // process force cache to clear on interval
1510
+ $cache_time = isset( $input['cache_time'] ) ? (int) $input['cache_time'] : 1;
1511
+ $cache_time_unit = isset( $input['cache_time_unit'] ) ? (int) $input['cache_time_unit'] : 3600;
 
 
 
1512
 
1513
+ if ( $cron_clear_cache == 'no' ) {
1514
+ wp_clear_scheduled_hook( 'ctf_cron_job' );
1515
+ } elseif ( $cron_clear_cache == 'yes' ) {
1516
+ //Clear the existing cron event
1517
+ wp_clear_scheduled_hook( 'ctf_cron_job' );
1518
 
1519
+ //Set the event schedule based on what the caching time is set to
1520
+ if ( $cache_time_unit == 3600 && $cache_time > 5 ) {
1521
+ $ctf_cron_schedule = 'twicedaily';
1522
+ } elseif ( $cache_time_unit == 86400 ) {
1523
+ $ctf_cron_schedule = 'daily';
1524
  } else {
1525
+ $ctf_cron_schedule = 'hourly';
1526
  }
1527
+
1528
+ wp_schedule_event( time(), $ctf_cron_schedule, 'ctf_cron_job' );
1529
+ }
1530
+ } elseif ( $input['tab'] === 'style' ) {
1531
+ $checkbox_settings = array( 'showbio', 'disablelinks', 'linktexttotwitter' );
1532
+ $leave_spaces = array( 'headertext' );
1533
+
1534
+ foreach ( $checkbox_settings as $checkbox_setting ) {
1535
+ $ctf_options[$checkbox_setting] = false;
1536
+ }
1537
+
1538
+ foreach ( $input as $key => $val ) {
1539
+ if ( in_array( $key, $checkbox_settings ) ) {
1540
+ if ( $val != 'on' ) {
1541
+ $ctf_options[$key] = false;
1542
+ } else {
1543
+ $ctf_options[$key] = true;
1544
+ }
1545
  } else {
1546
+ if ( in_array( $key, $leave_spaces ) ) {
1547
+ $ctf_options[$key] = $val;
1548
+ } else {
1549
+ $ctf_options[$key] = sanitize_text_field( $val );
1550
+ }
1551
  }
1552
  }
1553
  }
 
1554
 
1555
+ return $ctf_options;
1556
+ } elseif ( isset( $input['access_token'] ) ) {
1557
+ $new = array();
1558
+ $new['access_token'] = $input['access_token'];
1559
+ $new['access_token_secret'] = $input['access_token_secret'];
1560
+
1561
+ return $new;
1562
+
1563
+ }
1564
 
 
1565
  }
1566
  }
views/admin/configure.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  settings_errors(); ?>
3
  <form method="post" action="options.php">
 
4
  <?php settings_fields('ctf_options'); // matches the options name ?>
5
  <?php do_settings_sections('ctf_options_connect'); // matches the section name ?>
6
  <p class="submit"><input class="button-primary" type="submit" name="save" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
1
  <?php
2
  settings_errors(); ?>
3
  <form method="post" action="options.php">
4
+ <input type="hidden" name="ctf_options[tab]" value="configure" />
5
  <?php settings_fields('ctf_options'); // matches the options name ?>
6
  <?php do_settings_sections('ctf_options_connect'); // matches the section name ?>
7
  <p class="submit"><input class="button-primary" type="submit" name="save" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
views/admin/customize.php CHANGED
@@ -15,6 +15,7 @@ settings_errors(); ?>
15
  ?>
16
  </p>
17
  <form method="post" action="options.php">
 
18
  <?php settings_fields( 'ctf_options' ); // matches the options name ?>
19
  <?php do_settings_sections( 'ctf_options_general' ); // matches the section name ?>
20
  <hr>
15
  ?>
16
  </p>
17
  <form method="post" action="options.php">
18
+ <input type="hidden" name="ctf_options[tab]" value="customize" />
19
  <?php settings_fields( 'ctf_options' ); // matches the options name ?>
20
  <?php do_settings_sections( 'ctf_options_general' ); // matches the section name ?>
21
  <hr>
views/admin/style.php CHANGED
@@ -15,6 +15,7 @@ settings_errors(); ?>
15
  ?>
16
  </p>
17
  <form method="post" action="options.php">
 
18
  <?php settings_fields( 'ctf_options' ); // matches the options name ?>
19
  <?php do_settings_sections( 'ctf_options_general_style' ); // matches the section name ?>
20
  <hr>
15
  ?>
16
  </p>
17
  <form method="post" action="options.php">
18
+ <input type="hidden" name="ctf_options[tab]" value="style" />
19
  <?php settings_fields( 'ctf_options' ); // matches the options name ?>
20
  <?php do_settings_sections( 'ctf_options_general_style' ); // matches the section name ?>
21
  <hr>