/** * Get the template part path or the rendered template part. * * If the template is being loaded, the output will be buffered by default * and the result of the buffer returned. * * @access public * @since 0.8.11 * @static * @uses cnLocate::fileNames() * @uses cnTemplatePart::locate() * @param string $base The base template name. * @param string $name The template name. * @param array $params An array of arguments that will be extract() if the template part is to be loaded. * @param boolean $load Whether or not to load the template. * @param boolean $buffer * @param boolean $require_once Whether or not to require() or require_once() the template part. * @return string The template part file path, if one is located. */ public static function get($base, $name = NULL, $params, $load = TRUE, $buffer = TRUE, $require_once = TRUE) { $files = cnLocate::fileNames($base, $name); if ($load) { if ($buffer) { ob_start(); cnTemplatePart::locate($files, $params, TRUE, $require_once); $part = ob_get_clean(); } else { return cnTemplatePart::locate($files, $params, TRUE, $require_once); } } else { $part = cnTemplatePart::locate($files, $params); } return $part; }
/** * 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')); }