<?php
/**
 * Add theme page for up-selling services and software
 *
 * @package WordPress
 * @subpackage Brimstone
 * @since 1.01
 * @author Chris Baldelomar <chris@webplantmedia.com>
 * @copyright Copyright (c) 2018, Chris Baldelomar
 * @link https://webplantmedia.com/product/brimstone-wordpress-theme/
 * @license http://www.gnu.org/licenses/gpl-2.0.html
 */

/**
 * Store service text in array for reuse. Used in theme inc/theme-info.php
 *
 * @since Brimstone 1.01
 *
 * @return array
 */
function brimstone_dashboard_get_services() {
	$services = array(
		array(
			'short'       => esc_html__( 'Documentation', 'brimstone' ),
			'title'       => esc_html__( 'Theme Documentation', 'brimstone' ),
			'link'        => 'https://webplantmedia.com/product/brimstone-wordpress-theme/',
			'description' => esc_html__( 'Every theme option and theme feature is well documented on our product page. Find out all the amazing features coded within our theme.', 'brimstone' ),
		),
		array(
			'short'       => esc_html__( 'Support', 'brimstone' ),
			'title'       => esc_html__( 'Extended WordPress Support', 'brimstone' ),
			'link'        => 'https://webplantmedia.com/product/extended-wordpress-support/',
			'description' => esc_html__( 'If you are using one of our themes, and need WordPress support, a little CSS hack, or some custom debugging support for your WordPress site, then you can purchase extended WordPress support. We are WordPress experts, and will quickly and efficiently take care of your site problem or need.', 'brimstone' ),
		),
		array(
			'short'       => esc_html__( 'Font Customizer Plugin', 'brimstone' ),
			'title'       => esc_html__( 'Designer Fonts Plugin', 'brimstone' ),
			'link'        => 'https://webplantmedia.com/product/designer-fonts-wordpress-plugin/',
			'description' => esc_html__( 'Use our Designer Fonts plugin to quickly and easily customize the default fonts on your theme. Easily change your site title font, heading font, accent font, and body font, from your Customizer panel using our Designer Fonts plugin.', 'brimstone' ),
		),
	);

	return $services;
}

/**
 * Static feed to helpful posts for first time WordPress users.
 *
 * @since Brimstone 1.01
 *
 * @return void
 */
function brimstone_dashboard_static_feed() {
	$blog = array(
		array(
			'title' => esc_html__( 'The Best Setup For Your Self Hosted WordPress Shopping Site and Blog', 'brimstone' ),
			'link'  => 'https://webplantmedia.com/the-best-setup-for-your-wordpress-shopping-site-and-blog/',
		),
		array(
			'title' => esc_html__( 'How to Transfer and Migrate Your Site Content from WordPress.com to a Self Hosted WordPress.org Site on Bluehost &#8211; Step By Step Instructions', 'brimstone' ),
			'link'  => 'https://webplantmedia.com/how-to-transfer-and-migrate-your-site-content-from-wordpress-com-to-a-self-hosted-wordpress-org-site-on-bluehost-step-by-step-instructions/',
		),
		array(
			'title' => esc_html__( 'WordPress.com vs WordPress.org: What is the Difference?', 'brimstone' ),
			'link'  => 'https://webplantmedia.com/wordpress-com-vs-wordpress-org-what-is-the-difference/',
		),
		array(
			'title' => esc_html__( 'The Best Managed WordPress Hosting for Your Small Business Site', 'brimstone' ),
			'link'  => 'https://webplantmedia.com/the-best-managed-wordpress-hosting-for-your-small-business-site/',
		),
	);
	?>

	<?php foreach ( $blog as $post ) : ?>
		<div>
			<span class="dashicons dashicons-thumbs-up" style="color:#82878c;float:left;"></span>
			<p style="overflow:hidden;padding-left:10px;">
				<a target="_blank" href="<?php echo esc_attr( $post['link'] ); ?>"><?php echo $post['title']; /* WPCS: XSS OK. Already escaped. */ ?></a>
			</p>
		</div>
	<?php endforeach; ?>

	<?php
}

/**
 * Add theme page for up-sell
 *
 * @since Brimstone 1.01
 *
 * @return void
 */
function brimstone_theme_info() {
	add_theme_page( esc_html__( 'Theme Add-ons', 'brimstone' ), esc_html__( 'Theme Add-ons', 'brimstone' ), 'edit_theme_options', 'brimstone-theme-info', 'brimstone_theme_page' );
}
add_action( 'admin_menu', 'brimstone_theme_info' );

/**
 * Load theme info page. Modified from core.
 *
 * @since Brimstone 1.01
 *
 * @return void
 */
function brimstone_theme_page() {
	require get_parent_theme_file_path() . '/inc/theme-info.php';
}
