/** * 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')); }
/** * Retrieve the name of the highest priority template file that exists. * * @access public * @since 0.8.11 * @static * @uses cnLocate::file() * @uses load_template() * @param string|array $files Template file(s) to search for, in order of priority. * @param array $params An array of arguments that will be extract() if the template part is to be loaded. * @param boolean $load If true the template file will be loaded. * @param boolean $require_once Whether to require_once or require. Default is to require_once. * * @return mixed string|bool The template part file path, if one is located. */ public static function locate($files, $params, $load = FALSE, $require_once = TRUE) { $located = cnLocate::file($files); if ($load && $located) { return self::load($located, $params, $require_once); } return $located; }