Make WordPress Core

Changeset 8335


Ignore:
Timestamp:
07/15/2008 02:01:08 AM (17 years ago)
Author:
mdawaffe
Message:

crazyhorse: merge with log:trunk@8240:8334

Location:
branches/crazyhorse
Files:
64 edited
12 copied

Legend:

Unmodified
Added
Removed
  • branches/crazyhorse/readme.html

    r7104 r8335  
    99<h1 id="logo" style="text-align: center">
    1010    <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
    11     <br /> Version 2.5
     11    <br /> Version 2.6
    1212</h1>
    1313<p style="text-align: center">Semantic Personal Publishing Platform</p>
     
    3030<h1>Upgrading</h1>
    3131<p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
    32 <h2>Upgrading from any previous WordPress to 2.5:</h2>
     32<h2>Upgrading from any previous WordPress to 2.6:</h2>
    3333<ol>
    3434    <li>Delete your old WP files, saving ones you've modified.</li>
  • branches/crazyhorse/wp-admin/admin-ajax.php

    r8277 r8335  
    3131    check_ajax_referer( "delete-comment_$id" );
    3232    if ( !$comment = get_comment( $id ) )
    33         die('0');
     33        die('1');
    3434    if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
    3535        die('-1');
    3636
    37     if ( isset($_POST['spam']) && 1 == $_POST['spam'] )
     37    if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
     38        if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
     39            die('1');
    3840        $r = wp_set_comment_status( $comment->comment_ID, 'spam' );
    39     else
     41    } else {
    4042        $r = wp_delete_comment( $comment->comment_ID );
     43    }
    4144
    4245    die( $r ? '1' : '0' );
     
    4750        die('-1');
    4851
     52    $cat = get_category( $id );
     53    if ( !$cat || is_wp_error( $cat ) )
     54        die('1');
     55
    4956    if ( wp_delete_category( $id ) )
    5057        die('1');
    51     else    die('0');
     58    else
     59        die('0');
    5260    break;
    5361case 'delete-tag' :
     
    5664        die('-1');
    5765
     66    $tag = get_term( $id, 'post_tag' );
     67    if ( !$tag || is_wp_error( $tag ) )
     68        die('1');
     69
    5870    if ( wp_delete_term($id, 'post_tag'))
    5971        die('1');
    60     else    die('0');
     72    else
     73        die('0');
    6174    break;
    6275case 'delete-link-cat' :
     
    6477    if ( !current_user_can( 'manage_categories' ) )
    6578        die('-1');
     79
     80    $cat = get_term( $id, 'link_category' );
     81    if ( !$cat || is_wp_error( $cat ) )
     82        die('1');
    6683
    6784    $cat_name = get_term_field('name', $id, 'link_category');
     
    95112        die('-1');
    96113
     114    $link = get_bookmark( $id );
     115    if ( !$link || is_wp_error( $link ) )
     116        die('1');
     117
    97118    if ( wp_delete_link( $id ) )
    98119        die('1');
    99     else    die('0');
     120    else
     121        die('0');
    100122    break;
    101123case 'delete-meta' :
    102124    check_ajax_referer( "delete-meta_$id" );
    103125    if ( !$meta = get_post_meta_by_id( $id ) )
    104         die('0');
     126        die('1');
     127
    105128    if ( !current_user_can( 'edit_post', $meta->post_id ) )
    106129        die('-1');
     
    114137        die('-1');
    115138
     139    if ( !get_post( $id ) )
     140        die('1');
     141
    116142    if ( wp_delete_post( $id ) )
    117143        die('1');
     
    124150        die('-1');
    125151
     152    if ( !get_page( $id ) )
     153        die('1');
     154
    126155    if ( wp_delete_post( $id ) )
    127156        die('1');
    128     else    die('0');
     157    else
     158        die('0');
    129159    break;
    130160case 'dim-comment' :
    131161    if ( !$comment = get_comment( $id ) )
    132162        die('0');
     163
    133164    if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
    134165        die('-1');
     
    136167        die('-1');
    137168
    138     if ( in_array( wp_get_comment_status($comment->comment_ID), array( 'unapproved', 'spam' ) ) ) {
     169    $current = wp_get_comment_status( $comment->comment_ID );
     170    if ( $_POST['new'] == $current )
     171        die('1');
     172
     173    if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
    139174        check_ajax_referer( "approve-comment_$id" );
    140175        if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
  • branches/crazyhorse/wp-admin/admin-header.php

    r8270 r8335  
    6767<div id="wpcontent">
    6868<div id="wphead">
    69 <h1><a href="<?php echo clean_url( admin_url() ); ?>"><?php if ( '' == get_bloginfo('name') ) echo '&nbsp;'; else echo get_bloginfo('name'); ?></a><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
     69<h1><a href="<?php echo clean_url( admin_url() ); ?>"><?php if ( '' == get_bloginfo('name', 'display') ) echo '&nbsp;'; else echo get_bloginfo('name', 'display'); ?></a><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
    7070</div>
    7171
  • branches/crazyhorse/wp-admin/admin.php

    r8124 r8335  
    114114}
    115115
     116if ( !empty($_REQUEST['action']) )
     117    do_action('admin_action_' . $_REQUEST['action']);
     118
    116119?>
  • branches/crazyhorse/wp-admin/css/colors-classic.css

    r8329 r8335  
    325325}
    326326
    327 #adminmenu li a #awaiting-mod span {
     327#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
    328328    background-color: #d54e21;
    329329    color: #fff;
     
    336336
    337337
    338 #adminmenu li a:hover #awaiting-mod span {
     338#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
    339339    background-color: #07273E;
    340340}
  • branches/crazyhorse/wp-admin/css/colors-fresh.css

    r8329 r8335  
    302302}
    303303
    304 #adminmenu li a #awaiting-mod span, #rightnow .reallynow {
     304#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span, #rightnow .reallynow {
    305305    background-color: #d54e21;
    306306    color: #fff;
    307307}
    308308
    309 #adminmenu li a:hover #awaiting-mod span {
     309#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
    310310    background-color: #264761;
    311311}
  • branches/crazyhorse/wp-admin/css/dashboard-rtl.css

    r8116 r8335  
    2323}
    2424
     25div.dashboard-widget-submit input {
     26    font-family: sans-serif !important;
     27}
     28   
    2529#dashboard-widgets .widget_rss ul li a {
    2630    float:right;
     
    6468    float: right;
    6569}
     70#dashboard_secondary div.dashboard-widget-content ul li .post {
     71    font-family: sans-serif !important;
     72}
    6673#dashboard_secondary div.dashboard-widget-content ul li a {
    6774    border-right:0 none;
    6875    border-left:1px solid #DADADA;
    6976}
     77#dashboard_secondary div.dashboard-widget-content ul li a cite {
     78    font-family: sans-serif;
     79}
  • branches/crazyhorse/wp-admin/css/global-rtl.css

    r7908 r8335  
    1 /* styles for use by people extending the WordPress interface */
     1//* styles for use by people extending the WordPress interface */
     2body, td { font-family: sans-serif; }
     3
     4textarea, input, select { font-family: sans-serif; }
     5
    26.alignleft { float: right; }
    37.alignright { float: left; }
     
    59.textleft { text-align: right; }
    610.textright { text-align: left; }
     11   
     12.wrap h2 { font-family: sans-serif; }
    713
    814.widefat td {
  • branches/crazyhorse/wp-admin/css/install-rtl.css

    r7398 r8335  
    11body {
    2     font-size: 11px;;
     2    font-size: 11px;
     3    font-family: sans-serif !important;
    34}
    45ul, ol {
     
    1819    text-align: left;
    1920}
     21.submit input, .button, .button-secondary {
     22    font-family: sans-serif !important;
     23}
     24h1 {
     25    font-family: sans-serif;
     26}
  • branches/crazyhorse/wp-admin/css/install.css

    r7130 r8335  
    88    width: 700px;
    99    padding: 1em 2em;
     10    -moz-border-radius: 12px;
     11    -khtml-border-radius: 12px;
    1012    -webkit-border-radius: 12px;
    11     font-size: 62.5%;
     13    border-radius: 12px;
    1214}
    1315
     
    2628p, li {
    2729    padding-bottom: 2px;
    28     font-size: 1.3em;
    29     line-height: 1.8em;
     30    font-size: 13px;
     31    line-height: 18px;
    3032}
    3133
    3234code {
    33     font-size: 1.3em;
     35    font-size: 13px;
    3436}
    3537
     
    3840#logo { margin: 6px 0 14px 0px; border-bottom: none;}
    3941
    40 .step a, .step input { font-size: 2em; }
     42.step {
     43    margin: 20px 0 15px;
     44}
    4145
    42 td input { font-size: 1.5em; }
     46.step input {
     47    font-size: 18px;
     48}
     49
     50a.button {
     51    font-size: 18px;
     52}
    4353
    4454.step, th { text-align: left; padding: 0; }
     
    4656.submit input, .button, .button-secondary {
    4757    font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
    48     padding: 6px;
    49     border: none;
     58    padding: 5px 7px 7px;
     59    border: 1px solid #a3a3a3;
    5060    margin-left: 0;
    51     font-size: 13px !important;
    52     -moz-border-radius: 2px;
    53     -khtml-border-radius: 2px;
    54     -webkit-border-radius: 2px;
    55     border-radius: 2px;
     61    -moz-border-radius: 3px;
     62    -khtml-border-radius: 3px;
     63    -webkit-border-radius: 3px;
     64    border-radius: 3px;
    5665    color: #246;
    5766    background: #e5e5e5;
     
    6473.submit input:hover, .button:hover, .button-secondary:hover {
    6574    color: #d54e21;
     75    border-color: #535353;
    6676}
    6777
     
    7686    padding: 10px;
    7787    border-bottom: 8px solid #fff;
     88    font-size: 12px;
    7889}
    7990
    8091.form-table th {
    81     font-size: 12px;
     92    font-size: 13px;
    8293    text-align: left;
    83     padding: 12px 10px 10px 10px;
     94    padding: 16px 10px 10px 10px;
    8495    border-bottom: 8px solid #fff;
    8596    width: 110px;
     
    101112}
    102113
     114.form-table input {
     115    line-height: 20px;
     116    font-size: 15px;
     117    padding: 2px;
     118}
     119
    103120h1 {
    104121    border-bottom: 1px solid #dadada;
     
    117134#error-page p {
    118135    font-size: 14px;
    119     line-height: 1.6em;
     136    line-height: 16px;
     137    margin: 25px 0 20px;
    120138}
    121139
    122140#error-page code {
    123     font-size: 1em;
     141    font-size: 15px;
    124142}
  • branches/crazyhorse/wp-admin/css/login-rtl.css

    r7398 r8335  
    11body {
    2     font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
     2    font-family: sans-serif;
    33    direction: rtl;
     4}
     5#login form .submit input {
     6    font-family: sans-serif !important;
    47}
    58form {
  • branches/crazyhorse/wp-admin/css/media.css

    r7988 r8335  
    3333    display:block;
    3434    font-weight: bold;
     35    font-size: 13px;
    3536    margin-bottom: 0.5em;
    3637    margin: 0 0 0.5em 0;
     
    229230
    230231.filename {
     232    float: left;
    231233    line-height: 36px;
    232234    margin-left: 10px;
    233     float: left;
     235    overflow: hidden;
     236    max-width: 430px;
    234237}
    235238#media-upload .describe {
     
    277280    margin: 5px 0;
    278281}
     282
     283.menu_order {
     284    float: right;
     285    font-size: 11px;
     286    margin: 10px 10px 0;
     287}
     288
     289.menu_order_input {
     290    border: 1px solid #DDDDDD;
     291    font-size: 10px;
     292    padding: 1px;
     293    width: 23px;
     294}
     295
     296.ui-sortable-helper {
     297    background-color: #fff;
     298    border: 1px solid #aaa;
     299    opacity: 0.6;
     300    filter: alpha(opacity=60);
     301}
     302
     303#media-upload th.order-head {
     304     width: 25%;
     305     text-align: center;
     306}
     307
     308#media-upload .widefat {
     309    width: 626px;
     310    border-style: solid solid none;
     311}
     312
     313.sorthelper {
     314    z-index: -1;
     315}
  • branches/crazyhorse/wp-admin/css/press-this.css

    r8242 r8335  
    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: 0 8px 8px;
     235    vertical-align: middle;
    289236}
    290237
     
    301248    float: left;
    302249}
     250
    303251#img_container img {
    304252    width: 75px;
     
    315263#img_container a:hover, #img_container a:active {
    316264    border: 2px solid #000;
     265}
     266
     267/* Submit Column */
     268
     269div#categories {
     270    font-size: 85%;
     271    position: absolute;
     272    top: 50px;
     273    right: 16px;
     274    width: 27%;
     275    z-index: 2;
     276}
     277
     278div#categories h2 {
     279    color: #333;
     280    font-size: 12px;
     281    margin: .5em 0 .5em 1em;
     282    padding: 0;
     283}
     284
     285#categories-all {
     286    overflow: auto;
     287    padding: 0 1em 1em 1em;
     288    height: 15em;
     289}
     290
     291#categories ul {
     292    list-style: none;
     293    padding: 0;
     294    margin: 0;
     295}
     296
     297#tagsdiv #newtag {
     298    padding: 3px;
     299    margin-right: 5px;
     300    width: 16em;   
     301}
     302
     303#jaxtag {
     304    clear: both;
     305    padding-left: 1em;
     306    margin: 0;
     307}
     308
     309#tagchecklist {
     310    padding-left: 1em;
     311    margin-bottom: 1em;
     312    font-size: 12px;
     313    overflow: auto;
     314}
     315
     316#tagchecklist strong {
     317    position: absolute;
     318    font-size: .75em;
     319}
     320
     321#tagchecklist span {
     322    margin-right: .5em;
     323    margin-left: 10px;
     324    display: block;
     325    float: left;
     326    font-size: 11px;
     327    line-height: 1.8em;
     328    white-space: nowrap;
     329    cursor: default;
     330}
     331
     332#tagchecklist span a {
     333    margin: 6px 0pt 0pt -9px;
     334    cursor: pointer;
     335    width: 10px;
     336    height: 10px;
     337    display: block;
     338    float: left;
     339    text-indent: -9999px;
     340    overflow: hidden;
     341    position: absolute;
    317342}
    318343.submit {
     
    326351    border-bottom-right-radius: 3px;
    327352    margin: 0;
    328     padding: 0;
     353    padding: 10px;
    329354}
    330355.submitbox {
     
    341366    border: none;
    342367    text-align: left;
    343     padding: 12px 10px 10px 10px;
     368    padding: 6px 4px;
    344369    font-size: 12px;
    345     margin: 10px;
    346 
     370    margin: 2px;
    347371    -moz-border-radius: 3px;
    348372    -khtml-border-radius: 3px;
     
    364388}
    365389
    366 .hidden {
    367     display: none;
    368 }
    369 
     390/* Video Styles */
    370391.video_split #extra_fields {
    371392    width: 27%;
     
    384405}
    385406
    386 #jaxtag {
    387     clear: both;
    388     padding-left: 1em;
    389 }
    390 
    391407.ac_results {
    392408    padding: 0;
     
    414430}
    415431
    416 
    417432.photolist {
    418 display: none;
     433    display: none;
    419434}
    420435
    421436#extra_fields small {
    422 display: block;
    423 margin-top: .5em;
    424 padding-bottom: .25em;
     437    display: block;
     438    margin-top: .5em;
     439    padding-bottom: .25em;
    425440}
    426441
    427442#TB_ajaxContent #options {
    428 position: absolute;
    429 top: 20px;
    430 right: 25px;
    431 background: white;
    432 padding: 5px;
     443    position: absolute;
     444    top: 20px;
     445    right: 25px;
     446    padding: 5px;
    433447}
    434448#TB_ajaxContent h3 {
    435 margin-bottom: .25em;
     449    margin-bottom: .25em;
    436450}
    437451
     
    463477}
    464478
    465 #photo_directions {
    466 margin-top: .25em;
    467 display: block;
    468 position: relative;
    469 }
    470 #photo_directions span {
    471 display: block;
    472 position: absolute;
    473 top: 0;
    474 right: 3px;
    475 }
    476 #photo_saving {
    477 margin-bottom: 8px;
    478 }
    479 
    480479#post_status {
    481480    margin-left: 10px;
     
    484483}
    485484
     485/* Footer */
     486
    486487#footer {
    487488    height: 65px;
     
    506507#footer p a:hover {
    507508    text-decoration: underline;
     509}
     510
     511
     512/* Utility Classes */
     513.centered {
     514    text-align: center;
     515}
     516
     517.hidden {
     518    display: none;
     519}
  • branches/crazyhorse/wp-admin/css/theme-editor-rtl.css

    r7501 r8335  
     1#template textarea {
     2    font-family: monospace !important;
     3}
    14#templateside {
    25    float:left;
  • branches/crazyhorse/wp-admin/gears-manifest.php

    r8242 r8335  
    6565{
    6666"betaManifestVersion" : 1,
    67 "version" : "<?php echo $man_version; ?>_20080701",
     67"version" : "<?php echo $man_version; ?>_20080710a",
    6868"entries" : [
    6969<?php echo $defaults; ?>
     
    9898{ "url" : "images/wordpress-logo.png" },
    9999{ "url" : "images/xit.gif" },
     100{ "url" : "images/loading-publish.gif" },
     101{ "url" : "images/loading.gif" },
     102{ "url" : "images/required.gif" },
     103{ "url" : "images/no.png" },
     104{ "url" : "images/yes.png" },
    100105
    101106{ "url" : "../wp-includes/images/crystal/archive.png" },
     
    127132{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=311" },
    128133{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=311" },
    129 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311" },
     134{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311d" },
     135{ "url" : "../wp-includes/js/tinymce/tiny_mce.js?ver=311" },
     136{ "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=311" },
     137{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=311" },
    130138
    131139{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=311" },
     
    141149{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=311" },
    142150{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=311" },
    143 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311" },
     151{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311d" },
    144152{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=311" },
    145153
     
    154162{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=311" },
    155163{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=311" },
    156 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311" },
     164{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311d" },
    157165{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=311" },
    158166{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=311" },
     
    192200{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/image.png" },
    193201{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png" },
    194 { "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" }
     202{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" },
     203{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/image.gif" },
     204{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/media.gif" },
     205{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/video.gif" },
     206{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/audio.gif" }
    195207]}
  • branches/crazyhorse/wp-admin/import/wp-cat2tag.php

    r8103 r8335  
    1515            echo '</div>';
    1616        } else { ?>
    17             <div class="tablenav"><p style="margin:4px"><a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag">Categories to Tags</a>
    18             <a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag&amp;step=3">Tags to Categories</a></p></div>
     17            <div class="tablenav"><p style="margin:4px"><a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag"><?php _e( "Categories to Tags" ); ?></a>
     18            <a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag&amp;step=3"><?php _e( "Tags to Categories" ); ?></a></p></div>
    1919<?php   }
    2020    }
     
    5353            echo '<h2>' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
    5454            echo '<div class="narrow">';
    55             echo '<p>' . __('Hey there. Here you can selectively converts existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
     55            echo '<p>' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
    5656            echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p></div>';
    5757
  • branches/crazyhorse/wp-admin/includes/class-wp-filesystem-base.php

    r8018 r8335  
    11<?php
    22class WP_Filesystem_Base{
    3     var $verbose = true;
     3    var $verbose = false;
    44    var $cache = array();
    55   
  • branches/crazyhorse/wp-admin/includes/media.php

    r8329 r8335  
    2727
    2828function the_media_upload_tabs() {
     29    global $redir_tab;
    2930    $tabs = media_upload_tabs();
    3031
    3132    if ( !empty($tabs) ) {
    3233        echo "<ul id='sidemenu'>\n";
    33         if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
     34        if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) )
     35            $current = $redir_tab;
     36        elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
    3437            $current = $_GET['tab'];
    3538        else {
     
    6568function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
    6669
    67     if ( empty($alt) ) return $html;
     70    // CAPTIONS_OFF is temporary. Do not use it.
     71    if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html;
    6872    $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
    6973
     
    7579    if ( empty($align) ) $align = 'none';
    7680
    77     $shcode = '[wp_caption id="' . $id . '" align="align' . $align
    78     . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/wp_caption]';
     81    $shcode = '[caption id="' . $id . '" align="align' . $align
     82    . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/caption]';
    7983
    8084    return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
     
    155159            $content = $image_meta['caption'];
    156160    }
    157    
     161
    158162    $title = @$desc;
    159163
     
    232236    $out = <<<EOF
    233237
    234     <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
    235     <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
    236     <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
    237     <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
     238    <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
     239    <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
     240    <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
     241    <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
    238242
    239243EOF;
     
    326330    }
    327331
    328     if ( isset($_POST['save']) )
     332    if ( isset($_POST['save']) ) {
    329333        $errors['upload_notice'] = __('Saved.');
     334        return media_upload_gallery();
     335    }
    330336
    331337    return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
     
    337343        $file_array['tmp_name'] = download_url($file);
    338344        $desc = @$desc;
    339        
     345
    340346        $id = media_handle_sideload($file_array, $post_id, $desc);
    341347        $src = $id;
    342348
    343         unset($file_array);
    344 
    345349        if ( is_wp_error($id) ) {
    346             $errors['upload_error'] = $id;
     350            @unlink($file_array['tmp_name']);
    347351            return $id;
    348352        }
     
    388392    }
    389393
    390     if ( isset($_POST['save']) )
     394    if ( isset($_POST['save']) ) {
    391395        $errors['upload_notice'] = __('Saved.');
     396        return media_upload_gallery();
     397    }
    392398
    393399    return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
     
    426432    }
    427433
    428     if ( isset($_POST['save']) )
     434    if ( isset($_POST['save']) ) {
    429435        $errors['upload_notice'] = __('Saved.');
     436        return media_upload_gallery();
     437    }
    430438
    431439    return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
     
    464472    }
    465473
    466     if ( isset($_POST['save']) )
     474    if ( isset($_POST['save']) ) {
    467475        $errors['upload_notice'] = __('Saved.');
     476        return media_upload_gallery();
     477    }
    468478
    469479    return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
     
    500510    if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
    501511        $form_fields['post_title']['required'] = true;
    502         $form_fields['post_excerpt']['label'] = __('Caption');
    503         $form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"');
     512
     513        // CAPTIONS_OFF is temporary. Do not use it.
     514        if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
     515            $form_fields['post_excerpt']['label'] = __('Alternate Text');
     516            $form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"');
     517        } else {
     518            $form_fields['post_excerpt']['label'] = __('Caption');
     519            $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
     520        }
    504521
    505522        $form_fields['post_content']['label'] = __('Description');
     
    590607    $link = get_attachment_link($post->ID);
    591608
     609    // CAPTIONS_OFF is temporary. Do not use it.
     610    if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF )
     611        $alt = __('Alternate Text');
     612    else
     613        $alt = __('Caption');
     614
    592615    $form_fields = array(
    593616        'post_title'   => array(
     
    596619        ),
    597620        'post_excerpt' => array(
    598             'label'      => __('Caption'),
     621            'label'      => $alt,
    599622            'value'      => $edit_post->post_excerpt,
    600623        ),
     
    676699
    677700function get_media_item( $attachment_id, $args = null ) {
     701    global $redir_tab;
     702
    678703    $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true );
    679704    $args = wp_parse_args( $args, $default_args );
     
    723748
    724749    $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
     750    $display_title = wp_html_excerpt($display_title, 60);
     751
     752    $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
     753    $order = '';
     754
     755    foreach ( $form_fields as $key => $val ) {
     756        if ( 'menu_order' == $key ) {
     757            if ( $gallery )
     758                $order = '<div class="menu_order"> <input class="menu_order_input" type="text" id="attachments['.$attachment_id.'][menu_order]" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" /></div>';
     759            else
     760                $order = '<input type="hidden" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" />';
     761
     762            unset($form_fields['menu_order']);
     763            break;
     764        }
     765    }
    725766
    726767    $item = "
    727768    $type
    728769    $toggle_links
     770    $order
    729771    <div class='filename new'>$display_title</div>
    730772    <table class='slidetoggle describe $class'>
     
    9601002</div>
    9611003
     1004<script type="text/javascript">
     1005//<![CDATA[
     1006var addExtImage = {
     1007
     1008    width : '',
     1009    height : '',
     1010    align : 'alignnone',
     1011
     1012    insert : function() {
     1013        var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = null;
     1014
     1015        if ( '' == f.src.value || '' == t.width ) return false;
     1016
     1017        if ( f.title.value ) {
     1018            title = f.title.value.replace(/['"<>]+/g, '');
     1019            title = ' title="'+title+'"';
     1020        }
     1021
     1022        if ( f.alt.value ) {
     1023            alt = f.alt.value.replace(/['"<>]+/g, '');
     1024<?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>
     1025            caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
     1026<?php } ?>
     1027        }
     1028
     1029        cls = caption ? '' : ' class="'+t.align+'"';
     1030
     1031        html = '<img alt="'+alt+'" src="'+f.src.value+'"'+title+cls+' width="'+t.width+'" height="'+t.height+'" />';
     1032
     1033        if ( f.url.value )
     1034            html = '<a href="'+f.url.value+'">'+html+'</a>';
     1035
     1036        if ( caption )
     1037            html = '[caption id="" align="'+t.align+'" width="'+t.width+'" caption="'+caption+'"]'+html+'[/caption]';
     1038
     1039        var win = window.dialogArguments || opener || parent || top;
     1040        win.send_to_editor(html);
     1041    },
     1042
     1043    resetImageData : function() {
     1044        var t = addExtImage;
     1045
     1046        t.width = t.height = '';
     1047        document.getElementById('go_button').style.color = '#bbb';
     1048        if ( ! document.forms[0].src.value )
     1049            document.getElementById('status_img').src = 'images/required.gif';
     1050        else document.getElementById('status_img').src = 'images/no.png';
     1051    },
     1052
     1053    updateImageData : function() {
     1054        var t = addExtImage;
     1055
     1056        t.width = t.preloadImg.width;
     1057        t.height = t.preloadImg.height;
     1058        document.getElementById('go_button').style.color = '#333';
     1059        document.getElementById('status_img').src = 'images/yes.png';
     1060    },
     1061
     1062    getImageData : function() {
     1063        var t = addExtImage, src = document.forms[0].src.value;
     1064
     1065        if ( ! src ) {
     1066            t.resetImageData();
     1067            return false;
     1068        }
     1069        document.getElementById('status_img').src = 'images/loading.gif';
     1070        t.preloadImg = new Image();
     1071        t.preloadImg.onload = t.updateImageData;
     1072        t.preloadImg.onerror = t.resetImageData;
     1073        t.preloadImg.src = src;
     1074    }
     1075}
     1076//]]>
     1077</script>
     1078
    9621079<div id="media-items">
    9631080<div class="media-item media-blank">
     
    9711088
    9721089function media_upload_gallery_form($errors) {
     1090    global $redir_tab;
     1091
     1092    $redir_tab = 'gallery';
    9731093    media_upload_header();
    9741094
    9751095    $post_id = intval($_REQUEST['post_id']);
    976 
    9771096    $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id");
    978 
    9791097?>
    9801098
     
    9941112<?php wp_nonce_field('media-form'); ?>
    9951113<?php //media_upload_form( $errors ); ?>
    996 
     1114<table class="widefat">
     1115<thead><tr>
     1116<th><?php _e('Media'); ?></th>
     1117<th class="order-head"><?php _e('Order'); ?></th>
     1118</tr></thead>
     1119</table>
    9971120<div id="media-items">
    9981121<?php echo get_media_items($post_id, $errors); ?>
    9991122</div>
     1123<p class="ml-submit">
    10001124<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
    10011125<input type="submit" class="button insert-gallery" name="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery into post' ) ); ?>" />
     
    10031127<input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" />
    10041128<input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" />
     1129</p>
    10051130</form>
    10061131<?php
     
    11541279
    11551280function type_form_image() {
    1156     return '
     1281    $form = '
    11571282    <table class="describe"><tbody>
    11581283        <tr>
     1284            <th valign="top" scope="row" class="label" style="width:120px;">
     1285                <span class="alignleft"><label for="src">' . __('Source') . '</label></span>
     1286                <span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
     1287            </th>
     1288            <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()"></td>
     1289        </tr>
     1290
     1291        <tr>
    11591292            <th valign="top" scope="row" class="label">
    1160                 <span class="alignleft"><label for="insertonly[src]">' . __('Image URL') . '</label></span>
     1293                <span class="alignleft"><label for="title">' . __('Image Title') . '</label></span>
    11611294                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
    11621295            </th>
    1163             <td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text" aria-required="true"></td>
    1164         </tr>
     1296            <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
     1297        </tr>
     1298';
     1299    // CAPTIONS_OFF is temporary. Do not use it.
     1300    if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
     1301        $form .= '
    11651302        <tr>
    11661303            <th valign="top" scope="row" class="label">
    1167                 <span class="alignleft"><label for="insertonly[alt]">' . __('Description') . '</label></span>
    1168                 <span class="alignright"><abbr title="required" class="required">*</abbr></span>
     1304                <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span>
    11691305            </th>
    1170             <td class="field"><input id="insertonly[alt]" name="insertonly[alt]" value="" type="text" aria-required="true"></td>
    1171         </tr>
    1172         <tr><td></td><td class="help">' . __('Alternate text, e.g. "The Mona Lisa"') . '</td></tr>
     1306            <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
     1307            <p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td>
     1308        </tr>
     1309';
     1310
     1311    } else {
     1312        $form .= '
     1313        <tr>
     1314            <th valign="top" scope="row" class="label">
     1315                <span class="alignleft"><label for="alt">' . __('Image Caption') . '</label></span>
     1316            </th>
     1317            <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
     1318            <p class="help">' . __('Also used as alternate text for the image') . '</p></td>
     1319        </tr>
     1320';
     1321    }
     1322        $form .= '
    11731323        <tr class="align">
    1174             <th valign="top" scope="row" class="label"><label for="insertonly[align]">' . __('Alignment') . '</label></th>
     1324            <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
    11751325            <td class="field">
    1176                 <input name="insertonly[align]" id="image-align-none-0" value="none" type="radio" checked="checked" />
    1177                 <label for="image-align-none-0" class="align image-align-none-label">' . __('None') . '</label>
    1178                 <input name="insertonly[align]" id="image-align-left-0" value="left" type="radio" />
    1179                 <label for="image-align-left-0" class="align image-align-left-label">' . __('Left') . '</label>
    1180                 <input name="insertonly[align]" id="image-align-center-0" value="center" type="radio" />
    1181                 <label for="image-align-center-0" class="align image-align-center-label">' . __('Center') . '</label>
    1182                 <input name="insertonly[align]" id="image-align-right-0" value="right" type="radio" />
    1183                 <label for="image-align-right-0" class="align image-align-right-label">' . __('Right') . '</label>
     1326                <input name="align" id="align-none" value="alignnone" onclick="addExtImage.align=this.value" type="radio" checked="checked" />
     1327                <label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
     1328                <input name="align" id="align-left" value="alignleft" onclick="addExtImage.align=this.value" type="radio" />
     1329                <label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
     1330                <input name="align" id="align-center" value="aligncenter" onclick="addExtImage.align=this.value" type="radio" />
     1331                <label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
     1332                <input name="align" id="align-right" value="alignright" onclick="addExtImage.align=this.value" type="radio" />
     1333                <label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
    11841334            </td>
    11851335        </tr>
     1336
     1337        <tr>
     1338            <th valign="top" scope="row" class="label">
     1339                <span class="alignleft"><label for="url">' . __('Link URL') . '</label></span>
     1340            </th>
     1341            <td class="field"><input id="url" name="url" value="" type="text" /><br />
     1342
     1343            <button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __('None') . '</button>
     1344            <button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button>
     1345            <p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td>
     1346        </tr>
     1347
    11861348        <tr>
    11871349            <td></td>
    11881350            <td>
    1189                 <input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
     1351                <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . attribute_escape(__('Insert into Post')) . '" />
    11901352            </td>
    11911353        </tr>
    11921354    </tbody></table>
    11931355';
     1356
     1357    return $form;
    11941358}
    11951359
     
    12781442}
    12791443
     1444// support a GET parameter for disabling the flash uploader
     1445function media_upload_use_flash($flash) {
     1446        if ( array_key_exists('flash', $_REQUEST) )
     1447                $flash = !empty($_REQUEST['flash']);
     1448        return $flash;
     1449}
     1450
     1451add_filter('flash_uploader', 'media_upload_use_flash');
     1452
     1453function media_upload_flash_bypass() {
     1454        echo '<p class="upload-flash-bypass">';
     1455        printf( __('You are using the Flash uploader.  Problems?  Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) );
     1456        echo '</p>';
     1457}
     1458
     1459add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
     1460
     1461function media_upload_html_bypass() {
     1462        echo '<p class="upload-html-bypass">';
     1463        if ( array_key_exists('flash', $_REQUEST) )
     1464                // the user manually selected the browser uploader, so let them switch back to Flash
     1465                printf( __('You are using the Browser uploader.  Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
     1466        else
     1467                // the user probably doesn't have Flash
     1468                printf( __('You are using the Browser uploader.') );
     1469
     1470        echo '</p>';
     1471}
     1472
     1473add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
     1474add_action('post-html-upload-ui', 'media_upload_html_bypass');
     1475
     1476// make sure the GET parameter sticks when we submit a form
     1477function media_upload_bypass_url($url) {
     1478        if ( array_key_exists('flash', $_REQUEST) )
     1479                $url = add_query_arg('flash', intval($_REQUEST['flash']));
     1480        return $url;
     1481}
     1482
     1483add_filter('media_upload_form_url', 'media_upload_bypass_url');
     1484
     1485
     1486
    12801487add_filter('async_upload_image', 'get_media_item', 10, 2);
    12811488add_filter('async_upload_audio', 'get_media_item', 10, 2);
  • branches/crazyhorse/wp-admin/includes/plugin.php

    r8124 r8335  
    471471    $parent = get_admin_page_parent();
    472472
     473    $page_type = 'admin';
    473474    if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
    474475        if ( isset( $admin_page_hooks[$plugin_page] ))
     
    477478            if ( isset( $admin_page_hooks[$parent] ))
    478479                $page_type = $admin_page_hooks[$parent];
    479     } else {
    480         if ( isset( $admin_page_hooks[$parent_page] ) ) {
    481             $page_type = $admin_page_hooks[$parent_page];
    482         } else {
    483             $page_type = 'admin';
    484         }
     480    } else if ( isset( $admin_page_hooks[$parent_page] ) ) {
     481        $page_type = $admin_page_hooks[$parent_page];
    485482    }
    486483
  • branches/crazyhorse/wp-admin/includes/post.php

    r8143 r8335  
    9494        $mn = $_POST['mn'];
    9595        $ss = $_POST['ss'];
     96        $aa = ($aa <= 0 ) ? date('Y') : $aa;
     97        $mm = ($mm <= 0 ) ? date('n') : $mm;
    9698        $jj = ($jj > 31 ) ? 31 : $jj;
     99        $jj = ($jj <= 0 ) ? date('j') : $jj;
    97100        $hh = ($hh > 23 ) ? $hh -24 : $hh;
    98101        $mn = ($mn > 59 ) ? $mn -60 : $mn;
     
    744747        convert_urls : false,
    745748        apply_source_formatting : false,
    746         remove_linebreaks : false,
     749        remove_linebreaks : true,
    747750        accessibility_focus : false,
    748751        tab_focus : ":next",
    749752        plugins : "safari,inlinepopups",
    750753        entities : "38,amp,60,lt,62,gt",
    751         force_p_newlines : true
     754        force_p_newlines : true,
     755        save_callback : 'switchEditors.saveCallback'
    752756    });
    753757    };
  • branches/crazyhorse/wp-admin/includes/template.php

    r8288 r8335  
    526526
    527527/*
    528  * displays pages in hierarchical order
     528 * displays pages in hierarchical order with paging support
    529529 */
    530 
    531530function page_rows($pages, $pagenum = 1, $per_page = 20) {
    532531    $level = 0;
     
    539538    }
    540539
    541     // splice pages into two parts: those without parent and those with parent
    542     $top_level_pages = array();
    543     $children_pages  = array();
    544 
    545     // If searching, ignore hierarchy and treat everything as top level, otherwise split
    546     // into top level and children
     540    /*
     541     * arrange pages into two parts: top level pages and children_pages
     542     * children_pages is two dimensional array, eg.
     543     * children_pages[10][] contains all sub-pages whose parent is 10.
     544     * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
     545     * If searching, ignore hierarchy and treat everything as top level
     546     */
    547547    if ( empty($_GET['s']) )  {
     548       
     549        $top_level_pages = array();
     550        $children_pages  = array();
     551       
    548552        foreach ( $pages as $page ) {
     553           
    549554            // catch and repair bad pages
    550555            if ( $page->post_parent == $page->ID ) {
     
    557562                $top_level_pages[] = $page;
    558563            else
    559                 $children_pages[] = $page;
     564                $children_pages[ $page->post_parent ][] = $page;
    560565        }
    561566
     
    566571    $start = ($pagenum - 1) * $per_page;
    567572    $end = $start + $per_page;
     573   
    568574    foreach ( $pages as $page ) {
    569575        if ( $count >= $end )
    570576            break;
    571577
    572         $i++;
    573 
    574578        if ( $count >= $start )
    575579            echo "\t" . display_page_row( $page, $level );
     
    580584            _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
    581585    }
    582 }
    583 
    584 function _page_rows( $pages, &$count, $parent, $level, $pagenum, $per_page ) {
     586   
     587    // if it is the last pagenum and there are orphaned pages, display them with paging as well
     588    if ( isset($children_pages) && $count < $end ){
     589        foreach( $children_pages as $orphans ){
     590            foreach ( $orphans as $op ) {
     591                if ( $count >= $end )
     592                    break;
     593                if ( $count >= $start )
     594                    echo "\t" . display_page_row( $op, 0 );
     595                $count++;
     596            }
     597        }
     598    }
     599}
     600
     601/*
     602 * Given a top level page ID, display the nested hierarchy of sub-pages
     603 * together with paging support
     604 */
     605function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
     606   
     607    if ( ! isset( $children_pages[$parent] ) )
     608        return;
     609       
    585610    $start = ($pagenum - 1) * $per_page;
    586611    $end = $start + $per_page;
    587     $i = -1;
    588     foreach ( $pages as $page ) {
     612   
     613    foreach ( $children_pages[$parent] as $page ) {
     614       
    589615        if ( $count >= $end )
    590616            break;
    591 
    592         $i++;
    593 
    594         if ( $page->post_parent != $parent )
    595             continue;
    596 
     617           
    597618        // If the page starts in a subtree, print the parents.
    598619        if ( $count == $start && $page->post_parent > 0 ) {
     
    615636        if ( $count >= $start )
    616637            echo "\t" . display_page_row( $page, $level );
    617 
    618         unset($pages[$i]); // Prune the working set     
     638           
    619639        $count++;
    620640
    621         _page_rows( $pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
    622     }
     641        _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
     642    }
     643   
     644    unset( $children_pages[$parent] ); //required in order to keep track of orphans
    623645}
    624646
     
    758780
    759781    if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    760         $actions['approve']   = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
    761         $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
     782        $actions['approve']   = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
     783        $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
    762784        $actions['edit']      = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | ';
    763785        $actions['spam']      = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
  • branches/crazyhorse/wp-admin/includes/update.php

    r8060 r8335  
    5353    echo "<span id='wp-version-message'>$msg</span>";
    5454}
    55 
    56 function wp_update_plugins() {
    57     global $wp_version;
    58 
    59     if ( !function_exists('fsockopen') )
    60         return false;
    61 
    62     $plugins = get_plugins();
    63     $active  = get_option( 'active_plugins' );
    64     $current = get_option( 'update_plugins' );
    65 
    66     $new_option = '';
    67     $new_option->last_checked = time();
    68 
    69     $plugin_changed = false;
    70     foreach ( $plugins as $file => $p ) {
    71         $new_option->checked[ $file ] = $p['Version'];
    72 
    73         if ( !isset( $current->checked[ $file ] ) ) {
    74             $plugin_changed = true;
    75             continue;
    76         }
    77 
    78         if ( strval($current->checked[ $file ]) !== strval($p['Version']) )
    79             $plugin_changed = true;
    80     }
    81 
    82     if (
    83         isset( $current->last_checked ) &&
    84         43200 > ( time() - $current->last_checked ) &&
    85         !$plugin_changed
    86     )
    87         return false;
    88 
    89     $to_send->plugins = $plugins;
    90     $to_send->active = $active;
    91     $send = serialize( $to_send );
    92 
    93     $request = 'plugins=' . urlencode( $send );
    94     $http_request  = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";
    95     $http_request .= "Host: api.wordpress.org\r\n";
    96     $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
    97     $http_request .= "Content-Length: " . strlen($request) . "\r\n";
    98     $http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
    99     $http_request .= "\r\n";
    100     $http_request .= $request;
    101 
    102     $response = '';
    103     if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
    104         fwrite($fs, $http_request);
    105 
    106         while ( !feof($fs) )
    107             $response .= fgets($fs, 1160); // One TCP-IP packet
    108         fclose($fs);
    109         $response = explode("\r\n\r\n", $response, 2);
    110     }
    111 
    112     $response = unserialize( $response[1] );
    113 
    114     if ( $response )
    115         $new_option->response = $response;
    116 
    117     update_option( 'update_plugins', $new_option );
    118 }
    119 add_action( 'load-plugins.php', 'wp_update_plugins' );
    12055
    12156function wp_plugin_update_row( $file, $plugin_data ) {
  • branches/crazyhorse/wp-admin/includes/widgets.php

    r8063 r8335  
    6565                    // it's a multi-widget.  We only need to show it in the list once.
    6666                    $already_shown[] = $widget['callback'];
    67                     $num = (int) array_pop( explode( '-', $widget['id'] ) );
     67                    $num = (int) array_pop( $ids = explode( '-', $widget['id'] ) );
    6868                    $id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
    6969                    // so that we always add a new one when clicking "add"
  • branches/crazyhorse/wp-admin/install.php

    r8242 r8335  
    5555        </tr>
    5656    </table>
    57     <input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" />
     57    <p class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" /></p>
    5858</form>
    5959
     
    9999</table>
    100100
    101 <p><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a>
     101<p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
    102102
    103103<?php
  • branches/crazyhorse/wp-admin/js/editor.js

    r8242 r8335  
    5353        content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
    5454        content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
    55         content = content.replace(new RegExp('\\s*\\[wp_caption([^\\[]+)\\[/wp_caption\\]\\s*', 'gi'), '\n\n[wp_caption$1[/wp_caption]\n\n');
     55        content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
     56        content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
    5657
    5758        var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
     
    166167        pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
    167168        pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
    168         pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[wp_caption([^\\[]+)\\[/wp_caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[wp_caption$1[/wp_caption]');
     169        pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
    169170        // pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
    170171
  • branches/crazyhorse/wp-admin/js/gallery.js

    r7974 r8335  
    55            items: '.media-item',
    66            placeholder: 'sorthelper',
     7            axis: 'y',
     8            distance: 2,
    79            update: galleryReorder
    810        } );
     
    1113    // When an update has occurred, adjust the order for each item
    1214    var galleryReorder = function(e, sort) {
    13         jQuery.each(sort['instance'].toArray(), function(i, id) {
    14             jQuery('#' + id + ' .menu_order input')[0].value = i;
     15        jQuery.each(sort['element'].sortable('toArray'), function(i, id) {
     16            jQuery('#' + id + ' .menu_order input')[0].value = (1+i);
    1517        });
    1618    }
     
    1921    gallerySortableInit();
    2022});
     23
     24jQuery(document).ready(function($){
     25    $('.menu_order_input').each(function(){
     26        if ( this.value == '0' ) this.value = '';
     27    });
     28});
  • branches/crazyhorse/wp-admin/js/media-upload.js

    r8242 r8335  
    66            ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
    77
     8        if ( h.indexOf('[caption') != -1 )
     9            h = ed.plugins.wpeditimage._do_shcode(h);
     10       
    811        ed.execCommand('mceInsertContent', false, h);
    9         ed.execCommand('mceCleanup');
    1012    } else
    1113        edInsertContent(edCanvas, h);
  • branches/crazyhorse/wp-admin/press-this.php

    r8242 r8335  
    22require_once('admin.php');
    33
    4 if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; 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));
    108}
     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));
     14}
    1115function press_it() {
    1216    // define some basic variables
    13     $quick['post_status'] = $_REQUEST['post_status'];
     17    $quick['post_status'] = isset($_REQUEST['publish']) ? 'publish' : 'draft';
    1418    $quick['post_category'] = $_REQUEST['post_category'];
    1519    $quick['tags_input'] = $_REQUEST['tags_input'];
    1620    $quick['post_title'] = $_REQUEST['post_title'];
    1721    $quick['post_content'] = '';
    18        
     22
    1923    // insert the post with nothing in it, to get an ID
    2024    $post_ID = wp_insert_post($quick, true);
    21        
     25
    2226    $content = '';
    2327    switch ( $_REQUEST['post_type'] ) {
     
    2630            $content .= $_REQUEST['content'];
    2731            break;
    28        
     32
    2933        case 'photo':
    3034            $content = $_REQUEST['content'];
    31            
    32             foreach($_REQUEST['photo_src'] as $key => $image) {
    33                 #quote for matching
     35
     36            foreach( (array) $_REQUEST['photo_src'] as $key => $image) {
     37                // escape quote for matching
    3438                $quoted = preg_quote2($image);
    35                
     39
    3640                // see if files exist in content - we don't want to upload non-used selected files.
    37                 preg_match('/'.$quoted.'/', $_REQUEST['content'], $matches[0]);
    38                 if($matches[0]) {
     41                if( strpos($_REQUEST['content'], $quoted) !== false ) {
    3942                    $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
    4043                    // Replace the POSTED content <img> with correct uploaded ones.
     
    4245                }
    4346            }
    44            
     47
    4548            break;
    46            
     49
    4750        case "video":
    4851            if($_REQUEST['embed_code'])
    4952                $content .= $_REQUEST['embed_code']."\n\n";
    5053            $content .= $_REQUEST['content'];
    51             break; 
     54            break;
    5255        }
    53     # set the post_content
    54     $quick['post_content'] = str_replace('<br />', "\n", preg_replace('/<\/?p>/','',$content));
    55 
    56     #error handling for $post
     56    // set the post_content
     57    $quick['post_content'] = $content;
     58
     59    // error handling for $post
    5760    if ( is_wp_error($post_ID)) {
    5861        wp_die($id);
    5962        wp_delete_post($post_ID);
    60     #error handling for media_sideload
     63    // error handling for media_sideload
    6164    } elseif ( is_wp_error($upload)) {
    6265        wp_die($upload);
    6366        wp_delete_post($post_ID);
    64     } else {   
     67    } else {
    6568        $quick['ID'] = $post_ID;
    6669        wp_update_post($quick);
     
    6972}
    7073
    71 # For submitted posts.
     74// For submitted posts.
    7275if ( 'post' == $_REQUEST['action'] ) {
    7376    check_admin_referer('press-this'); $post_ID = press_it(); ?>
    74    
    7577    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    7678    <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
     
    8183        add_thickbox();
    8284        wp_enqueue_style('press-this');
     85        wp_enqueue_style('press-this-ie');
    8386        wp_enqueue_style( 'colors' );
    8487        wp_enqueue_script('post');
     
    9093    </head>
    9194    <body class="press-this">
    92        
    9395        <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        
    9596        <div id="footer">
    9697        <p><?php
     
    101102        </div>
    102103        <?php do_action('admin_footer', ''); ?>
    103        
    104104    </body>
    105105    </html>
     
    107107}
    108108
    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));   
    115 }
    116 
    117109// Ajax Requests
    118110$title = wp_specialchars(aposfix(stripslashes($_GET['t'])));
    119111
    120 $selection = str_replace("\n", "<br />", aposfix( stripslashes($_GET['s']) ) );
     112$selection = trim( aposfix( stripslashes($_GET['s']) ) );
     113if ( ! empty($selection) ) {
     114    $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
     115    $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>';
     116}
     117
    121118$url = clean_url($_GET['u']);
    122119$image = $_GET['i'];
     
    127124            tb_remove();
    128125        });
    129        
     126
    130127        jQuery('.select').click(function() {
    131128            image_selector();
     
    136133        <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
    137134    </div>
    138        
    139     <p><input type="hidden" name="this_photo" value="<?php echo attribute_escape($image); ?>" id="this_photo" />
    140         <a href="#" class="select"><img src="<?php echo clean_url($image); ?>" width="475" alt="<?php echo attribute_escape(__('Click to insert.')); ?>" title="<?php echo attribute_escape(__('Click to insert.')); ?>" /></a></p>
    141    
    142     <p id="options"><a href="#" class="select"><?php _e('Insert Image'); ?></a> | <a href="#" class="cancel"><?php _e('Cancel'); ?></a></p>
     135
     136    <p class="centered"><input type="hidden" name="this_photo" value="<?php echo attribute_escape($image); ?>" id="this_photo" />
     137        <a href="#" class="select"><img src="<?php echo clean_url($image); ?>" alt="<?php echo attribute_escape(__('Click to insert.')); ?>" title="<?php echo attribute_escape(__('Click to insert.')); ?>" /></a></p>
     138
     139    <p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
    143140<?php die;
    144141}
     
    149146            tb_remove();
    150147        });
    151        
     148
    152149        jQuery('.select').click(function() {
    153150            image_selector();
     
    158155        <input id="this_photo" name="this_photo" class="text" onkeypress="if(event.keyCode==13) image_selector();" />
    159156    </div>
    160    
    161    
     157
     158
    162159    <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
    163160    <div class="titlewrap">
    164161        <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
    165162    </div>
    166    
     163
    167164    <p id="options"><a href="#" class="select"><?php _e('Insert Image'); ?></a> | <a href="#" class="cancel"><?php _e('Cancel'); ?></a></p>
    168165<?php die;
     
    179176if($_REQUEST['ajax'] == 'photo_images') {
    180177    function get_images_from_uri($uri) {
    181         if(preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com'))
     178        if( preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com') )
    182179            return "'".$uri."'";
    183180
    184181        $content = wp_remote_fopen($uri);
    185182        if ( false === $content ) return '';
    186        
     183
    187184        $host = parse_url($uri);
    188        
    189         $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))(\2)([^>\/]*)\/*>/is';
     185
     186        $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif)[^<>\'\"]*)(\2)([^>\/]*)\/*>/is';
    190187        preg_match_all($pattern, $content, $matches);
    191        
     188
    192189        if ( empty($matches[1]) ) return '';
    193        
     190
    194191        $sources = array();
    195192        foreach ($matches[3] as $src) {
     
    199196                else
    200197                    $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src);
    201                                        
     198
    202199            $sources[] = clean_url($src);
    203200        }
    204201        return "'" . implode("','", $sources) . "'";
    205202    }
    206    
     203
    207204    $url = urldecode($url);
    208205    $url = str_replace(' ', '%20', $url);
    209206    echo 'new Array('.get_images_from_uri($url).')';
    210 die;       
     207die;
    211208}
    212209
    213210if($_REQUEST['ajax'] == 'photo_js') { ?>
    214    
    215    
    216211    // gather images and load some default JS
    217    
    218212    var last = null
    219213    var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
     
    228222        }).responseText
    229223    );
    230    
     224
    231225    for (i = 0; i < my_src.length; i++) {
    232226        img = new Image();
     
    239233            aspect = img.width / img.height;
    240234            scale = (aspect > 1) ? (75 / img.width) : (75 / img.height);
    241            
     235
    242236            w = img.width;
    243237            h = img.height;
    244            
     238
    245239            if (scale < 1) {
    246240                w = parseInt(img.width * scale);
     
    251245        if (!skip) strtoappend += '<a href="?ajax=thickbox&amp;i=' + img.src + '&amp;u=<?php echo $url; ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
    252246    }
    253    
     247
    254248    function pick(img, desc) {
    255249        if (img) {
     
    258252            jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
    259253            jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
    260             append_editor('<img src="' + img +'" alt="' + desc + '" />');
     254            append_editor("\n\n" + '<p><img src="' + img +'" alt="' + desc + '" /></p>');
    261255        }
    262256        tinyMCE.activeEditor.resizeToContent();
    263257        return false;
    264258    }
    265    
     259
    266260    function image_selector() {
    267261        tb_remove();
     
    271265        return false;
    272266    }
    273    
     267
    274268    jQuery(document).ready(function() {
    275269        jQuery('#img_container').html(strtoappend);
     
    277271        tb_init('a.thickbox, area.thickbox, input.thickbox');
    278272    });
    279    
    280 <?php die; }
     273
     274<?php die;
     275}
    281276
    282277if($_REQUEST['ajax'] == 'photo') { ?>
     
    288283            <div id="img_container"></div>
    289284        </div>
    290 <?php die; }
     285<?php die;
     286}
    291287?>
    292288<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    299295    add_thickbox();
    300296    wp_enqueue_style('press-this');
     297    wp_enqueue_style('press-this-ie');
    301298    wp_enqueue_style( 'colors' );
    302299    wp_enqueue_script( 'post' );
     300    wp_enqueue_script('editor_functions');
    303301
    304302    wp_teeny_mce();
     
    314312    // add the quickadd form
    315313    jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="submit" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" onclick="return false;" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
    316        
     314
    317315    jQuery('#tagadd').click( tag_flush_to_text );
    318316    jQuery('#newtag').focus(function() {
     
    328326    jQuery('#publish').click( tag_save_on_publish );
    329327    jQuery('#save-post').click( tag_save_on_publish );
    330        
     328
    331329    function set_menu(type) {
    332330        jQuery('#text_button').removeClass('ui-tabs-selected');
     
    335333        jQuery("#post_type").val(type);
    336334    }
    337    
     335
    338336    function set_editor(text) {
    339 
    340         if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent('');
    341         if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text);
    342     }
    343    
     337        if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>';
     338        if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text);
     339    }
     340
    344341    function append_editor(text) {
    345         if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text);
    346     }
    347    
     342        if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, text);
     343    }
     344
    348345    function set_title(title) { jQuery("#content_type").text(title); }
    349346
     
    355352                set_menu('text');
    356353                set_title('<?php _e('Post') ?>');
     354                <?php if ($selection) { ?>
     355                    set_editor('<?php echo $selection; ?><p><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</p>');
     356                <?php } else { ?>
     357                    set_editor('<p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
     358                <?php } ?>
    357359                return false;
    358360                break;
     
    360362                set_menu('quote');
    361363                set_title('<?php _e('Quote') ?>');
    362                 set_editor("<blockquote><p><?php echo format_to_edit($selection); ?> </p><p><cite><a href='<?php echo $url; ?>'><?php echo $title; ?> </a> </cite> </p></blockquote>");
     364                set_editor('<blockquote><?php echo $selection; ?> <p><cite><a href="<?php echo $url; ?>"><?php echo $title; ?> </a> </cite> </p></blockquote>');
    363365                return false;
    364366                break;
     
    366368                set_menu('video');
    367369                set_title('<?php _e('Caption') ?>');
    368                
    369370                jQuery('#extra_fields').show();
    370371                jQuery('body').addClass('video_split');
    371372                jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
    372373                    <?php
     374                    $content = '';
    373375                    if ( preg_match("/youtube\.com\/watch/i", $url) ) {
    374                     list($domain, $video_id) = split("v=", $url);
    375                     $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>'; ?>
    376                    
    377                     <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
    378                    
    379                     list($domain, $video_id) = split(".com/", $url);
    380                     $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>';
    381                    
    382                     if ( trim($selection) == '' )
    383                         $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>';
    384                     } else {
     376                        list($domain, $video_id) = split("v=", $url);
     377                        $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>';
     378
     379                    } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
     380                        list($domain, $video_id) = split(".com/", $url);
     381                        $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>';
     382
     383                        if ( trim($selection) == '' )
     384                            $selection = '<p><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></p>';
     385
     386                    } elseif ( strpos( $selection, '<object' ) !== false ) {
    385387                        $content = $selection;
    386                     } ?>
     388                    }
     389                    ?>
    387390                    jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>');
    388                    
    389                     set_editor("<?php echo $title; ?>");
     391
     392                    set_editor('<a href="<?php echo $url ?>"><?php echo $title; ?></a>.');
    390393                });
    391394                return false;
     
    395398                set_title('<?php _e('Post') ?>');
    396399                <?php if ($selection) { ?>
    397                     set_editor("<?php echo format_to_edit($selection); ?>");
     400                    set_editor('<?php echo $selection; ?><p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
     401                <?php } else { ?>
     402                    set_editor('<p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
    398403                <?php } ?>
    399404                jQuery('#extra_fields').show();
     
    414419        }
    415420    }
    416    
     421
    417422    jQuery(document).ready(function() {
    418423        jQuery('#menu li').click(function (){
     
    421426            show(tab_name);
    422427        });
    423        
    424428        // Set default tabs
    425429        <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
     
    431435        <?php } ?>
    432436    });
    433    
     437
    434438</script>
    435439</head>
     
    454458            <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
    455459        </div>
    456        
     460
    457461        <div id="extra_fields" style="display: none"></div>
    458        
     462
    459463        <div class="editor_area">
    460464            <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2>
    461465            <div class="editor-container">
    462                 <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if ($selection) { ?><a href='<?php echo $url ?>'><?php echo format_to_edit($selection) ?></a><?php } else { ?><a href='<?php echo $url ?>'><?php echo $title; ?></a><?php } ?></textarea>
     466                <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</textarea>
    463467            </div>
    464468        </div>
    465469    </div>
    466    
     470
    467471    <div id="categories">
    468472        <div class="submitbox" id="submitpost">
    469         <div id="previewview"></div>
    470         <div class="inside">
    471             <h2><?php _e('Categories') ?></h2>
    472             <div id="categories-all">
    473                 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
    474                     <?php wp_category_checklist() ?>
    475                 </ul>
     473            <div id="previewview"></div>
     474            <div class="inside">
     475                <h2><?php _e('Categories') ?></h2>
     476                <div id="categories-all">
     477                    <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
     478                        <?php wp_category_checklist() ?>
     479                    </ul>
     480                </div>
     481               
     482                <h2><?php _e('Tags') ?></h2>
     483                <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
     484                <div id="tagchecklist"></div>
    476485            </div>
    477             <h2><?php _e('Tags') ?></h2>
    478             <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
    479             <div id="tagchecklist"></div>
     486
     487            <p class="submit">         
     488                <input type="submit" name="draft" value="<?php _e('Save') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
     489                <input type="submit" name="publish" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
     490                <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/>
     491            </p>
    480492        </div>
    481         <div id="post_status">
    482             <input type="radio" name="post_status" value="publish" checked="checked" id="published" /> <label for="published"><?php _e('Published'); ?></label>
    483             <input type="radio" name="post_status" value="draft" id="unpublished" /> <label for="unpublished"><?php _e('Unpublished'); ?></label>
    484         </div>
    485         <p class="submit">         
    486             <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
    487             <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/>
    488         </p>
    489493    </div>
    490494</form>
  • branches/crazyhorse/wp-admin/revision.php

    r8242 r8335  
    4747    if ( $left_revision->ID == $right_revision->ID ) {
    4848        $redirect = get_edit_post_link( $left_revision->ID );
     49        include( 'js/revisions-js.php' );
    4950        break;
    5051    }
  • branches/crazyhorse/wp-admin/rtl.css

    r8116 r8335  
    55}
    66
    7 body, td {
    8     font-family: Tahoma,Verdana,sans-serif;
     7body, td, .submit input, .button, .button-secondary, .button-highlighted, #your-profile legend, .quicktags, .search, #wpcontent select, #wphead #viewsite a, #wphead h1 {
     8    font-family: sans-serif !important;
     9}
     10
     11.code, #quicktags #ed_code {
     12    font-family: monospace !important;
    913}
    1014
     
    6670    display:block;
    6771    float:right;
    68     font:700 16px/100% "Times New Roman", Times, serif;
     72    font:700 16px/100% sans-serif;
    6973    margin:0 0 0 10px;
    7074    padding:5px 7px 9px
     
    7983{
    8084    background:url(images/comment-stalk-rtl.gif) -309px bottom !important;
    81     font-family: Tahoma, Verdana, sans-serif;
     85    font-family: sans-serif !important;
    8286    margin-left:-45px;
    8387    margin-right:.2em;
  • branches/crazyhorse/wp-admin/setup-config.php

    r8242 r8335  
    6363<p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;</p>
    6464
    65 <p><a href="setup-config.php?step=1" class="button">Let&#8217;s go!</a></p>
     65<p class="step"><a href="setup-config.php?step=1" class="button">Let&#8217;s go!</a></p>
    6666<?php
    6767    break;
     
    9999        </tr>
    100100    </table>
    101     <h2 class="step">
    102     <input name="submit" type="submit" value="Submit" class="button" />
    103     </h2>
     101    <p class="step"><input name="submit" type="submit" value="Submit" class="button" /></p>
    104102</form>
    105103<?php
     
    155153<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;</p>
    156154
    157 <p><a href="install.php" class="button">Run the install</a></p>
     155<p class="step"><a href="install.php" class="button">Run the install</a></p>
    158156<?php
    159157    break;
  • branches/crazyhorse/wp-admin/upgrade.php

    r7979 r8335  
    2626<h2><?php _e('No Upgrade Required'); ?></h2>
    2727<p><?php _e('Your WordPress database is already up-to-date!'); ?></p>
    28 <h2 class="step"><a href="<?php echo get_option('home'); ?>/"><?php _e('Continue'); ?></a></h2>
     28<p class="step"><a class="button" href="<?php echo get_option('home'); ?>/"><?php _e('Continue'); ?></a></p>
    2929
    3030<?php else :
     
    3838<p><?php _e('Your WordPress database is out-of-date, and must be upgraded before you can continue.'); ?></p>
    3939<p><?php _e('The upgrade process may take a while, so please be patient.'); ?></p>
    40 <h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress'); ?></a></h2>
     40<p class="step"><a class="button" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress'); ?></a></p>
    4141<?php
    4242        break;
     
    5353<h2><?php _e('Upgrade Complete'); ?></h2>
    5454    <p><?php _e('Your WordPress database has been successfully upgraded!'); ?></p>
    55     <h2 class="step"><a href="<?php echo $backto; ?>"><?php _e('Continue'); ?></a></h2>
     55    <p class="step"><a class="button" href="<?php echo $backto; ?>"><?php _e('Continue'); ?></a></p>
    5656
    5757<!--
  • branches/crazyhorse/wp-admin/wp-admin.css

    r8329 r8335  
    725725}
    726726
    727 #adminmenu li a #awaiting-mod {
     727#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
    728728    position: absolute;
    729729    margin-top: 0.2em;
     
    735735}
    736736
    737 #adminmenu li a .count-0 {
     737#adminmenu li a .count-0, #sidemenu li a .count-0 {
    738738    display: none;
    739739}
     
    775775}
    776776
    777 #adminmenu li a:hover #awaiting-mod {
     777#adminmenu li a:hover #awaiting-mod, #sidemenu li a:hover #update-plugins {
    778778    background-position: -80px bottom;
    779779}
    780780
    781 #adminmenu li a #awaiting-mod span {
     781#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
    782782    top: -0.8em;
    783783    right: 0;
  • branches/crazyhorse/wp-app.php

    r8242 r8335  
    198198        // check to see if AtomPub is enabled
    199199        if( !get_option( 'enable_app' ) )
    200             $this->not_allowed( sprintf( __( 'AtomPub services are disabled on this blog.  An admin user can enable them at %s' ), admin_url('options-writing.php') ) );
     200            $this->forbidden( sprintf( __( 'AtomPub services are disabled on this blog.  An admin user can enable them at %s' ), admin_url('options-writing.php') ) );
    201201
    202202        // dispatch
     
    940940    }
    941941
     942    function forbidden($reason='') {
     943        log_app('Status','403: Forbidden');
     944        header('Content-Type: text/plain');
     945        status_header('403');
     946        echo $reason;
     947        exit;
     948    }
     949
    942950    function not_found() {
    943951        log_app('Status','404: Not Found');
  • branches/crazyhorse/wp-config-sample.php

    r7971 r8335  
    88define('DB_COLLATE', '');
    99
    10 // Change SECRET_KEY to a unique phrase.  You won't have to remember it later,
    11 // so make it long and complicated.  You can visit http://api.wordpress.org/secret-key/1.0/
    12 // to get a secret key generated for you, or just make something up.
    13 define('SECRET_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
     10// Change each KEY to a different unique phrase.  You won't have to remember the phrases later,
     11// so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/
     12// to get keys generated for you, or just make something up.  Each key should have a different phrase.
     13define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
     14define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
     15define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
    1416
    1517// You can have multiple installations in one database if you give each a unique prefix
  • branches/crazyhorse/wp-content/themes/classic/style.css

    r8242 r8335  
    323323/* Captions & aligment */
    324324.aligncenter,
    325 dl.aligncenter {
     325div.aligncenter {
    326326    display: block;
    327327    margin-left: auto;
     
    337337}
    338338
    339 .wp_caption {
     339.wp-caption {
    340340    border: 1px solid #ddd;
    341341    text-align: center;
     
    349349}
    350350
    351 .wp_caption img {
     351.wp-caption img {
    352352    margin: 0;
    353353    padding: 0;
     
    355355}
    356356
    357 .wp_caption_dd {
     357.wp-caption p.wp-caption-text {
    358358    font-size: 11px;
    359359    line-height: 17px;
  • branches/crazyhorse/wp-content/themes/default/style.css

    r8242 r8335  
    291291
    292292.postmetadata {
    293     clear: left;
     293    clear: both;
    294294}
    295295
     
    641641/* Captions */
    642642.aligncenter,
    643 dl.aligncenter {
     643div.aligncenter {
    644644    display: block;
    645645    margin-left: auto;
     
    647647}
    648648
    649 .wp_caption {
     649.wp-caption {
    650650    border: 1px solid #ddd;
    651651    text-align: center;
     
    659659}
    660660
    661 .wp_caption img {
     661.wp-caption img {
    662662    margin: 0;
    663663    padding: 0;
     
    665665}
    666666
    667 .wp_caption_dd {
     667.wp-caption p.wp-caption-text {
    668668    font-size: 11px;
    669669    line-height: 17px;
  • branches/crazyhorse/wp-includes/category-template.php

    r8151 r8335  
    11<?php
    22
    3 function get_category_children($id, $before = '/', $after = '') {
     3function get_category_children($id, $before = '/', $after = '', $visited=array()) {
    44    if ( 0 == $id )
    55        return '';
     
    1515        if ( is_wp_error( $category ) )
    1616            return $category;
    17         if ( $category->parent == $id ) {
     17        if ( $category->parent == $id && !in_array($category->term_id, $visited) ) {
     18            $visited[] = $category->term_id;
    1819            $chain .= $before.$category->term_id.$after;
    1920            $chain .= get_category_children($category->term_id, $before, $after);
     
    4546}
    4647
    47 function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){
     48function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE, $visited = array()){
    4849    $chain = '';
    4950    $parent = &get_category($id);
     
    5657        $name = $parent->cat_name;
    5758
    58     if ( $parent->parent && ($parent->parent != $parent->term_id) )
    59         $chain .= get_category_parents($parent->parent, $link, $separator, $nicename);
     59    if ( $parent->parent && ($parent->parent != $parent->term_id) && !in_array($parent->parent, $visited) ) {
     60        $visited[] = $parent->parent;
     61        $chain .= get_category_parents($parent->parent, $link, $separator, $nicename, $visited);
     62    }
    6063
    6164    if ( $link )
     
    416419        $tag_id = $tag_ids[$tag];
    417420        $tag_link = clean_url($tag_links[$tag]);
    418         $tag = str_replace(' ', '&nbsp;', wp_specialchars( $tag ));
    419421        $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext('%d topic','%d topics',$count), $count ) ) . "'$rel style='font-size: " .
    420422            ( $smallest + ( ( $count - $min_count ) * $font_step ) )
  • branches/crazyhorse/wp-includes/class.wp-scripts.php

    r7976 r8335  
    5151
    5252        $src = $this->registered[$handle]->src;
    53         if ( !preg_match('|^https?://|', $src) ) {
     53        if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
    5454            $src = $this->base_url . $src;
    5555        }
  • branches/crazyhorse/wp-includes/class.wp-styles.php

    r7976 r8335  
    6060
    6161    function _css_href( $src, $ver, $handle ) {
    62         if ( !preg_match('|^https?://|', $src) ) {
     62        if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
    6363            $src = $this->base_url . $src;
    6464        }
  • branches/crazyhorse/wp-includes/classes.php

    r8151 r8335  
    9292            $request_match = $request;
    9393            foreach ($rewrite as $match => $query) {
     94                // Don't try to match against AtomPub calls
     95                if ( $req_uri == 'wp-app.php' )
     96                    break;
     97
    9498                // If the requesting file is the anchor of the match, prepend it
    9599                // to the path info.
  • branches/crazyhorse/wp-includes/deprecated.php

    r7130 r8335  
    10651065 * @author Dougal
    10661066 * @since 1.0.1
    1067  * @deprecated Use get_categories()
    1068  * @see get_categories()
     1067 * @deprecated Use wp_list_bookmarks()
     1068 * @see wp_list_bookmarks()
    10691069 *
    10701070 * @param string $order Sort link categories by 'name' or 'id'
     
    10721072 */
    10731073function get_links_list($order = 'name', $deprecated = '') {
    1074     _deprecated_function(__FUNCTION__, '0.0', 'get_categories()');
     1074    _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()');
    10751075
    10761076    $order = strtolower($order);
  • branches/crazyhorse/wp-includes/feed.php

    r7244 r8335  
    11<?php
    2 
     2/**
     3 * WordPress Feed API
     4 *
     5 * Many of the functions used in here belong in The Loop, or The Loop for the
     6 * Feeds.
     7 *
     8 * @package WordPress
     9 * @subpackage Feed
     10 */
     11
     12/**
     13 * RSS container for the bloginfo function.
     14 *
     15 * You can retrieve anything that you can using the get_bloginfo() function.
     16 * Everything will be stripped of tags and characters converted, when the values
     17 * are retrieved for use in the feeds.
     18 *
     19 * @package WordPress
     20 * @subpackage Feed
     21 * @since 1.5.1
     22 * @uses apply_filters() Calls 'get_bloginfo_rss' hook with two parameters.
     23 * @see get_bloginfo() For the list of possible values to display.
     24 *
     25 * @param string $show See get_bloginfo() for possible values.
     26 * @return string
     27 */
    328function get_bloginfo_rss($show = '') {
    429    $info = strip_tags(get_bloginfo($show));
     
    631}
    732
     33/**
     34 * Display RSS container for the bloginfo function.
     35 *
     36 * You can retrieve anything that you can using the get_bloginfo() function.
     37 * Everything will be stripped of tags and characters converted, when the values
     38 * are retrieved for use in the feeds.
     39 *
     40 * @package WordPress
     41 * @subpackage Feed
     42 * @since 0.71
     43 * @uses apply_filters() Calls 'bloginfo_rss' hook with two parameters.
     44 * @see get_bloginfo() For the list of possible values to display.
     45 *
     46 * @param string $show See get_bloginfo() for possible values.
     47 */
    848function bloginfo_rss($show = '') {
    949    echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show);
    1050}
    1151
     52/**
     53 * Retrieve the default feed.
     54 *
     55 * The default feed is 'rss2', unless a plugin changes it through the
     56 * 'default_feed' filter.
     57 *
     58 * @package WordPress
     59 * @subpackage Feed
     60 * @since 2.5
     61 * @uses apply_filters() Calls 'default_feed' hook on the default feed string.
     62 *
     63 * @return string Default feed, or for example 'rss2', 'atom', etc.
     64 */
    1265function get_default_feed() {
    1366    return apply_filters('default_feed', 'rss2');
    1467}
    1568
     69/**
     70 * Retrieve the blog title for the feed title.
     71 *
     72 * @package WordPress
     73 * @subpackage Feed
     74 * @since 2.2.0
     75 * @uses apply_filters() Calls 'get_wp_title_rss' hook on title.
     76 * @uses wp_title() See function for $sep parameter usage.
     77 *
     78 * @param string $sep Optional.How to separate the title. See wp_title() for more info.
     79 * @return string Error message on failure or blog title on success.
     80 */
    1681function get_wp_title_rss($sep = '&#187;') {
    1782    $title = wp_title($sep, false);
     
    2287}
    2388
     89/**
     90 * Display the blog title for display of the feed title.
     91 *
     92 * @package WordPress
     93 * @subpackage Feed
     94 * @since 2.2.0
     95 * @uses apply_filters() Calls 'wp_title_rss' on the blog title.
     96 * @see wp_title() $sep parameter usage.
     97 *
     98 * @param string $sep Optional.
     99 */
    24100function wp_title_rss($sep = '&#187;') {
    25101    echo apply_filters('wp_title_rss', get_wp_title_rss($sep));
    26102}
    27103
     104/**
     105 * Retrieve the current post title for the feed.
     106 *
     107 * @package WordPress
     108 * @subpackage Feed
     109 * @since 2.0.0
     110 * @uses apply_filters() Calls 'the_title_rss' on the post title.
     111 *
     112 * @return string Current post title.
     113 */
    28114function get_the_title_rss() {
    29115    $title = get_the_title();
     
    32118}
    33119
    34 
     120/**
     121 * Display the post title in the feed.
     122 *
     123 * @package WordPress
     124 * @subpackage Feed
     125 * @since 0.71
     126 * @uses get_the_title_rss() Used to retrieve current post title.
     127 */
    35128function the_title_rss() {
    36129    echo get_the_title_rss();
    37130}
    38131
    39 
     132/**
     133 * Display the post content for the feed.
     134 *
     135 * For encoding the html or the $encode_html parameter, there are three possible
     136 * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
     137 * encode special characters and automatically display all of the content. The
     138 * value of '2' will strip all HTML tags from the content.
     139 *
     140 * Also note that you cannot set the amount of words and not set the html
     141 * encoding. If that is the case, then the html encoding will default to 2,
     142 * which will strip all HTML tags.
     143 *
     144 * To restrict the amount of words of the content, you can use the cut
     145 * parameter. If the content is less than the amount, then there won't be any
     146 * dots added to the end. If there is content left over, then dots will be added
     147 * and the rest of the content will be removed.
     148 *
     149 * @package WordPress
     150 * @subpackage Feed
     151 * @since 0.71
     152 * @uses apply_filters() Calls 'the_content_rss' on the content before processing.
     153 * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file
     154 *      parameters.
     155 *
     156 * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
     157 * @param int|bool $stripteaser Optional. Default is 0.
     158 * @param string $more_file Optional.
     159 * @param int $cut Optional. Amount of words to keep for the content.
     160 * @param int $encode_html Optional. How to encode the content.
     161 */
    40162function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
    41163    $content = get_the_content($more_link_text, $stripteaser, $more_file);
     
    60182            $use_dotdotdot = 0;
    61183        }
     184
     185        /** @todo Check performance, might be faster to use array slice instead. */
    62186        for ( $i=0; $i<$k; $i++ )
    63187            $excerpt .= $blah[$i].' ';
     
    69193}
    70194
    71 
     195/**
     196 * Display the post excerpt for the feed.
     197 *
     198 * @package WordPress
     199 * @subpackage Feed
     200 * @since 0.71
     201 * @uses apply_filters() Calls 'the_excerpt_rss' hook on the excerpt.
     202 */
    72203function the_excerpt_rss() {
    73204    $output = get_the_excerpt();
     
    75206}
    76207
     208/**
     209 * Display the permalink to the post for use in feeds.
     210 *
     211 * @package WordPress
     212 * @subpackage Feed
     213 * @since 2.3.0
     214 * @uses apply_filters() Call 'the_permalink_rss' on the post permalink
     215 */
    77216function the_permalink_rss() {
    78217    echo apply_filters('the_permalink_rss', get_permalink());
    79 
    80 }
    81 
     218}
     219
     220/**
     221 * Display the feed GUID for the current comment.
     222 *
     223 * @package WordPress
     224 * @subpackage Feed
     225 * @since unknown
     226 */
    82227function comment_guid() {
    83228    echo get_comment_guid();
    84229}
    85230
     231/**
     232 * Retrieve the feed GUID for the current comment.
     233 *
     234 * @package WordPress
     235 * @subpackage Feed
     236 * @since unknown
     237 *
     238 * @return bool|string false on failure or guid for comment on success.
     239 */
    86240function get_comment_guid() {
    87241    global $comment;
     
    93247}
    94248
     249/**
     250 * Display the link to the comments.
     251 *
     252 * @since 1.5.0
     253 */
    95254function comment_link() {
    96255    echo get_comment_link();
    97256}
    98257
     258/**
     259 * Retrieve the current comment author for use in the feeds.
     260 *
     261 * @package WordPress
     262 * @subpackage Feed
     263 * @since 2.0.0
     264 * @uses apply_filters() Calls 'comment_author_rss' hook on comment author.
     265 * @uses get_comment_author()
     266 *
     267 * @return string Comment Author
     268 */
    99269function get_comment_author_rss() {
    100270    return apply_filters('comment_author_rss', get_comment_author() );
    101271}
    102272
     273/**
     274 * Display the current comment author in the feed.
     275 *
     276 * @package WordPress
     277 * @subpackage Feed
     278 * @since 1.0.0
     279 */
    103280function comment_author_rss() {
    104281    echo get_comment_author_rss();
    105282}
    106283
     284/**
     285 * Display the current comment content for use in the feeds.
     286 *
     287 * @package WordPress
     288 * @subpackage Feed
     289 * @since 1.0.0
     290 * @uses apply_filters() Calls 'comment_text_rss' filter on comment content.
     291 * @uses get_comment_text()
     292 */
    107293function comment_text_rss() {
    108294    $comment_text = get_comment_text();
     
    111297}
    112298
     299/**
     300 * Retrieve all of the post categories, formatted for use in feeds.
     301 *
     302 * All of the categories for the current post in the feed loop, will be
     303 * retrieved and have feed markup added, so that they can easily be added to the
     304 * RSS2, Atom, or RSS1 and RSS0.91 RDF feeds.
     305 *
     306 * @package WordPress
     307 * @subpackage Feed
     308 * @since 2.1.0
     309 * @uses apply_filters()
     310 *
     311 * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
     312 * @return string All of the post categories for displaying in the feed.
     313 */
    113314function get_the_category_rss($type = 'rss') {
    114315    $categories = get_the_category();
     
    143344}
    144345
     346/**
     347 * Display the post categories in the feed.
     348 *
     349 * @package WordPress
     350 * @subpackage Feed
     351 * @since 0.71
     352 * @see get_the_category_rss() For better explanation.
     353 *
     354 * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
     355 */
    145356function the_category_rss($type = 'rss') {
    146357    echo get_the_category_rss($type);
    147358}
    148359
     360/**
     361 * Display the HTML type based on the blog setting.
     362 *
     363 * The two possible values are either 'xhtml' or 'html'.
     364 *
     365 * @package WordPress
     366 * @subpackage Feed
     367 * @since 2.2.0
     368 */
    149369function html_type_rss() {
    150370    $type = get_bloginfo('html_type');
     
    156376}
    157377
    158 
     378/**
     379 * Display the rss enclosure for the current post.
     380 *
     381 * Uses the global $post to check whether the post requires a password and if
     382 * the user has the password for the post. If not then it will return before
     383 * displaying.
     384 *
     385 * Also uses the function get_post_custom() to get the post's 'enclosure'
     386 * metadata field and parses the value to display the enclosure(s). The
     387 * enclosure(s) consist of enclosure HTML tag(s) with a URI and other
     388 * attributes.
     389 *
     390 * @package WordPress
     391 * @subpackage Template
     392 * @since 1.5.0
     393 * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure.
     394 * @uses get_post_custom() To get the current post enclosure metadata.
     395 */
    159396function rss_enclosure() {
    160397    global $post;
     
    172409}
    173410
     411/**
     412 * Display the atom enclosure for the current post.
     413 *
     414 * Uses the global $post to check whether the post requires a password and if
     415 * the user has the password for the post. If not then it will return before
     416 * displaying.
     417 *
     418 * Also uses the function get_post_custom() to get the post's 'enclosure'
     419 * metadata field and parses the value to display the enclosure(s). The
     420 * enclosure(s) consist of link HTML tag(s) with a URI and other attributes.
     421 *
     422 * @package WordPress
     423 * @subpackage Template
     424 * @since 2.2.0
     425 * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure.
     426 * @uses get_post_custom() To get the current post enclosure metadata.
     427 */
    174428function atom_enclosure() {
    175429    global $post;
     
    188442
    189443/**
    190  * prep_atom_text_construct() - Determine the type of a given string of data
     444 * Determine the type of a string of data with the data formatted.
    191445 *
    192446 * Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1.
     
    203457 * @since 2.5
    204458 *
    205  * @param string $data input string
    206  * @return array $result array(type, value)
     459 * @param string $data Input string
     460 * @return array array(type, value)
    207461 */
    208462function prep_atom_text_construct($data) {
     
    233487
    234488/**
    235  * self_link() - Generate a correct link for the atom:self elemet
    236  *
    237  * Echo the link for the currently displayed feed in a XSS safe way.
     489 * Display the link for the currently displayed feed in a XSS safe way.
     490 *
     491 * Generate a correct link for the atom:self element.
    238492 *
    239493 * @package WordPress
    240494 * @subpackage Feed
    241495 * @since 2.5
    242  *
    243496 */
    244497function self_link() {
  • branches/crazyhorse/wp-includes/formatting.php

    r8103 r8335  
    44    global $wp_cockneyreplace;
    55    $next = true;
     6    $has_pre_parent = false;
    67    $output = '';
    78    $curl = '';
     
    2728        $curl = $textarr[$i];
    2829
    29         if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag
     30        if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent) { // If it's not a tag
    3031            // static strings
    3132            $curl = str_replace($static_characters, $static_replacements, $curl);
    3233            // regular expressions
    3334            $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    34         } elseif (strpos($curl, '<code') !== false || strpos($curl, '<pre') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
     35        } elseif (strpos($curl, '<code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
    3536            $next = false;
     37        } elseif (strpos($curl, '<pre') !== false) {
     38            $has_pre_parent = true;
     39        } elseif (strpos($curl, '</pre>') !== false) {
     40            $has_pre_parent = false;
    3641        } else {
    3742            $next = true;
     
    11251130    if ( empty($text) ) return apply_filters('richedit_pre', '');
    11261131
    1127     $output = $text;
    1128     $output = convert_chars($output);
     1132    $output = convert_chars($text);
    11291133    $output = wpautop($output);
    1130 
    1131     // These must be double-escaped or planets will collide.
    1132     $output = str_replace('&lt;', '&amp;lt;', $output);
    1133     $output = str_replace('&gt;', '&amp;gt;', $output);
    1134 
    1135     // These should be entities too
    1136     $output = str_replace('<', '&lt;', $output);
    1137     $output = str_replace('>', '&gt;', $output);
    1138    
     1134    $output = htmlspecialchars($output, ENT_NOQUOTES);
     1135
    11391136    return apply_filters('richedit_pre', $output);
    11401137}
  • branches/crazyhorse/wp-includes/functions.php

    r8242 r8335  
    491491    $newvalue = sanitize_option( $option_name, $newvalue );
    492492
     493    $oldvalue = get_option( $safe_option_name );
     494
     495    $newvalue = apply_filters( 'pre_update_option_' . $option_name, $newvalue, $oldvalue );
     496
    493497    // If the new and old values are the same, no need to update.
    494     $oldvalue = get_option( $safe_option_name );
    495498    if ( $newvalue === $oldvalue )
    496499        return false;
     
    14931496        $url = trailingslashit( $siteurl ) . UPLOADS;
    14941497    }
    1495    
     1498
     1499    $bdir = $dir;
     1500    $burl = $url;
     1501
    14961502    $subdir = '';
    14971503    if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
     
    15131519    }
    15141520
    1515     $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'error' => false );
     1521    $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
    15161522    return apply_filters( 'upload_dir', $uploads );
    15171523}
     
    22542260 */
    22552261function is_ssl() {
    2256     return ( 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
     2262    return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
    22572263}
    22582264
  • branches/crazyhorse/wp-includes/js/tinymce/langs/wp-langs.php

    r8242 r8335  
    396396wp_help_desc:"' . mce_escape( __('Help') ) . ' (Alt+Shift+H)",
    397397wp_more_alt:"' . mce_escape( __('More...') ) . '",
    398 wp_page_alt:"' . mce_escape( __('Next page...') ) . '"
     398wp_page_alt:"' . mce_escape( __('Next page...') ) . '",
     399add_media:"' . mce_escape( __('Add Media') ) . '",
     400add_image:"' . mce_escape( __('Add an Image') ) . '",
     401add_video:"' . mce_escape( __('Add Video') ) . '",
     402add_audio:"' . mce_escape( __('Add Audio') ) . '"
    399403});
    400404
     
    408412medium:"' . mce_escape( __('Medium') ) . '",
    409413full_size:"' . mce_escape( __('Full Size') ) . '",
    410 alt_help:"' . js_escape( __('Alternate text, e.g. "The Mona Lisa"') )  . '",
    411414current_link:"' . mce_escape( __('Current Link') ) . '",
    412415link_to_img:"' . mce_escape( __('Link to Image') ) . '",
     
    431434s120:"' . mce_escape( __('120%') ) . '",
    432435s130:"' . mce_escape( __('130%') ) . '",
    433 caption:"' . mce_escape( __('Caption') ) . '"
     436img_title:"' . mce_escape( __('Edit Image Title') ) . '",
     437caption:"' . mce_escape( __('Edit Image Caption') ) . '",
     438alt:"' . mce_escape( __('Edit Alternate Text') ) . '"
    434439});
    435440';
  • branches/crazyhorse/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js

    r8242 r8335  
    9090            });
    9191
     92            // Add Media buttons
     93            ed.addButton('add_media', {
     94                title : 'wordpress.add_media',
     95                image : url + '/img/media.gif',
     96                onclick : function() {
     97                    tb_show('', tinymce.DOM.get('add_media').href);
     98                    tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
     99                }
     100            });
     101
     102            ed.addButton('add_image', {
     103                title : 'wordpress.add_image',
     104                image : url + '/img/image.gif',
     105                onclick : function() {
     106                    tb_show('', tinymce.DOM.get('add_image').href);
     107                    tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
     108                }
     109            });
     110
     111            ed.addButton('add_video', {
     112                title : 'wordpress.add_video',
     113                image : url + '/img/video.gif',
     114                onclick : function() {
     115                    tb_show('', tinymce.DOM.get('add_video').href);
     116                    tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
     117                }
     118            });
     119
     120            ed.addButton('add_audio', {
     121                title : 'wordpress.add_audio',
     122                image : url + '/img/audio.gif',
     123                onclick : function() {
     124                    tb_show('', tinymce.DOM.get('add_audio').href);
     125                    tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
     126                }
     127            });
     128
     129            // Add Media buttons to fullscreen
     130            ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
     131                if ( 'mceFullScreen' != cmd ) return;
     132                if ( 'mce_fullscreen' != ed.id )
     133                    ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
     134            });
     135
    92136            // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
    93             ed.onExecCommand.add(function( ed, cmd ) {
    94                 var n, bl, dom = ed.dom;
    95 
    96                 if ( 'JustifyCenter' == cmd ) {
    97                     tinymce.each(dom.select('img'), function(n) {
    98                         var v = n.className;
    99 
    100                         if (v.indexOf('aligncenter') == -1) {
    101                             dom.getParent(n, function(P) {
    102                                 if (P && P.style && P.style.textAlign == 'center')
    103                                     dom.setStyle(P, 'textAlign', '');
    104                             });
    105                         }
    106                     });
    107 
    108                     ed.execCommand('mceRepaint');
    109                 }
    110             });
    111 
    112             ed.onBeforeExecCommand.add(function( ed, cmd ) {
    113                 var n, dir, xdir, bl, dom = ed.dom;
    114 
    115                 if ( ( cmd.indexOf('Justify') != -1 ) && ( n = ed.selection.getNode() ) ) {
    116                     if ( 'JustifyFull' == cmd || n.nodeName !== 'IMG' ) return;
    117                     dir = cmd.substring(7).toLowerCase();
    118 
    119                     if (  ed.queryCommandState( cmd ) ) {
    120                         n.className = n.className.replace(/align[^ '"]+\s?/g, '');
    121                         dom.addClass( n, "alignnone" );
    122                     } else if ( 'JustifyCenter' == cmd ) {
    123                         n.className = n.className.replace(/alignleft\s?|alignright\s?|alignnone\s?/g, '');
    124                         if ( dom.hasClass( n, "aligncenter" ) ) {
    125                             dom.removeClass( n, "aligncenter" );
    126                             dom.addClass( n, "alignnone" );
    127                         } else
    128                             dom.addClass( n, "aligncenter" );
    129 
    130                     } else {
    131                         n.className = n.className.replace(/align[^ '"]+\s?/g, '');
    132                         dom.addClass( n, "align"+dir );
    133                     }
    134                 }
    135             });
    136 
    137             // Word count if script is loaded
    138             if ( 'undefined' != typeof wpWordCount ) {
    139                 var last = 0;
    140                 ed.onKeyUp.add(function(ed, e) {
    141                     if ( e.keyCode == last ) return;
    142                     if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) );
    143                     last = e.keyCode;
    144                 });
    145             };
    146 
    147             // Add listeners to handle more break
     137            ed.addCommand('JustifyLeft', function() {
     138                var n = ed.selection.getNode();
     139
     140                if ( n.nodeName != 'IMG' )
     141                    ed.editorCommands.mceJustify('JustifyLeft', 'left');
     142                else ed.plugins.wordpress.do_align(n, 'alignleft');
     143            });
     144
     145            ed.addCommand('JustifyRight', function() {
     146                var n = ed.selection.getNode();
     147
     148                if ( n.nodeName != 'IMG' )
     149                    ed.editorCommands.mceJustify('JustifyRight', 'right');
     150                else ed.plugins.wordpress.do_align(n, 'alignright');
     151            });
     152
     153            ed.addCommand('JustifyCenter', function() {
     154                var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl');
     155
     156                if ( n.nodeName == 'IMG' && ( P || DL ) )
     157                    ed.plugins.wordpress.do_align(n, 'aligncenter');
     158                else ed.editorCommands.mceJustify('JustifyCenter', 'center');
     159            });
     160
     161            // Word count if script is loaded
     162            if ( 'undefined' != typeof wpWordCount ) {
     163                var last = 0;
     164                ed.onKeyUp.add(function(ed, e) {
     165                    if ( e.keyCode == last ) return;
     166                    if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) );
     167                    last = e.keyCode;
     168                });
     169            };
     170
     171            // Add listeners to handle more break
    148172            t._handleMoreBreak(ed, url);
    149173
     
    184208
    185209        // Internal functions
     210        do_align : function(n, a) {
     211            var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
     212
     213            P = ed.dom.getParent(n, 'p');
     214            DL = ed.dom.getParent(n, 'dl');
     215            DIV = ed.dom.getParent(n, 'div');
     216
     217            if ( DL && DIV ) {
     218                cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
     219                DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
     220                ed.dom.addClass(DL, cls);
     221                c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter');
     222            } else if ( P ) {
     223                cls = ed.dom.hasClass(n, a) ? 'alignnone' : a;
     224                n.className = n.className.replace(/align[^ '"]+\s?/g, '');
     225                ed.dom.addClass(n, cls);
     226                if ( cls == 'aligncenter' )
     227                    ed.dom.setStyle(P, 'textAlign', 'center');
     228                else if (P.style && P.style.textAlign == 'center')
     229                    ed.dom.setStyle(P, 'textAlign', '');
     230            }
     231
     232            ed.execCommand('mceRepaint');
     233        },
    186234
    187235        // Resizes the iframe by a relative height value
  • branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css

    r8242 r8335  
    6363}
    6464
     65#media-upload #basic th.label {
     66    padding: 5px 5px 5px 0;
     67}
     68
    6569.show-align {
    6670    height: 200px;
  • branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html

    r8242 r8335  
    55<title></title>
    66
    7 <script type="text/javascript" src="js/editimage.js?ver=311"></script>
     7<script type="text/javascript" src="js/editimage.js?ver=311d"></script>
    88<script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
    99
    10 <link rel="stylesheet" href="css/editimage.css?ver=311" type="text/css" media="all" />
    11 <link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta1" type="text/css" media="all" />
     10<link rel="stylesheet" href="css/editimage.css?ver=311d" type="text/css" media="all" />
     11<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta3" type="text/css" media="all" />
    1212<script type="text/javascript">
    1313if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
     
    7575        </tr>
    7676
    77         <tr class="">
     77        <tr>
    7878            <th valign="top" scope="row" class="label">
    7979                <label for="img_title">
    80                 <span class="alignleft">{#advanced_dlg.link_titlefield}</span>
    81                 <span class="alignright"><abbr title="required" class="required">*</abbr></span>
     80                <span class="alignleft">{#wpeditimage.img_title}</span>
    8281                </label>
    8382            </th>
     
    8786        </tr>
    8887
    89         <tr class="post_excerpt">
    90             <th valign="top" scope="row" class="label">
    91                 <label for="img_alt">
     88        <tr id="cap_field">
     89            <th valign="top" scope="row" class="label">
     90                <label for="img_cap">
    9291                <span class="alignleft">{#wpeditimage.caption}</span>
    9392                </label>
    9493            </th>
    9594            <td class="field">
    96                 <input type="text" id="img_alt" name="img_alt" value="" size="60" />
    97                 <p class="help">{#wpeditimage.alt_help}</p>
    98             </td>
    99         </tr>
    100 
    101         <tr class="url">
     95                <input type="text" id="img_cap" name="img_cap" value="" size="60" />
     96            </td>
     97        </tr>
     98
     99        <tr>
    102100            <th valign="top" scope="row" class="label">
    103101                <label for="link_href">
     
    131129            </td>
    132130        </tr>
     131       
     132        <tr>
     133            <th valign="top" scope="row" class="label">
     134                <label for="img_alt">
     135                <span class="alignleft">{#wpeditimage.alt}</span>
     136                </label>
     137            </th>
     138            <td class="field">
     139                <input type="text" id="img_alt" name="img_alt" value="" size="60" />
     140            </td>
     141        </tr>
    133142
    134143        <tr id="img_dim">
  • branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js

    r8242 r8335  
    1616                    return;
    1717
    18                 tb_show('', url + '/editimage.html?TB_iframe=true');
     18                tb_show('', url + '/editimage.html?ver=311c&TB_iframe=true');
    1919                tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
    2020            });
     
    2222            ed.onInit.add(function(ed) {
    2323                tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
    24                     ed.plugins.wpeditimage.hideButtons();
     24                    ed.plugins.wpeditimage.hideButtons();
    2525                });
    2626            });
     
    2828            ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
    2929                ed.plugins.wpeditimage.hideButtons();
    30             });
     30            });
    3131
    3232            ed.onSaveContent.add(function(ed, o) {
    33                 ed.plugins.wpeditimage.hideButtons();
     33                ed.plugins.wpeditimage.hideButtons();
    3434            });
    3535
    3636            ed.onMouseUp.add(function(ed, e) {
    37                 if ( ! tinymce.isOpera ) return;
    38                 if ( e.target.nodeName == 'IMG' )
    39                     ed.plugins.wpeditimage.showButtons(e.target);
     37                if ( tinymce.isOpera ) {
     38                    if ( e.target.nodeName == 'IMG' )
     39                        ed.plugins.wpeditimage.showButtons(e.target);
     40                } else if ( ! tinymce.isWebKit ) {
     41                    var n = ed.selection.getNode(), DL;
     42                   
     43                    if ( n.nodeName == 'IMG' && (DL = ed.dom.getParent(n, 'DL')) ) {                   
     44                        window.setTimeout(function(){
     45                            var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL = ed.dom.getParent(n, 'DL');
     46                       
     47                            if ( n.width != (parseInt(ed.dom.getStyle(DL, 'width')) - 10) ) {
     48                                ed.dom.setStyle(DL, 'width', parseInt(n.width)+10);
     49                                ed.execCommand('mceRepaint');
     50                            }
     51                        }, 100);
     52                    }
     53                }
    4054            });
    4155
     
    6478
    6579            ed.onBeforeSetContent.add(function(ed, o) {
    66                 o.content = t._do_shcode(o.content);
    67             });
     80                o.content = t._do_shcode(o.content);
     81            });
    6882
    6983            ed.onPostProcess.add(function(ed, o) {
     
    7488
    7589        _do_shcode : function(co) {
    76             return co.replace(/\[wp_caption([^\]]+)\]([\s\S]+?)\[\/wp_caption\][\s\u00a0]*/g, function(a,b,c){
    77                 var id = b.match(/id=['"]([^'"]+)/), cls = b.match(/align=['"]([^'"]+)/);
    78                 var w = b.match(/width=['"]([0-9]+)/), cap = b.match(/caption=['"]([^'"]+)/);
     90            return co.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g, function(a,b,c){
     91                b = b.replace(/\\'|\\&#39;|\\&#039;/g, '&#39;').replace(/\\"|\\&quot;/g, '&quot;');
     92                c = c.replace(/\\&#39;|\\&#039;/g, '&#39;').replace(/\\&quot;/g, '&quot;');
     93                var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/align=['"]([^'"]+)/i);
     94                var w = b.match(/width=['"]([0-9]+)/), cap = b.match(/caption=['"]([^'"]+)/i);
    7995
    8096                id = ( id && id[1] ) ? id[1] : '';
     
    86102                var div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
    87103
    88                 return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp_caption '+cls+'" style="width: '+(10+parseInt(w))+
    89                 'px"><dt class="wp_caption_dt">'+c+'</dt><dd class="wp_caption_dd">'+cap+'</dd></dl></div>';
     104                return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+
     105                'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
    90106            });
    91107        },
    92108
    93109        _get_shcode : function(co) {
    94             return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>([^<]+)<\/dd>\s*<\/dl>\s*<\/div>\s*/g, function(a,b,c,cap){
    95                 var id = b.match(/id=['"]([^'"]+)/), cls = b.match(/class=['"]([^'"]+)/);
     110            return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){
     111                var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/class=['"]([^'"]+)/i);
    96112                var w = c.match(/width=['"]([0-9]+)/);
    97113
     
    101117
    102118                if ( ! w || ! cap ) return c;
    103                 cls = cls ? cls.match(/align[^ '"]+/) : '';
    104 
    105                 return '[wp_caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/wp_caption]';
    106             });
    107         },
    108 
    109         _fixCenter : function(c) {
    110             var ed = tinyMCE.activeEditor;
    111 
    112             tinymce.each(ed.dom.select('img', c), function(n) {
    113                 if ( ed.dom.hasClass(n, 'aligncenter') ) {
    114                     var P = ed.dom.getParent(n, 'p');
    115                     if ( tinymce.isIE )
    116                         ed.dom.addClass(P, 'mce_iecenter');
    117                     if ( P.style && P.style.textAlign == 'center' )
    118                         ed.dom.setStyle(P, 'textAlign', '');
    119                 }
     119                cls = cls.match(/align[^ '"]+/) || 'alignnone';
     120                cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
     121
     122                return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]';
    120123            });
    121124        },
     
    173176                ed.execCommand("WP_EditImage");
    174177                this.parentNode.style.display = 'none';
    175             }
     178            };
    176179
    177180            var wp_delimgbtn = DOM.add('wp_editbtns', 'img', {
     
    197200                    return false;
    198201                }
    199             }
     202            };
    200203        },
    201204
  • branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js

    r8242 r8335  
    246246
    247247    setup : function() {
    248         var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption;
     248        var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = null;
    249249        document.dir = tinyMCEPopup.editor.getParam('directionality','');
     250
     251        if ( ! tinyMCEPopup.editor.getParam('wpeditimage_do_captions', true) )
     252            t.I('cap_field').style.display = 'none';
     253
    250254        tinyMCEPopup.restoreSelection();
    251255        el = ed.selection.getNode();
     
    256260        t.getImageData();
    257261        c = ed.dom.getAttrib(el, 'class');
    258         caption = t.img_alt = ed.dom.getAttrib(el, 'alt');
    259262
    260263        if ( DL = dom.getParent(el, 'dl') ) {
    261264            var dlc = ed.dom.getAttrib(DL, 'class');
    262265            dlc = dlc.match(/align[^ "']+/i);
    263             if ( ! dom.hasClass(el, dlc) )
     266            if ( dlc && ! dom.hasClass(el, dlc) ) {
    264267                c += ' '+dlc;
    265                
     268                tinymce.trim(c);
     269            }
     270
    266271            tinymce.each(DL.childNodes, function(e) {
    267                 if ( e.nodeName == 'DD' ) {
     272                if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp-caption-dd') ) {
    268273                    caption = e.innerHTML;
    269274                    return;
     
    272277        }
    273278
     279        f.img_cap.value = caption;
    274280        f.img_title.value = ed.dom.getAttrib(el, 'title');
    275         f.img_alt.value = caption;
     281        f.img_alt.value = ed.dom.getAttrib(el, 'alt');
    276282        f.border.value = ed.dom.getAttrib(el, 'border');
    277283        f.vspace.value = ed.dom.getAttrib(el, 'vspace');
     
    356362        }
    357363
    358         if ( f.img_alt.value != '' && f.width.value != '' ) {
     364        if ( f.img_cap.value != '' && f.width.value != '' ) {
    359365            do_caption = 1;
    360366            img_class = img_class.replace( /align[^ "']+\s?/gi, '' );
     
    371377            src : f.img_src.value,
    372378            title : f.img_title.value,
    373             alt : t.img_alt,
     379            alt : f.img_alt.value,
    374380            width : f.width.value,
    375381            height : f.height.value,
     
    378384        });
    379385
    380         if ( ! f.link_href.value ) {
    381             if ( A ) {
    382                 b = ed.selection.getBookmark();
    383                 ed.dom.remove(A, 1);
    384                 ed.selection.moveToBookmark(b);
    385             }
    386         } else {
     386        if ( f.link_href.value ) {
    387387            // Create new anchor elements
    388388            if ( A == null ) {
    389                 if ( ! f.link_href.value.match(/https?:\/\//) )
     389                if ( ! f.link_href.value.match(/https?:\/\//i) )
    390390                    f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value);
    391391
     
    428428            if ( DL ) {
    429429                ed.dom.setAttribs(DL, {
    430                     'class' : 'wp_caption '+t.align,
     430                    'class' : 'wp-caption '+t.align,
    431431                    style : 'width: '+cap_width+'px;'
    432432                });
    433433
    434                 if ( DIV ) 
     434                if ( DIV )
    435435                    ed.dom.setAttrib(DIV, 'class', div_cls);
    436436
    437                 if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp_caption_dd') )
    438                     ed.dom.setHTML(DD, f.img_alt.value);
     437                if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') )
     438                    ed.dom.setHTML(DD, f.img_cap.value);
    439439
    440440            } else {
     441                var lnk = '', pa;
    441442                if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] )
    442443                    cap_id = 'attachment_'+id[1];
    443444
    444                 if ( f.link_href.value ) html = ed.dom.getOuterHTML(ed.dom.getParent(el, 'a'));
    445                 else html = ed.dom.getOuterHTML(el);
    446 
    447                 html = '<dl id="'+cap_id+'" class="wp_caption '+t.align+'" style="width: '+cap_width+
    448                 'px"><dt class="wp_caption_dt">'+html+'</dt><dd class="wp_caption_dd">'+f.img_alt.value+'</dd></dl>';
     445                if ( f.link_href.value && (lnk = ed.dom.getParent(el, 'a')) ) {
     446                    if ( lnk.childNodes.length == 1 )
     447                        html = ed.dom.getOuterHTML(lnk);
     448                    else {
     449                        html = ed.dom.getOuterHTML(lnk);
     450                        html = html.match(/<a[^>]+>/i);
     451                        html = html+ed.dom.getOuterHTML(el)+'</a>';
     452                    }
     453                } else html = ed.dom.getOuterHTML(el);
     454
     455                html = '<dl id="'+cap_id+'" class="wp-caption '+t.align+'" style="width: '+cap_width+
     456                'px"><dt class="wp-caption-dt">'+html+'</dt><dd class="wp-caption-dd">'+f.img_cap.value+'</dd></dl>';
    449457
    450458                cap = ed.dom.create('div', {'class': div_cls}, html);
     
    452460                if ( P ) {
    453461                    P.parentNode.insertBefore(cap, P);
    454                     ed.dom.remove(P);
     462                    if ( P.childNodes.length == 1 )
     463                        ed.dom.remove(P);
     464                    else if ( lnk && lnk.childNodes.length == 1 )
     465                        ed.dom.remove(lnk);
     466                    else ed.dom.remove(el);
     467                } else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) {
     468                    pa.appendChild(cap);
     469                    if ( lnk && lnk.childNodes.length == 1 )
     470                        ed.dom.remove(lnk);
     471                    else ed.dom.remove(el);
    455472                }
    456473            }
    457474
    458             tinyMCEPopup.execCommand("mceEndUndoLevel");
    459             ed.execCommand('mceRepaint');
    460             tinyMCEPopup.close();
    461             return;
    462475        } else {
    463             if ( DL ) {
    464                 if ( f.link_href.value ) html = ed.dom.getOuterHTML(ed.dom.getParent(el, 'a'));
     476            if ( DL && DIV ) {
     477                var aa;
     478                if ( f.link_href.value && (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa);
    465479                else html = ed.dom.getOuterHTML(el);
    466                
     480
    467481                P = ed.dom.create('p', {}, html);
    468                 DL.parentNode.insertBefore(P,DL);
    469                 ed.dom.remove(DL.childNodes);
    470                 ed.dom.remove(DL);
     482                DIV.parentNode.insertBefore(P, DIV);
     483                ed.dom.remove(DIV);
    471484            }
    472485        }
     
    478491            if ( P && P.style && P.style.textAlign == 'center' )
    479492                ed.dom.setStyle(P, 'textAlign', '');
     493        }
     494
     495        if ( ! f.link_href.value && A ) {
     496            b = ed.selection.getBookmark();
     497            ed.dom.remove(A, 1);
     498            ed.selection.moveToBookmark(b);
    480499        }
    481500
  • branches/crazyhorse/wp-includes/js/tinymce/tiny_mce_config.php

    r8242 r8335  
    130130$mce_buttons_4 = apply_filters('mce_buttons_4', array());
    131131$mce_buttons_4 = implode($mce_buttons_4, ',');
     132
     133$do_captions = ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ? false : true;
    132134
    133135// TinyMCE init settings
     
    164166    'content_css' => "$mce_css",
    165167    'save_callback' => 'switchEditors.saveCallback',
     168    'wpeditimage_do_captions' => $do_captions,
    166169    'plugins' => "$plugins",
    167170    // pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init"
     
    223226if ( $disk_cache ) {
    224227
    225     $cacheKey = apply_filters('tiny_mce_version', '20080626');
     228    $cacheKey = apply_filters('tiny_mce_version', '20080710');
    226229
    227230    foreach ( $initArray as $v )
  • branches/crazyhorse/wp-includes/js/tinymce/wordpress.css

    r8242 r8335  
    1616}
    1717
    18 .wp_caption {
     18.wp-caption {
    1919    border: 1px solid #ddd;
    2020    text-align: center;
     
    2828}
    2929
    30 .wp_caption img {
     30.wp-caption img {
    3131    margin: 0;
    3232    padding: 0;
     
    3434}
    3535
    36 .wp_caption_dd {
     36.wp-caption-dd {
    3737    font-size: 11px;
    3838    line-height: 17px;
  • branches/crazyhorse/wp-includes/link-template.php

    r8242 r8335  
    746746function get_shortcut_link() {
    747747    $link = "javascript:
    748             var d=document;
    749             var w=window;
    750             var e=w.getSelection;
    751             var k=d.getSelection;
    752             var x=d.selection;
    753             var s=(e?e():(k)?k():(x?x.createRange().text:0));
    754             var f='" . admin_url('press-this.php') . "';
    755             var l=d.location;
    756             var e=encodeURIComponent;
    757             var u= '?u=' + e(l.href);
    758             var t= '&t=' + e(d.title);
    759             var s= '&s=' + e(s);
    760             var v='&v=1';
    761             var g= f+u+t+s+v;
     748            var d=document,
     749            w=window,
     750            e=w.getSelection,
     751            k=d.getSelection,
     752            x=d.selection,
     753            s=(e?e():(k)?k():(x?x.createRange().text:0)),
     754            f='" . admin_url('press-this.php') . "',
     755            l=d.location,
     756            e=encodeURIComponent,
     757            g=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=2';
    762758            function a(){
    763759                if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=700,height=500')){
    764760                    l.href=g;
    765761                }
    766             }
    767             if(/Firefox/.test(navigator.userAgent)){
    768                 setTimeout(a,0);
    769             }else{
    770                 a();
    771             }
    772             void(0);";
     762            }";
     763            if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false)
     764                $link .= 'setTimeout(a,0);';
     765            else
     766                $link .= 'a();';
     767
     768            $link .= "void(0);";
    773769
    774770    $link = str_replace(array("\r", "\n", "\t"),  '', $link);
     
    777773}
    778774
    779 // return the site_url option, using https if is_ssl() is true
    780 // if $scheme is 'http' or 'https' it will override is_ssl()
     775/** Return the site url
     776 *
     777 *
     778 * @package WordPress
     779 * @since 2.6
     780 *
     781 * Returns the 'site_url' option with the appropriate protocol,  'https' if is_ssl() and 'http' otherwise.
     782 * If $scheme is 'http' or 'https', is_ssl() is overridden.
     783 *
     784 * @param string $path Optional path relative to the site url
     785 * @param string $scheme Optional scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'
     786 * @return string Site url link with optional path appended
     787*/
    781788function site_url($path = '', $scheme = null) {
    782789    // should the list of allowed schemes be maintained elsewhere?
     
    800807}
    801808
     809/** Return the admin url
     810 *
     811 *
     812 * @package WordPress
     813 * @since 2.6
     814 *
     815 * Returns the url to the admin area
     816 *
     817 * @param string $path Optional path relative to the admin url
     818 * @return string Admin url link with optional path appended
     819*/
    802820function admin_url($path = '') {
    803     global $_wp_admin_url;
    804 
    805821    $url = site_url('wp-admin/', 'admin');
    806822
     
    811827}
    812828
     829/** Return the includes url
     830 *
     831 *
     832 * @package WordPress
     833 * @since 2.6
     834 *
     835 * Returns the url to the includes directory
     836 *
     837 * @param string $path Optional path relative to the includes url
     838 * @return string Includes url link with optional path appended
     839*/
    813840function includes_url($path = '') {
    814     global $_wp_includes_url;
    815 
    816841    $url = site_url() . '/' . WPINC . '/';
    817842
     
    822847}
    823848
     849/** Return the content url
     850 *
     851 *
     852 * @package WordPress
     853 * @since 2.6
     854 *
     855 * Returns the url to the content directory
     856 *
     857 * @param string $path Optional path relative to the content url
     858 * @return string Content url link with optional path appended
     859*/
     860function content_url($path = '') {
     861    $scheme = ( is_ssl() ? 'https' : 'http' );
     862    $url = WP_CONTENT_URL;
     863    if ( 0 === strpos($url, 'http') ) {
     864        if ( is_ssl() )
     865            $url = str_replace( 'http://', "{$scheme}://", $url );
     866    }
     867
     868    if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     869        $url .= '/' . ltrim($path, '/');
     870
     871    return $url;
     872}
     873
     874/** Return the plugins url
     875 *
     876 *
     877 * @package WordPress
     878 * @since 2.6
     879 *
     880 * Returns the url to the plugins directory
     881 *
     882 * @param string $path Optional path relative to the plugins url
     883 * @return string Plugins url link with optional path appended
     884*/
     885function plugins_url($path = '') {
     886    $scheme = ( is_ssl() ? 'https' : 'http' );
     887    $url = WP_PLUGIN_URL;
     888    if ( 0 === strpos($url, 'http') ) {
     889        if ( is_ssl() )
     890            $url = str_replace( 'http://', "{$scheme}://", $url );
     891    }
     892
     893    if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     894        $url .= '/' . ltrim($path, '/');
     895
     896    return $url;
     897}
     898
    824899?>
  • branches/crazyhorse/wp-includes/media.php

    r8242 r8335  
    7474    elseif ( $size == 'thumbnail' ) {
    7575        // fall back to the old thumbnail
    76         if ( $thumb_file = wp_get_attachment_thumb_file() && $info = getimagesize($thumb_file) ) {
     76        if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
    7777            $img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
    7878            $width = $info[0];
     
    275275
    276276function image_get_intermediate_size($post_id, $size='thumbnail') {
    277     if ( !$imagedata = wp_get_attachment_metadata( $post_id ) )
     277    if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) )
    278278        return false;
    279279
     
    351351}
    352352
    353 add_shortcode('wp_caption', 'wp_caption_shortcode');
    354 
    355 function wp_caption_shortcode($attr, $content = null) {
    356    
     353add_shortcode('wp_caption', 'img_caption_shortcode');
     354add_shortcode('caption', 'img_caption_shortcode');
     355
     356function img_caption_shortcode($attr, $content = null) {
     357
     358    if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF )
     359        return $content;
     360
    357361    // Allow plugins/themes to override the default caption template.
    358     $output = apply_filters('wp_caption_shortcode', '', $attr, $content);
     362    $output = apply_filters('img_caption_shortcode', '', $attr, $content);
    359363    if ( $output != '' )
    360364        return $output;
     
    372376    if ( $id ) $id = 'id="' . $id . '" ';
    373377   
    374     return '<dl ' . $id . 'class="wp_caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">'
    375     . '<dt class="wp_caption_dt">' . $content . '</dt><dd class="wp_caption_dd">' . $caption . '</dd></dl>';
     378    return '<div ' . $id . 'class="wp-caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">'
     379    . $content . '<p class="wp-caption-text">' . $caption . '</p></div>';
    376380}
    377381
  • branches/crazyhorse/wp-includes/pluggable.php

    r8242 r8335  
    828828        $location = 'http:' . $location;
    829829
    830     $lp  = parse_url($location);
     830    // In php 5 parse_url may fail if the URL query part contains http://, bug #38143
     831    $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
     832   
     833    $lp  = parse_url($test);
    831834    $wpp = parse_url(get_option('home'));
    832835
  • branches/crazyhorse/wp-includes/post.php

    r8242 r8335  
    24252425    if ( !$post =& get_post( $post_id ) )
    24262426        return false;
    2427     if ( !$imagedata = wp_get_attachment_metadata( $post->ID ) )
     2427    if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
    24282428        return false;
    24292429
  • branches/crazyhorse/wp-includes/script-loader.php

    r8242 r8335  
    3535    $scripts->add( 'editor', false, $visual_editor, '20080321' );
    3636
    37     $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080701' );
     37    $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080710' );
    3838
    3939    // Modify this version when tinyMCE plugins are changed.
    40     $mce_version = apply_filters('tiny_mce_version', '20080701');
     40    $mce_version = apply_filters('tiny_mce_version', '20080710');
    4141    $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
    4242
     
    7474    $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20');
    7575    $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430');
    76     $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.1.0');
    77     $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.1.0');
     76    $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2-20080430');
     77    $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
    7878    $scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
    7979        'is_lighttpd_before_150' => is_lighttpd_before_150(),
    8080    ) );
    81     $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.1.0');
    82     $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.1.0');
     81    $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
     82    $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080407');
    8383    // these error messages came from the sample swfupload js, they might need changing.
    8484    $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
     
    159159            'edit' => __('Edit'),
    160160        ) );
    161         $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20080520' );
    162         $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080701' );
     161        $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20080709' );
     162        $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080710' );
    163163        $scripts->localize( 'upload', 'uploadL10n', array(
    164164            'browseTitle' => attribute_escape(__('Browse your files')),
     
    212212    $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
    213213
    214     $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets' );
     214    $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'press-this-ie' );
    215215
    216216    $styles->add( 'wp-admin', '/wp-admin/wp-admin.css' );
     
    225225
    226226    $styles->add( 'global', '/wp-admin/css/global.css' );
    227     $styles->add( 'media', '/wp-admin/css/media.css', array(), '20080523' );
     227    $styles->add( 'media', '/wp-admin/css/media.css', array(), '20080709' );
    228228    $styles->add( 'widgets', '/wp-admin/css/widgets.css' );
    229229    $styles->add( 'dashboard', '/wp-admin/css/dashboard.css' );
    230     $styles->add( 'install', '/wp-admin/css/install.css' );
     230    $styles->add( 'install', '/wp-admin/css/install.css', array(), '20080708' );
    231231    $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css' );
    232     $styles->add( 'press-this', '/wp-admin/css/press-this.css' );
     232    $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20080710' );
     233    $styles->add( 'press-this-ie', '/wp-admin/css/press-this-ie.css', array(), '20080710' );
     234    $styles->add_data( 'press-this-ie', 'conditional', 'gte IE 6' );
    233235    $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20080613' );
    234236    $styles->add( 'login', '/wp-admin/css/login.css' );
  • branches/crazyhorse/wp-includes/theme.php

    r8040 r8335  
    338338
    339339function get_theme_root_uri() {
    340     return apply_filters('theme_root_uri', WP_CONTENT_URL . "/themes", get_option('siteurl'));
     340    return apply_filters('theme_root_uri', content_url('themes'), get_option('siteurl'));
    341341}
    342342
     
    487487        return;
    488488
    489     $_GET[template] = preg_replace('|[^a-z0-9]|i', '', $_GET[template]);
     489    $_GET[template] = preg_replace('|[^a-z0-9_-]|i', '', $_GET[template]);
    490490
    491491    add_filter('template', create_function('', "return '$_GET[template]';") );
    492492
    493493    if ( isset($_GET['stylesheet']) ) {
    494         $_GET[stylesheet] = preg_replace('|[^a-z0-9]|i', '', $_GET[stylesheet]);
     494        $_GET[stylesheet] = preg_replace('|[^a-z0-9_-]|i', '', $_GET[stylesheet]);
    495495        add_filter('stylesheet', create_function('', "return '$_GET[stylesheet]';") );
    496496    }
  • branches/crazyhorse/wp-includes/update.php

    r7237 r8335  
    1111 *
    1212 * The WordPress version, PHP version, and Locale is sent. Checks against the WordPress server at
    13  * api.wordpress.org server. Will only check if PHP has fsockopen enabled and WordPress isn't installing.
     13 * api.wordpress.org. Will only check if PHP has fsockopen enabled and WordPress isn't installing.
    1414 *
    1515 * @package WordPress
     
    2020 */
    2121function wp_version_check() {
    22     if ( !function_exists('fsockopen') || strpos($_SERVER['PHP_SELF'], 'install.php') !== false || defined('WP_INSTALLING') )
     22    if ( !function_exists('fsockopen') || defined('WP_INSTALLING') )
    2323        return;
    2424
     
    7070    update_option( 'update_core', $new_option );
    7171}
    72 
    7372add_action( 'init', 'wp_version_check' );
    7473
     74/**
     75 * wp_update_plugins() - Check plugin versions against the latest versions hosted on WordPress.org.
     76 *
     77 * The WordPress version, PHP version, and Locale is sent along with a list of all plugins installed.
     78 * Checks against the WordPress server at api.wordpress.org.
     79 * Will only check if PHP has fsockopen enabled and WordPress isn't installing.
     80 *
     81 * @package WordPress
     82 * @since 2.3
     83 * @uses $wp_version Used to notidy the WordPress version.
     84 *
     85 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
     86 */
     87function wp_update_plugins() {
     88    global $wp_version;
     89
     90    if ( !function_exists('fsockopen') || defined('WP_INSTALLING') )
     91        return false;
     92
     93    $current = get_option( 'update_plugins' );
     94
     95    $time_not_changed = isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked );
     96
     97    // If running blog-side, bail unless we've not checked in the last 12 hours
     98    if ( !function_exists( 'get_plugins' ) ) {
     99        if ( $time_not_changed )
     100            return false;
     101        require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     102    }
     103
     104    $plugins = get_plugins();
     105    $active  = get_option( 'active_plugins' );
     106
     107    $new_option = '';
     108    $new_option->last_checked = time();
     109
     110    $plugin_changed = false;
     111    foreach ( $plugins as $file => $p ) {
     112        $new_option->checked[ $file ] = $p['Version'];
     113
     114        if ( !isset( $current->checked[ $file ] ) ) {
     115            $plugin_changed = true;
     116            continue;
     117        }
     118
     119        if ( strval($current->checked[ $file ]) !== strval($p['Version']) )
     120            $plugin_changed = true;
     121    }
     122
     123    // Bail if we've checked in the last 12 hours and if nothing has changed
     124    if ( $time_not_changed && !$plugin_changed )
     125        return false;
     126
     127    $to_send->plugins = $plugins;
     128    $to_send->active = $active;
     129    $send = serialize( $to_send );
     130
     131    $request = 'plugins=' . urlencode( $send );
     132    $http_request  = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";
     133    $http_request .= "Host: api.wordpress.org\r\n";
     134    $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
     135    $http_request .= "Content-Length: " . strlen($request) . "\r\n";
     136    $http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
     137    $http_request .= "\r\n";
     138    $http_request .= $request;
     139
     140    $response = '';
     141    if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
     142        fwrite($fs, $http_request);
     143
     144        while ( !feof($fs) )
     145            $response .= fgets($fs, 1160); // One TCP-IP packet
     146        fclose($fs);
     147        $response = explode("\r\n\r\n", $response, 2);
     148    }
     149
     150    $response = unserialize( $response[1] );
     151
     152    if ( $response )
     153        $new_option->response = $response;
     154
     155    update_option( 'update_plugins', $new_option );
     156}
     157if ( defined( 'WP_ADMIN' ) && WP_ADMIN )
     158    add_action( 'admin_init', 'wp_update_plugins' );
     159else
     160    add_action( 'init', 'wp_update_plugins' );
     161
    75162?>
  • branches/crazyhorse/wp-includes/widgets.php

    r8242 r8335  
    462462function wp_widget_search($args) {
    463463    extract($args);
    464 ?>
    465         <?php echo $before_widget; ?>
    466             <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
    467             <div>
     464    $searchform_template = get_template_directory() . '/searchform.php';
     465   
     466    echo $before_widget;
     467   
     468    // Use current theme search form if it exists
     469    if ( file_exists($searchform_template) ) {
     470        include_once($searchform_template);
     471    } else { ?>
     472        <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/"><div>
    468473            <label class="hidden" for="s"><?php _e('Search for:'); ?></label>
    469             <input type="text" name="s" id="s" size="15" /><br />
     474            <input type="text" name="s" id="s" size="15" value="<?php the_search_query(); ?>" />
    470475            <input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />
    471             </div>
    472             </form>
    473         <?php echo $after_widget; ?>
    474 <?php
     476        </div></form>
     477    <?php }
     478   
     479    echo $after_widget;
    475480}
    476481
  • branches/crazyhorse/wp-includes/wp-db.php

    r8242 r8335  
    686686        else
    687687            return false;
    688         return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) . ' LIMIT 1' );
     688           
     689        return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) );
    689690    }
    690691
  • branches/crazyhorse/wp-includes/wp-diff.php

    r7747 r8335  
    309309    function _splitOnWords($string, $newlineEscape = "\n") {
    310310        $string = str_replace("\0", '', $string);
    311         $words  = preg_split( '/([^\w])/', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
     311        $words  = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
    312312        $words  = str_replace( "\n", $newlineEscape, $words );
    313313        return $words;
  • branches/crazyhorse/wp-login.php

    r8242 r8335  
    5454    wp_admin_css( 'login', true );
    5555    wp_admin_css( 'colors-fresh', true );
    56     ?>
    57     <script type="text/javascript">
    58         function focusit() {
    59             document.getElementById('user_login').focus();
    60         }
    61         window.onload = focusit;
    62     </script>
    63 <?php do_action('login_head'); ?>
     56    do_action('login_head'); ?>
    6457</head>
    6558<body class="login">
     
    335328<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
    336329
     330<script type="text/javascript">
     331try{document.getElementById('user_login').focus();}catch(e){}
     332</script>
    337333</body>
    338334</html>
     
    400396<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
    401397
     398<script type="text/javascript">
     399try{document.getElementById('user_login').focus();}catch(e){}
     400</script>
    402401</body>
    403402</html>
     
    482481<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
    483482
     483<script type="text/javascript">
     484try{document.getElementById('user_login').focus();}catch(e){}
     485</script>
    484486</body>
    485487</html>
Note: See TracChangeset for help on using the changeset viewer.