<?php
/**
 * Campoal functions and definitions
 *
 * Set up the theme and provides some helper functions, which are used in the
 * theme as custom template tags. Others are attached to action and filter
 * hooks in WordPress to change core functionality.
 *
 * When using a child theme you can override certain functions (those wrapped
 * in a function_exists() call) by defining them first in your child theme's
 * functions.php file. The child theme's functions.php file is included before
 * the parent theme's file, so the child theme functions would be used.
 *
 * @link https://codex.wordpress.org/Theme_Development
 * @link https://codex.wordpress.org/Child_Themes
 *
 * Functions that are not pluggable (not wrapped in function_exists()) are
 * instead attached to a filter or action hook.
 *
 * For more information on hooks, actions, and filters,
 * {@link https://codex.wordpress.org/Plugin_API}
 *
 * @package WordPress
 * @subpackage Campoal
 */


/**
 *	Include all theme functions
 */
require_once get_parent_theme_file_path('/inc/theme_init.php');


/**
 * Check latest version of theme on Github and notice update plugin for customers
 *
 * @since Campoal 1.4.0
 */
if ( is_admin() && class_exists( 'Puc_v4_Factory' ) && function_exists('ConikalLicense') ) :
	$license        = ConikalLicense();
    $valid_status   = $license->validate_status();
    $github_token   = (array_key_exists('github_token', $valid_status) ? $valid_status['github_token'] : '');

    if (!empty($github_token)) {
		$CampoalUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
		    'https://github.com/conikal/campoal/',
		    __FILE__,
		    'campoal'
		);

		//Optional: If you're using a private repository, specify the access token like this:
		$CampoalUpdateChecker->setAuthentication($github_token);

		//Optional: Set the branch that contains the stable release.
		$CampoalUpdateChecker->setBranch('master');

		// use release assets
		$CampoalUpdateChecker->getVcsApi()->enableReleaseAssets();
	}
endif;
?>
