XPressME Integration Kit

Trac


Ignore:
Timestamp:
Nov 20, 2009, 2:52:16 PM (15 years ago)
Author:
toemon
Message:

MUブランチにVer2.2.0RC1の変更内容をマージ

Location:
branches/XPressMU/xpressme_integration_kit/wp-content/plugins/xpressme/include
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/XPressMU/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php

    r428 r451  
    792792 
    793793        $week_begins = intval(get_option('start_of_week')); 
    794         $head_pattrn = '<thead>\s*<tr>\s*(<th[^>]*>.*<\/th>)\s*(<th[^>]*>.*<\/th>)\s*(<th[^>]*>.*<\/th>)\s*(<th[^>]*>.*<\/th>)\s*(<th[^>]*>.*<\/th>)\s*(<th[^>]*>.*<\/th>)\s*(<th[^>]*>.*<\/th>)\s*<\/tr>\s*<\/thead>'; 
     794        $head_pattrn = '<thead>\s*<tr>\s*(<th[^>]*>[^<]*<\/th>)\s*(<th[^>]*>[^<]*<\/th>)\s*(<th[^>]*>[^<]*<\/th>)\s*(<th[^>]*>[^<]*<\/th>)\s*(<th[^>]*>[^<]*<\/th>)\s*(<th[^>]*>[^<]*<\/th>)\s*(<th[^>]*>[^<]*<\/th>)\s*<\/tr>\s*<\/thead>'; 
    795795        if(preg_match('/'. $head_pattrn . '/s' ,$calendar,$head_match)){ 
    796796                $sun_index = 1 - $week_begins; 
  • branches/XPressMU/xpressme_integration_kit/wp-content/plugins/xpressme/include/xpress_common_functions.php

    r389 r451  
    365365} 
    366366 
     367function get_block_file_path($mydirname,$file_name) 
     368{ 
     369        global $xoops_config, $xpress_config; 
     370        $mydirpath = $xoops_config->xoops_root_path . '/modules/' . $mydirname; 
     371        $select_theme = xpress_ThemeTemplate(get_xpress_theme_name($mydirname)); 
     372        $xpress_default_theme = 'xpress_default'; 
     373        $select_block = '/wp-content/themes/' . $select_theme . '/blocks/' . $file_name; 
     374        $default_block = '/wp-content/themes/xpress_default/blocks/' . $file_name; 
     375        $select_block_path = $mydirpath . $select_block; 
     376        $default_block_path =  $mydirpath . $default_block; 
     377 
     378        $block_file_data = array(); 
     379        $block_file_data['file_path'] = $default_block_path; 
     380        $block_file_data['error'] = ''; 
     381 
     382        if($select_theme != $xpress_default_theme){ 
     383                if (file_exists($select_block_path)){ 
     384                        $select_block_version = get_block_version($select_block_path); 
     385                        $default_block_version = get_block_version($default_block_path); 
     386                        if (version_compare($select_block_version,$default_block_version, "<")){ 
     387                                $block_file_data['file_path'] = $default_block_path; 
     388                                if ($xpress_config->is_block_error_display){ 
     389                                        $error_str = '<div style="color:red">'; 
     390                                        $error_str .= sprintf(__('Block file %1$s is an old version %2$s.<br />used block file %3$s of new version %4$s.','xpressme'),$select_block,$select_block_version,$default_block,$default_block_version); 
     391                                        $error_str .= '</div>'; 
     392                                        $block_file_data['error'] = $error_str; 
     393                                } 
     394                        } else { 
     395                                $block_file_data['file_path'] = $select_block_path; 
     396                                $block_file_data['error'] = ''; 
     397                        } 
     398                } 
     399        } 
     400        return $block_file_data; 
     401} 
     402 
     403function get_block_version($file_path = ''){ 
     404        $array_file = file($file_path); 
     405        $pattern = '^[\s|\/]*[B|b]lock\s+[V|v]ersion\s*[:|;]\s*([0-9|.]*)'; 
     406        $version = '0.1'; 
     407        if (empty($file_path)) return $version; 
     408        if (!file_exists($file_path)) return $version; 
     409        if (count($array_file) > 5) $file_count = 5; else $file_count = count($array_file); 
     410        for ($i = 0 ; $i < $file_count ; $i++){ 
     411                if (preg_match('/' . $pattern . '/' ,$array_file[$i],$matchs)){ 
     412                        $version = $matchs[1]; 
     413                        break; 
     414                } 
     415        } 
     416        return $version; 
     417} 
     418 
    367419?> 
Note: See TracChangeset for help on using the changeset viewer.