<?php
	wp_enqueue_style( 'plugin-install' );
	wp_enqueue_script( 'plugin-install' );
	wp_enqueue_script( 'updates' );
	

if( !empty($this->actions_req) ) { ?>

		<?php if( $this->actions_req['pro_plug'] ){ ?>
			<h4 class="recomplug-title"><?php echo esc_html($this->strings['pro_plugin_title']); ?></h4>
		<?php } ?>

		<div class="recomended-plugin-wrap ap-required-plugins ap-recom-pl-wrapper">

			<?php 

		foreach($this->actions_req['pro_plug'] as $plugin) {
			$status_arg = $this->get_plugin_active($plugin);
			$icon_url = $plugin['screenshot'];


			switch($status_arg) {
				case 'install' :
					$btn_class = 'install button';
					$label = $this->strings['install_n_activate'];
					$link_arg = $plugin['location'];
					break;

				case 'inactive' :
					$btn_class = 'deactivate button';
					$label = $this->strings['deactivate'];
					$link_arg = admin_url('plugins.php');
					break;

				case 'active' :
					$btn_class = 'activate button button-primary';
					$label = $this->strings['activate'];
					$link_arg = $plugin['location'];
					break;
			}

			?>
			<div class="recom-plugin-wrap">
					<div class="recom-plugin-inner-wrapper">
						<div class="plugin-img-wrap">
							<img src="<?php echo esc_url($icon_url); ?>" />
							
						</div>
						<div class="plugin-title-install clearfix">
							<span class="title" title="<?php echo esc_attr($plugin['name']); ?>">
								<?php echo esc_html($plugin['name']); ?>
							</span>

							<span class="plugin-action-btn plugin-btn-wrapper plugin-card-<?php echo esc_attr($plugin['slug']); ?>">
								<a class="<?php echo esc_attr($btn_class); ?>" data-host-type="<?php echo esc_attr($plugin['host_type']); ?>" data-file="<?php echo esc_attr($plugin['filename']); ?>" data-class="<?php echo esc_attr($plugin['class']); ?>" data-slug="<?php echo esc_attr($plugin['slug']); ?>" href="<?php echo esc_attr($link_arg); ?>"><?php echo esc_html($label); ?></a>
							</span>
							<div class="version-author-info free">
								<span class="version"><?php echo esc_html__('Version ', 'accesspress-parallax') . esc_html($plugin['version']); ?></span>
								<span class="seperator">|</span>
								<span class="author"><?php echo esc_html($plugin['author']); ?></span>
							</div>
						</div>
					</div>
				</div>
			<?php
		} ?>
	</div>


		<h4 class="recomplug-title"><?php echo esc_html($this->strings['free_plugin_title']); ?></h4>
		<div class="recomended-plugin-wrap ap-required-plugins ap-recom-pl-wrapper">

		<?php
		foreach($this->actions_req['free_plug'] as $plugin) {
			$info = $this->call_plugin_api($plugin['slug']);

			$icon_url = $this->check_for_icon($info->icons);
			$status_arg = $this->get_plugin_active($plugin);
			$btn_url = $this->generate_plugin_url($status_arg, $plugin);

			switch($status_arg) {
				case 'install' :
					$btn_class = 'install button';
					$label = $this->strings['install_n_activate'];
					break;

				case 'inactive' :
					$btn_class = 'deactivate button';
					$label = $this->strings['deactivate'];
					break;

				case 'active' :
					$btn_class = 'activate button button-primary';
					$label = $this->strings['activate'];
					break;
			}

			?>
				<div class="recom-plugin-wrap ">
					<div class="recom-plugin-inner-wrap">
						<div class="plugin-img-wrap">
							<img src="<?php echo esc_url($icon_url); ?>" />
							
						</div>
						<div class="plugin-title-install clearfix">
							<?php if( $info->name ){ ?>
								<span class="title" title="<?php echo esc_attr($info->name); ?>">
									<?php echo esc_html($info->name); ?>
								</span>
							<?php } ?>

							<?php if( isset($plugin['info']) ){ ?>
								<p class="plugin-info">
									<?php echo esc_html($plugin['info']); ?>
								</p>
							<?php } ?>
								
							<span class="plugin-action-btn plugin-btn-wrapper plugin-card-<?php echo esc_attr($plugin['slug']); ?>" action_button>
								<a class="<?php echo esc_attr($btn_class); ?>" data-file="<?php echo esc_attr($plugin['filename']); ?>" data-slug="<?php echo esc_attr($plugin['slug']); ?>" href="<?php echo esc_url($btn_url); ?>"><?php echo esc_html($label); ?></a>
							</span>
							<div class="version-author-info free">
								<span class="version"><?php echo esc_html__('Version ', 'accesspress-parallax') . esc_html($info->version); ?></span>
								<span class="seperator">|</span>
								<span class="author"><?php echo wp_kses_post($info->author); ?></span>
							</div>
						</div>
					</div>
				</div>
			<?php
		} ?>
		</div>

		
	<?php
	}