static function loadCustomCss($style, $templateObj) { $actionBoxObj = $templateObj->_actionbox_obj; $actionBoxId = $actionBoxObj->getId(); /** LOAD CUSTOM CSS **/ //get stylesheet which should contain only CSS in Custom CSS box under Design Setting: Custom CSS $custom_css_stylesheet = mab_get_actionbox_stylesheet_path($actionBoxId); //create stylesheet file if its not created yet if (!file_exists($custom_css_stylesheet) || trim(mab_get_actionbox_stylesheet_contents($actionBoxId)) == '') { mab_create_actionbox_stylesheet($actionBoxId); } if (file_exists($custom_css_stylesheet)) { //actionbox specific stylesheet wp_enqueue_style("mab-actionbox-style-{$actionBoxId}", mab_get_actionbox_stylesheet_url($actionBoxId), array(), filemtime($custom_css_stylesheet)); } /** LOAD BUTTONS CSS **/ /* create custom buttons stylesheet if its not there */ if (!file_exists(mab_get_custom_buttons_stylesheet_path())) { $MabButton = MAB('button'); $MabButton->writeConfiguredButtonsStylesheet($MabButton->getConfiguredButtons(), ''); } // load buttons stylesheet. // we do this way to ensure that mab-custom-buttons-css stylesheet will always be the last // to load. this is especially important when two action boxes use custom buttons. if (wp_style_is('mab-custom-buttons-css', 'queue')) { //dequeue the style so we can enqueue it to footer wp_dequeue_style('mab-custom-buttons-css'); } $buttons_stylesheet = mab_get_custom_buttons_stylesheet_path(); if (file_exists($buttons_stylesheet)) { wp_enqueue_style('mab-custom-buttons-css', mab_get_custom_buttons_stylesheet_url(), array(), filemtime($buttons_stylesheet)); } /** LOAD MISC **/ }
function create_actionbox_stylesheet($postId = null, $section = 'all') { require_once MAB_LIB_DIR . 'stylesheets.php'; mab_create_actionbox_stylesheet($postId, $section); }