XPressME Integration Kit

Trac

Changeset 755


Ignore:
Timestamp:
May 20, 2011, 2:02:46 PM (13 years ago)
Author:
toemon
Message:

modInfoクラスのテスト準備、config_from_xoopsクラスの代替

Location:
branches/Ver3.0/xpressme_integration_kit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Ver3.0/xpressme_integration_kit/class/modInfo_class.php

    r749 r755  
    1212 * The function to acquire only a set value without calling the XOOPS system is here. 
    1313 */ 
    14 require_once dirname( __FILE__ ).'/wpInfo_class.php' ; 
    1514 
    16 class xpressInfo{ 
     15class modInfo{ 
    1716        var $xoops_mainfile_path; 
    1817        var $xoops_root_path; 
    1918        var $xoops_url; 
    2019        var $xoops_trust_path; 
     20        var $xoops_var_path; 
    2121        var $xoops_cache_path; 
    2222        var $xoops_upload_path; 
     
    3636        var $module_version; 
    3737        var $module_codename; 
     38        var $module_id; 
    3839        var $is_impress; 
    39         var $module_id; 
    4040        var $xoops_time_zone; 
    41         var $xoops_var_path; 
    4241         
    4342        function __constructor()        //for PHP5 
     
    4746    } 
    4847     
    49     function xpressInfo()       //for PHP4 constructor 
     48    function modInfo()  //for PHP4 constructor 
    5049    {   
     50        global $xoopsModule; 
     51         
    5152        $this->xoops_mainfile_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php'; 
    5253        $this->module_path=dirname(dirname(__FILE__)); 
    5354        $this->module_name=basename($this->module_path); 
    5455                $this->xoops_root_path = XOOPS_ROOT_PATH; 
    55                 if(defined('XOOPS_TRUST_PATH')) $this->xoops_trust_path = XOOPS_TRUST_PATH; else $this->xoops_trust_path = ''; 
     56                $this->xoops_trust_path = (defined('XOOPS_TRUST_PATH')) ? XOOPS_TRUST_PATH : ''; 
    5657                $this->xoops_url = XOOPS_URL; 
    5758                $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 
     
    6566                $this->db_pass = XOOPS_DB_PASS; 
    6667                $this->db_host = XOOPS_DB_HOST; 
    67                 if(defined('XOOPS_DB_SALT')) $this->xoops_db_salt = XOOPS_DB_SALT; else $this->xoops_db_salt = ''; 
    68                 if(defined('XOOPS_SALT')) $this->xoops_salt = XOOPS_SALT; else $this->xoops_salt = ''; 
     68                $this->xoops_db_salt = (defined('XOOPS_DB_SALT')) ? XOOPS_DB_SALT : ''; 
     69                $this->xoops_salt = (defined('XOOPS_SALT')) ? XOOPS_SALT : ''; 
    6970                $this->xoops_lang =  @$GLOBALS["xoopsConfig"]['language']; 
    70  
     71                $this->module_id =! empty($xoopsModule) ? $xoopsModule->getVar('mid') : 0; 
     72                $this->module_version = empty($xoopsModule) ? $xoopsModule->getVar('version') : ''; 
     73                $module_codename = $this->_get_module_codename(); 
    7174        // start /admin/index.php page detect 
    7275        $php_script_name = $_SERVER['SCRIPT_NAME']; 
     
    7679                if (strstr($php_script_name,$admin_page) !== false) $is_xoops_module_admin = true; 
    7780                if (strstr($php_query_string,$admin_page) !== false) $is_xoops_module_admin = true; 
    78         $this->_get_value_by_xoops_define(); 
    79                 //  define from /settings/definition.inc.php (XCL)  or /include/common.php(2016a-JP) 
    8081                 
    81                 $this->set_module_version(); 
    82                 $this->set_wp_version(); 
    8382                if (function_exists('date_default_timezone_get')){ 
    8483                        $this->xoops_time_zone = date_default_timezone_get(); 
     
    8685    } 
    8786 
    88         // A set value is acquired from XOOPS define value . 
    89         function _get_value_by_xoops_define(){ 
    90                 $wp_info = new wpInfo; 
    91                 $this->wp_lang = $wp_info->get_wpLang($this->xoops_lang); 
    92  
    93         } 
    94          
    9587     
    96     // set XPressME module virsion and codename from xoops_versions.php 
    97     function set_module_version(){ 
    98         $xoops_version_file = dirname(dirname(__FILE__)) . '/xoops_version.php'; 
     88    // get XPressME module virsion and codename from xoops_versions.php 
     89    function _get_module_codename(){ 
     90        $xoops_version_file = $this->module_path . '/xoops_version.php'; 
    9991                if(file_exists($xoops_version_file)){ 
    10092                        $version_file = file($xoops_version_file); 
    101                         $version_pattern = '^\s*(\$modversion\[\s*\'version\'\s*\])\s*=\s*[\'"]([^\'"]*)[\'"]'; 
    10293                        $codename_pattern = '^\s*(\$modversion\[\s*\'codename\'\s*\])\s*=\s*[\'"]([^\'"]*)[\'"]'; 
    103                         $version_found = false; 
    104                         $codename_found = false; 
    10594                        for ($i = 0 ; $i <count($version_file) ; $i++){ 
    106                                 if (preg_match( "/$version_pattern/", $version_file[$i] ,$v_matches )){ 
    107                                         $this->module_version = $v_matches[2]; 
    108                                         $version_found = true; 
     95                                if (preg_match( "/$codename_pattern/", $version_file[$i] ,$c_matches )){ 
     96                                        return $c_matches[2]; 
    10997                                } 
    110                                 if (preg_match( "/$codename_pattern/", $version_file[$i] ,$c_matches )){ 
    111                                         $this->module_codename = $c_matches[2]; 
    112                                         $codename_found = true; 
    113                                 } 
    114                                 if ( $version_found && $codename_found ) break; 
    11598                        } 
    11699                } 
    117     } 
    118      
    119     function set_wp_version(){ 
    120         include dirname(dirname(__FILE__)) . '/wp-includes/version.php'; 
    121          
    122         $this->wp_db_version = $wp_db_version; 
    123                  
    124                 $this->wp_version = str_replace("ME", "", $wp_version); 
    125                  
    126                 $pattern = 'ME.*'; 
    127         if (preg_match('/' . $pattern . '/' ,$wp_version)){ 
    128                         $this->is_wp_me = true; 
    129                 } else { 
    130                         $this->is_wp_me = true; 
    131                 } 
     100                return ''; 
    132101    } 
    133102     
  • branches/Ver3.0/xpressme_integration_kit/include/add_xpress_config.php

    r750 r755  
    2828require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ; 
    2929$xoops_config = new ConfigFromXoops; 
     30// TEST modInfo_class 
     31require_once dirname(dirname( __FILE__ )).'/class/modInfo_class.php' ; 
     32$mod_info = new modInfo; 
    3033require_once dirname( __FILE__ ).'/set_cash_cookie_path.php' ; 
    3134?> 
Note: See TracChangeset for help on using the changeset viewer.