/** * Prepares the contents of the export file. * * @author Gary Jones * @since 0.9.6 * @return array $output multi-dimensional array holding CSS data * @uses premise_get_mapping() * @version 1.0 */ function premise_prepare_export($key) { $mapping = premise_get_mapping(); foreach ($mapping as $selector => $declaration) { if (!is_array($declaration)) { $output[$selector] = premise_get_design_option($declaration, $key); } else { foreach ($declaration as $property => $value) { if (!is_array($value)) { $output[$selector][$property] = premise_get_design_option($value, $key); } else { foreach ($value as $index => $composite_value) { $val = $composite_value[0]; $type = $composite_value[1]; if ('fixed_string' == $type) { $output[$selector][$property][$index]['value'] = $val; } else { $output[$selector][$property][$index]['value'] = premise_get_design_option($val, $key); } $output[$selector][$property][$index]['type'] = $type; } } } } } // Add in contents of custom stylesheet $css = file_get_contents(premise_get_custom_stylesheet_path()); $output['custom_css'] = $css; return apply_filters('premise_prepare_export', $output); }
<?php $paddingVert = 0; $bodyFontSize = premise_get_design_option('body_font_size', $styleKey); $rules = ''; foreach ($tabs as $key => $tab) { $tabNumber = $key + 1; $icon = isset($tab['icon']) ? $tab['icon'] : null; if (!empty($icon) && false !== strpos($icon, $uploadUrl)) { $iconPath = str_replace($uploadUrl, $uploadDir, $icon); list($width, $height) = getimagesize($iconPath); if ($width) { $paddingLeft = $width + 16; $thisPaddingVert = 10 + $height / 2 - $bodyFontSize; $paddingVert = $paddingVert >= $thisPaddingVert ? $paddingVert : $thisPaddingVert; $rules .= "#coda-nav-tab-{$tabNumber} a { background-position: 8px center; padding-left: {$paddingLeft}px; background-image: url({$icon}); background-repeat: no-repeat; }"; } } } if (!$rules && !$paddingVert) { return; } ?> <style type="text/css"> .coda-nav ul li a { <?php if ($paddingVert > 0) { ?> padding-bottom: <?php echo $paddingVert;
/** * Add settings to the General Settings box. Does premise_settings_general action hook. * * @author Gary Jones * @since 0.9.6 * @version 1.0 */ function premise_settings_general() { global $theme, $blog_id; premise_setting_line(premise_add_checkbox_setting('minify_css', 'Minify CSS?')); premise_setting_line(premise_add_note(__('Check this box for a live site, uncheck for testing.'))); premise_setting_line(premise_add_textarea_setting('premise_custom_css', __('Custom CSS', 'premise'), 25, 10)); echo '<hr />'; if (isset($_GET['premise-design-key'])) { premise_setting_line('<a class="button" href="' . wp_nonce_url(admin_url('admin.php?page=premise-style-settings&premise=export&premise-design-key=' . $_GET['premise-design-key']), 'premise-export') . '">' . __('Export Premise Settings', 'premise') . '</a>'); } $title = premise_get_design_option('premise_style_title', $_GET['premise-design-key']); if (empty($title)) { $title = __('My Style', 'premise'); } premise_setting_line('</form><form id="premise-settings-import" method="post" enctype="multipart/form-data" action="">' . wp_nonce_field('premise-import', '_wpnonce-premise-import') . premise_add_label('import-file', 'Import premise Settings File') . '<br /><input type="hidden" name="premise" value="import" /><input type="file" class="text_input" name="file" id="import-file" /><input class="button" type="submit" value="Upload" /><input type="hidden" name="premise-design-key" value="' . esc_attr($_GET['premise-design-key']) . '" /><input type="hidden" name="premise_style_title" value="' . esc_attr($title) . '" /></form>'); do_action('premise_settings_general'); }