- Timestamp:
- May 20, 2011, 2:02:46 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Ver3.0/xpressme_integration_kit/class/modInfo_class.php
r749 r755 12 12 * The function to acquire only a set value without calling the XOOPS system is here. 13 13 */ 14 require_once dirname( __FILE__ ).'/wpInfo_class.php' ;15 14 16 class xpressInfo{15 class modInfo{ 17 16 var $xoops_mainfile_path; 18 17 var $xoops_root_path; 19 18 var $xoops_url; 20 19 var $xoops_trust_path; 20 var $xoops_var_path; 21 21 var $xoops_cache_path; 22 22 var $xoops_upload_path; … … 36 36 var $module_version; 37 37 var $module_codename; 38 var $module_id; 38 39 var $is_impress; 39 var $module_id;40 40 var $xoops_time_zone; 41 var $xoops_var_path;42 41 43 42 function __constructor() //for PHP5 … … 47 46 } 48 47 49 function xpressInfo() //for PHP4 constructor48 function modInfo() //for PHP4 constructor 50 49 { 50 global $xoopsModule; 51 51 52 $this->xoops_mainfile_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php'; 52 53 $this->module_path=dirname(dirname(__FILE__)); 53 54 $this->module_name=basename($this->module_path); 54 55 $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 : ''; 56 57 $this->xoops_url = XOOPS_URL; 57 58 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; … … 65 66 $this->db_pass = XOOPS_DB_PASS; 66 67 $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 : ''; 69 70 $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(); 71 74 // start /admin/index.php page detect 72 75 $php_script_name = $_SERVER['SCRIPT_NAME']; … … 76 79 if (strstr($php_script_name,$admin_page) !== false) $is_xoops_module_admin = true; 77 80 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)80 81 81 $this->set_module_version();82 $this->set_wp_version();83 82 if (function_exists('date_default_timezone_get')){ 84 83 $this->xoops_time_zone = date_default_timezone_get(); … … 86 85 } 87 86 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 95 87 96 // set XPressME module virsion and codename from xoops_versions.php97 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'; 99 91 if(file_exists($xoops_version_file)){ 100 92 $version_file = file($xoops_version_file); 101 $version_pattern = '^\s*(\$modversion\[\s*\'version\'\s*\])\s*=\s*[\'"]([^\'"]*)[\'"]';102 93 $codename_pattern = '^\s*(\$modversion\[\s*\'codename\'\s*\])\s*=\s*[\'"]([^\'"]*)[\'"]'; 103 $version_found = false;104 $codename_found = false;105 94 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]; 109 97 } 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;115 98 } 116 99 } 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 ''; 132 101 } 133 102
Note: See TracChangeset
for help on using the changeset viewer.