コード例 #1
0
	static public function partCSS($layoutid){
		global $wpdb;
		$csstable = $wpdb->prefix.ULTIMATUM_PREFIX.'_css';
		$query = "SELECT * FROM $csstable WHERE layout_id='$layoutid'";
		
		$res = $wpdb->get_results($query,ARRAY_A);
		$css='';
		
		foreach($res as $fetch){
			if($fetch["element"]=='general'){
				if($fetch["container"]!='body'){
					if(preg_match('/col-/i',$fetch["container"])){
						$el = '#'.$fetch["container"].' .colwrapper';
					} else {
						$el = '#'.$fetch["container"];
					}
				}else{
					$el = $fetch["container"];
				}
			} elseif($fetch["container"]=='body'){
				if($fetch["element"]=='h1' || $fetch["element"]=='h2' || $fetch["element"]=='h3' || $fetch["element"]=='h4' || $fetch["element"]=='h5' || $fetch["element"]=='h6'){
					$fetch["element"]=$fetch["element"].', '.$fetch["element"].' a,'.$fetch["element"].' a:hover';
				}
				$el = $fetch["element"];
				if($el=='ahover'){$el = 'a:hover'; }
		
			} else {
				if($fetch["element"]=='ahover'){$fetch["element"] = 'a:hover'; }
				if($fetch["element"]=='h1' || $fetch["element"]=='h2' || $fetch["element"]=='h3' || $fetch["element"]=='h4' || $fetch["element"]=='h5' || $fetch["element"]=='h6'){
					//$fetch["element"]=$fetch["element"].', '.$fetch["element"].' a,'.$fetch["element"].' a:hover';
					$el = '#'.$fetch["container"].' '.$fetch["element"].', #'.$fetch["container"].' '.$fetch["element"].' a, #'.$fetch["container"].' '.$fetch["element"].' a:hover';
				} else {
					$el = '#'.$fetch["container"].' '.$fetch["element"];
				}
			}
			$proprties =WonderWorksCSS::parseCSS($fetch["properties"]);
				
				
			if(count($proprties)!=0){
				//print_r($proprties);
				$css .= $el.'{'.@implode(';',$proprties).'}';
			}
		}
		return $css;
	}