Changeset 8303

Show
Ignore:
Timestamp:
07/09/08 21:39:36 (3 months ago)
Author:
ryan
Message:

Press This: CSS cleanup, photo input newline breaks, fixes short_tags problem. Props noel. see #6813

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/css/press-this.css

    r8256 r8303  
    8989} 
    9090 
     91/* Header */ 
    9192#wphead { 
    9293    border-top: none; 
    93 } 
    94  
    95 .button { 
    96 font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; 
    97 padding: 3px 5px; 
    98 font-size: 12px; 
    99 line-height: 1.5em; 
    100 border-width: 1px; 
    101 border-style: solid; 
    102 -moz-border-radius: 3px; 
    103 -khtml-border-radius: 3px; 
    104 -webkit-border-radius: 3px; 
    105 border-radius: 3px; 
    106 cursor: pointer; 
    107 margin-left: 5px; 
    108 text-decoration: none; 
    109 } 
    110  
    111 .howto { 
    112 font-size: 11px; 
    113 } 
    114 #newtag { width: 60%; padding: 3px; } 
    115  
    116 #wphead { 
    11794    height: 2em; 
    11895    padding-top: 8px; 
     96} 
     97 
     98.button { 
     99    font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; 
     100    padding: 3px 5px; 
     101    font-size: 12px; 
     102    line-height: 1.5em; 
     103    border-width: 1px; 
     104    border-style: solid; 
     105    -moz-border-radius: 3px; 
     106    -khtml-border-radius: 3px; 
     107    -webkit-border-radius: 3px; 
     108    border-radius: 3px; 
     109    cursor: pointer; 
     110    margin-left: 5px; 
     111    text-decoration: none; 
     112} 
     113 
     114.howto { 
     115    font-size: 11px; 
     116    font-style: italic; 
     117    display: block; 
    119118} 
    120119 
     
    133132 
    134133#wphead #viewsite a { 
    135     font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, 
    136         sans-serif; 
     134    font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; 
    137135    padding: 3px 4px; 
    138136    display: block; 
     
    174172} 
    175173 
     174/* Editor/Main Column */ 
     175 
     176div#container { 
     177    margin: 0; 
     178    min-width: 500px; 
     179} 
     180 
     181div#container form { 
     182    margin: 0px; 
     183    padding: 0px; 
     184} 
     185 
     186div#posting { 
     187    padding-left: 16px; 
     188    position: absolute; 
     189    z-index: 1; 
     190    width: 66%; 
     191} 
     192 
     193#post_title { 
     194    width: 99%; 
     195} 
     196 
    176197.titlewrap { 
    177198    border-style: solid; 
     
    179200    padding: 2px 3px; 
    180201    border-color: #CCCCCC; 
    181 } 
    182  
    183 div#container { 
    184     margin: 0; 
    185     min-width: 500px; 
    186 } 
    187  
    188 div#posting { 
    189     padding-left: 16px; 
    190     position: absolute; 
    191     z-index: 1; 
    192     width: 66%; 
    193202} 
    194203 
     
    200209} 
    201210 
    202 div#container form { 
    203     margin: 0px; 
    204     padding: 0px; 
    205 } 
    206  
    207 div#categories { 
    208     font-size: 85%; 
    209     position: absolute; 
    210     top: 50px; 
    211     right: 16px; 
    212     width: 27%; 
    213     z-index: 2; 
    214 } 
    215  
    216 div#categories h2 { 
    217     color: #333; 
    218     font-size: 12px; 
    219     margin: .5em 0 0 1em; 
    220     padding: 0; 
    221 } 
    222  
    223 #categories-all { 
    224     overflow: auto; 
    225     padding: 1em; 
    226     height: 15em; 
    227 } 
    228  
    229 #categories ul { 
    230     list-style: none; 
    231     padding: 0; 
    232     margin: 0; 
    233 } 
    234  
    235211.editor-container { 
    236212    border-width: 1px; 
     
    240216} 
    241217 
    242 #tagsdiv #newtag { 
    243     margin-right: 5px; 
    244     width: 16em; 
    245 
    246  
    247 #tagchecklist { 
    248     padding-left: 1em; 
    249     margin-bottom: 1em; 
    250     font-size: 12px; 
    251     overflow: auto; 
    252 
    253  
    254 #tagchecklist strong { 
    255     position: absolute; 
    256     font-size: .75em; 
    257 
    258  
    259 #tagchecklist span { 
    260     margin-right: .5em; 
    261     margin-left: 10px; 
    262     display: block; 
    263     float: left; 
    264     font-size: 11px; 
    265     line-height: 1.8em; 
    266     white-space: nowrap; 
    267     cursor: default; 
    268 
    269  
    270 #tagchecklist span a { 
    271     margin: 6px 0pt 0pt -9px; 
    272     cursor: pointer; 
    273     width: 10px; 
    274     height: 10px; 
    275     display: block; 
    276     float: left; 
    277     text-indent: -9999px; 
    278     overflow: hidden; 
    279     position: absolute; 
    280 
    281  
    282 .howto { 
    283     font-style: italic; 
    284     display: block; 
    285 
    286  
    287 #post_title { 
    288     width: 99%; 
     218/* Photo Styles */ 
     219 
     220#photo_directions { 
     221    margin-top: .25em; 
     222    display: block; 
     223    position: relative; 
     224
     225 
     226#photo_directions span { 
     227    display: block; 
     228    position: absolute; 
     229    top: 0; 
     230    right: 3px; 
     231
     232 
     233#photo_saving { 
     234    margin-bottom: 8px; 
    289235} 
    290236 
     
    301247    float: left; 
    302248} 
     249 
    303250#img_container img { 
    304251    width: 75px; 
     
    315262#img_container a:hover, #img_container a:active { 
    316263    border: 2px solid #000; 
     264} 
     265 
     266/* Submit Column */ 
     267 
     268div#categories { 
     269    font-size: 85%; 
     270    position: absolute; 
     271    top: 50px; 
     272    right: 16px; 
     273    width: 27%; 
     274    z-index: 2; 
     275} 
     276 
     277div#categories h2 { 
     278    color: #333; 
     279    font-size: 12px; 
     280    margin: .5em 0 .5em 1em; 
     281    padding: 0; 
     282} 
     283 
     284#categories-all { 
     285    overflow: auto; 
     286    padding: 0 1em 1em 1em; 
     287    height: 15em; 
     288} 
     289 
     290#categories ul { 
     291    list-style: none; 
     292    padding: 0; 
     293    margin: 0; 
     294} 
     295 
     296#tagsdiv #newtag { 
     297    padding: 3px; 
     298    margin-right: 5px; 
     299    width: 16em;     
     300} 
     301 
     302#jaxtag { 
     303    clear: both; 
     304    padding-left: 1em; 
     305} 
     306 
     307#tagchecklist { 
     308    padding-left: 1em; 
     309    margin-bottom: 1em; 
     310    font-size: 12px; 
     311    overflow: auto; 
     312} 
     313 
     314#tagchecklist strong { 
     315    position: absolute; 
     316    font-size: .75em; 
     317} 
     318 
     319#tagchecklist span { 
     320    margin-right: .5em; 
     321    margin-left: 10px; 
     322    display: block; 
     323    float: left; 
     324    font-size: 11px; 
     325    line-height: 1.8em; 
     326    white-space: nowrap; 
     327    cursor: default; 
     328} 
     329 
     330#tagchecklist span a { 
     331    margin: 6px 0pt 0pt -9px; 
     332    cursor: pointer; 
     333    width: 10px; 
     334    height: 10px; 
     335    display: block; 
     336    float: left; 
     337    text-indent: -9999px; 
     338    overflow: hidden; 
     339    position: absolute; 
    317340} 
    318341.submit { 
     
    364387} 
    365388 
    366 .hidden { 
    367     display: none; 
    368 
    369  
     389/* Video Styles */ 
    370390.video_split #extra_fields { 
    371391    width: 27%; 
     
    384404} 
    385405 
    386 #jaxtag { 
    387     clear: both; 
    388     padding-left: 1em; 
    389 } 
    390  
    391406.ac_results { 
    392407    padding: 0; 
     
    414429} 
    415430 
    416  
    417431.photolist { 
    418 display: none; 
     432   display: none; 
    419433} 
    420434 
    421435#extra_fields small { 
    422 display: block; 
    423 margin-top: .5em; 
    424 padding-bottom: .25em; 
     436   display: block; 
     437   margin-top: .5em; 
     438   padding-bottom: .25em; 
    425439} 
    426440 
    427441#TB_ajaxContent #options { 
    428 position: absolute; 
    429 top: 20px; 
    430 right: 25px; 
    431 padding: 5px; 
     442   position: absolute; 
     443   top: 20px; 
     444   right: 25px; 
     445   padding: 5px; 
    432446} 
    433447#TB_ajaxContent h3 { 
    434 margin-bottom: .25em; 
     448   margin-bottom: .25em; 
    435449} 
    436450 
     
    462476} 
    463477 
    464 #photo_directions { 
    465 margin-top: .25em; 
    466 display: block; 
    467 position: relative; 
    468 } 
    469 #photo_directions span { 
    470 display: block; 
    471 position: absolute; 
    472 top: 0; 
    473 right: 3px; 
    474 } 
    475 #photo_saving { 
    476 margin-bottom: 8px; 
    477 } 
    478  
    479478#post_status { 
    480479    margin-left: 10px; 
     
    483482} 
    484483 
     484/* Footer */ 
     485 
    485486#footer { 
    486487    height: 65px; 
     
    507508} 
    508509 
     510 
     511/* Utility Classes */ 
    509512.centered { 
    510513    text-align: center; 
    511514} 
     515 
     516.hidden { 
     517    display: none; 
     518} 
  • trunk/wp-admin/press-this.php

    r8302 r8303  
    22require_once('admin.php'); 
    33 
    4 if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin’ uh?' )); ?> 
    5  
    6 <?php  
     4if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' ) ); 
    75 
    86function preg_quote2($string) { 
    97    return str_replace('/', '\/', preg_quote($string)); 
     8} 
     9function aposfix($text) { 
     10    $translation_table[chr(34)] = '&quot;'; 
     11    $translation_table[chr(38)] = '&'; 
     12    $translation_table[chr(39)] = '&apos;'; 
     13    return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));     
    1014} 
    1115function press_it() { 
     
    3135             
    3236            foreach($_REQUEST['photo_src'] as $key => $image) { 
    33                 #quote for matching 
     37                // escape quote for matching 
    3438                $quoted = preg_quote2($image); 
    3539                 
     
    5155            break;   
    5256        } 
    53     # set the post_content 
     57    // set the post_content 
    5458    $quick['post_content'] = str_replace('<br />', "\n", preg_replace('/<\/?p>/','',$content)); 
    5559 
    56     #error handling for $post 
     60    // error handling for $post 
    5761    if ( is_wp_error($post_ID)) { 
    5862        wp_die($id); 
    5963        wp_delete_post($post_ID); 
    60     #error handling for media_sideload 
     64    // error handling for media_sideload 
    6165    } elseif ( is_wp_error($upload)) { 
    6266        wp_die($upload); 
     
    6973} 
    7074 
    71 # For submitted posts. 
     75// For submitted posts. 
    7276if ( 'post' == $_REQUEST['action'] ) {  
    7377    check_admin_referer('press-this'); $post_ID = press_it(); ?> 
    74      
    7578    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    7679    <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>> 
     
    8992    ?> 
    9093    </head> 
    91     <body class="press-this"> 
    92          
    93         <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div> 
    94          
     94    <body class="press-this">    
     95        <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>    
    9596        <div id="footer"> 
    9697        <p><?php 
     
    100101        ?></p> 
    101102        </div> 
    102         <?php do_action('admin_footer', ''); ?> 
    103          
     103        <?php do_action('admin_footer', ''); ?>      
    104104    </body> 
    105105    </html> 
    106106    <?php die; 
    107 } 
    108  
    109  
    110 function aposfix($text) { 
    111     $translation_table[chr(34)] = '&quot;'; 
    112     $translation_table[chr(38)] = '&'; 
    113     $translation_table[chr(39)] = '&apos;'; 
    114     return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));     
    115107} 
    116108 
     
    179171if($_REQUEST['ajax'] == 'photo_images') { 
    180172    function get_images_from_uri($uri) { 
    181         if(preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com'))  
     173        if( preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com') )  
    182174            return "'".$uri."'"; 
    183175 
     
    212204 
    213205if($_REQUEST['ajax'] == 'photo_js') { ?> 
    214      
    215      
    216206    // gather images and load some default JS 
    217      
    218207    var last = null 
    219208    var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; 
     
    258247            jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>'); 
    259248            jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>'); 
    260             append_editor('<img src="' + img +'" alt="' + desc + '" />'); 
     249            append_editor("\n\n" + '<p><img src="' + img +'" alt="' + desc + '" /></p>'); 
    261250        } 
    262251        tinyMCE.activeEditor.resizeToContent(); 
     
    278267    }); 
    279268     
    280 <?php die; } 
     269<?php die; 
     270
    281271 
    282272if($_REQUEST['ajax'] == 'photo') { ?> 
     
    288278            <div id="img_container"></div> 
    289279        </div> 
    290 <?php die; } 
     280<?php die; 
     281
    291282?> 
    292283<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    378369     
    379370    function set_editor(text) { 
    380  
    381371        if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent(''); 
    382372        if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text); 
     
    400390                <?php } else { ?> 
    401391                    set_editor("<a href='<?php echo $url ?>'><?php echo $title; ?></a>"); 
    402                 <? } ?> 
     392                <?php } ?> 
    403393                return false; 
    404394                break; 
     
    412402                set_menu('video'); 
    413403                set_title('<?php _e('Caption') ?>'); 
    414                  
    415404                jQuery('#extra_fields').show(); 
    416405                jQuery('body').addClass('video_split'); 
     
    418407                    <?php  
    419408                    if ( preg_match("/youtube\.com\/watch/i", $url) ) { 
    420                     list($domain, $video_id) = split("v=", $url); 
    421                     $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'; ?> 
     409                        list($domain, $video_id) = split("v=", $url); 
     410                        $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'; 
     411                         
     412                    } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { 
     413                        list($domain, $video_id) = split(".com/", $url); 
     414                        $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />  <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>'; 
    422415                     
    423                     <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { 
    424                      
    425                     list($domain, $video_id) = split(".com/", $url); 
    426                     $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />  <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>'; 
    427                      
    428                     if ( trim($selection) == '' ) 
    429                         $selection = '<a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a>'; 
     416                        if ( trim($selection) == '' ) 
     417                            $selection = '<a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a>'; 
     418                                         
    430419                    } else { 
    431420                        $content = $selection; 
    432                     } ?> 
     421                    } 
     422                     
     423                    ?> 
    433424                    jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>'); 
    434425                     
     
    444435                <?php } else { ?> 
    445436                    set_editor("<a href='<?php echo $url ?>'><?php echo $title; ?></a>"); 
    446                 <? } ?> 
     437                <?php } ?> 
    447438                jQuery('#extra_fields').show(); 
    448439                jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /><?php echo js_escape( __( 'Loading...' ) ); ?></h2>'); 
     
    469460            show(tab_name); 
    470461        }); 
    471          
    472462        // Set default tabs 
    473463        <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?> 
     
    479469        <?php } ?> 
    480470    }); 
    481      
     471 
    482472</script> 
    483473</head>