/**
 * Enfold uses ID CSS selectors which override the core Chosen CSS selectors.
 * This will load an alternative CSS file where all the core Chosen CSS selectors are prefixed with #cn-list.
 * This in theory should override the Enfold CSS selectors.
 *
 * @link https://connections-pro.com/support/topic/enfold-theme-issues/
 */
function cn_enqueue_enfold_css_override()
{
    // If SCRIPT_DEBUG is set and TRUE load the non-minified CSS files, otherwise, load the minified files.
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    $url = cnURL::makeProtocolRelative(CN_URL);
    $theme = wp_get_theme();
    $parent = $theme->parent();
    if (FALSE === $parent || NULL === $parent) {
        $enqueue = in_array($theme->get('Name'), array('Enfold'), TRUE);
    } elseif ($parent instanceof WP_Theme) {
        $enqueue = in_array($parent->get('Name'), array('Enfold'), TRUE);
    } else {
        $enqueue = FALSE;
    }
    if ($enqueue) {
        wp_deregister_style('cn-chosen');
        wp_register_style('cn-chosen', $url . "vendor/chosen/chosen-cn-list{$min}.css", array(), CN_CURRENT_VERSION);
    }
}
 /**
  * Registers the CSS libraries that may be enqueued in the admin or frontend.
  *
  * @access private
  * @since  0.7.3.2
  * @static
  *
  * @uses   add_filter()
  * @uses   is_admin()
  * @uses   wp_register_style()
  * @uses   get_user_option()
  * @uses   is_rtl()
  * @uses   cnSettingsAPI::get()
  * @uses   cnLocate::file()
  * @uses   cnLocate::fileNames()
  * @uses   wp_style_is()
  * @uses   remove_filter()
  *
  * @return void
  */
 public static function registerCSS()
 {
     // Add a filter so cnLocate will search the plugins CSS folder.
     add_filter('cn_locate_file_paths', array(__CLASS__, 'coreCSSPath'));
     // If SCRIPT_DEBUG is set and TRUE load the non-minified CSS files, otherwise, load the minified files.
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $url = cnURL::makeProtocolRelative(CN_URL);
     if (is_admin()) {
         wp_register_style('cn-admin', $url . "assets/css/cn-admin{$min}.css", array(), CN_CURRENT_VERSION);
         wp_register_style('cn-admin-jquery-ui', $url . 'assets/css/jquery-ui-' . ('classic' == get_user_option('admin_color') ? 'classic' : 'fresh') . "{$min}.css", array(), CN_CURRENT_VERSION);
         wp_register_style('cn-admin-jquery-datepicker', $url . "assets/css/datepicker{$min}.css", array('cn-admin-jquery-ui'), CN_CURRENT_VERSION);
         if (is_rtl()) {
             wp_register_style('cn-admin-rtl', $url . "assets/css/cn-admin-rtl{$min}.css", array('cn-admin'), CN_CURRENT_VERSION);
         }
     } else {
         if (cnSettingsAPI::get('connections', 'compatibility', 'css')) {
             // This will locate the CSS file to be enqueued.
             $coreCSS = cnLocate::file(cnLocate::fileNames('cn-user', NULL, NULL, 'css'), 'url');
             // var_dump($coreCSS);
             // Registering the CSS with 'connections-user' for legacy support. Remove this at some point. 04/01/2014
             wp_register_style('connections-user', $coreCSS, array(), CN_CURRENT_VERSION);
             wp_register_style('cn-public', $coreCSS, array(), CN_CURRENT_VERSION);
         }
         // This will locate the custom CSS file to be enqueued.
         $customCSS = cnLocate::file(cnLocate::fileNames('cn-custom', NULL, NULL, 'css'), 'url');
         // var_dump($customCSS);
         // If a custom CSS file was found, lets register it.
         if ($customCSS) {
             // Check to see if the core CSS file was registered since it can be disabled.
             // Add it to the $required array to be used when registering the custom CSS file.
             $required = wp_style_is('cn-public', 'registered') ? array('cn-public') : array();
             wp_register_style('cn-public-custom', $customCSS, $required, CN_CURRENT_VERSION);
         }
     }
     wp_register_style('cn-qtip', $url . "vendor/jquery-qtip/jquery.qtip{$min}.css", array(), '2.2.1');
     wp_register_style('cn-chosen', $url . "vendor/chosen/chosen{$min}.css", array(), '1.6.1');
     wp_register_style('cn-font-awesome', $url . "vendor/font-awesome/css/font-awesome{$min}.css", array(), '4.4.0');
     // Remove the filter that adds the core CSS path to cnLocate.
     remove_filter('cn_locate_file_paths', array(__CLASS__, 'coreCSSPath'));
 }
 /**
  * Enqueues the template's JS in the theme's footer.
  *
  * @access private
  * @since  0.7.6
  * @return void
  */
 public function enqueueScript()
 {
     $required = apply_filters('cn_template_required_js-' . $this->slug, array(), $this);
     $url = cnURL::makeProtocolRelative($this->parts['js-url']);
     wp_enqueue_script("cnt-{$this->slug}", $url, $required, $this->version, TRUE);
 }