HEX
Server: Apache/2.4.57 (Unix) OpenSSL/1.1.1k
System: Linux tam.zee-supreme-vps.net 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Sat Dec 2 05:23:44 EST 2023 x86_64
User: adltc (1070)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/adltc/public_html/wp-content/plugins/feeds-for-youtube/inc/Services/DebugReportingService.php
<?php

namespace SmashBalloon\YouTubeFeed\Services;

use Smashballoon\Stubs\Services\ServiceProvider;
use SmashBalloon\YouTubeFeed\Pro\SBY_Settings_Pro;
use SmashBalloon\YouTubeFeed\SBY_GDPR_Integrations;

class DebugReportingService extends ServiceProvider {
	public function register() {
		add_action( 'sby_before_feed_end', [ $this, 'sby_debug_report' ], 11, 2 );
	}

	public function sby_debug_report( $youtube_feed, $feed_id ) {

		if ( ! isset( $_GET['sb_debug'] ) ) {
			return;
		}

		?>
		<p>Status</p>
		<ul>
			<li>Time: <?php echo date( "Y-m-d H:i:s", time() ); ?></li>
			<?php foreach ( $youtube_feed->get_report() as $item ) : ?>
				<li><?php echo esc_html( $item ); ?></li>
			<?php endforeach; ?>

		</ul>

		<?php
		$feed = $youtube_feed->get_feed_id();
		$atts = array();
		if ( ! empty( $feed ) ) {
			$atts = array( 'feed' => $feed );
		}

		$settings_obj = sby_is_pro_version() ? new SBY_Settings_Pro( $atts, sby_get_database_settings() ) : new SBY_Settings( $atts, sby_get_database_settings() );

		$settings = $settings_obj->get_settings();
		$public_settings_keys = sby_is_pro_version() ? SBY_Settings_Pro::get_public_db_settings_keys() : SBY_Settings::get_public_db_settings_keys();

		?>
		<p>Settings</p>
		<ul>
			<?php foreach ( $public_settings_keys as $key ) : if ( isset( $settings[ $key ] ) ) : ?>
				<li>
					<small><?php echo esc_html( $key ); ?>:</small>
					<?php if ( ! is_array( $settings[ $key ] ) ) :
						echo esc_html( $settings[ $key ] );
					else : ?>
						<ul>
							<?php foreach ( $settings[ $key ] as $sub_key => $value ) {
								echo '<li><small>' . esc_html( $sub_key ). ':</small> '. esc_html( $value ) . '</li>';
							} ?>
						</ul>
					<?php endif; ?>
				</li>

			<?php endif; endforeach; ?>
		</ul>
		<p>GDPR</p>
		<ul>
			<?php
			$statuses = SBY_GDPR_Integrations::statuses();
			foreach ( $statuses as $status_key => $value) : ?>
				<li>
					<small><?php echo esc_html( $status_key ); ?>:</small>
					<?php if ( $value == 1 ) { echo 'success'; } else {  echo 'failed'; } ?>
				</li>

			<?php endforeach; ?>
			<li>
				<small>Enabled:</small>
				<?php echo SBY_GDPR_Integrations::doing_gdpr( $settings ); ?>
			</li>
		</ul>
		<?php
	}

}