Admin
1 month ago
Builder
1 month ago
Integrations
1 month ago
SmashTwitter
1 month ago
UsageTracking
1 month ago
V2
1 month ago
blocks
1 month ago
CTF_Display_Elements.php
1 month ago
CTF_Feed.php
1 month ago
CTF_Feed_Locator.php
1 month ago
CTF_GDPR_Integrations.php
1 month ago
CTF_Parse.php
1 month ago
CTF_Settings.php
1 month ago
CtfAdmin.php
1 month ago
CtfCache.php
1 month ago
CtfFeed.php
1 month ago
CtfOauthConnect.php
1 month ago
SB_Twitter_Cron_Updater.php
1 month ago
admin-hooks.php
1 month ago
ctf-functions.php
1 month ago
notices.php
1 month ago
widget.php
1 month ago
notices.php
71 lines
| 1 | <?php |
| 2 | function ctf_get_current_time() { |
| 3 | $current_time = time(); |
| 4 | |
| 5 | // where to do tests |
| 6 | //$current_time = strtotime( 'November 25, 2020' ) + 1; |
| 7 | |
| 8 | return $current_time; |
| 9 | } |
| 10 | |
| 11 | // generates the html for the admin notices |
| 12 | function ctf_notices_html() { |
| 13 | //delete_option( 'ctf_rating_notice'); |
| 14 | //delete_transient( 'instagram_feed_rating_notice_waiting' ); |
| 15 | } |
| 16 | //add_action( 'admin_notices', 'ctf_notices_html', 12 ); // priority 8 for Instagram, priority 10 for Facebook |
| 17 | |
| 18 | function ctf_get_future_date( $month, $year, $week, $day, $direction ) { |
| 19 | if ( $direction > 0 ) { |
| 20 | $startday = 1; |
| 21 | } else { |
| 22 | $startday = date( 't', mktime(0, 0, 0, $month, 1, $year ) ); |
| 23 | } |
| 24 | |
| 25 | $start = mktime( 0, 0, 0, $month, $startday, $year ); |
| 26 | $weekday = date( 'N', $start ); |
| 27 | |
| 28 | $offset = 0; |
| 29 | if ( $direction * $day >= $direction * $weekday ) { |
| 30 | $offset = -$direction * 7; |
| 31 | } |
| 32 | |
| 33 | $offset += $direction * ($week * 7) + ($day - $weekday); |
| 34 | return mktime( 0, 0, 0, $month, $startday + $offset, $year ); |
| 35 | } |
| 36 | |
| 37 | |
| 38 | function ctf_admin_database_warning() { |
| 39 | if ( isset( $_GET['page'] ) && in_array( $_GET['page'], array( 'custom-twitter-feeds', '' ) ) ) { |
| 40 | |
| 41 | |
| 42 | if ( ! current_user_can( 'manage_options' ) ) { |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | global $wpdb; |
| 47 | $table_name = $wpdb->prefix . "options"; |
| 48 | $result = $wpdb->get_var(" |
| 49 | SELECT COUNT(*) |
| 50 | FROM $table_name |
| 51 | WHERE option_name LIKE '%ctf_!%' |
| 52 | "); |
| 53 | |
| 54 | if ( (int) $result < 500 ) { |
| 55 | return; |
| 56 | } |
| 57 | ?> |
| 58 | <div class="notice notice-warning is-dismissible ctf-admin-notice"> |
| 59 | <p> |
| 60 | <?php echo esc_html__( 'Heads up! It looks like you have over 500 Twitter feeds stored in your WordPress database. This is typically caused by a large number of hashtag feeds on your site, as the plugin permanently stores older Tweets to work around Twitter\'s 7 day hashtag feed limit. This many caches may lead to performance issues.', 'custom-twitter-feeds' ); ?> |
| 61 | </p> |
| 62 | <p> |
| 63 | <?php echo sprintf( __( 'For a solution, please follow the directions %shere%s.', 'custom-twitter-feeds' ), '<a href="https://smashballoon.com/why-does-my-database-have-a-lot-of-twitter-feed-caches/?utm_campaign=twitter-free&utm_source=notices&utm_medium=docs" target="_blank" rel="noopener noreferrer">', '</a>' ); ?> |
| 64 | </p> |
| 65 | </div> |
| 66 | <?php |
| 67 | } |
| 68 | } |
| 69 | add_action( 'admin_notices', 'ctf_admin_database_warning' ); |
| 70 | |
| 71 |