'); class SelectorsItem extends kDBItem { /** * Returns compiled selector for inserting into css file * * @return string */ function CompileStyle($separator = STYLE_FILE) { $ret = $this->GetDBField('SelectorName')." {\n"; $ret .= $this->CompileStyleBody($separator); $ret .= $separator."}\n"; return $ret; } function CompileStyleBody($separator) { $ret = ''; $selector_data = $this->GetDBField('SelectorData'); if($selector_data) { foreach($selector_data as $property_name => $property_value) { if ($property_value == '') continue; $ret .= "\t$property_name: $property_value;".$separator; } } $advanced_css = $this->GetDBField('AdvancedCSS'); if($separator != "\n") $advanced_css = str_replace("\n",$separator,$advanced_css); $ret .= $advanced_css; return $ret; } /** * Resets all block style attributes to it's base style * */ function ResetStyle() { if( $this->GetDBField('ParentId') ) { $this->SetDBField( 'SelectorData', Array() ); $this->Update(); } } }