function ultimatum_findLayout(){ global $post; global $ultimatumlayout; if($ultimatumlayout){ return; } // 404 Assignment if(is_404()){ $ultimatumlayout = getLayoutInfoFromAssignment('404'); } // Search Assignment if(is_search()){ $ultimatumlayout = getLayoutInfoFromAssignment('search'); } // if(is_author()){ $ultimatumlayout = getLayoutInfoFromAssignment('author'); } if(is_front_page()){ $ultimatumlayout = getLayoutInfoFromAssignment('home'); } if(is_home()){ $page_for_posts = get_option( 'page_for_posts' ); $meta_key= THEME_SLUG.'_layout'; $ultimatumlayout = getLayoutInfo(get_post_meta($page_for_posts, $meta_key, true)); } if(!$ultimatumlayout){ if(is_single() || is_page()){ // look for individual post layout $meta_key= THEME_SLUG.'_layout'; $ultimatumlayout = getLayoutInfo(get_post_meta($post->ID, $meta_key, true)); if(!$ultimatumlayout){ $posttype = $post->post_type.'-single'; $ultimatumlayout = getLayoutInfoFromAssignment($posttype); } } else { // Look for cats taxes for multiple posts if(is_category()){ $thisCat = get_category(get_query_var('cat'),false); $posttype = 'cat-'.$thisCat->term_id; $ultimatumlayout = getLayoutInfoFromAssignment($posttype); } else if (is_tax()) { $posttype = $post->post_type; global $wp_query; $tax = get_query_var('taxonomy'); $term = get_query_var('term'); $posttype = $posttype.'-'.$tax.'-'.$term; $ultimatumlayout = getLayoutInfoFromAssignment($posttype); } else if(is_tag()){ $posttype = $post->post_type; global $wp_query; $tax = 'post_tag'; $term = get_query_var('tag'); $posttype = $posttype.'-'.$tax.'-'.$term; $ultimatumlayout = getLayoutInfoFromAssignment($posttype); } if(!$ultimatumlayout){ $posttype = str_replace($post->post_type.'_', '',$posttype); $ultimatumlayout = getLayoutInfoFromAssignment($posttype); } } } if(!$ultimatumlayout){ //look for post type layout $posttype=$post->post_type; $ultimatumlayout = getLayoutInfoFromAssignment($posttype); } if(!$ultimatumlayout){//none found go with default $ultimatumlayout = getDefaultTempLateandLayout(); } add_filter('body_class','ultimatum_body_class',10); //print_r($ultimatumlayout); }
function ultimatum_css_generator(){ global $wpdb; $table = $wpdb->prefix.ULTIMATUM_PREFIX.'_css'; $table2 = $wpdb->prefix.ULTIMATUM_PREFIX.'_classes'; if($_POST){ $vars=$_POST["cssvar"][$_GET["container"]]; foreach($vars as $element=>$property){ $delete = "DELETE FROM $table WHERE container='$_GET[container]' AND layout_id='$_POST[layoutid]' AND element='$element'"; $wpdb->query($delete); $properties = mysql_escape_string(serialize($property)); $query = "INSERT INTO $table (`container`, `layout_id`, `element`, `properties`) VALUES ('$_GET[container]','$_POST[layoutid]', '$element','$properties')"; $wpdb->query($query); } $query2 = "REPLACE INTO $table2 (`container`, `layout_id`, `user_class`, `hidephone`, `hidetablet`,`hidedesktop`) VALUES ('$_GET[container]','$_POST[layoutid]', '$_POST[user_class]', '$_POST[hidephone]', '$_POST[hidetablet]', '$_POST[hidedesktop]')"; $wpdb->query($query2); ?> <script type="text/javascript"> self.parent.SaveLayoutCSS(); </script> <?php } ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('table.widefat th.top') .click( function() { jQuery(this) .parents('table.widefat') .children('tbody').slideToggle(); }); jQuery('.widefat tbody').hide(); jQuery('.tb-closer') .click( function() { self.parent.tb_remove(); }); jQuery('.save-form').each(function(){ var form = jQuery(this).attr('data-form'); jQuery(this).click(function(){ jQuery('#'+form).submit(); }); }); }); </script> <form action="" method="post" id="css-editor-form" enctype="multipart/form-data"> <div class="fixed-top"> <div class="tb-closer"><i class="fa fa-off"></i> Close</div> <div class="save-form" data-form="css-editor-form"><i class="fa fa-save"></i> <?php _e('Save', 'ultimatum');?></div> <input type="hidden" name="layoutid" value="<?php echo $_GET["layoutid"];?>" /> </div> <?php global $wpdb; $layoinfo = getLayoutInfo($_GET["layoutid"]); $value = false; $table = $wpdb->prefix.ULTIMATUM_PREFIX.'_css'; $query = "SELECT * FROM $table WHERE `layout_id`='$_GET[layoutid]' AND `container`='$_GET[container]'"; $result = $wpdb->get_results($query,ARRAY_A); if($result): foreach($result as $fetch){ $valuez=unserialize($fetch["properties"]); if(count($valuez)!=0): foreach($valuez as $key=>$malue){ $value[$fetch["container"]][$fetch["element"]][$key]=$malue; } endif; } endif; $table2 = $wpdb->prefix.ULTIMATUM_PREFIX.'_classes'; $query2 = "SELECT * FROM $table2 WHERE `container`='$_GET[container]'"; $fetch2 = $wpdb->get_row($query2,ARRAY_A); $hide_desktop=''; $hide_phone=''; $hide_tablet=''; if($fetch2): $user_class=$fetch2['user_class']; if($fetch2['hidephone']=="hidden-phone") $hide_phone=' checked="checked"'; if($fetch2['hidetablet']=="hidden-tablet") $hide_tablet=' checked="checked"'; if($fetch2['hidedesktop']=="hidden-desktop") $hide_desktop=' checked="checked"'; endif; if($layoinfo->dcss!='yes'){ ?> <table width="100%" class="widefat" cellspacing="0"> <thead> <tr valign="top"> <th scope="row" colspan="3" class="top"><?php _e('Background Color and Image', 'ultimatum');?></th> </tr> </thead> <tbody> <tr valign="top"> <td> <?php _e('Background Color', 'ultimatum');?> </td> <td colspan="2"> <p class="description"> <?php _e('Select your desired backround color for the body delete the text box content for transparent.', 'ultimatum');?> </p> <input id="bg_color" class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][background-color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["general"]['background-color'];?>" data-alpha="true" data-reset-alpha="true"/> </td> </tr> <tr valign="top"> <th scope="row"> <?php _e('Background Image', 'ultimatum');?> </th> <td> <p class="description"><?php _e('Paste the full URL (include <code>http://</code>) of image here or you can insert the image through the button. To remove image just delete the text in field.', 'ultimatum');?></p> <?php $uploader = ''; $val = $value[$_GET["container"]]["general"]['background-image']; $uploader .= '<input size="75" name="cssvar'.'['.$_GET["container"].'][general][background-image]" id="bgImage_upload" type="text" size="6" value="'. $val .'" />'; $uploader .= '<div class="upload_button_div"><input type="button" class="button option-upload-button" data-id="bgImage_upload" value="Upload Image" />'; $uploader .='</div>' . "\n"; echo $uploader; ?> </td> <td style="border: medium none;" id="image_here"> <?php if(!empty($val)){ echo '<div id="bgImage_upload_preview" style="background:#'.$value[$_GET["container"]]["general"]['background-color'].';width:150px;height:150px"><div style="background-image:url('.$val.');width:150px;height:150px"></div></div>'; } ?> </td> </tr> </tr> <tr valign="top"> <th scope="row"><?php _e('Image Location', 'ultimatum');?></th> <td colspan="2"> <p class="description"></p> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][background-position]"> <option value="left top" <?php if($value[$_GET["container"]]["general"]['background-position']=='left top'){ echo ' selected="selected"';}?>><?php _e('top left', 'ultimatum');?></option> <option value="right top" <?php if($value[$_GET["container"]]["general"]['background-position']=='right top'){ echo ' selected="selected"';}?>><?php _e('top right', 'ultimatum');?></option> <option value="center top" <?php if($value[$_GET["container"]]["general"]['background-position']=='center top'){ echo ' selected="selected"';}?>><?php _e('top center', 'ultimatum');?></option> <option value="left bottom" <?php if($value[$_GET["container"]]["general"]['background-position']=='left bottom'){ echo ' selected="selected"';}?>><?php _e('bottom left', 'ultimatum');?></option> <option value="right bottom" <?php if($value[$_GET["container"]]["general"]['background-position']=='right bottom'){ echo ' selected="selected"';}?>><?php _e('bottom right', 'ultimatum');?></option> <option value="center bottom" <?php if($value[$_GET["container"]]["general"]['background-position']=='center bottom'){ echo ' selected="selected"';}?>><?php _e('bottom center', 'ultimatum');?></option> </select> <br /> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Image Repeat', 'ultimatum');?></th> <td colspan="2"> <p class="description"></p> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][background-repeat]"> <option value="repeat" <?php if($value[$_GET["container"]]["general"]['background-repeat']=='repeat'){ echo ' selected="selected"';}?>><?php _e('repeat', 'ultimatum');?></option> <option value="repeat-x" <?php if($value[$_GET["container"]]["general"]['background-repeat']=='repeat-x'){ echo ' selected="selected"';}?>><?php _e('repeat horizontal', 'ultimatum');?></option> <option value="repeat-y" <?php if($value[$_GET["container"]]["general"]['background-repeat']=='repeat-y'){ echo ' selected="selected"';}?>><?php _e('repeat vertical', 'ultimatum');?></option> <option value="no-repeat" <?php if($value[$_GET["container"]]["general"]['background-repeat']=='no-repeat'){ echo ' selected="selected"';}?>><?php _e('No repeat', 'ultimatum');?></option> </select> <br /> </td> </tr> </tbody> </table> <table width="100%" class="widefat" cellspacing="0"> <thead> <tr valign="top"> <th scope="row" colspan="4" class="top"> <?php _e('Borders', 'ultimatum');?> </th> </tr> </thead> <tbody> <tr><td></td><th><?php _e('Border Size', 'ultimatum');?></th><th><?php _e('Border Color', 'ultimatum');?></th><th><?php _e('Border Style', 'ultimatum');?></th></tr> <tr> <th><?php _e('Border Top', 'ultimatum');?></th> <td> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-top-width]"> <option value=""><?php _e('select', 'ultimatum');?></option> <?php for($i=0;$i<=5;$i++){ echo '<option value="'.$i.'px"'; if($value[$_GET["container"]]["general"]['border-top-width'] && $value[$_GET["container"]]["general"]['border-top-width']==$i){ echo ' selected="selected"';} echo '>'.$i.'px</option>'; } ?> </select> </td> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-top-color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["general"]['border-top-color'];?>"/> </td> <td> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-top-style]"> <option value="none" <?php if($value[$_GET["container"]]["general"]['border-top-style'] && $value[$_GET["container"]]["general"]['border-top-style']=='none'){ echo ' selected="selected"';}?>>none</option> <option value="solid" <?php if($value[$_GET["container"]]["general"]['border-top-style'] && $value[$_GET["container"]]["general"]['border-top-style']=='solid'){ echo ' selected="selected"';}?>>Solid</option> <option value="dotted" <?php if($value[$_GET["container"]]["general"]['border-top-style'] && $value[$_GET["container"]]["general"]['border-top-style']=='dotted'){ echo ' selected="selected"';}?>>Dotted</option> <option value="dashed" <?php if($value[$_GET["container"]]["general"]['border-top-style'] && $value[$_GET["container"]]["general"]['border-top-style']=='dashed'){ echo ' selected="selected"';}?>>Dashed</option> </select> </td> </tr> <tr> <th><?php _e('Border Bottom', 'ultimatum');?></th> <td> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-bottom-width]"> <option value=""><?php _e('select', 'ultimatum');?></option> <?php for($i=0;$i<=5;$i++){ echo '<option value="'.$i.'px"'; if($value[$_GET["container"]]["general"]['border-bottom-width'] && $value[$_GET["container"]]["general"]['border-bottom-width']==$i){ echo ' selected="selected"';} echo '>'.$i.'px</option>'; } ?> </select> </td> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-bottom-color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["general"]['border-bottom-color'];?>"/> </td> <td> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-bottom-style]"> <option value="none" <?php if($value[$_GET["container"]]["general"]['border-bottom-style'] && $value[$_GET["container"]]["general"]['border-bottom-style']=='none'){ echo ' selected="selected"';}?>>none</option> <option value="solid" <?php if($value[$_GET["container"]]["general"]['border-bottom-style'] && $value[$_GET["container"]]["general"]['border-bottom-style']=='solid'){ echo ' selected="selected"';}?>>Solid</option> <option value="dotted" <?php if($value[$_GET["container"]]["general"]['border-bottom-style'] && $value[$_GET["container"]]["general"]['border-bottom-style']=='dotted'){ echo ' selected="selected"';}?>>Dotted</option> <option value="dashed" <?php if($value[$_GET["container"]]["general"]['border-bottom-style'] && $value[$_GET["container"]]["general"]['border-bottom-style']=='dashed'){ echo ' selected="selected"';}?>>Dashed</option> </select> </td> </tr> <?php if(!preg_match('/wrapper-/i',$_GET["container"])) {?> <tr> <th><?php _e('Border Left', 'ultimatum');?></th> <td> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-left-width]"> <option value=""><?php _e('select', 'ultimatum');?></option> <?php for($i=0;$i<=5;$i++){ echo '<option value="'.$i.'px"'; if($value[$_GET["container"]]["general"]['border-left-width'] && $value[$_GET["container"]]["general"]['border-left-width']==$i){ echo ' selected="selected"';} echo '>'.$i.'px</option>'; } ?> </select> </td> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-left-color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["general"]['border-left-color'];?>"/> </td> <td> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-left-style]"> <option value="none" <?php if($value[$_GET["container"]]["general"]['border-left-style'] && $value[$_GET["container"]]["general"]['border-left-style']=='none'){ echo ' selected="selected"';}?>>none</option> <option value="solid" <?php if($value[$_GET["container"]]["general"]['border-left-style'] && $value[$_GET["container"]]["general"]['border-left-style']=='solid'){ echo ' selected="selected"';}?>>Solid</option> <option value="dotted" <?php if($value[$_GET["container"]]["general"]['border-left-style'] && $value[$_GET["container"]]["general"]['border-left-style']=='dotted'){ echo ' selected="selected"';}?>>Dotted</option> <option value="dashed" <?php if($value[$_GET["container"]]["general"]['border-left-style'] && $value[$_GET["container"]]["general"]['border-left-style']=='dashed'){ echo ' selected="selected"';}?>>Dashed</option> </select> </td> </tr> <tr> <th><?php _e('Border right', 'ultimatum');?></th> <td> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-right-width]"> <option value=""><?php _e('select', 'ultimatum');?></option> <?php for($i=0;$i<=5;$i++){ echo '<option value="'.$i.'px"'; if($value[$_GET["container"]]["general"]['border-right-width'] && $value[$_GET["container"]]["general"]['border-right-width']==$i){ echo ' selected="selected"';} echo '>'.$i.'px</option>'; } ?> </select> </td> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-right-color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["general"]['border-right-color'];?>"/> </td> <td> <select name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][border-right-style]"> <option value="none" <?php if($value[$_GET["container"]]["general"]['border-right-style'] && $value[$_GET["container"]]["general"]['border-right-style']=='none'){ echo ' selected="selected"';}?>>none</option> <option value="solid" <?php if($value[$_GET["container"]]["general"]['border-right-style'] && $value[$_GET["container"]]["general"]['border-right-style']=='solid'){ echo ' selected="selected"';}?>>Solid</option> <option value="dotted" <?php if($value[$_GET["container"]]["general"]['border-right-style'] && $value[$_GET["container"]]["general"]['border-right-style']=='dotted'){ echo ' selected="selected"';}?>>Dotted</option> <option value="dashed" <?php if($value[$_GET["container"]]["general"]['border-right-style'] && $value[$_GET["container"]]["general"]['border-right-style']=='dashed'){ echo ' selected="selected"';}?>>Dashed</option> </select> </td> </tr> <?php } ?> </tbody> </table> <!-- BG TABLE DONE --> <table width="100%" class="widefat" cellspacing="0"> <thead> <tr valign="top"> <th scope="row" colspan="9" class="top"> <?php _e('Height / Margin / Padding', 'ultimatum');?> </th> </tr> </thead> <tbody> <tr> <th><?php _e('Height', 'ultimatum');?></th> <td colspan="8"> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][min-height]" value="<?php echo $value[$_GET["container"]]["general"]['min-height'];?>" type="text" size="2">px </td> </tr> <tr> <th> <?php _e('Margin', 'ultimatum');?> </th> <td> <?php _e('margin top', 'ultimatum');?><br /> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][margin-top]" value="<?php echo $value[$_GET["container"]]["general"]['margin-top'];?>" type="text" size="2">px </td> <td colspan="5"> <?php _e('margin bottom', 'ultimatum');?> <br /> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][margin-bottom]" value="<?php echo $value[$_GET["container"]]["general"]['margin-bottom'];?>" type="text" size="2">px </td> </tr> <tr> <th> <?php _e('padding', 'ultimatum');?> </th> <td> <?php _e('padding top', 'ultimatum');?> <br/> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][padding-top]" value="<?php echo $value[$_GET["container"]]["general"]['padding-top'];?>" type="text" size="2">px </td> <td> <?php _e('padding bottom', 'ultimatum');?> <br /> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][padding-bottom]" value="<?php echo $value[$_GET["container"]]["general"]['padding-bottom'];?>" type="text" size="2">px </td> <?php if(preg_match('/col-/i',$_GET["container"])) {?> <td> <?php _e('padding left', 'ultimatum');?> <br /> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][padding-left]" value="<?php echo $value[$_GET["container"]]["general"]['padding-left'];?>" type="text" size="2">px </td> <td> <?php _e('padding right', 'ultimatum');?> <br /> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][padding-right]" value="<?php echo $value[$_GET["container"]]["general"]['padding-right'];?>" type="text" size="2">px </td> <?php }?> </tr> <tr> <th> <?php _e('Margin Between Widgets', 'ultimatum');?> </th> <td colspan="5"> <?php _e('margin bottom', 'ultimatum');?> <br /> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[.inner-container][margin-bottom]" value="<?php echo $value[$_GET["container"]]['.inner-container']['margin-bottom'];?>" type="text" size="2">px </td> </tr> </tbody> </table> <table class="widefat"> <thead> <tr> <th class="top" colspan="4"><?php _e('Font Styling', 'ultimatum');?></th> </tr> </thead> <tbody> <tr> <td></td> <td><?php _e('Color', 'ultimatum');?></td> <td><?php _e('Font Size', 'ultimatum');?></td> <td><?php _e('Line Height', 'ultimatum');?></td> </tr> <tr> <th width="100"> <?php _e('General Font', 'ultimatum');?> </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["general"]['color'];?>"/> </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][font-size]" type="text" value="<?php echo $value[$_GET["container"]]["general"]['font-size'];?>" size="3" />px </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[general][line-height]" type="text" value="<?php echo $value[$_GET["container"]]["general"]['line-height'];?>" size="3" />px </td> </tr> <tr> <th> H1 </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h1][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["h1"]['color'];?>"/> </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h1][font-size]" type="text" value="<?php echo $value[$_GET["container"]]["h1"]['font-size'];?>" size="3" />px </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h1][line-height]" type="text" value="<?php echo $value[$_GET["container"]]["h1"]['line-height'];?>" size="3" />px </td> </tr> <tr> <th> H2 </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h2][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["h2"]['color'];?>"/> </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h2][font-size]" type="text" value="<?php echo $value[$_GET["container"]]["h2"]['font-size'];?>" size="3" />px </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h2][line-height]" type="text" value="<?php echo $value[$_GET["container"]]["h2"]['line-height'];?>" size="3" />px </td> </tr> <tr> <th> H3 </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h3][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["h3"]['color'];?>"/> </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h3][font-size]" type="text" value="<?php echo $value[$_GET["container"]]["h3"]['font-size'];?>" size="3" />px </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h3][line-height]" type="text" value="<?php echo $value[$_GET["container"]]["h3"]['line-height'];?>" size="3" />px </td> </tr> <tr> <th> H4 </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h4][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["h4"]['color'];?>"/> </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h4][font-size]" type="text" value="<?php echo $value[$_GET["container"]]["h4"]['font-size'];?>" size="3" />px </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h4][line-height]" type="text" value="<?php echo $value[$_GET["container"]]["h4"]['line-height'];?>" size="3" />px </td> </tr> <tr> <th> H5 </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h5][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["h5"]['color'];?>"/> </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h5][font-size]" type="text" value="<?php echo $value[$_GET["container"]]["h5"]['font-size'];?>" size="3" />px </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h5][line-height]" type="text" value="<?php echo $value[$_GET["container"]]["h5"]['line-height'];?>" size="3" />px </td> </tr> <tr> <th> H6 </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h6][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["h6"]['color'];?>"/> </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h6][font-size]" type="text" value="<?php echo $value[$_GET["container"]]["h6"]['font-size'];?>" size="3" />px </td> <td> <input name="cssvar<?php echo '['.$_GET["container"].']'; ?>[h6][line-height]" type="text" value="<?php echo $value[$_GET["container"]]["h6"]['line-height'];?>" size="3" />px </td> </tr> <tr> <th> a </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[a][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["a"]['color'];?>"/> </td> </tr> <tr> <th> a:hover </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[ahover][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]["ahover"]['color'];?>"/> </td> </tr> <tr> <th> <?php _e('button text', 'ultimatum');?> </th> <td> <input class="ult-color-field" name="cssvar<?php echo '['.$_GET["container"].']'; ?>[.button][color]" type="text" size="6" value="<?php echo $value[$_GET["container"]]['.button']['color'];?>"/> </td> </tr> </tbody> </table> <?php } ?> <table class="widefat"> <thead> <tr> <th class="top" colspan="2"><?php _e('Additional Classes', 'ultimatum');?></th> </tr> </thead> <tbody> <tr><td><?php _e('Custom CSS Classes', 'ultimatum')?></td><td><i><?php _e('Add any classes you want for extra styling in your custom CSS with spaces in between. eg. class1 class2 ', 'ultimatum');?></i><br /></br><input type="text" name="user_class" value="<?php echo $user_class;?>" /></td></tr> <tr><td><?php _e('Hide Form Desktop', 'ultimatum')?></td><td><i><?php _e('If the layout is responsive this option will make sure the element selected will not show for desktops', 'ultimatum');?></i><input type="checkbox" name="hidedesktop" value="hidden-desktop" <?php echo $hide_desktop;?> /></td></tr> <tr><td><?php _e('Hide From Tablets', 'ultimatum')?></td><td><i><?php _e('If the layout is responsive this option will make sure the element selected will not show for tablets', 'ultimatum');?></i><input type="checkbox" name="hidetablet" value="hidden-tablet" <?php echo $hide_tablet;?> /></td></tr> <tr><td><?php _e('Hide from Phones', 'ultimatum')?></td><td><i><?php _e('If the layout is responsive this option will make sure the element selected will not show for phones', 'ultimatum');?></i><input type="checkbox" name="hidephone" value="hidden-phone" <?php echo $hide_phone;?> /></td></tr> </tbody> </table> </form> <?php }
static public function saveCSS($id,$type= null) { $content=''; if(!$type) { $type='layout'; $setter='_'.$id.'_css'; $css_disabler = getLayoutInfo($id); } else { $setter='_template_'.$id.'_css'; $css_disabler = getTemplateInfo($id); } $option = THEME_SLUG.$setter; $data = get_option($option); if($css_disabler->dcss == 'yes'){ unset($data); } if (is_writable(THEME_CACHE_DIR)) { $file = THEME_CACHE_DIR.'/'.$type.'_'.$id.'.css'; if($data && is_array($data) && count($data)!=0): foreach($data as $el=>$values){ $cssvar = array( "cssvar1" => "body", "cssvar2" => "#logo-container", "cssvar3" => "h1, h1 a, h1 a:hover, h1 a:visited", "cssvar4" => "h2, h2 a, h2 a:hover, h2 a:visited", "cssvar5" => "h3, h3 a, h3 a:hover, h3 a:visited", "cssvar6" => "h4, h4 a, h4 a:hover, h4 a:visited", "cssvar7" => "h5, h5 a, h5 a:hover, h5 a:visited", "cssvar8" => "h6, h6 a, h6 a:hover, h6 a:visited", "cssvar9" => "a", "cssvar10" => "a:hover", "cssvar11" => ".multi-post-title, .multi-post-title a, .multi-post-title a:hover, .multi-post-title a:visited", "cssvar12" => ".multi-post-title", "cssvar13" => ".post-inner, .post-inner-single", "cssvar14" => ".post-inner, .post-inner-single", "cssvar15" => ".post-header", "cssvar16" => "div.post-meta", "cssvar17" => ".post-meta", "cssvar18" => ".post-header, .post-header a, .post-header a:hover, .post-header a:visited", "cssvar19" => "div.post-meta, div.post-meta a", "cssvar20" => "div.post-taxonomy span", "cssvar21" => "div.post-taxonomy a", "cssvar22" => "a.readmorecontent", "cssvar23" => "#comments h3, #comments h3 a, #comments h3 a:hover, #comments h3 a:visited", "cssvar24" => ".comment-author, .comment-author a, .comment-author a:hover, .comment-author a:visited", "cssvar25" => ".comment-meta a", "cssvar26" => ".comment-content", "cssvar27" => "a.comment-reply-link, a.cancel-comment-reply-link", "cssvar28" => "h3.respond, h3.respond a, h3.respond a:hover, h3.respond a:visited", "cssvar29" => "form#commentform label", "cssvar30" => "div.breadcrumbs-plus p span, div.breadcrumbs-plus p, div.breadcrumbs-plus p a", "cssvar31" => "div.breadcrumbs-plus p span.breadcrumbs-title", "cssvar32" => "div.breadcrumbs-plus p strong", "cssvar33" => ".wp-pagenavi a, .wp-pagenavi span", "cssvar34" => ".wp-pagenavi span.current", "cssvar35" => "div.wp-pagenavi a, div.wp-pagenavi span", "cssvar36" => "div.wp-pagenavi span.current", "cssvar37" => ".wfm-mega-menu", "cssvar38" => ".wfm-mega-menu ul li:hover, .wfm-mega-menu ul li .sub-container", "cssvar39" => ".wfm-mega-menu ul li .sub li.mega-hdr a.mega-hdr-a", "cssvar40" => ".wfm-mega-menu ul li .sub-container.non-mega li a:hover, .wfm-mega-menu ul li .sub ul.sub-menu li a:hover", "cssvar41" => ".wfm-mega-menu ul.menu li a", "cssvar42" => ".wfm-mega-menu ul.menu li:hover a", "cssvar43" => ".wfm-mega-menu ul li .sub li.mega-hdr a.mega-hdr-a:hover", "cssvar44" => ".wfm-mega-menu ul li .sub ul.sub-menu li a", "cssvar45" => ".wfm-mega-menu ul li .sub ul.sub-menu li a:hover", "cssvar46" => ".wfm-mega-menu ul li .sub-container.non-mega li a", "cssvar47" => ".wfm-mega-menu ul li .sub-container.non-mega li a:hover", "cssvar48" => ".ddsmoothmenuh", "cssvar49" => ".ddsmoothmenuh ul li ul", "cssvar50" => ".ddsmoothmenuh ul li a", "cssvar51" => ".ddsmoothmenuh ul li:hover,.ddsmoothmenuh ul li a.selected,.ddsmoothmenuh ul li a:hover,.ddsmoothmenuh ul li ul.sub-menu li, .ddsmoothmenuh ul li ul.sub-menu li a", "cssvar52" => ".ddsmoothmenuh ul li ul li:hover, .ddsmoothmenuh ul li ul li a:hover", "cssvar53" => ".ddsmoothmenuh ul li a:link,.ddsmoothmenuh ul li a:visited", "cssvar54" => ".ddsmoothmenuh ul li a:hover", "cssvar55" => ".ddsmoothmenuh ul li ul li a:link,.ddsmoothmenuh ul li ul li a:visited", "cssvar56" => ".ddsmoothmenuh ul li ul li a:hover", "cssvar57" => "div.horizontal-menu", "cssvar58" => "div.horizontal-menu ul li a", "cssvar59" => "div.horizontal-menu ul li:hover", "cssvar60" => "div.horizontal-menu ul li", "cssvar61" => "div.horizontal-menu ul li, div.horizontal-menu ul li a:link,div.horizontal-menu ul li a:visited", "cssvar62" => "div.horizontal-menu ul li:hover a", "cssvar63" => ".wfm-vertical-mega-menu", "cssvar64" => ".wfm-vertical-mega-menu ul li:hover, .wfm-vertical-mega-menu ul li .sub-container", "cssvar65" => ".wfm-vertical-mega-menu ul li .sub li.mega-hdr a.mega-hdr-a", "cssvar66" => ".wfm-vertical-mega-menu ul li .sub-container.non-mega li a:hover, .wfm-vertical-mega-menu ul li .sub ul.sub-menu li a:hover", "cssvar67" => ".wfm-vertical-mega-menu ul li a", "cssvar68" => ".wfm-vertical-mega-menu ul li a:hover", "cssvar69" => ".wfm-vertical-mega-menu ul li .sub li.mega-hdr a.mega-hdr-a:hover", "cssvar70" => ".wfm-vertical-mega-menu ul li .sub ul.sub-menu li a", "cssvar71" => ".wfm-vertical-mega-menu ul li .sub ul.sub-menu li a:hover", "cssvar72" => ".wfm-vertical-mega-menu ul li .sub-container.non-mega li a", "cssvar73" => ".wfm-vertical-mega-menu ul li .sub-container.non-mega li a:hover", "cssvar74" => ".ddsmoothmenuv", "cssvar75" => ".ddsmoothmenuv ul li a:link,.ddsmoothmenuv ul li a:visited,.ddsmoothmenuv ul li a:active", "cssvar76" => ".ddsmoothmenuv ul li:hover,.ddsmoothmenuv ul li a.selected,.ddsmoothmenuv ul li a:hover,.ddsmoothmenuv ul li ul.sub-menu li, .ddsmoothmenuv ul li ul.sub-menu li a", "cssvar77" => ".ddsmoothmenuv ul li ul li:hover, .ddsmoothmenuv ul li ul li a:hover", "cssvar78" => ".ddsmoothmenuv ul li a:link,.ddsmoothmenuv ul li a:visited", "cssvar79" => ".ddsmoothmenuv ul li a:hover", "cssvar80" => ".ddsmoothmenuv ul li ul li a:link,.ddsmoothmenuv ul li ul li a:visited", "cssvar81" => ".ddsmoothmenuv ul li ul li a:hover", "cssvar82" => ".vertical-menu a", "cssvar83" => "div.vertical-menu a:hover", "cssvar84" => ".vertical-menu a:link,.vertical-menu a:visited", "cssvar85" => ".vertical-menu a:hover", "cssvar86" => ".ult_tabs ul.ult_tablinks li a", "cssvar87" => ".ult_tabs ul.ult_tablinks li a:hover", "cssvar88" => ".ult_tabs ul.ult_tablinks li.active a", "cssvar89" => "div.tabs-wrapper.ult_tabs", "cssvar90" => ".ult_accordion .accordion-toggle", "cssvar91" => ".ult_accordion .accordion-toggle.active", "cssvar92" => ".ult_accordion .accordion-inner", "cssvar93" => ".ult_accordion .accordion-toggle", "cssvar94" => ".toggler .accordion-toggle.collapsed", "cssvar95" => ".toggler .accordion-toggle", "cssvar96" => ".toggler .accordion-inner", "cssvar97" => ".toggler .accordion-toggle", "cssvar98" => ".toggler .accordion-inner", "cssvar99" => ".slidertitle, .slidertitle a, .slidertitle a:hover, .slidertitle a:visited", "cssvar100" => "p.slidertext", "cssvar101" => ".slidedeck > dt", "cssvar102" => "h1.super-title, h1.super-title a, h1.super-title a:hover, h1.super-title a:visited", "cssvar103" => ".element-title, .element-title a, .element-title a:hover, .element-title a:visited", "cssvar104" => ".element-title", "cssvar105" => "h3.slidertitle, h3.slidertitle a, h3.slidertitle a:hover, h3.slidertitle a:visited", "cssvar106" => ".anyCaption h3.slidertitle, .s3caption h3.slidertitle, .anyCaption h3.slidertitle, .s3caption h3.slidertitle a, .anyCaption h3.slidertitle, .s3caption h3.slidertitle a:hover, .anyCaption h3.slidertitle, .s3caption h3.slidertitle a:visited", "cssvar107" => ".anyCaption p.slidertext, .s3caption p.slidertext", "cssvar108" => "#logo,#logo a", "cssvar109" => "span#tagline", "cssvar110" => "blockquote *", "cssvar111" => ".wfm-mega-menu ul li.current-menu-ancestor, .wfm-mega-menu ul li.current-menu-item", "cssvar112" => ".wfm-mega-menu ul li.current-menu-ancestor a, .wfm-mega-menu ul li.current-menu-item a", "cssvar113" => ".wfm-vertical-mega-menu ul li.current-menu-ancestor, .wfm-vertical-mega-menu ul li.current-menu-item", "cssvar114" => ".wfm-vertical-mega-menu ul li.current-menu-ancestor a, .wfm-vertical-mega-menu ul li.current-menu-item a", "cssvar115" => ".ddsmoothmenuh ul li.current-menu-ancestor a, .ddsmoothmenuh ul li.current-menu-item a", "cssvar116" => ".ddsmoothmenuh ul li.current-menu-ancestor a, .ddsmoothmenuh ul li.current-menu-item a", "cssvar117" => ".ddsmoothmenuv ul li.current-menu-ancestor a, .ddsmoothmenuv ul li.current-menu-item a", "cssvar118" => ".ddsmoothmenuv ul li.current-menu-ancestor a, .ddsmoothmenuv ul li.current-menu-item a", "cssvar119" => "div.horizontal-menu ul li.current-menu-ancestor , div.horizontal-menu ul li.current-menu-item ", "cssvar120" => "div.horizontal-menu ul li.current-menu-ancestor a, div.horizontal-menu ul li.current-menu-item a ", "cssvar121" => ".vertical-menu ul li.current-menu-item>a", "cssvar122" => ".vertical-menu ul li.current-menu-item>a", "cssvar123" => ".ultimatum-menu", "cssvar127" => ".ultimatum-menu .nav-holder .ultimatum-megamenu-wrapper .ultimatum-megamenu-title ,.ultimatum-menu .nav-holder h3.widget-title.element-title", 'cssvar128' => ".ultimatum-menu .nav-holder .navigation > li >a", 'cssvar129' => ".ultimatum-menu .nav-holder .navigation > li:hover >a,.ultimatum-menu .nav-holder .navigation > li.current-menu-ancestor > a,.ultimatum-menu .nav-holder .navigation > li.current_page_item > a,.ultimatum-menu .nav-holder .navigation > li.current-menu-item > a,.ultimatum-menu .nav-holder .navigation > li.current-menu-parent > a", "cssvar130" => '.ultimatum-menu .nav-holder ul li ul li > a', "cssvar131" => '.ultimatum-menu .nav-holder ul li ul li > a:hover', "cssvar132" => '.ultimatum-menu .nav-holder ul ul,.ultimatum-menu .nav-holder .ultimatum-megamenu-wrapper .ultimatum-megamenu-holder,.ultimatum-menu .nav-holder ul .login-box,.ultimatum-menu .nav-holder ul .cart-contents,.ultimatum-menu .nav-holder .nav-search-form', "cssvar133" => '.ultimatum-menu .nav-holder ul li ul li > a:hover, .ultimatum-menu .nav-holder ul li ul li.current-menu-item > a,.ultimatum-menu .nav-holder .ultimatum-menu-nav > li .sub-menu .current-menu-ancestor', "cssvar134" => '.ultimatum-menu .nav-holder .ultimatum-megamenu-wrapper .ultimatum-megamenu-submenu,.ultimatum-menu .nav-holder .ultimatum-megamenu-wrapper .ultimatum-megamenu-border,.ultimatum-menu .nav-holder .ultimatum-menu-nav .ultimatum-megamenu-wrapper ul ul,.ultimatum-menu .nav-holder .ultimatum-menu-nav .ultimatum-megamenu-wrapper ul ul li', 'cssvar135' => 'a.sidr-toggler, a.sidr-toggler:hover', 'cssvar136' => '.slicknav_menu .slicknav_menutxt', 'cssvar137' => 'a.slicknav_btn', 'cssvar138' => 'ul.slicknav_nav a', 'cssvar139' => 'ul.slicknav_nav a:hover,ul.slicknav_nav li:hover,ul.slicknav_nav .slicknav_row:hover', 'cssvar140' => '#content article.hentry', 'cssvar141' => 'header.headwrapper', 'cssvar142' => 'footer.footwrapper', ); if($el!='save_options' && $el!='bg_pattern'){ $umm_fix = $el; $el = $cssvar[$el]; foreach ($values as $property=>$value){ // add px and # if($umm_fix == 'cssvar124' && strlen($value)!=0 && $value !='inherit'){ $content .= '.ultimatum-menu .nav-holder .navigation > li > a{height:'.$value.'px;line-height:'.$value.'px;}'; } elseif($umm_fix == 'cssvar125' && strlen($value)!=0 && $value !='inherit'){ $content .= '.ultimatum-menu .nav-holder > .ultimatum-menu-nav > li{ padding-right: '.$value.'px; }.rtl .ultimatum-menu .nav-holder > .ultimatum-menu-nav > li{ padding-left: '.$value.'px; }'; } elseif($umm_fix == 'cssvar126' && strlen($value)!=0 && $value !='inherit'){ $content .= '.ultimatum-menu .nav-holder ul ul.sub-menu{width:'.$value.'px;}.ultimatum-menu .nav-holder ul ul.sub-menu li ul{left:'.$value.'px;} ul.navigation > li:last-child ul.sub-menu ul{left:-'.$value.'px;}.ultimatum-menu .nav-holder .ultimatum-megamenu-wrapper ul{left:auto;}.rtl .ultimatum-menu .nav-holder ul ul.sub-menu li:hover ul {right:'.$value.'px;left: auto;}.rtl ul.navigation > li:last-child ul.sub-menu ul{right:-'.$value.'px;left: auto;}'; } else { if(strlen($value)!=0 && $value !='inherit'){ if($umm_fix == 'cssvar134'){ $content .= ".ultimatum-menu .nav-holder ul li ul li > a,.ultimatum-menu .nav-holder .nav-search-form{border-bottom:1px solid #".str_replace('#', '',$value).";}"; } elseif ($umm_fix=='cssvar136') { $content .= '.slicknav_menu .slicknav_icon-bar{background-color:#'.str_replace('#','',$value).'}'; } if(preg_match('/color/i',$property)){ //empty # fix if(stripslashes(str_replace('#', '',$value))!=""){ if(preg_match('/rgba/i',$value)){ $element[]=$property.': '.stripslashes(str_replace('#', '',$value)); } else { $element[]=$property.': #'.stripslashes(str_replace('#', '',$value)); } } } elseif (preg_match('/letter-spacing/i',$property) || preg_match('/width/i',$property) || preg_match('/word-spacing/i',$property) || preg_match('/size/i',$property) || preg_match('/height/i',$property) || preg_match('/margin/i',$property) || preg_match('/padding/i',$property )){ if($property != 'background-size') { $element[]=$property.': '.stripslashes($value).'px'; } } elseif (preg_match('/image/i',$property)){ $element[]=$property.': url('.stripslashes($value).')'; } elseif (preg_match('/family/i',$property)){ // cufon fontface google if(preg_match('/cufon-/i',$value)){ //cufon $cf = str_replace('cufon-', '', $value); $cfonts = explode('-js-',$cf); $cufonjs[]=$cfonts[1]; $cufonreplace[$cfonts[0]][]=$el; unset($cfonts); $element[]=$property.': Arial,sans-serif'; }elseif(preg_match('/google-/i',$value)){ //google $gfont=explode('-css-',str_replace('google-','',$value)); $font = $gfont[0]; $googlecss[] = $gfont[1]; unset($gfont); $element[]=$property.': "'.stripslashes($font).'", Arial, sans-serif'; }elseif(preg_match('/fontface-/i',$value)){ //fontface $ffont=explode('-css-',str_replace('fontface-','',$value)); $font = $ffont[0]; $fontfacer[] = $ffont[1]; unset($ffont); $element[]=$property.': "'.stripslashes($font).'", Arial, sans-serif'; } else { $element[]=$property.': '.stripslashes($value); } } else { $element[]=$property.': '.stripslashes($value); } } }//ummfix end } $linebreak=';'."\n"; if(isset($element) && is_array($element)){ $content.= $el.' {'."\n".@implode($linebreak, $element).';'."\n".'}'."\n\n"; } unset($element); } } // Intelligent Google $googleCss = false; if(isset($googlecss)){ $gcss = array_unique($googlecss); if(count($gcss)>=1){ foreach($gcss as $google_css){ $google_css=str_replace(' ', '+', $google_css); $charsets = get_ultimatum_option('scripts','google_charset'); if(is_array($charsets) && ($charsets)!=0){ $subset="&subset=".implode(',',$charsets); $google_css .=$subset; } $googleCss .= '@import url(//fonts.googleapis.com/css?family='.$google_css.');'."\n"; } } } //Intelligent @font-face $fontfacecss=false; if(isset($fontfacer)){ $fcss = array_unique($fontfacer); if(count($fcss)!=0){ $url = str_replace('http:','',ULTIMATUM_LIBRARY_URI.'/fonts/fontface'); $url = str_replace('https:','',$url); foreach ($fcss as $font_str){ $font_info = explode("|", $font_str); $stylesheet = THEME_FONTFACE_DIR.'/'.$font_info[0].'/stylesheet.css'; if(file_exists($stylesheet)){ $file_content = file_get_contents($stylesheet); if( preg_match("/@font-face\s*{[^}]*?font-family\s*:\s*('|\")$font_info[1]\\1.*?}/is", $file_content, $match) ){ $fontfacecss .= preg_replace("/url\s*\(\s*['|\"]\s*/is","\\0$url/$font_info[0]/",$match[0])."\n"; } } } } } endif; if($type == "layout"){ $fffile = THEME_CACHE_DIR.'/fontface'.$setter.'.css'; if(file_exists($fffile)){ unlink($fffile); } if($fontfacecss){ $ffhandle2 = @fopen($fffile, 'w+'); if ($ffhandle2) fwrite($ffhandle2, $fontfacecss, strlen($fontfacecss)); $ffinclude = "@import url('".THEME_CACHE_URL.'/fontface'.$setter.".css');"."\n"; $content = $ffinclude.$content; } if(isset($googleCss)){ $content = $googleCss.$content; } $content .= WonderWorksCSS::partCSS($id);// the original row // add the included layouts as well $includedLayouts = WonderWorksCSS::getLayoutsIncluded($id); foreach ($includedLayouts as $includedLayout){ $content .= WonderWorksCSS::partCSS($includedLayout); } if(strlen($content)!=0){ $content = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $content ); $content = str_replace( array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $content ); $fhandle = @fopen($file, 'w+'); if ($fhandle) fwrite($fhandle, $content, strlen($content)); } $custom_css= stripslashes(get_option(THEME_SLUG.'_custom_css_'.$id)); if(strlen($custom_css)){ $file2 = THEME_CACHE_DIR.'/layout_custom_'.$id.'.css'; $fhandle2 = @fopen($file2, 'w+'); if ($fhandle2) fwrite($fhandle2, $custom_css, strlen($custom_css)); } } elseif($type!='layout'){ // do the grid $grid = WonderWorksCSS::gridParser($id); $content = $grid.$content; if(strlen($googleCss)!=0){ $content = $googleCss.$content; } // do the fontface inclusion $fffile = THEME_CACHE_DIR.'/fontface'.$setter.'.css'; if(file_exists($fffile)){ unlink($fffile); } if($fontfacecss){ $ffhandle2 = @fopen($fffile, 'w+'); if ($ffhandle2) fwrite($ffhandle2, $fontfacecss, strlen($fontfacecss)); $ffinclude = "@import url('".THEME_CACHE_URL.'/fontface'.$setter.".css');"."\n"; $content = $ffinclude.$content; } if(strlen($content)!=0){ $content = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $content ); $content = str_replace( array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $content ); $fhandle = @fopen($file, 'w+'); if ($fhandle) fwrite($fhandle, $content, strlen($content)); } $custom_css= stripslashes(get_option(THEME_SLUG.'_custom_template_css_'.$id)); if(strlen($custom_css)){ $file2 = THEME_CACHE_DIR.'/template_custom_'.$id.'.css'; $fhandle2 = @fopen($file2, 'w+'); if ($fhandle2) fwrite($fhandle2, $custom_css, strlen($custom_css)); } } $cfile = THEME_CACHE_DIR.'/cufon'.$setter.'.php'; if(file_exists($cfile)){ unlink($cfile); } if(isset($cufonjs)){ $cufjs = array_unique($cufonjs); if(count($cufjs)>=1){ $phpcontent = '<script type="text/javascript" src="'.ULTIMATUM_URL.'/assets/js/plugins/cufon-yui.js"></script>'."\n"; foreach ($cufjs as $cjsi){ $phpcontent.='<script type="text/javascript" src="'.ULTIMATUM_LIBRARY_URI.'/fonts/cufon/'.$cjsi.'"></script>'."\n"; } $phpcontent.='<script type="text/javascript">'."\n"; foreach($cufonreplace as $font=>$item){ $phpcontent .= 'Cufon.replace("'.implode(', ',$item).'", {fontFamily : "'.$font.'",hover:true});'."\n"; } $phpcontent .= '</script>'; $fhandler = @fopen($cfile, 'w+'); if ($fhandler){ fwrite($fhandler, $phpcontent, strlen($phpcontent)); } } } } return false; }
function cssDefaults(){ global $theme_options; require_once ULTIMATUM_ADMIN_HELPERS.DS.'class.options.php'; echo '<div class="wrap ultwrap">'; global $wpdb; if(isset($_GET["layout_id"])){ $fetch = getLayoutInfo($_GET["layout_id"]); $editing_now= $fetch->title; $defpage = "admin.php?page=wonder-css&layout_id=".$_GET["layout_id"]; } elseif(isset($_GET["template_id"])){ $fetch=getTemplateInfo($_GET["template_id"]); $editing_now= $fetch->name; $defpage = "admin.php?page=wonder-css&template_id=".$_GET["template_id"]; } if(!$fetch){ echo '<h2>No Templates / Layouts Selected</h2>'; return; } else { // CSS Editors OFF function if($fetch->dcss=='yes'): ?> <script type='text/javascript' src='<?php echo ULTIMATUM_ADMIN_ASSETS;?>/js/codemirror/lib/codemirror.js'></script> <script type='text/javascript' src='<?php echo ULTIMATUM_ADMIN_ASSETS;?>/js/codemirror/mode/css/css.js'></script> <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ULTIMATUM_ADMIN_ASSETS;?>/js/codemirror/lib/codemirror.css" /> <div class="ultadmnavi" style="position:absolute;top:0;width:100%;margin-right:25px;"> <div class="navbar" id="ult-nav"> <div class="navbar-inner"> <a class="brand" href="<?php echo $defpage; ?>"><CSS><?php echo $editing_now; ?></a> <ul class="nav"> <li> <a href="javascript: history.go(-1)">Back</a> </li> </ul> <ul class="nav pull-right"> <li class=""><button class="btn-info btn" id="setting-submit"><i class="fa fa-save"></i> Save Changes</button></li> </ul> </div> </div> </div> <?php if(isset($_REQUEST['layout_id'])){ $layout_id = $_REQUEST['layout_id']; $cssfile = THEME_SLUG.'_custom_css_'.$layout_id; } elseif($_REQUEST['template_id']){ $layout_id = $_REQUEST['template_id']; $cssfile = THEME_SLUG.'_custom_template_css_'.$layout_id; } if($_POST){ update_option($cssfile,$_POST['custom_css']); } $css=get_option($cssfile); ?> <form method="post" action="" id="css-editor-form"> <textarea id="custom_css" name="custom_css"> <?php echo $css; ?> </textarea> <input type="submit" class="btn btn-info" value="save"/> </form> <script type="text/javascript"> var editor = CodeMirror.fromTextArea(document.getElementById("custom_css"), { mode: "text/css", styleActiveLine: true, lineNumbers: true, lineWrapping: true} ); </script> <?php else: if(isset($_GET['task'])): $task = $_GET['task']; $tbg = include_once ULTIMATUM_ADMIN_OPTIONS.DS.'css'.DS.$_GET['task'].'.php'; else: $task = false; $tbg = include_once ULTIMATUM_ADMIN_OPTIONS.DS.'css-options.php'; endif; ?> <style> .wp-picker-holder{position:absolute;z-index:999} </style> <div class="ultadmnavi" style="position:absolute;top:0;width:100%;margin-right:25px;"> <div class="navbar" id="ult-nav"> <div class="navbar-inner"> <a class="brand" href="<?php echo $defpage; ?>">{CSS} <?php echo $editing_now; ?></a> <ul class="nav"> <li <?php if(!$task) echo ' class="active"' ;?>> <a href="<?php echo $defpage; ?>"><?php _e('Basics','ultimatum');?></a> </li> <li class="dropdown <?php if($task=="post" || $task=="comment"|| $task=="widget") {echo ' active' ;}?>" > <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php _e('Core WP','ultimatum');?><b class="caret"></b></a> <ul class="dropdown-menu" role="menu" > <li <?php if($task=="post") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=post'; ?>"><?php _e('Posts','ultimatum');?></a></li> <li <?php if($task=="comment") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=comment'; ?>"><?php _e('Comments','ultimatum');?></a></li> <li <?php if($task=="widget") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=widget'; ?>"><?php _e('Widgets','ultimatum');?></a></li> </ul> </li> <li class="dropdown <?php if($task=="hm" ||$task=="mdm" ||$task=="ultimatum-menu" || $task=="hmm"|| $task=="hdm"|| $task=="vm"|| $task=="vmm"|| $task=="vdm") {echo ' active' ;}?>" > <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php _e('Menus','ultimatum');?><b class="caret"></b></a> <ul class="dropdown-menu" role="menu" > <li <?php if($task=="hm") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=hm'; ?>"><?php _e('Horizontal','ultimatum');?></a></li> <li <?php if($task=="hmm") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=hmm'; ?>"><?php _e('Horizontal Mega','ultimatum');?></a></li> <li <?php if($task=="hdm") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=hdm'; ?>"><?php _e('Horizontal Dropdown','ultimatum');?></a></li> <li <?php if($task=="vm") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=vm'; ?>"><?php _e('Vertical','ultimatum');?></a></li> <li <?php if($task=="vmm") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=vmm'; ?>"><?php _e('Vertical Mega','ultimatum');?></a></li> <li <?php if($task=="vdm") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=vdm'; ?>"><?php _e('Vertical Dropdown','ultimatum');?></a></li> <li <?php if($task=="ultimatum-menu") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=ultimatum-menu'; ?>"><?php _e('Ultimatum Menu','ultimatum');?></a></li> <li <?php if($task=="mdm") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=mdm'; ?>"><?php _e('Mobile Menus','ultimatum');?></a></li> </ul> </li> <li class="dropdown <?php if($task=="tabs" || $task=="togglers"|| $task=="accord"|| $task=="bcum"|| $task=="slides") {echo ' active' ;}?>" > <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php _e('Extras','ultimatum');?><b class="caret"></b></a> <ul class="dropdown-menu" role="menu" > <!-- <li <?php if($task=="bcum") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=bcum'; ?>"><?php _e('Breadcrumbs and Pagination','ultimatum');?></a></li> --> <li <?php if($task=="tabs") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=tabs'; ?>"><?php _e('Tabs','ultimatum');?></a></li> <li <?php if($task=="togglers") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=togglers'; ?>"><?php _e('Togglers','ultimatum');?></a></li> <li <?php if($task=="accord") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=accord'; ?>"><?php _e('Accordions','ultimatum');?></a></li> <li <?php if($task=="slides") echo ' class="active"' ;?>><a tabindex="-1" href="<?php echo $defpage.'&task=slides'; ?>"><?php _e('Slideshows','ultimatum');?></a></li> </ul> </li> <?php if(isset($_GET["layout_id"])){?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php _e('Custom CSS','ultimatum');?><b class="caret"></b></a> <ul class="dropdown-menu" role="menu" > <li><a href="./index.php?page=ultimatum-custom-css&template_id=<?php echo $fetch->theme;?>&TB_iframe=1&width=770&height=480" class="thickbox" title="<?php _e('Type your Custom CSS', 'ultimatum');?>"><?php _e('Template wide Custom CSS', 'ultimatum');?></a></li> <li><a class="thickbox" href="./index.php?page=ultimatum-custom-css&?layout_id=<?php echo $_GET["layout_id"];?>&TB_iframe=1&width=770&height=480" title="<?php _e('Type your Custom CSS', 'ultimatum');?>"> <?php _e('Layout Specific Custom CSS', 'ultimatum');?></a></li> </ul> </li> <li> <a href="<?php echo "admin.php?page=wonder-layout&task=edit&layoutid=".$_GET["layout_id"].'&theme='.$fetch->theme; ?>"><?php _e('Back To Layout Editor','ultimatum');?></a> </li> <?php } else { ?> <li><a href="./index.php?page=ultimatum-custom-css&template_id=<?php echo $_GET["template_id"];?>&TB_iframe=1&width=770&height=480" class="thickbox" title="<?php _e('Type your Custom CSS', 'ultimatum');?>"><?php _e('Template wide Custom CSS', 'ultimatum');?></a></li> <li> <a href="javascript: history.go(-1)">Back</a> </li> <?php } ?> </ul> <ul class="nav pull-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php _e('Advanced','ultimatum');?><b class="caret"></b></a> <ul class="dropdown-menu" role="menu" > <li ><a tabindex="-1" id="reset-form">Reset Section</a></li> </ul> </li> <li class=""><button class="button button-primary" id="setting-submit"><?php _e('Save Changes','ultimatum');?></button></li> </ul> </div> </div> </div> <?php if(!$task) { ?> <?php /* if(isset($_GET["layout_id"])){ <table class="widefat"> <thead><tr><th><?php _e('Copy CSS From another Layout', 'ultimatum');?></th></tr></thead> <tbody> <tr valign="top"><td> <form method="post" action="admin.php?page=wonder-layout"> <?php _e('Copy CSS From', 'ultimatum');?> : <select name="source"> $defql = "SELECT * FROM $table WHERE `type`='full' AND `id`<>'$_GET[layout]'"; $lss = $wpdb->get_results($defql,ARRAY_A); if($lss){ foreach($lss as $ls){ echo '<option value="'.$ls[id].'">'.$ls[title].'</option>'; } } </select> <input type="hidden" name="cloneid" value="<?php echo $_GET[layout];?>" /> <input type="hidden" name="action" value="copycss" /> <input type="submit" value="Clone CSS" class="button-primary" /> </form></td></tr> </tbody> </table> <br /> <?php } */ ?> <?php } $onur = new optionGenerator($tbg["name"], $tbg["options"]);?> <?php endif; } echo '</div>'; }