<?php

// includes/gle-admin-options-plugins

/**
 * Prevent direct access to this file.
 *
 * @since 1.7.0
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'Sorry, you are not allowed to access this file directly.' );
}


/**
 * Second meta box - optional: setting up the setting fields & labels.
 * For supported plugins with CPTs.
 *
 * @since 1.3.0
 *
 * @uses  post_type_exists()
 * @uses  ddw_genesis_layout_extras_option()
 * @uses  ddw_gle_save_button()
 */
function ddw_genesis_layout_extras_box_cpts() {

	/** Description - user info: Plugin generated special Custom Post Type sections */
	echo '<h4>' . __( 'Special Custom Post Type Sections', 'genesis-layout-extras' ) . '</h4>';

		echo '<p><span class="description">' . __( 'Here you can set up a <strong>default</strong> layout option for various extra archive pages generated by Custom Post Types which were set by plugins. There are only post types listed for which proper template/ layout integration for Genesis exist.', 'genesis-layout-extras' ) . ' ' . sprintf(
				/* translators: %1$s - opening HTML code tag / %2$s - closing HTML code tag / %3$s - label "Genesis layout settings" */
				__( '%1$sGenesis Default%2$s in the drop-down menus below always means the chosen default layout option in the regular %3$s.', 'genesis-layout-extras' ),
				'<code style="font-style: normal; color: #333;">',
				'</code>',
				'<a href="' . esc_url( admin_url( 'admin.php?page=genesis#genesis-theme-settings-layout' ) ) . '">' . __( 'Genesis layout settings', 'genesis-layout-extras' ) . '</a>'
			) . '</span></p>';


	/** Plugin: AgentPress Listings */
	if ( post_type_exists( 'listing' ) && ddw_gle_is_agentpress_listings_active() ) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugin: AgentPress Listings', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'Listing Post Type Layout (archive)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_apl_listing'
			);

			ddw_genesis_layout_extras_option(
				__( 'Listings Features Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_apl_features'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %1$s - name of a plugin, "AgentPress Listings" / %2$s - opening link markup / %3$s - closing link markup */
					__( 'For these settings to take any effect the plugin %1$s needs to be installed first. &mdash; Of course, the plugin (and so the setting here) could be used with the %2$sAgentPress child theme%3$s and also with any other Genesis child theme, so this setting might come in really handy ;-).', 'genesis-layout-extras' ),
					'<a href="https://deckerweb.de/go/agentpress-listings/" target="_blank" rel="noopener noreferrer" title="Plugin: AgentPress Listings ..."><em>AgentPress Listings</em></a>',
					'<a href="https://deckerweb.de/go/genesis-agentpress-child-theme/" target="_blank" rel="noopener noreferrer" title="AgentPress Genesis Child Theme ...">',
					'</a>'
				) . '</span></p>';

			ddw_gle_save_button();

	}  // end if APL check


	/** Plugin: Simple Listings for Genesis */
	if ( post_type_exists( 'listing' ) && ddw_gle_is_simple_listings_genesis_active() ) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugin: Simple Listings for Genesis', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'Listing Post Type Layout (archive)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_slfg_listing'
			);

			ddw_genesis_layout_extras_option(
				__( 'Listings Status Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_slfg_listing_status'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %s - name of a plugin, "Simple Listings for Genesis" */
					__( 'For these settings to take any effect the plugin %s needs to be installed first. &mdash; Of course, the plugin (and so the setting here) could be used with any Genesis child theme, so this setting might come in really handy ;-).', 'genesis-layout-extras' ),
					'<a href="https://wordpress.org/plugins/simple-listings-genesis/" target="_blank" rel="noopener noreferrer" title="Plugin: Simple Listings for Genesis ..."><em>Simple Listings for Genesis</em></a>'
				) . '</span></p>';

			ddw_gle_save_button();

	}  // end if SLFG check


	/** Plugin: Genesis Portfolio Pro */
	if ( post_type_exists( 'portfolio' ) && ddw_gle_is_genesis_portfolio_pro_active() ) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugin: Genesis Portfolio Pro', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'Portfolio Post Type Layout (archive)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gpp_portfolio'
			);

			ddw_genesis_layout_extras_option(
				__( 'Portfolio Type Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gpp_portfolio_type'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %s - name of a plugin, "Genesis Portfolio Pro" */
					__( 'For these settings to take any effect the plugin %s needs to be installed first. &mdash; Of course, the plugin (and so the setting here) could be used with with any Genesis child theme, so this setting might come in really handy ;-).', 'genesis-layout-extras' ),
					'<a href="https://wordpress.org/plugins/genesis-portfolio-pro/" target="_blank" rel="noopener noreferrer" title="Plugin: Genesis Portfolio Pro ..."><em>Genesis Portfolio Pro</em></a>'
				) . '</span></p>';

			ddw_gle_save_button();

	}  // end if GPP check


	/** Plugin: Genesis Author Pro */
	if ( post_type_exists( 'portfolio' ) && ddw_gle_is_genesis_portfolio_pro_active() ) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugin: Genesis Author Pro', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'Book Post Type Layout (archive)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gap_book'
			);

			ddw_genesis_layout_extras_option(
				__( 'Book Authors Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gap_book_authors'
			);

			ddw_genesis_layout_extras_option(
				__( 'Book Series Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gap_book_series'
			);

			ddw_genesis_layout_extras_option(
				__( 'Book Tags Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gap_book_tags'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %s - name of a plugin, "Genesis Author Pro" */
					__( 'For these settings to take any effect the plugin %s needs to be installed first. &mdash; Of course, the plugin (and so the setting here) could be used with with any Genesis child theme, so this setting might come in really handy ;-).', 'genesis-layout-extras' ),
					'<a href="https://wordpress.org/plugins/genesis-author-pro/" target="_blank" rel="noopener noreferrer" title="Plugin: Genesis Author Pro ..."><em>Genesis Author Pro</em></a>'
				) . '</span></p>';

			ddw_gle_save_button();

	}  // end if GAP check


	/** Plugins: WooCommerce & Jigoshop */
	if ( post_type_exists( 'product' )
		&& ( ddw_gle_is_woocommerce_active() || ddw_gle_is_jigoshop_active() )
	) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugins: WooCommerce OR Jigoshop', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'Product Post Type Layout - Product Categories (all)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_wcjs_product_cat'
			);

			ddw_genesis_layout_extras_option(
				__( 'Product Post Type Layout - Product Tags (all)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_wcjs_product_tag'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %1$s - name of a plugin, "WooCommerce" / %2$s - name of a plugin, "Jigoshop" */
					__( 'For these settings to take any effect the plugin %1$s OR %2$s needs to be installed first.', 'genesis-layout-extras' ),
					'<a href="https://wordpress.org/plugins/woocommerce/" target="_blank" rel="noopener noreferrer" title="' . __( 'Plugin: WooCommerce', 'genesis-layout-extras' ) . ' ..."><em>' . __( 'WooCommerce', 'genesis-layout-extras' ) . '</em></a>',
					'<a href="https://wordpress.org/plugins/jigoshop/" target="_blank" rel="noopener noreferrer" title="' . __( 'Plugin: Jigoshop', 'genesis-layout-extras' ) . ' ..."><em>' . __( 'Jigoshop', 'genesis-layout-extras' ) . '</em></a>'
				);

			echo '<br />&raquo; WooCommerce ' . __( 'Integration plugin', 'genesis-layout-extras' ) . ': <a href="https://wordpress.org/plugins/genesis-connect-woocommerce/" target="_blank" rel="noopener noreferrer" title="' . __( 'Genesis Connect for WooCommerce', 'genesis-layout-extras' ) . '">' . __( 'Genesis Connect for WooCommerce', 'genesis-layout-extras' ) . '</a>';

			echo '<br />&raquo; Jigoshop ' . __( 'Integration plugin', 'genesis-layout-extras' ) . ': <a href="https://www.jigoshop.com/product/genesis-connect-for-jigoshop/" target="_blank" rel="noopener noreferrer" title="' . __( 'Genesis Connect for Jigoshop', 'genesis-layout-extras' ) . '">' . __( 'Genesis Connect for Jigoshop', 'genesis-layout-extras' ) . '</a></span></p>';

			ddw_gle_save_button();

	}  // end if CPT "product" check


	/** Plugin: Easy Digital Downloads */
	if ( post_type_exists( 'download' ) && ddw_gle_is_edd_active() ) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugin: Easy Digital Downloads', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'Download Post Type Layout (archive)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_edd_download'
			);

			ddw_genesis_layout_extras_option(
				__( 'Download Categories Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_edd_download_category'
			);

			ddw_genesis_layout_extras_option(
				__( 'Download Tags Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_edd_download_tag'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %1$s - name of a plugin, "Easy Digital Downloads" */
					__( 'For these settings to take any effect the plugin %1$s needs to be installed first.', 'genesis-layout-extras' ),
					'<a href="https://wordpress.org/plugins/easy-digital-downloads/" target="_blank" rel="noopener noreferrer" title="' . __( 'Plugin: Easy Digital Downloads', 'genesis-layout-extras' ) . ' ..."><em>' . __( 'Easy Digital Downloads', 'genesis-layout-extras' ) . '</em></a>'
				);

			echo '<br />&raquo; ' . __( 'Integration plugin', 'genesis-layout-extras' ) . ': <a href="https://wordpress.org/plugins/genesis-connect-edd/" target="_blank" rel="noopener noreferrer" title="' . __( 'Genesis Connect for Easy Digital Downloads', 'genesis-layout-extras' ) . '">' . __( 'Genesis Connect for Easy Digital Downloads', 'genesis-layout-extras' ) . '</a></span></p>';

			ddw_gle_save_button();

	}  // end if EDD check


	/** Plugin: Sugar Events Calendar */
	if ( post_type_exists( 'sc_event' ) && ddw_gle_is_sugar_calendar_active() ) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugin: Sugar Events Calendar', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'Event Post Type Layout (archive)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_sc_event'
			);

			ddw_genesis_layout_extras_option(
				__( 'Event Categories Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_sc_event_category'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %1$s - name of a plugin, "Sugar Events Calendar" */
					__( 'For these settings to take any effect the plugin %1$s needs to be installed first.', 'genesis-layout-extras' ),
					'<a href="https://sugarcalendar.com/" target="_blank" rel="noopener noreferrer" title="' . __( 'Plugin: Sugar Events Calendar', 'genesis-layout-extras' ) . ' ..."><em>' . __( 'Sugar Events Calendar', 'genesis-layout-extras' ) . '</em></a>'
				);

			ddw_gle_save_button();

	}  // end if Sugar Events check


	/** Plugin: bbPress 2.x Forum section */
	if ( ddw_gle_is_bbpress_active() ) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugin: bbPress 2.x Forum Section', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'bbPress 2.x Forum Layout (all areas)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_bbpress'
			);

			ddw_genesis_layout_extras_option(
				__( 'bbPress 2.x Topics Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_bbpress_topics'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %1$s - name of a plugin, "bbPress 2.x" */
					__( 'For this setting to take any effect the plugin %1$s needs to be installed first.', 'genesis-layout-extras' ),
					'<a href="https://wordpress.org/plugins/bbpress/" target="_blank" rel="noopener noreferrer" title="' . __( 'Plugin: bbPress 2.x Forum', 'genesis-layout-extras' ) . ' ..."><em>' . __( 'bbPress 2.x', 'genesis-layout-extras' ) . '</em></a>'
				);

			echo '<br />&raquo; ' . __( 'Integration plugin', 'genesis-layout-extras' ) . ': <a href="https://wordpress.org/plugins/bbpress-genesis-extend/" target="_blank" rel="noopener noreferrer" title="' . __( 'bbPress Genesis Extend', 'genesis-layout-extras' ) . '">' . __( 'bbPress Genesis Extend', 'genesis-layout-extras' ) . '</a></span></p>';

			ddw_gle_save_button();

	}  // end-if bbPress check


	/** Plugin: Genesis Media Project */
	if ( post_type_exists( 'video' ) && ddw_gle_is_genesis_media_project_active() ) {

		echo '<hr class="div" />';

		echo '<h4>' . __( 'Plugin: Genesis Media Project', 'genesis-layout-extras' ) . '</h4>';

			ddw_genesis_layout_extras_option(
				__( 'Video Post Type Layout (archive)', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gmp_video'
			);

			ddw_genesis_layout_extras_option(
				__( 'Video SlideShows Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gmp_slideshow'
			);

			ddw_genesis_layout_extras_option(
				__( 'Video Categories Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gmp_video_category'
			);

			ddw_genesis_layout_extras_option(
				__( 'Video Tags Taxonomy Layout', 'genesis-layout-extras' ) . ': ',
				'ddw_genesis_layout_cpt_gmp_video_tag'
			);

			echo '<p><span class="description">' . sprintf(
					/* translators: %1$s - name of a plugin, "Genesis Media Project" */
					__( 'For these settings to take any effect the plugin %1$s needs to be installed first.', 'genesis-layout-extras' ),
					'<a href="https://wordpress.org/plugins/genesis-media-project/" target="_blank" rel="noopener noreferrer" title="' . __( 'Plugin: Genesis Media Project', 'genesis-layout-extras' ) . ' ..."><em>' . __( 'Genesis Media Project', 'genesis-layout-extras' ) . '</em></a>'
				) . '</a></span></p>';

			ddw_gle_save_button();

	}  // end if GMP check

}  // end function
