static function loadStylesheets($style, $templateObj) { $actionBoxObj = $templateObj->_actionbox_obj; $meta = $actionBoxObj->getMeta(); switch ($style) { case 'user': //get user style key $userStyleKey = $meta['userstyle']; //use style set by user $mabStylesheet = mab_get_settings_stylesheet_path($userStyleKey); //create stylesheet file if its not created yet if (!file_exists($mabStylesheet) || trim(mab_get_settings_stylesheet_contents($userStyleKey)) == '') { mab_create_stylesheet($userStyleKey); } if (file_exists($mabStylesheet)) { //actionbox specific stylesheet wp_enqueue_style('mab-user-style-' . $userStyleKey, mab_get_settings_stylesheet_url($userStyleKey), array('mab-base-style'), filemtime($mabStylesheet)); } break; // =================== // =================== case 'none': break; default: /** LOAD PRECONFIGURED STYLESHEET **/ //$other_style_location = MAB_ASSETS_URL . 'css/style-'; /* TODO: be able to load type specific stylesheets style-{TYPE}.css */ //use one of the preconfigured styles //$preconfigured_style = $other_style_location . $style . '.css'; $preconfigured_style = $templateObj->getTemplateStyleUrl() . "style.css"; //if( file_exists( $preconfigured_style ) ){ this is a url.. tsk. wp_enqueue_style("mab-preconfigured-style-{$style}", $preconfigured_style, array('mab-base-style'), MAB_VERSION); //} else { //wp_enqueue_style( "mab-style-default", MAB_ASSETS_URL . 'css/style-default.css', array(), "1.0" ); //} //wp_redirect( "{$preconfigured_style}" ); break; // ========================== } //endswitch }
function create_stylesheet($key = '', $section = 'all') { require_once MAB_LIB_DIR . 'stylesheets.php'; mab_create_stylesheet($key, $section); }