Ticket #5298: 5298.diff
| File 5298.diff, 5.4 KB (added by westi, 6 years ago) |
|---|
-
wp-includes/default-filters.php
134 134 add_filter('pre_comment_content', 'wp_rel_nofollow', 15); 135 135 add_filter('comment_email', 'antispambot'); 136 136 137 //Atom SSL support 138 add_filter('atom_service_url','atom_service_url_filter'); 139 137 140 // Actions 138 141 add_action('wp_head', 'rsd_link'); 139 142 add_action('wp_head', 'wlwmanifest_link'); -
wp-includes/functions.php
1484 1484 return abs( intval( $maybeint ) ); 1485 1485 } 1486 1486 1487 ?> 1488 No newline at end of file 1487 /** 1488 * Determines if the blog can be accessed over SSL 1489 * @return bool whether of not SSL access is available 1490 */ 1491 function blog_is_accessable_via_ssl() 1492 { 1493 if (in_array('curl', get_loaded_extensions())) { 1494 $ssl = preg_replace( '/^http:\/\//', 'https://', get_bloginfo('url') ); 1495 1496 $ch = curl_init(); 1497 curl_setopt($ch, CURLOPT_URL, $ssl); 1498 curl_setopt($ch, CURLOPT_FAILONERROR, true); 1499 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 1500 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 1501 1502 $data = curl_exec ($ch); 1503 1504 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); 1505 curl_close ($ch); 1506 1507 if ($status == 200 || $status == 401) { 1508 return true; 1509 } 1510 } 1511 return false; 1512 } 1513 1514 function atom_service_url_filter($url) 1515 { 1516 if ( blog_is_accessable_via_ssl() ) 1517 return preg_replace( '/^http:\/\//', 'https://', $url ); 1518 } 1519 ?> -
wp-app.php
68 68 var $MEDIA_SINGLE_PATH = "attachment"; 69 69 70 70 var $params = array(); 71 var $script_name = "wp-app.php";72 71 var $media_content_types = array('image/*','audio/*','video/*'); 73 72 var $atom_content_types = array('application/atom+xml'); 74 73 … … 80 79 function AtomServer() { 81 80 82 81 $this->script_name = array_pop(explode('/',$_SERVER['SCRIPT_NAME'])); 82 $this->app_base = get_bloginfo('url') . '/' . $this->script_name . '/'; 83 if ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) { 84 $this->app_base = preg_replace( '/^http:\/\//', 'https://', $this->app_base ); 85 } 83 86 84 87 $this->selectors = array( 85 88 '@/service$@' => … … 594 597 } else { 595 598 $path = $this->ENTRIES_PATH; 596 599 } 597 $url = get_bloginfo('url') . '/' . $this->script_name . '/'. $path;600 $url = $this->app_base . $path; 598 601 if(isset($page) && is_int($page)) { 599 602 $url .= "/$page"; 600 603 } … … 607 610 } 608 611 609 612 function get_categories_url($page = NULL) { 610 return get_bloginfo('url') . '/' . $this->script_name . '/'. $this->CATEGORIES_PATH;613 return $this->app_base . $this->CATEGORIES_PATH; 611 614 } 612 615 613 616 function the_categories_url() { … … 616 619 } 617 620 618 621 function get_attachments_url($page = NULL) { 619 $url = get_bloginfo('url') . '/' . $this->script_name . '/'. $this->MEDIA_PATH;622 $url = $this->app_base . $this->MEDIA_PATH; 620 623 if(isset($page) && is_int($page)) { 621 624 $url .= "/$page"; 622 625 } … … 629 632 } 630 633 631 634 function get_service_url() { 632 return get_bloginfo('url') . '/' . $this->script_name . '/'. $this->SERVICE_PATH;635 return $this->app_base . $this->SERVICE_PATH; 633 636 } 634 637 635 638 function get_entry_url($postID = NULL) { … … 638 641 $postID = (int) $GLOBALS['post']->ID; 639 642 } 640 643 641 $url = get_bloginfo('url') . '/' . $this->script_name . '/'. $this->ENTRY_PATH . "/$postID";644 $url = $this->app_base . $this->ENTRY_PATH . "/$postID"; 642 645 643 646 log_app('function',"get_entry_url() = $url"); 644 647 return $url; … … 655 658 $postID = (int) $GLOBALS['post']->ID; 656 659 } 657 660 658 $url = get_bloginfo('url') . '/' . $this->script_name . '/'. $this->MEDIA_SINGLE_PATH ."/file/$postID";661 $url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID"; 659 662 660 663 log_app('function',"get_media_url() = $url"); 661 664 return $url; … … 919 922 $ctloc = $this->get_entry_url($post_ID); 920 923 break; 921 924 case 'attachment': 922 $edit = get_bloginfo('url') . '/' . $this->script_name . "/attachments/$post_ID";925 $edit = $this->app_base . "attachments/$post_ID"; 923 926 break; 924 927 } 925 928 header("Content-Type: $this->ATOM_CONTENT_TYPE"); -
xmlrpc.php
19 19 20 20 if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd 21 21 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); 22 23 22 ?> 24 23 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> 25 24 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> … … 32 31 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 33 32 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 34 33 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 35 <api name="Atom" blogID=" 1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/wp-app.php/service" />34 <api name="Atom" blogID="" preferred="false" apiLink="<?php apply_filters('atom_service_url',bloginfo_rss('wpurl')."/wp-app.php/service"?>" /> 36 35 </apis> 37 36 </service> 38 37 </rsd>
