XPressME Integration Kit

Trac

Changeset 454


Ignore:
Timestamp:
Nov 24, 2009, 3:49:32 PM (14 years ago)
Author:
toemon
Message:

WordPressの一般設定の「ブログのアドレス (URL)」を変更できるようにした。
但し、アクセスが可能URLなURLでない場合は、インデックスページ呼び出し時に修正が行われる。
fixes #249

Location:
trunk/xpressme_integration_kit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/include/add_xpress_process.php

    r430 r454  
    55        if (is_object($wptouch_plugin)) return $wptouch_plugin->applemobile; 
    66        return false; 
     7} 
     8 
     9function safe_site_url(){ 
     10        global $xoops_config; 
     11         
     12        if (is_xpress_index_page_call()){ 
     13                $siteurl = get_option('siteurl'); 
     14                $home = get_option('home'); 
     15                $module_url = $xoops_config->module_url; 
     16                $guess_url = wp_guess_url(); 
     17                $guess_url = preg_replace('/\/$/','',$guess_url); 
     18                 
     19                if($siteurl != $module_url) { 
     20                        if (!@fclose(@fopen($siteurl . '/xoops_version.php', "r"))){ 
     21                                update_option('siteurl' , $module_url); 
     22                        } 
     23                } 
     24                 
     25                if($guess_url != $home) { 
     26                        if (!@fclose(@fopen($home . '/xoops_version.php', "r"))){ 
     27                                update_option('home' , $guess_url); 
     28                        } 
     29                } 
     30        } 
    731} 
    832 
     
    1640        unset($offset); 
    1741        require_once(ABSPATH.'wp-settings.php'); 
     42         
     43        safe_site_url(); 
     44 
    1845        if (!is_object($xoopsUser)){    // before login auth cookie clear 
    1946                wp_logout(); 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/functions_for_wp_old.php

    r378 r454  
    190190 
    191191endif;  // Under WP2.5 
     192 
     193// Under WP2.7 
     194if (version_compare($xoops_config->wp_version,'2.6', '<')) : 
     195        /** 
     196         * Guess the URL for the site. 
     197         * 
     198         * Will remove wp-admin links to retrieve only return URLs not in the wp-admin 
     199         * directory. 
     200         * 
     201         * @since 2.6.0 
     202         * 
     203         * @return string 
     204         */ 
     205        function wp_guess_url() { 
     206        if ( defined('WP_SITEURL') && '' != WP_SITEURL ) { 
     207                $url = WP_SITEURL; 
     208        } else { 
     209                $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; 
     210                $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
     211        } 
     212        return $url; 
     213} 
     214endif;  // Under WP2.6 
    192215 
    193216// Under WP2.7 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/xpress_common_functions.php

    r452 r454  
    357357} 
    358358 
    359 function safe_site_url_filter($site_url){ 
    360         global $xoops_config; 
    361         if (!$xoops_config->is_wpmu){ 
    362                 if ($site_url != get_xpress_url()) $site_url = get_xpress_url(); 
    363         } 
    364         return $site_url; 
    365 } 
    366  
    367359function get_block_file_path($mydirname,$file_name) 
    368360{ 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php

    r453 r454  
    7171} 
    7272add_action("wp_meta" , "wp_meta_add_xpress_menu");                      // add xpress menu  in wp_meta 
    73          
    74 //Site URL check 
    75 add_filter('option_home',                       "safe_site_url_filter"); 
    76 add_filter('option_siteurl',            "safe_site_url_filter"); 
    77          
    7873 
    7974//XOOPS Bloack Cache Refresh 
Note: See TracChangeset for help on using the changeset viewer.