<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
if ( ! current_user_can( 'manage_options' ) ) {
	wp_die( esc_html__( 'You do not have permission to access this page.', 'commenting-feature' ) );
}
/**
 * Gutenberg Commenting Feature Settings Page.
 */

// Get settings.
$multicollab_view                        = filter_input( INPUT_GET, 'view', FILTER_SANITIZE_SPECIAL_CHARS );
$multicollab_tab_number                  = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_SPECIAL_CHARS );
$multicollab_activated                   = filter_input( INPUT_GET, 'activated', FILTER_SANITIZE_SPECIAL_CHARS );
$multicollab_admin_notif              = get_option( 'multicollab_admin_notif' );

$multicollab_show_multicollab_sidebar = get_option( 'multicollab_show_multicollab_sidebar' );
$multicollab_hide_editorial_column 						= get_option( 'multicollab_hide_editorial_column' ) !== false
    												? get_option( 'multicollab_hide_editorial_column' )
    												: ( update_option( 'multicollab_hide_editorial_column', '0' ) ? '0' : '0' );
$multicollab_hide_floating_icons 						= get_option( 'multicollab_hide_floating_icons' ) !== false
    												? get_option( 'multicollab_hide_floating_icons' )
    												: ( update_option( 'multicollab_hide_floating_icons', '0' ) ? '0' : '0' );
