/** * Write the Minified stylesheet file. * * @since 1.0.1 */ function genesis_extender_write_minified_styles() { // Clear out the cached values so the latest Custom CSS setting will be written to the Custom Stylesheet. genesis_extender_get_custom_css(null, $args = array('cached' => false, 'array' => false)); $css = genesis_extender_build_minified_styles(); $handle = @fopen(genesis_extender_get_minified_stylesheet_path(), 'w'); @fwrite($handle, $css); @fclose($handle); if (substr(sprintf('%o', fileperms(genesis_extender_get_minified_stylesheet_path())), -4) != '0644' && substr(sprintf('%o', fileperms(genesis_extender_get_minified_stylesheet_path())), -4) != '0666') { @chmod(genesis_extender_get_minified_stylesheet_path(), 0644); } }
/** * Build the Combined & Minified stylesheet file. * * @since 1.0.1 */ function genesis_extender_build_minified_styles() { if (genesis_extender_get_settings('include_column_class_styles')) { $default_stylesheet = 'default-with-columns.css'; } else { $default_stylesheet = 'default.css'; } $css_prefix = '/* ' . __('Combined & Minified CSS', 'extender') . "\n" . '------------------------------------------------------------ */' . "\n"; $css = file_get_contents(GENEXT_PATH . 'lib/css/' . $default_stylesheet); $css .= genesis_extender_get_custom_css('custom_css'); $css = $css_prefix . genesis_extender_minify_css($css); return $css; }
/** * If the Front-end CSS Builder is active then echo the Custom CSS into the <head>. * * @since 1.0 */ function genesis_extender_css_builder_css_echo() { global $genesis_extender_css_builder_popup; if (genesis_extender_get_custom_css('css_builder_popup_active') && current_user_can('administrator')) { $genesis_extender_css_builder_popup = true; } if (!$genesis_extender_css_builder_popup) { return; } $output = ''; $custom_css = genesis_extender_get_custom_css('custom_css'); if ($custom_css != '') { $output .= $custom_css . "\n"; } $output = "\n\n<!-- Begin Genesis Extender Custom CSS -->\n<style id=\"custom-css-echo\" type=\"text/css\">\n" . $output . "</style>\n<!-- End Genesis Extender Custom CSS -->\n"; echo stripslashes($output); }
require_once GENEXT_PATH . 'lib/functions/genesis-extender-add-styles.php'; require_once GENEXT_PATH . 'lib/functions/genesis-extender-functions.php'; require_once GENEXT_PATH . 'lib/functions/genesis-extender-fonts.php'; if (is_admin()) { require_once GENEXT_PATH . 'lib/functions/genesis-extender-option-lists.php'; } if (!is_admin() && genesis_extender_get_custom_css('css_builder_popup_active')) { add_action('init', 'genesis_extender_require_genesis_extender_options_lists'); } function genesis_extender_require_genesis_extender_options_lists() { if (current_user_can('administrator')) { require_once GENEXT_PATH . 'lib/functions/genesis-extender-option-lists.php'; } } if (genesis_extender_get_custom_css('css_builder_popup_active')) { add_action('init', 'genesis_extender_require_css_builder_popup'); } function genesis_extender_require_css_builder_popup() { if (current_user_can('administrator')) { require_once GENEXT_PATH . 'lib/admin/css-builder-popup.php'; } } /** * Create globals and Require files only needed for admin. */ if (is_admin()) { /** * Create globals to define both the folder locations to be written to and their current writable state. */
/** * Add scripts and HTML to the <head> that are necessary * for the front-end CSS builder to function. * * @since 1.0 */ function genesis_extender_css_builder_popup() { ?> <script type="text/javascript"> var cssBuilderImagesUrl = 'url(<?php echo genesis_extender_get_stylesheet_location('url') . 'images'; ?> '; var cssBuilderLabelsUrl = '<?php echo GENEXT_URL . 'lib/css/images/css-builder-element-labels'; ?> '; var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?> '; <?php if (current_theme_supports('html5')) { ?> var cssBtabsSiteInner = '.site-inner'; var cssBtabsSiteHeader = '.site-header'; var cssBtabsNavPrimary = '.nav-primary'; var cssBtabsNavSecondary = '.nav-secondary'; var cssBtabsContent = '.content'; var cssBtabsSidebarPrimary = '.sidebar-primary'; var cssBtabsSidebarSecondary = '.sidebar-secondary'; var cssBtabsSiteFooter = '.site-footer'; <?php } else { ?> var cssBtabsSiteInner = '#inner'; var cssBtabsSiteHeader = '#header'; var cssBtabsNavPrimary = '#nav'; var cssBtabsNavSecondary = '#subnav'; var cssBtabsContent = '#content'; var cssBtabsSidebarPrimary = '#sidebar'; var cssBtabsSidebarSecondary = '#sidebar-alt'; var cssBtabsSiteFooter = '#footer'; <?php } ?> </script> <?php if (genesis_extender_get_custom_css('css_builder_popup_editor_only')) { echo '<span id="css-builder-custom-css-only"></span>' . "\n"; } else { echo '<span id="css-builder-custom-css"></span>' . "\n"; } echo '<span id="css-builder-editor-css"></span>' . "\n"; echo '<span id="css-builder-highlight-css"></span>' . "\n"; require_once GENEXT_PATH . 'lib/admin/boxes/custom-css-builder-popup.php'; }
/** * Use ajax to update the Custom Options based on the posted values. * * @since 1.0 */ function genesis_extender_custom_options_save() { check_ajax_referer('custom-options', 'security'); if (!empty($_POST['extender']['css_builder_popup_active']) || genesis_extender_get_custom_css('css_builder_popup_active')) { $custom_css = genesis_extender_get_custom_css('custom_css'); } else { $custom_css = $_POST['extender']['custom_css']; } $css_update = array('custom_css' => $custom_css, 'css_builder_popup_active' => !empty($_POST['extender']['css_builder_popup_active']) ? 1 : 0, 'css_builder_popup_editor_only' => !empty($_POST['extender']['css_builder_popup_editor_only']) ? 1 : 0); $css_update_merged = array_merge(genesis_extender_custom_css_options_defaults(), $css_update); update_option('genesis_extender_custom_css', $css_update_merged); $functions_default = '<?php /* Do not remove this line. Add your functions below. */ '; if (!empty($_POST['custom_functions'])) { $functions_update = array('custom_functions_effect_admin' => !empty($_POST['custom_functions']['custom_functions_effect_admin']) ? 1 : 0, 'custom_functions' => $_POST['custom_functions']['custom_functions'] != '' ? $_POST['custom_functions']['custom_functions'] : $functions_default); $functions_update_merged = array_merge(genesis_extender_custom_functions_options_defaults(), $functions_update); update_option('genesis_extender_custom_functions', $functions_update_merged); } if (!empty($_POST['custom_js'])) { $js_update = array('custom_js_in_head' => !empty($_POST['custom_js']['custom_js_in_head']) ? 1 : 0, 'custom_js' => $_POST['custom_js']['custom_js']); $js_update_merged = array_merge(genesis_extender_custom_js_options_defaults(), $js_update); update_option('genesis_extender_custom_js', $js_update_merged); } if (!empty($_POST['custom_template_ids'])) { $template_ids_empty = true; foreach ($_POST['custom_template_ids'] as $key) { if (!empty($key)) { $template_ids_empty = false; } } foreach ($_POST['custom_template_ids'] as $key) { if (empty($key) && !$template_ids_empty) { echo 'Please fill in ALL "File Name" fields'; exit; } } genesis_extender_update_templates($_POST['custom_template_ids'], $_POST['custom_template_names'], $_POST['custom_template_types'], $_POST['custom_template_textarea']); } if (!empty($_POST['custom_label_names'])) { $label_names_empty = true; foreach ($_POST['custom_label_names'] as $key) { if (!empty($key)) { $label_names_empty = false; } } foreach ($_POST['custom_label_names'] as $key) { if (empty($key) && !$label_names_empty) { echo 'Please fill in ALL "Name" fields'; exit; } } genesis_extender_update_labels($_POST['custom_label_names']); if (!empty($_POST['custom_label_create_conditionals'])) { $custom_conditional_ids = array(); $custom_conditional_tags = array(); foreach ($_POST['custom_label_create_conditionals'] as $key => $value) { $custom_conditional_ids[] = 'has_label_' . str_replace('-', '_', genesis_extender_sanatize_string($_POST['custom_label_names'][$key])); $custom_conditional_tags[] = 'extender_has_label(\'' . genesis_extender_sanatize_string($_POST['custom_label_names'][$key]) . '\')'; } genesis_extender_update_conditionals($custom_conditional_ids, $custom_conditional_tags); } } if (!empty($_POST['custom_widget_conditionals_list'])) { $custom_widget_conditionals_list = $_POST['custom_widget_conditionals_list']; } else { $custom_widget_conditionals_list = array(); } if (!empty($_POST['custom_hook_conditionals_list'])) { $custom_hook_conditionals_list = $_POST['custom_hook_conditionals_list']; } else { $custom_hook_conditionals_list = array(); } if (!empty($_POST['custom_conditional_ids'])) { $conditional_ids_empty = true; foreach ($_POST['custom_conditional_ids'] as $key) { if (!empty($key)) { $conditional_ids_empty = false; } } foreach ($_POST['custom_conditional_ids'] as $key) { if (empty($key) && !$conditional_ids_empty) { echo 'Please fill in ALL "Name" fields'; exit; } } genesis_extender_update_conditionals($_POST['custom_conditional_ids'], $_POST['custom_conditional_tags']); } if (!empty($_POST['custom_widget_ids'])) { $widget_ids_empty = true; foreach ($_POST['custom_widget_ids'] as $key) { if (!empty($key)) { $widget_ids_empty = false; } } foreach ($_POST['custom_widget_ids'] as $key) { if (empty($key) && !$widget_ids_empty) { echo 'Please fill in ALL "Name" fields'; exit; } } genesis_extender_update_widgets($_POST['custom_widget_ids'], $custom_widget_conditionals_list, $_POST['custom_widget_hook'], $_POST['custom_widget_class'], $_POST['custom_widget_status'], $_POST['custom_widget_priority']); } if (!empty($_POST['custom_hook_ids'])) { $hook_ids_empty = true; foreach ($_POST['custom_hook_ids'] as $key) { if (!empty($key)) { $hook_ids_empty = false; } } foreach ($_POST['custom_hook_ids'] as $key) { if (empty($key) && !$hook_ids_empty) { echo 'Please fill in ALL "Name" fields'; exit; } } genesis_extender_update_hooks($_POST['custom_hook_ids'], $custom_hook_conditionals_list, $_POST['custom_hook_hook'], $_POST['custom_hook_status'], $_POST['custom_hook_priority'], $_POST['custom_hook_textarea']); } genesis_extender_write_files($css = true, $ez = false); echo 'Custom Options Updated'; exit; }
_e('Who Sees The CSS Builder Tool', 'extender'); ?> </h5> <p> <?php _e('To be able to see the "Show/Hide CSS Builder" tab, let alone be able to display and use the CSS Builder Tool, the "Activate Front-end CSS Builder" option must be selected and you must be currently logged in as an Administrator. So basically, no one but you will see these items.', 'extender'); ?> </p> </div> <div style="display:none;" id="css-builder-click-to-view"> <a href="<?php echo home_url(); ?> " target="_blank"><?php _e('Click To View Front-end', 'extender'); ?> </a> </div> <div id="genesis-extender-custom-css-admin-p" class="genesis-extender-custom-option"> <p> <textarea wrap="off" id="genesis-extender-custom-css" class="genesis-extender-tabby-textarea" name="extender[custom_css]" rows="20"><?php echo genesis_extender_get_custom_css('custom_css'); ?> </textarea> </p> </div> </div> </div>
<?php /** * Builds the Custom CSS Builder Popup content. * * @package Extender */ ?> <?php if (!genesis_extender_get_custom_css('css_builder_popup_editor_only')) { ?> <div style="display:none;" id="genesis-extender-custom-css-builder-nav"> <ul> <li id="custom-css-builder-nav-open-close-elements" class="genesis-extender-css-builder-nav-all genesis-extender-options-nav-active"><a>Elements</a></li><li id="custom-css-builder-nav-backgrounds" class="genesis-extender-css-builder-nav-all"><a>Backgrounds</a></li><li id="custom-css-builder-nav-borders" class="genesis-extender-css-builder-nav-all"><a>Borders</a></li><li id="custom-css-builder-nav-margins-padding" class="genesis-extender-css-builder-nav-all"><a>Margins & Padding</a></li><li id="custom-css-builder-nav-fonts" class="genesis-extender-css-builder-nav-all"><a>Fonts</a></li><li id="custom-css-builder-nav-dimensions-position" class="genesis-extender-css-builder-nav-all"><a>Dimensions & Position</a></li><li id="custom-css-builder-nav-shadows" class="genesis-extender-css-builder-nav-all"><a>Shadows</a></li><li id="custom-css-builder-nav-scripts" class="genesis-extender-css-builder-nav-all"><a>Scripts</a></li><li id="custom-css-builder-nav-html" class="genesis-extender-css-builder-nav-all"><a class="genesis-extender-options-nav-last">HTML</a></li> </ul> </div> <div style="display:none;" id="genesis-extender-custom-css-builder" class="genesis-extender-optionbox-outer-1col"> <div class="genesis-extender-optionbox-inner-1col"> <div id="genesis-extender-custom-css-builder-wrap"> <form name="form"> <div id="genesis-extender-custom-css-builder-wrap-inner" class="bg-box"> <div id="custom-css-builder-nav-open-close-elements-box" class="genesis-extender-all-css-builder genesis-extender-options-display"> <p style="float:left;"> <span style="color:#444; font-size:13px; font-weight:bold; line-height:21px;"><?php _e('Select/Insert [»] Elements to be styled:', 'extender'); ?> <br /></span>
/** * Enqueue various bits of javascript. * * @since 1.0 */ function genesis_extender_enqueue_scripts() { global $genesis_extender_css_builder_popup; if (genesis_extender_get_custom_css('css_builder_popup_active') && current_user_can('administrator')) { $genesis_extender_css_builder_popup = true; } if ($genesis_extender_css_builder_popup && !is_admin()) { wp_enqueue_script('css-builder-popup', GENEXT_URL . 'lib/js/genesis-extender-custom-css-builder-popup.js', false, GENEXT_VERSION, true); wp_enqueue_script('js-color-popup', GENEXT_URL . 'lib/js/jscolor/jscolor-popup.js', false, GENEXT_VERSION, true); wp_enqueue_script('jquery-ui-draggable'); } $custom_js = get_option('genesis_extender_custom_js'); if (!empty($custom_js['custom_js_in_head'])) { $in_footer = false; } else { $in_footer = true; } if (file_exists(genesis_extender_get_custom_js_path()) && 0 != filesize(genesis_extender_get_custom_js_path())) { wp_enqueue_script('custom-scripts', genesis_extender_get_stylesheet_location('url') . 'custom-scripts.js', false, GENEXT_VERSION, $in_footer); } }