XPressME Integration Kit

Trac


Ignore:
Timestamp:
May 23, 2011, 3:03:57 PM (13 years ago)
Author:
toemon
Message:

ConfigFromXoopsクラスを廃止し、modInfoクラスを使用するように変更
WP2.2以下で使用するテンプレートold_templateの廃止

Location:
branches/Ver3.0/xpressme_integration_kit/include
Files:
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • branches/Ver3.0/xpressme_integration_kit/include/add_xpress_config.php

    r755 r757  
    2020 
    2121require_once dirname(dirname(dirname(dirname( __FILE__ )))).'/mainfile.php' ; 
    22 require_once dirname( __FILE__ ).'/xoops3_define.php' ; 
    23 get_xoops3_define(); 
    2422 
    2523$_SERVER['REQUEST_METHOD'] = $request_method; //It returns it to former data.  
    2624 
    2725require_once dirname( __FILE__ ).'/xpress_debug_log.php' ; 
    28 require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ; 
    29 $xoops_config = new ConfigFromXoops; 
    30 // TEST modInfo_class 
     26require_once dirname(dirname( __FILE__ )).'/class/wpConfigInfo_class.php' ; 
     27$wpConfigInfo = new wpConfigInfoClass; 
    3128require_once dirname(dirname( __FILE__ )).'/class/modInfo_class.php' ; 
    32 $mod_info = new modInfo; 
     29$modInfo = new modInfoClass; 
    3330require_once dirname( __FILE__ ).'/set_cash_cookie_path.php' ; 
    3431?> 
  • branches/Ver3.0/xpressme_integration_kit/include/add_xpress_process.php

    r744 r757  
    1414} 
    1515function safe_site_url(){ 
    16         global $xoops_config,$blog_id,$blogname; 
     16        global $modInfo,$blog_id,$blogname; 
    1717         
    1818        if (is_xpress_index_page_call()){ 
     
    3535                $siteurl = get_option('siteurl'); 
    3636                $home = get_option('home'); 
    37                 $module_url = $xoops_config->module_url; 
    38                 $module_name = $xoops_config->module_name; 
     37                $module_url = $modInfo->get_module_url(); 
     38                $module_name = $modInfo->get_module_name(); 
    3939                $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; 
    4040                $guess_url = preg_replace('|/' . $module_name . '/.*|i', '/' . $module_name, $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); 
     
    5959                } 
    6060                if ($site_url_error || $home_url_error){ 
    61                         include $xoops_config->xoops_root_path ."/header.php"; 
     61                        include $modInfo->get_xoops_header_path(); 
    6262                        $form = '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n"; 
    6363                        $form .= '<table cellspacing="1" cellpadding="1" border="0">'; 
     
    9494                        $form .= '</form>' ."\n"; 
    9595                        echo $form; 
    96                         include $xoops_config->xoops_root_path . '/footer.php'; 
     96                        include $modInfo->get_xoops_footer_path(); 
    9797                        exit(); 
    9898                } 
     
    103103                        $form .= '<input type="submit" value= "'.__('Permalink Settings').'" name="submit_redirect" />' ."\n"; 
    104104                        $form .= '</form>' ."\n"; 
    105                         include $xoops_config->xoops_root_path ."/header.php"; 
     105                        include $modInfo->get_xoops_header_path(); 
    106106                        echo $form; 
    107                         include $xoops_config->xoops_root_path . '/footer.php'; 
     107                        include $modInfo->get_xoops_footer_path(); 
    108108                        exit(); 
    109109                } 
     
    118118        require_once( dirname( __FILE__ ).'/wp_check.php'); 
    119119        if (!is_wpdb_installed()){ 
    120                 include $xoops_config->xoops_root_path ."/header.php"; 
     120                include $modInfo->get_xoops_header_path(); 
    121121                echo "<h2>Wordpress has not been installed yet. </h2>"; 
    122                 include $xoops_config->xoops_root_path . '/footer.php'; 
     122                include $modInfo->get_xoops_footer_path(); 
    123123                exit(); 
    124124        } 
    125125 
    126         //$_SERVER['REQUEST_METHOD'] = 'POST' is 
    127         //When notifying by a private message, Notification_reserve_send(); 
    128         //it is evaded that the data base becomes read-only as a result of the check on the referrer and the method.  
    129 /* 
    130         $request_method =  (isset($_SERVER['REQUEST_METHOD'])) ? $_SERVER['REQUEST_METHOD'] : ''; 
    131         $_SERVER['REQUEST_METHOD'] = 'POST'; 
    132         require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.  
    133         $_SERVER['REQUEST_METHOD'] = $request_method; 
    134 */ 
    135126        xpress_set_memory_limmit(); // Set memory limmit.(Limmit Value from XPressMe modele config.) 
    136127        unset($offset);         //This Trap is provides the case where $offset is defined on the XOOPS side. 
     
    161152                xpress_pulugin_activation('xpressme/xpressme.php'); 
    162153                // reloaded  
    163                 header('Location: ' . $xoops_config->module_url . '/'); 
     154                header('Location: ' . $modInfo->get_module_url() . '/'); 
    164155                 
    165156                $err_str = "The activation of the XPressME plugin was executed.<br />\n"; 
     
    172163        ob_start(); 
    173164                $now_ob_level = ob_get_level(); 
    174                 if (version_compare($xoops_config->wp_version,'2.2', '<')) 
    175                         require_once dirname( __FILE__ ).'/old_template-loader.php' ; 
    176                 else 
    177                         require_once( ABSPATH . WPINC . '/template-loader.php' ); 
     165                require_once( ABSPATH . WPINC . '/template-loader.php' ); 
    178166                ob_end_flush_child($now_ob_level); 
    179167                $wp_output = ob_get_contents(); 
     
    202190        // This Function in xpressme plugin 
    203191        require_once( dirname( __FILE__ ).'/xpress_block_render.php' );  
    204         xpress_unnecessary_block_cache_delete($xoops_config->module_name); 
     192        xpress_unnecessary_block_cache_delete($modInfo->get_module_dirname()); 
    205193        if (is_home()) { 
    206                 xpress_block_cache_refresh($xoops_config->module_name); 
     194                xpress_block_cache_refresh($modInfo->get_module_dirname()); 
    207195                require_once( dirname( __FILE__ ).'/xpress_block_header.php' );  
    208                 set_xpress_block_header($xoops_config->module_name); 
     196                set_xpress_block_header($modInfo->get_module_dirname()); 
    209197        } 
    210198        if ( ini_get( 'register_globals' ) ) 
     
    213201        exit();         // The return to wp-blog-header.php is stolen here 
    214202} 
    215 //if (is_admin_post_call()) require_once $xoops_config->xoops_mainfile_path;            // for Notification_triggerEvent 
    216 //if (is_xpress_comments_post_call()) require_once $xoops_config->xoops_mainfile_path;  // for Notification_triggerEvent 
    217203xpress_set_memory_limmit(); // Set memory limmit.(Limmit Value from XPressMe modele config.) 
    218204require_once(ABSPATH.'wp-settings.php'); 
  • branches/Ver3.0/xpressme_integration_kit/include/data.inc.php

    r749 r757  
    3131        global $xoopsDB; 
    3232 
     33        $module_handler =& xoops_gethandler('module'); 
     34        $module =& $module_handler->getByDirname($mydirname); 
     35        $module_id = $module->getVar('mid'); 
     36         
    3337        $wp_prefix = preg_replace('/wordpress/','wp',$mydirname); 
    3438        require_once (XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/include/general_functions.php'); 
    3539        include(XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/wp-includes/version.php'); 
    36  
    37         $modules_table = $xoopsDB->prefix('modules'); 
    38         $modSQL ="SELECT mid FROM " . $modules_table . " WHERE dirname LIKE '" . $mydirname . "'"; 
    39         $modRes = $xoopsDB->query($modSQL, 0, 0); 
    40         $modRow = $xoopsDB->fetchArray($modRes); 
    41         $module_id = $modRow['mid']; 
    4240 
    4341        $table_config = $xoopsDB->prefix('config'); 
  • branches/Ver3.0/xpressme_integration_kit/include/memory_limit.php

    r752 r757  
    22        // Set XPressME memory limit 
    33        function xpress_set_memory_limmit(){ 
    4                 global $xoops_config; 
    54                global $xoopsDB,$xoopsModule,$xoopsModuleConfig; 
    65                 
  • branches/Ver3.0/xpressme_integration_kit/include/request_url.php

    r232 r757  
    1313 */ 
    1414function check_page_call($check_file =''){ 
    15         global $xoops_config;   // not object at install 
     15        global $modInfo;        // not object at install 
    1616        if (empty($check_file)) return false; 
    1717        $xpress_page =  basename(dirname(dirname(__FILE__))) . '/' . $check_file; 
  • branches/Ver3.0/xpressme_integration_kit/include/set_cash_cookie_path.php

    r478 r757  
    11<?php 
    2 $modname= $xoops_config->module_name; 
    3 $modurl = $xoops_config->module_url; 
     2$modname= $modInfo->get_module_dirname(); 
     3$modurl = $modInfo->get_module_url(); 
    44$hash = md5($modurl); 
    55/** 
     
    5050 */ 
    5151if ( !defined('COOKIEPATH') ) 
    52         define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', $xoops_config->xoops_url . '/' ) ); 
     52        define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', $modInfo->get_xoops_url() . '/' ) ); 
    5353 
    5454/** 
     
    5757 */ 
    5858if ( !defined('SITECOOKIEPATH') ) 
    59         define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', $xoops_config->xoops_url  . '/' ) ); 
     59        define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', $modInfo->get_xoops_url()  . '/' ) ); 
    6060 
    6161/** 
  • branches/Ver3.0/xpressme_integration_kit/include/wp_installer.php

    r744 r757  
    4646        //xpress 
    4747        global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles, $wp_query,$wp_embed; 
    48         global $xoops_config; 
    4948        $msgs = array(); 
    5049                 
     
    107106         
    108107        // Rewrite Option for Xpress 
    109         $xoops_config_tbl = XOOPS_DB_PREFIX . '_config' ; 
    110         $sql = "SELECT conf_value FROM  $xoops_config_tbl WHERE `conf_name` = 'default_TZ'"; 
     108        $xoops_conf_tbl = XOOPS_DB_PREFIX . '_config' ; 
     109        $sql = "SELECT conf_value FROM  $xoops_conf_tbl WHERE `conf_name` = 'default_TZ'"; 
    111110        $xoops_default_TZ = $wpdb->get_var($sql); 
    112111        update_option('gmt_offset', $xoops_default_TZ);  
  • branches/Ver3.0/xpressme_integration_kit/include/xpress_block_header.php

    r719 r757  
    44        require_once dirname( __FILE__ ) .'/xml.php' ; 
    55        require_once dirname( __FILE__ ) .'/xpress_cache.php' ; 
    6         global $xoops_config; 
     6        global $mod_info; 
    77         
    8         if (!is_object($xoops_config)){ // is call other modules 
    9                 require_once dirname(dirname( __FILE__ )) .'/class/config_from_xoops.class.php' ; 
    10                 $xoops_config = new ConfigFromXoops; 
     8        if (!is_object($mod_info)){ // is call other modules 
     9                require_once dirname(dirname( __FILE__ )) .'/class/modInfo_class.php' ; 
     10                $mod_info = new modInfoClass; 
    1111        } 
    1212         
     
    4646        function get_block_stylesheet_url($mydirname) 
    4747        { 
    48                 global $xoops_config; 
    49                 $mydirpath = $xoops_config->xoops_root_path . '/modules/' . $mydirname; 
     48                global $mod_info; 
     49                $mydirpath = $mod_info->get_xoops_root_path() . '/modules/' . $mydirname; 
    5050                $select_theme = get_xpress_theme_name($mydirname); 
    5151                $style_file = $mydirpath . '/wp-content/themes/' . $select_theme . '/blocks/block_style.css'; 
    5252                if (file_exists($style_file)) 
    53                         return $xoops_config->xoops_url . '/modules/' .$mydirname . '/wp-content/themes/' . $select_theme . '/blocks/block_style.css'; 
     53                        return $mod_info->get_xoops_url() . '/modules/' .$mydirname . '/wp-content/themes/' . $select_theme . '/blocks/block_style.css'; 
    5454                else     
    55                         return $xoops_config->xoops_url . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/block_style.css'; 
     55                        return $mod_info->get_xoops_url() . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/block_style.css'; 
    5656        } 
    5757 
  • branches/Ver3.0/xpressme_integration_kit/include/xpress_block_render.php

    r749 r757  
    44        require_once dirname( __FILE__ ) .'/xml.php' ; 
    55        require_once dirname( __FILE__ ) .'/xpress_cache.php' ; 
    6         global $xoops_config; 
    7          
    8         if (!is_object($xoops_config)){ // is call other modules 
    9                 require_once dirname(dirname( __FILE__ )) .'/class/config_from_xoops.class.php' ; 
    10                 $xoops_config = new ConfigFromXoops; 
     6        global $modInfo; 
     7         
     8        if (!is_object($modInfo)){ // is call other modules 
     9                require_once dirname(dirname( __FILE__ )) .'/class/modInfo_class.php' ; 
     10                $modInfo = new modInfoClass; 
    1111        } 
    1212         
     
    6868        { 
    6969                global $xoopsDB; 
    70                         $modules_tbl = $xoopsDB->prefix('modules'); 
    71  
    72                         $sql = "SELECT mid FROM $modules_tbl WHERE dirname = '$mydirname'"; 
    73                         $result =  $xoopsDB->query($sql, 0, 0); 
    74                         if ($xoopsDB->getRowsNum($result)  > 0){ 
    75                                 $row = $xoopsDB->fetchArray($result); 
    76                                 $mid = $row['mid']; 
    77                         } 
    78                         return $mid; 
     70                $module_handler =& xoops_gethandler('module'); 
     71                $module =& $module_handler->getByDirname($mydirname); 
     72                $module_id = $module->getVar('mid'); 
     73                return $module_id; 
    7974        } 
    8075 
     
    121116    function xpress_block_cache_found($mydirname,$block_name) 
    122117    { 
    123         global $xoops_config; 
     118        global $modInfo; 
    124119         
    125                 $cache_dir = $xoops_config->xoops_cache_path . '/'; 
     120                $cache_dir = $modInfo->get_xoops_cache_path() . '/'; 
    126121        $xml_name = $block_name . '.xml'; 
    127122 
     
    138133        function xpress_block_render($mydirname,$block_function_name,$options) 
    139134        { 
    140                 global $wpdb,$xoops_config,$xoopsUserIsAdmin; 
     135                global $wpdb,$modInfo,$xoopsUserIsAdmin; 
    141136                $func_file = $block_function_name; 
    142137                $call_theme_function_name = str_replace(".php", "", $block_function_name); 
     
    183178                 
    184179                $tpl =& new XoopsTpl() ; 
    185                 $tpl->template_dir = $xoops_config->module_path . '/templates'; 
     180                $tpl->template_dir = $modInfo->get_module_templates_path(); 
    186181                if (!$tpl->template_exists($templates_file)){ 
    187                         $src_file_path = $xoops_config->module_path . '/templates/' .$mydirname. '_' . str_replace(".php", ".html", $block_function_name); 
     182                        $src_file_path = $modInfo->get_module_templates_path() . '/' .$mydirname. '_' . str_replace(".php", ".html", $block_function_name); 
    188183                        $templates_file = add_xpress_tpl($mydirname,$templates_file,$src_file_path); 
    189184                } 
     
    198193         
    199194        function add_xpress_tpl($mydirname,$templates='',$src_file_path){ 
    200                 global $wpdb,$xoops_config , $xoops_db; 
     195                global $wpdb,$modInfo , $xoops_db; 
    201196                 
    202197                $mid = get_block_mid($mydirname); 
     
    210205                        $type = $temp_parm[0]; 
    211206                } 
    212                 $temp_file_path = $xoops_config->module_path . '/templates/'. $filename; 
     207                $temp_file_path = $modInfo->get_module_templates_path() . '/'. $filename; 
    213208                $pattern = '^' . $mydirname . '_'; 
    214209                if (preg_match('/' . $pattern . '/' , $filename, $match)){ // file prefix check 
     
    274269        function xpress_unnecessary_block_cache_delete($mydirname) 
    275270        { 
    276                 global $xoops_db,$xoops_config; 
     271                global $xoops_db,$modInfo; 
    277272                 
    278273                $mid = get_xpress_modid(); 
     
    289284                $pattern = '(' . $pattern . ')'; 
    290285                 
    291                 $cache_dir = $xoops_config->xoops_cache_path . '/'; 
     286                $cache_dir = $modInfo->get_xoops_cache_path() . '/'; 
    292287                $cache_time = 0; 
    293288        if ($dh = opendir($cache_dir)) { 
  • branches/Ver3.0/xpressme_integration_kit/include/xpress_cache.php

    r719 r757  
    44if(!function_exists("cache_is_writable")): 
    55        function cache_is_writable(){ 
    6                 global $xoops_config; 
    7                 $cache_dir = $xoops_config->xoops_cache_path . '/'; 
     6                global $modInfo; 
     7                $cache_dir = $modInfo->get_xoops_cache_path() . '/'; 
    88                $filename = $cache_dir .'xpress_cache_test.txt'; 
    99                $fp = @fopen($filename, "w"); 
     
    3030    function xpress_cache_read($mydirname,$collation_key) 
    3131    { 
    32         global $xoops_config; 
     32        global $modInfo; 
    3333         
    34         $cache_dir = $xoops_config->xoops_cache_path . '/'; 
     34        $cache_dir = $modInfo->get_xoops_cache_path() . '/'; 
    3535        $filename = $cache_dir .$mydirname . '_' . $collation_key; 
    3636        if (xpress_cache_found($filename)) { 
     
    4545    function xpress_cache_write($mydirname,$collation_key,$content) 
    4646    { 
    47                 global $xoops_config; 
    48                 $cache_dir = $xoops_config->xoops_cache_path . '/'; 
     47                global $modInfo; 
     48                $cache_dir = $modInfo->get_xoops_cache_path() . '/'; 
    4949                $cache_time = 0; 
    5050 
     
    6262    function xpress_cache_clear($mydirname) 
    6363    { 
    64                 global $xoops_config; 
    65                 $cache_dir = $xoops_config->xoops_cache_path . '/'; 
     64                global $modInfo; 
     65                $cache_dir = $modInfo->get_xoops_cache_path() . '/'; 
    6666                $cache_time = 0; 
    6767        if ($dh = opendir($cache_dir)) { 
  • branches/Ver3.0/xpressme_integration_kit/include/xpress_render.php

    r754 r757  
    182182//rendering for the module header and the body 
    183183function xpress_render($contents){ 
    184         global $xoops_config; 
     184        global $modInfo; 
    185185        global $xoopsUser , $xoopsTpl,$xpress_config , $xoopsModule , $xoopsLogger, $xoopsConfig ; //for XOOPS 
    186186         
     
    190190        xpress_remake_global_for_permlink(); 
    191191        $mydirname = basename(dirname(dirname(__FILE__))); 
    192         include $xoops_config->xoops_root_path ."/header.php"; 
     192        include $modInfo->get_xoops_header_path(); 
    193193        $xoopsTpl->assign('xoops_breadcrumbs', $xoops_breadcrumbs); 
    194194        $xoopsTpl->assign('xoops_module_header', get_xpress_module_header($contents)); 
     
    265265        //If notification_select.php is not executed in CMS other than XCL, the selector of in-line is not displayed.  
    266266        if (is_object($xoopsModule) && $xoopsModule->getVar('hasnotification') == 1 && is_object($xoopsUser)) { 
    267                 require_once $xoops_config->xoops_root_path . '/include/notification_select.php'; 
     267                require_once $modInfo->get_xoops_root_path() . '/include/notification_select.php'; 
    268268        } 
    269269         
     
    272272        $xoopsTpl->clear_cache($templates_file); 
    273273        echo $xoopsTpl->fetch( $templates_file ) ; 
    274         include $xoops_config->xoops_root_path . '/footer.php'; 
     274        include $modInfo->get_xoops_footer_path(); 
    275275} 
    276276 
Note: See TracChangeset for help on using the changeset viewer.