$multicollab_page_url                                    = menu_page_url( 'editorial-comments', false );
$multicollab_web_activity_url                            = add_query_arg( 'view', 'web-activity', $multicollab_page_url );
$multicollab_post_activity_url                           = add_query_arg( 'view', 'post-activity', $multicollab_page_url );
$multicollab_view                                           = ( null === $multicollab_view ) ? 'web-activity' : $multicollab_view;
if ( 'modules' === $multicollab_view ) {
	wp_safe_redirect( admin_url( 'admin.php?page=editorial-comments&view=web-activity' ) );
	exit;
}
?>
<div class="cf-dashboard-layout">
<div class="cf-settings-loader"></div>
			<?php
			// Display Promotional Banner.
			$multicollab_promotional_banner = multicollab_dpb_promotional_banner( 'setting' );
			if ( ! empty( $multicollab_promotional_banner ) ) {
				echo $multicollab_promotional_banner; // phpcs:ignore WordPress.Security.EscapeOutput
			}
			?>
			<div class="cf-dashboard-layout__header">
			<div class="cf-dashboard-layout__header-logo">
				<a href="https://www.multicollab.com/" target="_blank"><img src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/multicollab_logo.svg' ); ?>"/></a>
				<a href="<?php echo esc_url( 'https://www.multicollab.com/pricing/#h-compare-features-side-by-side' ); ?>" target="_blank" class="cf-dashboard-layout__header-plan-name">
					<svg xmlns="http://www.w3.org/2000/svg" width="14" height="12.513" viewBox="0 0 14 12.513">
					<g id="Group_52550" data-name="Group 52550" transform="translate(-285.455 -280.192)">
						<path id="Path_199491" data-name="Path 199491" d="M324.995,428.1a.56.56,0,0,1-.561.561h-8.208a.561.561,0,1,1,0-1.121h8.208a.561.561,0,0,1,.56.561Z" transform="translate(-27.875 -135.952)" fill="#d0a823"/>
						<path id="Path_199492" data-name="Path 199492" d="M299.228,282.364h0a.559.559,0,0,0-.623-.029l-3.432,2.078-2.229-3.938a.561.561,0,0,0-.976,0l-2.229,3.938-3.432-2.078a.56.56,0,0,0-.833.616l1.728,6.863a.56.56,0,0,0,.543.424h9.423a.56.56,0,0,0,.543-.424l1.728-6.863A.559.559,0,0,0,299.228,282.364Zm-2.5,6.753h-8.549L286.893,284l2.759,1.67a.561.561,0,0,0,.778-.2l2.025-3.579,2.026,3.578a.561.561,0,0,0,.778.2l2.759-1.67Z" transform="translate(0 0)" fill="#d0a823"/>
					</g>
					</svg>
					<?php
						echo esc_html( __( 'FREE', 'commenting-feature' ) );
					?>
				</a>
				<a class="cf-dashboard-layout__header-plan-version" href="<?php echo esc_url( 'https://www.multicollab.com/change-log' ); ?>" target="_blank">v <?php echo esc_html( COMMENTING_BLOCK_VERSION ); ?></a>
			</div>
			<div class="cf-plugin-version">
				<a href="<?php echo esc_url( 'https://www.multicollab.com/contact/?utm_source=plugin_setting_header_link_contact&utm_medium=header_link_contact&utm_campaign=plugin_setting_header_link_contact&utm_id=plugin_setting_header_link' ); ?>" target="_blank"><?php esc_html_e( 'Contact', 'commenting-feature' ); ?><img class="cf-external-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/arrow_blue.svg' ); ?>" alt="external-link"></a>
				<a class="pricing-block-button__link" href="<?php echo esc_url( 'https://www.multicollab.com/pricing/' ); ?>" target="_blank"><?php esc_html_e( 'Plans', 'commenting-feature' ); ?><img class="cf-external-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/arrow-white.svg' ); ?>" alt="external-link"></a>
			</div>
		</div>
	
		<div class="cf-dashboard-layout__outer">
			<div class="cf-dashboard-layout__inner">
				<div class="cf-dashboard-layout__tabs-wrap">
				<ul class="cf-dashboard-layout__tabs-list">
					<li class="
						<?php
						if ( ( 'dashboard' === $multicollab_tab_number || empty( $multicollab_tab_number ) || 'web-activity' === $multicollab_view ) && 'post-activity' !== $multicollab_view && 'settings' !== $multicollab_view && 'integrations' !== $multicollab_tab_number && 'license' !== $multicollab_view && 'need-help' !== $multicollab_view ) {
							echo esc_html( 'cf-tab-active' ); }
						?>
							"><a href="<?php echo esc_url( site_url() ); ?>/wp-admin/admin.php?page=editorial-comments&view=web-activity" class="cf-tab-item" data-id="cf-dashboard"><?php esc_html_e( 'Dashboard', 'commenting-feature' ); ?></a></li>
						<li class="
									<?php
									if ( 'post-activity' === $multicollab_view ) {
										echo esc_html( 'cf-tab-active' ); }
									?>
						"><a href="<?php echo esc_url( site_url() ); ?>/wp-admin/admin.php?page=editorial-comments&view=post-activity" class="cf-tab-item" data-id="cf-reports"><?php esc_html_e( 'Reports', 'commenting-feature' ); ?></a></li>
						<?php if ( current_user_can( 'administrator' ) ) : ?>
						<li class="
							<?php
							if ( 'settings' === $multicollab_view ) {
								echo esc_html( 'cf-tab-active' ); }
							?>
						"><a href="<?php echo esc_url( site_url() ); ?>/wp-admin/admin.php?page=editorial-comments&view=settings" class="cf-tab-item" data-id="cf-settings"><?php esc_html_e( 'Settings', 'commenting-feature' ); ?></a></li>
							<li class="cf-dashboard-need-help-tab 
								<?php
								if ( 'need-help' === $multicollab_view ) {
									echo esc_html( 'cf-tab-active' ); }
								?>
							"><a href="<?php echo esc_url( site_url() ); ?>/wp-admin/admin.php?page=editorial-comments&view=need-help" class="cf-tab-item" data-id="cf-need-help"><?php esc_html_e( 'Get Started', 'commenting-feature' ); ?></a></li>

						<?php endif; ?>
					</ul>
					<div class="cf-dashboard-layout__tabs-content">
						<div id="cf-dashboard" class="cf-dashboard-layout__tabs-wrap-inner 
							<?php
							if ( ( 'dashboard' === $multicollab_tab_number || empty( $multicollab_tab_number ) || 'web-activity' === $multicollab_view ) && 'post-activity' !== $multicollab_view && 'settings' !== $multicollab_view && 'integrations' !== $multicollab_tab_number && 'license' !== $multicollab_view && 'need-help' !== $multicollab_view ) {
								echo esc_html( 'cf-tab-active' ); 
							}
							?>
						">
							<?php
								$this->multicollab_get_activities();
								require_once COMMENTING_BLOCK_DIR . 'admin/settings/settings-dashboard.php'; // Removed phpcs:ignore by Rishi Shah.

							?>
							<div class="cf-copyright-text"><?php esc_html_e( 'Multicollab is powered by ', 'commenting-feature' ); ?>
								<img class="cf-footer-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/multidots-logo.svg' ); ?>" alt="Multidots" style="height: 16px;position: relative;top: 0px;">
								<?php esc_html_e( ' — Enterprise WordPress Agency.', 'commenting-feature' ); ?>
								<a href="https://www.multidots.com?utm_source=plugin+&utm_medium=+Explore+custom+solutions.&utm_campaign=plugin_footer_free" target="_blank"><?php esc_html_e( 'Explore custom solutions', 'commenting-feature' ); ?><img class="cf-external-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/arrow_blue.svg' ); ?>" alt="external-link"></a></div>							
						</div>
						<?php if ( current_user_can( 'administrator' ) || current_user_can( 'manage_options' ) ) : ?>
						<div id="cf-reports" class="cf-dashboard-layout__tabs-wrap-inner
							<?php
							if ( 'post-activity' === $multicollab_view ) {
								echo esc_html( 'cf-tab-active' ); }
							?>
						">
							<?php

							$this->multicollab_get_activities();
							require_once COMMENTING_BLOCK_DIR . 'admin/settings/settings-report.php'; // Removed phpcs:ignore by Rishi Shah.
							?>
							<div class="cf-copyright-text"><?php esc_html_e( 'Multicollab is powered by ', 'commenting-feature' ); ?>
								<img class="cf-footer-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/multidots-logo.svg' ); ?>" alt="Multidots" style="height: 16px;position: relative;top: 0px;">
								<?php esc_html_e( ' — Enterprise WordPress Agency.', 'commenting-feature' ); ?>
								<a href="https://www.multidots.com?utm_source=plugin+&utm_medium=+Explore+custom+solutions.&utm_campaign=plugin_footer_free" target="_blank"><?php esc_html_e( 'Explore custom solutions', 'commenting-feature' ); ?><img class="cf-external-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/arrow_blue.svg' ); ?>" alt="external-link"></a></div>							
						</div>
						<?php endif; ?>
						<?php if ( current_user_can( 'administrator' ) ) : ?>
							<div id="cf-settings" class="cf-dashboard-layout__tabs-wrap-inner
							<?php
							if ( 'settings' === $multicollab_view ) {
								echo esc_html( 'cf-tab-active' ); 
							 
							}
							?>
							">
								<div class="cf-settings-wrapper">
									<div class="cf-settings-wrapper__sidebar">
										<ul>
											<li class="cf-tab-btn cf-tab-active" data-tab="cf-general">
												<svg width="18px" height="18px" viewBox="-2.73 -2.73 96.46 96.46" enable-background="new 0 0 91 91" id="Layer_1" version="1.1" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#5B6064" stroke="#5B6064" stroke-width="6"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <path d="M90.668,35.091c0.17-0.643,0.08-1.326-0.25-1.902L78.813,13.115c-0.695-1.195-2.225-1.607-3.422-0.914 l-9.734,5.619c-1.791-1.283-3.707-2.391-5.727-3.307V3.269c0-1.383-1.121-2.504-2.506-2.504H34.23 c-1.385,0-2.504,1.121-2.504,2.504v11.246c-1.891,0.861-3.699,1.893-5.406,3.086l-9.678-5.736 c-0.572-0.338-1.252-0.434-1.896-0.271c-0.643,0.166-1.197,0.578-1.535,1.15L1.387,32.69c-0.338,0.57-0.436,1.254-0.271,1.898 c0.166,0.643,0.578,1.195,1.15,1.533l9.682,5.734c-0.154,1.305-0.229,2.523-0.229,3.695c0,1.039,0.061,2.117,0.189,3.309 L2.16,54.491c-0.576,0.334-0.996,0.881-1.166,1.521c-0.174,0.641-0.082,1.326,0.25,1.9l11.6,20.076 c0.691,1.197,2.225,1.609,3.422,0.914l9.736-5.621c1.793,1.285,3.711,2.391,5.725,3.307v11.244c0,1.385,1.119,2.504,2.504,2.504 h23.193c1.385,0,2.506-1.119,2.506-2.504V76.589c1.889-0.859,3.697-1.895,5.402-3.088l9.684,5.736 c1.188,0.705,2.727,0.311,3.432-0.879L90.27,58.413c0.336-0.572,0.434-1.256,0.271-1.898c-0.166-0.643-0.578-1.195-1.152-1.533 l-9.676-5.734c0.156-1.314,0.23-2.518,0.23-3.695c0-1.051-0.063-2.143-0.189-3.313l9.746-5.627 C90.074,36.282,90.496,35.733,90.668,35.091z M59.242,45.55c0,7.396-6.018,13.414-13.416,13.414 c-7.396,0-13.412-6.018-13.412-13.414c0-7.393,6.016-13.41,13.412-13.41C53.225,32.14,59.242,38.157,59.242,45.55z" fill="#ffffff"></path> </g> </g></svg>
												<?php esc_html_e( 'General', 'commenting-feature' ); ?>
											</li>
											<li class="cf-tab-btn" data-tab="cf-email">
												<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18.6 23.169" fill="#5B6064" stroke-width="0"><g transform="translate(-182.701 -870.7)"><g transform="translate(183.001 871)"><path d="M54.445,14.569a3.653,3.653,0,0,1-3.622-3.259H46.445a1,1,0,0,1-.977-.772.973.973,0,0,1,.505-1.077,3.233,3.233,0,0,0,.9-1.256,15.959,15.959,0,0,0,1.044-6.287,6.586,6.586,0,0,1,3.656-5.873V-5.22A2.781,2.781,0,0,1,54.345-8h.2a2.781,2.781,0,0,1,2.776,2.78v1.265a6.591,6.591,0,0,1,3.655,5.844c0,.006,0,.017,0,.029a15.958,15.958,0,0,0,1.044,6.287,3.234,3.234,0,0,0,.9,1.256.973.973,0,0,1,.505,1.077.994.994,0,0,1-.977.772H58.068a3.653,3.653,0,0,1-3.622,3.259ZM52.814,11.31a1.676,1.676,0,0,0,3.262,0Zm7.577-1.968-.048-.093a16.518,16.518,0,0,1-1.332-7.3s0-.016,0-.027a4.566,4.566,0,1,0-9.132,0,16.555,16.555,0,0,1-1.332,7.331l-.048.093ZM54.445-4.625a6.572,6.572,0,0,1,.911.064V-5.22a.812.812,0,0,0-.81-.812h-.2a.812.812,0,0,0-.81.812v.659A6.579,6.579,0,0,1,54.445-4.625Z" transform="translate(-45.445 8)"/><path d="M54.445,14.869a3.954,3.954,0,0,1-3.882-3.259H46.445a1.3,1.3,0,0,1-1.271-1.01,1.275,1.275,0,0,1,.639-1.394A3.118,3.118,0,0,0,46.6,8.077a15.678,15.678,0,0,0,1.016-6.159,6.9,6.9,0,0,1,3.656-6.057V-5.22A3.081,3.081,0,0,1,54.345-8.3h.2a3.081,3.081,0,0,1,3.076,3.08v1.081a6.9,6.9,0,0,1,3.655,6.022c0,.009,0,.022,0,.034a15.677,15.677,0,0,0,1.016,6.159,3.119,3.119,0,0,0,.784,1.129,1.275,1.275,0,0,1,.639,1.394,1.3,1.3,0,0,1-1.271,1.01H58.328a3.953,3.953,0,0,1-3.882,3.259ZM54.345-7.7a2.481,2.481,0,0,0-2.476,2.48v1.451l-.167.083a6.293,6.293,0,0,0-3.488,5.6A16.242,16.242,0,0,1,47.14,8.333a3.508,3.508,0,0,1-.993,1.372l-.019.014-.021.01a.674.674,0,0,0-.346.746.693.693,0,0,0,.684.534h4.648l.029.268a3.343,3.343,0,0,0,6.648,0l.029-.268h4.648a.693.693,0,0,0,.684-.534.674.674,0,0,0-.346-.746l-.021-.01-.019-.014a3.509,3.509,0,0,1-.993-1.372,16.241,16.241,0,0,1-1.073-6.416c0-.006,0-.013,0-.016V1.89a6.3,6.3,0,0,0-3.488-5.577l-.167-.083V-5.22A2.481,2.481,0,0,0,54.546-7.7Zm.1,20.6a1.971,1.971,0,0,1-1.923-1.521l-.088-.369h4.022l-.088.369A1.971,1.971,0,0,1,54.445,12.9Zm-1.193-1.29a1.377,1.377,0,0,0,2.387,0Zm7.636-1.968H48l.231-.439.046-.089a16.273,16.273,0,0,0,1.3-7.2,4.866,4.866,0,1,1,9.732,0v.027a16.236,16.236,0,0,0,1.3,7.167l.046.089Zm-11.909-.6H59.912a17.558,17.558,0,0,1-1.2-7.09c0-.009,0-.02,0-.032a4.266,4.266,0,1,0-8.532,0A17.6,17.6,0,0,1,48.979,9.042ZM55.656-4.216l-.342-.048a6.288,6.288,0,0,0-1.738,0l-.342.048v-1a1.112,1.112,0,0,1,1.11-1.112h.2a1.112,1.112,0,0,1,1.11,1.112Zm-1.211-.709c.2,0,.408.009.611.027V-5.22a.511.511,0,0,0-.51-.512h-.2a.511.511,0,0,0-.51.512V-4.9C54.038-4.916,54.242-4.925,54.445-4.925Z" transform="translate(-45.445 8)" fill="#fff"/></g></g></svg>
												<?php esc_html_e( 'Email Notification', 'commenting-feature' ); ?>
											</li>
										</ul>
									</div>
									<div class="cf-settings-wrapper__content">
										<!-- All your PHP blocks go here -->
										<div id="cf-general" class="cf-tab-content cf-tab-active">
											<!-- General settings -->
											<div class="cf-settings-wrap__repeater">
												<div class="cf-settings-wrap__repeater-header">
													<h3><?php esc_html_e( 'General', 'commenting-feature' ); ?></h3>
													<p><?php esc_html_e( 'Manage your general settings from here.', 'commenting-feature' ); ?><a href="https://docs.multicollab.com/article/28-general-settings?utm_source=plugin+&utm_medium=setting+page&utm_campaign=help+doc+from+plugin+setting+section" target="_blank"><?php esc_html_e( 'Learn More', 'commenting-feature' ); ?><img class="cf-external-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/arrow_blue.svg' ); ?>" alt="external-link"></a></p>
												</div>
												<?php
													// Get general settings form HTML.
													require_once COMMENTING_BLOCK_DIR . 'admin/settings/settings-general.php';
												?>
											</div>
										</div>
										<?php // Floating Icons/@author Rishi Shah/@since EDD - 3.0.1 ?>
										<div id="cf-email" class="cf-tab-content">
											<!-- Email notification -->
											<?php // Floating Icons/@author Rishi Shah/@since EDD - 3.0.1 ?>
											<div class="cf-settings-wrap__repeater">
												<div class="cf-settings-wrap__repeater-header">
													<h3>
														<?php
														printf(
															'%s',
															esc_html__( 'Email Notification', 'commenting-feature' )
														);
														?>
													</h3>											<p>
													<?php
													printf(
														'%s - <a href="https://docs.multicollab.com/article/11-email-notifications?utm_source=plugin+&utm_medium=setting+page&utm_campaign=help+doc+from+plugin+setting+section" target="_blank"> %s <img class="cf-external-link-icon" src="%s" alt="external-link"></a>',
														esc_html__( 'Set your email notification preferences.', 'commenting-feature' ),
														esc_html__( 'Guide to Setup Email Notifications', 'commenting-feature' ),
														esc_url( COMMENTING_BLOCK_URL . 'admin/assets/images/arrow_blue.svg' ),
													);
													?>
												</p>
												</div>
												<?php
													// Get general settings form HTML.
													require_once COMMENTING_BLOCK_DIR . 'admin/settings/settings-email-notification.php';
													?>
											</div>
										</div>
									</div>
								</div>

								<div class="cf-copyright-text"><?php esc_html_e( 'Multicollab is powered by ', 'commenting-feature' ); ?>
								<img class="cf-footer-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/multidots-logo.svg' ); ?>" alt="Multidots" style="height: 16px;position: relative;top: 0px;">
								<?php esc_html_e( ' — Enterprise WordPress Agency.', 'commenting-feature' ); ?>
								<a href="https://www.multidots.com?utm_source=plugin+&utm_medium=+Explore+custom+solutions.&utm_campaign=plugin_footer_free" target="_blank"><?php esc_html_e( 'Explore custom solutions', 'commenting-feature' ); ?><img class="cf-external-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/arrow_blue.svg' ); ?>" alt="external-link"></a></div>							
							</div>
						<?php endif; ?>

						<div id="cf-need-help" class="cf-dashboard-layout__tabs-wrap-inner 
							<?php
							if ( 'need-help' === $multicollab_view ) {
								echo esc_html( 'cf-tab-active' ); 
							}
							?>
						">
							<?php
								// Load "Need Help" content here.
								require_once COMMENTING_BLOCK_DIR . 'admin/settings/settings-need-help.php';
							?>
							<div class="cf-copyright-text"><?php esc_html_e( 'Multicollab is powered by ', 'commenting-feature' ); ?>
								<img class="cf-footer-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/multidots-logo.svg' ); ?>" alt="Multidots" style="height: 16px;position: relative;top: 0px;">
								<?php esc_html_e( ' — Enterprise WordPress Agency.', 'commenting-feature' ); ?>
								<a href="https://www.multidots.com?utm_source=plugin+&utm_medium=+Explore+custom+solutions.&utm_campaign=plugin_footer_free" target="_blank"><?php esc_html_e( 'Explore custom solutions', 'commenting-feature' ); ?><img class="cf-external-link-icon" src="<?php echo esc_url( COMMENTING_BLOCK_URL . '/admin/assets/images/arrow_blue.svg' ); ?>" alt="external-link"></a></div>							
						</div>
					</div>
				</div>
			</div>

			<div class="cf-right">
			</div>
		</div>
  
</div>
