WordPress.org

Plugin Directory

Changeset 337531


Ignore:
Timestamp:
01/26/11 17:33:08 (3 years ago)
Author:
lessbloat
Message:

Removed inline styles.

Location:
grunion-contact-form/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • grunion-contact-form/trunk/grunion-contact-form.php

    r336749 r337531  
    7070 
    7171    if ( $field['type'] == 'email' ) { 
    72         $r .= "\n<div style='margin-bottom: 5px;'>\n"; 
    73         $r .= "\t\t<label style='font-weight: bold; display: block;' for='".esc_attr($field_id)."' class='grunion-field-label ".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span style="color: #AAA; margin-left: 4px; font-weight: normal;">'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
     72        $r .= "\n<div>\n"; 
     73        $r .= "\t\t<label for='".esc_attr($field_id)."' class='grunion-field-label ".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span>'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
    7474        $r .= "\t\t<input type='text' name='".esc_attr($field_id)."' id='".esc_attr($field_id)."' value='".esc_attr($field_value)."' class='".esc_attr($field['type'])."'/>\n"; 
    7575        $r .= "\t</div>\n"; 
    7676    } elseif ( $field['type'] == 'textarea' ) { 
    77         $r .= "\n<div style='margin-bottom: 5px;'>\n"; 
    78         $r .= "\t\t<label style='font-weight: bold; display: block;' for='".esc_attr($field_id)."' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span style="color: #AAA; margin-left: 4px; font-weight: normal;">'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
     77        $r .= "\n<div>\n"; 
     78        $r .= "\t\t<label for='".esc_attr($field_id)."' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span>'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
    7979        $r .= "\t\t<textarea name='".esc_attr($field_id)."' id='contact-form-comment-".esc_attr($field_id)."' rows='20'>".htmlspecialchars($field_value)."</textarea>\n"; 
    8080        $r .= "\t</div>\n"; 
    8181    } elseif ( $field['type'] == 'radio' ) { 
    82         $r .= "\t<div><label style='font-weight: bold; display: block;' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span style="color: #AAA; margin-left: 4px; font-weight: normal;">'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
     82        $r .= "\t<div><label class='". ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span>'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
    8383        foreach ( $field['options'] as $option ) { 
    8484            $r .= "\t\t<input type='radio' name='".esc_attr($field_id)."' value='".esc_attr($option)."' class='".esc_attr($field['type'])."' ".( $option == $field_value ? "checked='checked' " : "")." />\n"; 
    85             $r .= "\t\t<label style='float: left; margin-left: 8px;' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>". htmlspecialchars( $option ) . "</label>\n"; 
    86             $r .= "\t\t<div style='clear: both;'></div>\n"; 
     85            $r .= "\t\t<label class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>". htmlspecialchars( $option ) . "</label>\n"; 
     86            $r .= "\t\t<div class='clear'></div>\n"; 
    8787        } 
    8888        $r .= "\t\t</div>\n"; 
    8989    } elseif ( $field['type'] == 'checkbox' ) { 
    90         $r .= "\t<div style='margin-bottom: 5px;'>\n"; 
     90        $r .= "\t<div>\n"; 
    9191        $r .= "\t\t<input type='checkbox' name='".esc_attr($field_id)."' value='".__('Yes')."' class='".esc_attr($field['type'])."' ".( $field_value ? "checked='checked' " : "")." />\n"; 
    92         $r .= "\t\t<label style='font-weight: bold;' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>\n"; 
    93         $r .= "\t\t". htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span style="color: #AAA; margin-left: 4px; font-weight: normal;">'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
     92        $r .= "\t\t<label class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>\n"; 
     93        $r .= "\t\t". htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span>'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
     94        $r .= "\t\t<div class='clear'></div>\n"; 
    9495        $r .= "\t</div>\n"; 
    9596    } elseif ( $field['type'] == 'select' ) { 
    96         $r .= "\n<div style='margin-bottom: 5px;'>\n"; 
    97         $r .= "\t\t<label style='font-weight: bold; display: block;' for='".esc_attr($field_id)."' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span style="color: #AAA; margin-left: 4px; font-weight: normal;">'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
    98         $r .= "\t<select name='".esc_attr($field_id)."' style='margin-bottom: 0 !important;' id='".esc_attr($field_id)."' value='".esc_attr($field_value)."' class='".esc_attr($field['type'])."'/>\n"; 
     97        $r .= "\n<div>\n"; 
     98        $r .= "\t\t<label for='".esc_attr($field_id)."' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span>'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
     99        $r .= "\t<select name='".esc_attr($field_id)."' id='".esc_attr($field_id)."' value='".esc_attr($field_value)."' class='".esc_attr($field['type'])."'/>\n"; 
    99100        foreach ( $field['options'] as $option ) { 
    100101            $option = html_entity_decode( $option ); 
     
    108109        // note that any unknown types will produce a text input, so we can use arbitrary type names to handle 
    109110        // input fields like name, email, url that require special validation or handling at POST 
    110         $r .= "\n<div style='margin-bottom: 5px;'>\n"; 
    111         $r .= "\t\t<label style='font-weight: bold; display: block;' for='".esc_attr($field_id)."' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span style="color: #AAA; margin-left: 4px; font-weight: normal;">'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
     111        $r .= "\n<div>\n"; 
     112        $r .= "\t\t<label for='".esc_attr($field_id)."' class='".esc_attr($field['type']) . ( contact_form_is_error($field_id) ? ' form-error' : '' ) . "'>" . htmlspecialchars( $field['label'] ) . ( $field['required'] ? '<span>'. __("(required)") . '</span>' : '' ) . "</label>\n"; 
    112113        $r .= "\t\t<input type='text' name='".esc_attr($field_id)."' id='".esc_attr($field_id)."' value='".esc_attr($field_value)."' class='".esc_attr($field['type'])."'/>\n"; 
    113114        $r .= "\t</div>\n"; 
     
    256257     
    257258    $r .= "\n<style>\n"; 
    258     $r .= "\t\t .textwidget input[type='text'], .textwidget textarea { width: 100% !important; }\n"; 
    259     $r .= "\t\t .contact-form input[type='text'] { width: 300px; }\n"; 
    260     $r .= "\t\t .contact-form input { margin-bottom: 0 !important; font-size: 12px !important; font-family: 'Lucida Grande',Verdana,Arial,'Bitstream Vera Sans',sans-serif; }\n"; 
    261     $r .= "\t\t .contact-form textarea { height: 200px; width: 400px; float: none !important; }\n"; 
    262     $r .= "\t\t .contact-form input[type='radio'] { float: left; }\n"; 
    263     $r .= "\t\t .contact-form label { margin-bottom: 3px; float: none !important; }\n"; 
    264     $r .= "\t\t .contact-form input{type='checkbox'] { display: inline-block; }\n"; 
     259    $r .= "\t\t .textwidget input[type='text'], .textwidget textarea { width: 100% }\n"; 
     260    $r .= "\t\t .contact-form .clear { clear: both; }\n"; 
     261    $r .= "\t\t .contact-form input[type='text'] { width: 300px; margin-bottom: 13px; }\n"; 
     262    $r .= "\t\t .contact-form select { margin-bottom: 13px; }\n"; 
     263    $r .= "\t\t .contact-form textarea { height: 200px; width: 400px; float: none; margin-bottom: 13px; }\n"; 
     264    $r .= "\t\t .contact-form input[type='radio'], .contact-form input[type='checkbox'] { float: none; margin-bottom: 13px; }\n"; 
     265    $r .= "\t\t .contact-form label { margin-bottom: 3px; float: none; font-weight: bold; display: block; }\n"; 
     266    $r .= "\t\t .contact-form label.checkbox, .contact-form label.radio { margin-bottom: 3px; float: none; font-weight: bold; display: inline-block; }\n"; 
     267    $r .= "\t\t .contact-form label span { color: #AAA; margin-left: 4px; font-weight: normal; }\n"; 
    265268    $r .= "\n</style>\n"; 
    266269    $r .= "<form action='#contact-form-$id' method='post' class='contact-form commentsblock'>\n"; 
    267     $r .= '<div style="line-height: 1em;">'; 
    268270    $r .= $body; 
    269271    $r .= "\t<p class='contact-submit'>\n"; 
     
    272274    $r .= "\t\t<input type='hidden' name='contact-form-id' value='$id' />\n"; 
    273275    $r .= "\t</p>\n"; 
    274     $r .= '</div>'; 
    275276    $r .= "</form>\n</div>"; 
    276277     
  • grunion-contact-form/trunk/js/grunion.js

    r325572 r337531  
    348348                if (currentCode.match(regexp)) { 
    349349                    if (isVisual) { 
    350                         var formattedResponse = response.replace(/\n/g, "<br />").split("<br />").slice(1).join("<br />"); 
    351                         win.tinyMCE.activeEditor.execCommand('mceSetContent', false, currentCode.replace(regexp, formattedResponse)); 
     350                        win.tinyMCE.activeEditor.execCommand('mceSetContent', false, currentCode.replace(regexp, response)); 
    352351                    } else { 
    353352                        // looks like the visual editor is disabled, 
     
    357356                } else { 
    358357                    if (isVisual) { 
    359                         win.tinyMCE.activeEditor.execCommand('mceInsertContent', false, response.replace(/\n/g, "<br />").split("<br />").slice(1).join("<br />")); 
     358                        win.tinyMCE.activeEditor.execCommand('mceInsertContent', false, response); 
    360359                    } else { 
    361360                        // looks like the visual editor is disabled, 
  • grunion-contact-form/trunk/readme.txt

    r331853 r337531  
    9090* Fix the from address formatting in the email headers 
    9191* Use the correct bulk action filter to limit the list to supported actions only 
     92* Removed inline styles 
    9293 
    9394= 1.2 = 
Note: See TracChangeset for help on using the changeset viewer.