XPressME Integration Kit

Trac


Ignore:
Timestamp:
Mar 3, 2009, 8:33:23 PM (15 years ago)
Author:
toemon
Message:

XOOPS mainfile.phpのdefine文を事前に読み取りwp-config.phpのDB接続関係を生成することにより、XOOPSシステムを必要なときだけ呼び出す仕組みを作る。
およびイベント通知関係の修正(まだゲストのアクセス権限がないと駄目)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/include/custom_functions.php

    r75 r95  
    148148    } 
    149149} 
    150 // xoops db 
    151 function get_xpress_dir_path() 
    152 { 
    153         return ABSPATH; 
    154 } 
    155  
    156 function get_xpress_dir_name() 
    157 { 
    158         return basename(ABSPATH); 
    159 } 
    160  
    161 function get_wp_prefix_only() 
    162 { 
    163         $dir_name = get_xpress_dir_name(); 
    164         $prefix = $dir_name; 
    165         if ($prefix == 'wordpress') $prefix = 'wp'; 
    166          
    167         $prefix = $prefix . '_'; 
    168         return $prefix; 
    169 } 
    170  
    171 function get_xoops_prefix() 
    172 { 
    173         $ret =XOOPS_DB_PREFIX . '_'; 
    174         return $ret; 
    175 } 
    176 function get_wp_prefix() 
    177 { 
    178         $prefix = get_xoops_prefix() . get_wp_prefix_only(); 
    179         return $prefix; 
    180 } 
    181  
    182 function get_xpress_modid() 
    183 { 
    184         global $xoops_db; 
    185          
    186         $modulename = get_xpress_dir_name();     
    187         $sql = "SELECT mid FROM " . get_xoops_prefix() . "modules WHERE dirname = '$modulename'"; 
    188         $mid = $xoops_db->get_var($sql); 
    189         return $mid;     
    190 } 
    191  
    192 function block_cache_refresh() 
    193 { 
    194         global $xoops_db; 
    195         $mid = get_xpress_modid(); 
    196         $sql = "SELECT bid,options,func_file FROM " . get_xoops_prefix() . "newblocks WHERE mid = $mid"; 
    197         $blocks = $xoops_db->get_results($sql); 
    198         $mydirname = get_xpress_dir_name(); 
    199         require_once get_xpress_dir_path() . '/include/xpress_block_render.php'; 
    200  
    201  
    202         foreach($blocks as $block){ 
    203                 $func_file = $block->func_file; 
    204                 $call_theme_function_name = str_replace(".php", "", $func_file); 
    205                 $inc_theme_file_name = str_replace(".php", "", $func_file) . '_theme.php'; 
    206                 $cache_title = str_replace(".php", "", $func_file); 
    207                 $blockID = $block->bid; 
    208                 $options = explode("|", $block->options); 
    209                                          
    210                 $block_theme_file = get_block_file_path($mydirname,$inc_theme_file_name); 
    211                 require_once $block_theme_file; 
    212                 $block_render = $call_theme_function_name($options);            //The block name and the called function name should be assumed to be the same name.                     
    213                 $xml['block'] = $block_render; 
    214                 xpress_block_cache_write($mydirname,$cache_title. $blockID, $xml); 
    215         } 
    216 } 
     150 
    217151 
    218152// views count 
Note: See TracChangeset for help on using the changeset viewer.